@kong-ui-public/entities-plugins 9.231.0 → 9.232.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- (function(ve,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@kong/icons"),require("@kong/kongponents"),require("@vue-flow/background"),require("@vue-flow/controls"),require("@vue-flow/core"),require("@vueuse/core"),require("@kong-ui-public/i18n"),require("@vue-flow/controls/dist/style.css"),require("@vue-flow/core/dist/style.css"),require("@vue-flow/core/dist/theme-default.css"),require("@kong-ui-public/entities-shared"),require("@kong-ui-public/entities-plugins-icon"),require("@kong-ui-public/entities-plugins-metadata"),require("@kong-ui-public/forms"),require("marked"),require("dompurify"),require("@kong-ui-public/monaco-editor"),require("monaco-editor"),require("vue-router"),require("@kong-ui-public/monaco-editor/dist/runtime/style.css"),require("@kong-ui-public/entities-redis-configurations"),require("@kong-ui-public/entities-redis-configurations/dist/style.css"),require("@kong-ui-public/entities-vaults"),require("shiki"),require("zod"),require("axios"),require("@kong-ui-public/entities-vaults/dist/style.css"),require("@kong-ui-public/forms/dist/style.css")):typeof define=="function"&&define.amd?define(["exports","vue","@kong/icons","@kong/kongponents","@vue-flow/background","@vue-flow/controls","@vue-flow/core","@vueuse/core","@kong-ui-public/i18n","@vue-flow/controls/dist/style.css","@vue-flow/core/dist/style.css","@vue-flow/core/dist/theme-default.css","@kong-ui-public/entities-shared","@kong-ui-public/entities-plugins-icon","@kong-ui-public/entities-plugins-metadata","@kong-ui-public/forms","marked","dompurify","@kong-ui-public/monaco-editor","monaco-editor","vue-router","@kong-ui-public/monaco-editor/dist/runtime/style.css","@kong-ui-public/entities-redis-configurations","@kong-ui-public/entities-redis-configurations/dist/style.css","@kong-ui-public/entities-vaults","shiki","zod","axios","@kong-ui-public/entities-vaults/dist/style.css","@kong-ui-public/forms/dist/style.css"],e):(ve=typeof globalThis<"u"?globalThis:ve||self,e(ve["kong-ui-public-entities-plugins"]={},ve.Vue,ve.KongIcons,ve.Kongponents,ve.background,ve.controls,ve.core$1,ve.core,ve["kong-ui-public-i18n"],null,null,null,ve["kong-ui-public-entities-shared"],ve.entitiesPluginsIcon,ve.entitiesPluginsMetadata,ve.forms,ve.marked,ve.DOMPurify,ve.monacoEditor,ve.monaco,ve.VueRouter,null,ve.entitiesRedisConfigurations,null,ve.entitiesVaults,ve.shiki,ve.zod,ve.axios))})(this,function(ve,e,$e,Fe,h1,Gg,xt,Pt,jt,WK,YK,JK,Ie,xr,fe,et,cl,y1,ha,fo,Ar,XK,Hg,ZK,ya,_1,ee,Zo){"use strict";var HK=Object.defineProperty;var zK=(ve,e,$e)=>e in ve?HK(ve,e,{enumerable:!0,configurable:!0,writable:!0,value:$e}):ve[e]=$e;var K=(ve,e,$e)=>zK(ve,typeof e!="symbol"?e+"":e,$e);var Xo;function b1(n){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const r in n)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>n[r]})}}return t.default=n,Object.freeze(t)}function w1(n,t){for(var r=0;r<t.length;r++){const o=t[r];if(typeof o!="string"&&!Array.isArray(o)){for(const i in o)if(i!=="default"&&!(i in n)){const a=Object.getOwnPropertyDescriptor(o,i);a&&Object.defineProperty(n,i,a.get?a:{enumerable:!0,get:()=>o[i]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}const ul=b1(fo),Jt={actions:{cancel:"Cancel",view_configuration:"View configuration",create:"New plugin",create_custom:"Create",configure:"Configure",copy_id:"Copy ID",copy_json:"Copy JSON",edit:"Edit",enable:"Enable",enabled:"Enabled",delete:"Delete",disabled:"Disabled",confirm_delete:"Yes, delete",view:"View details",configure_dynamic_ordering:"Configure dynamic ordering",go_to_plugins:"Go to plugins",save:"Save",add_entity:"Add {entity}",remove_entity:"Remove {entity}",loading_spinner:"Loading..."},view_configuration:{title:"Configuration",message:"Export configurations for core Kong Gateway objects, like services, routes, and plugins, to either YAML, JSON, or Terraform. This allows for straightforward importing into APIOps tools like decK with YAML, Insomnia and cURL with JSON, or Terraform products with Terraform.",yaml:"YAML",terraform:"Terraform",json:"JSON",deck:"decK"},delete:{title:"Delete a plugin",custom_title:"Delete {name}",custom_plugin:"Custom plugin",description:"This action cannot be reversed.",description_custom:"Please ensure this plugin is not in use. This action cannot be reversed.",plugin_schema_in_use_title:"Unable to delete custom plugin",plugin_schema_in_use_message:"This custom plugin is currently in use in this control plane. Please delete any existing instances before removing this schema.",confirmModalText1:"Are you sure you want to delete",confirmModalText2:"Please ensure this plugin is not in use. This delete action cannot be reversed.",confirm_text:"Type {name} to confirm your action",success_message:"Successfully deleted custom plugin {name}"},copy:{success:"Copied {val} to clipboard",success_brief:"Successfully copied to clipboard",tooltip:"Copy {label}",success_tooltip:"Copied!"},errors:{general:"Plugins could not be retrieved",delete:"The plugin could not be deleted at this time.",copy:"Failed to copy to clipboard",load_results:"Error loading available plugins",load_schema:"Error loading plugin schema"},search:{placeholder:{konnect:"Filter by name",exact:"Filter by exact instance name or ID",kongManager:"Filter by exact instance name or ID",select:"Filter plugins",search_plugins:"Search plugins"},filter:{field:{enabled:"Enabled"}},no_results:'No results found for "{filter}"'},labels:{new:"New"},plugins:{title:"Plugins",list:{toolbar_actions:{new_plugin:"New plugin"},table_headers:{applied_to:"Applied to",applied_to_badges:{consumer:"Consumer",global:"Global",route:"Route",service:"Service",consumer_group:"Consumer group"},id:"ID",name:"Name",instance_name:"Instance name",ordering:"Ordering",ordering_badge:{dynamic:"Dynamic",static:"Static"},enabled:"Enabled",tags:"Tags",updated_at:"Last modified"},empty_state:{title:"Configure a new plugin",description:"Plugins are used to extend Kong functionality."},empty_state_v2:{title:"Configure your first plugin",description:"Plugins extend gateways functionalities, offering features like authentication, rate limiting, and request transformations to enhance security and performance.",create_cta:"New plugin",group:"Plugins created in gateways within this group will automatically appear here.",learn_more:"Learn more"}},meta:{"basic-auth":{name:"Basic Authentication",credential_name:"Basic Auth Credential",description:"Add Basic Authentication to your services"},"hmac-auth":{name:"HMAC Authentication",credential_name:"HMAC Credential",description:"Add HMAC Authentication to your services"},"jwt-signer":{name:"JWT Signer",description:"Verify and (re-)sign one or two tokens in a request"},jwt:{name:"JWT",credential_name:"JWT Credential",description:"Verify and authenticate JSON Web Tokens"},"key-auth":{name:"Key Authentication",credential_name:"Key Auth Credential",description:"Add key authentication to your services"},"key-auth-enc":{name:"Key Authentication Encrypted",credential_name:"Key Auth Encrypted",description:"Add key authentication to your services with an encrypted token"},"ldap-auth-advanced":{name:"LDAP Authentication Advanced",description:"Integrate Kong with a LDAP server"},"ldap-auth":{name:"LDAP Authentication",description:"Integrate Kong with a LDAP server"},"oauth2-introspection":{name:"OAuth 2.0 Introspection",description:"Integrate Kong with a third-party OAuth 2.0 Authorization Server"},oauth2:{name:"OAuth 2.0 Authentication",credential_name:"OAuth 2.0 Application",description:"Add OAuth 2.0 authentication to your services"},"openid-connect":{name:"OpenID Connect",description:"Integrate Kong with a third-party OpenID Connect 1.0 provider"},"mtls-auth":{name:"Mutual TLS Authentication",description:"Secure routes and services with client certificate and mutual TLS authentication"},"vault-auth":{name:"Vault Authentication",description:"Secure routes and services with an access token and secret token, stored securely via Vault"},"bot-detection":{name:"Bot Detection",description:"Detect and clock bots or custom clients"},cors:{name:"CORS",description:"Allow developers to make requests from the browser"},"ip-restriction":{name:"IP Restriction",description:"Whitelist or blacklist IPs that can make requests"},opa:{name:"OPA",description:"Authorize requests against Open Policy Agent"},"kubernetes-sidecar-injector":{name:"Kubernetes Sidecar Injector",description:"This plugin will inject Kong dataplane nodes and form a service mesh on top of Kubernetes"},"request-validator":{name:"Request Validator",description:"Validate requests before they reach their upstream service."},acl:{name:"ACL",credential_name:"Access Control Group",description:"Control which consumers can access services"},canary:{name:"Canary Release",description:"Methodically roll out software changes to a subset of users"},"forward-proxy":{name:"Forward Proxy",description:"Allow Kong to connect to intermediary transparent HTTP proxies"},"proxy-cache":{name:"Proxy Caching",description:"Cache and serve commonly requested responses in Kong"},"proxy-cache-advanced":{name:"Proxy Caching Advanced",description:"Cache and serve commonly requested responses in Kong"},"graphql-proxy-cache-advanced":{name:"GraphQL Proxy Caching Advanced",description:"Cache and serve commonly requested responses in Kong"},"rate-limiting-advanced":{name:"Rate Limiting Advanced",description:"Rate-limit how many HTTP requests a developer can make"},"rate-limiting":{name:"Rate Limiting",description:"Rate-limit how many HTTP requests a developer can make"},"graphql-rate-limiting-advanced":{name:"GraphQL Rate Limiting Advanced",description:"Rate-limit how many HTTP requests a developer can make"},mocking:{name:"Mocking",description:"Provide mock endpoints to test your APIs in development against your services"},"request-size-limiting":{name:"Request Size Limiting",description:"Block requests with bodies greater than a specific size"},"request-termination":{name:"Request Termination",description:"Terminate all requests with a specific response"},"response-ratelimiting":{name:"Response Rate Limiting",description:"Rate-Limiting based on a custom response header value"},"route-by-header":{name:"Route by Header",description:"Route requests based on request headers"},"ai-proxy":{name:"AI Proxy",description:"Directly call a configured LLM, with mediated security and tuning parameters, and using standardised Kong request and response formats."},"ai-prompt-decorator":{name:"AI Prompt Decorator",description:"Prepend and append chat prompts to AI Proxy plugin LLM requests."},"ai-prompt-template":{name:"AI Prompt Template",description:"Define a set of templates, containing string variable placeholders, that can be consumed by users when used with the AI Proxy plugin."},"ai-prompt-guard":{name:"AI Prompt Guard",description:"Define a set of valid, and a set of invalid, regular expression patterns when calling LLM models with the AI Proxy plugin."},"ai-request-transformer":{name:"AI Request Transformer",description:"Use an LLM to transform API request from a user, before sending to the upstream service."},"ai-response-transformer":{name:"AI Response Transformer",description:"Use an LLM to transform API responses from the upstream service, before returning to the user."},"ai-rate-limiting-advanced":{name:"AI Rate Limiting Advanced",description:"Provides rate limiting for the providers used by any AI plugins."},"ai-azure-content-safety":{name:"AI Azure Content Safety",description:"Allows checking and auditing of AI-Proxy plugin messages, using Azure Cognitive Services, before proxying to upstream large-language model."},"aws-lambda":{name:"AWS Lambda",description:"Invoke and manage AWS Lambda functions from Kong"},"azure-functions":{name:"Azure Functions",description:"Invoke Azure functions"},openwhisk:{name:"OpenWhisk",description:"Invoke and manage OpenWhisk actions from Kong"},"pre-function":{name:"Kong Functions (Pre-Plugins)",description:"Add and manage custom lua functions to run before other plugins"},"post-function":{name:"Kong Functions (Post-Plugins)",description:"Add and manage custom lua functions to run after other plugins"},datadog:{name:"Datadog",description:"Visualize metrics on Datadog"},prometheus:{name:"Prometheus",description:"Export performance metrics to Prometheus"},zipkin:{name:"Zipkin",description:"Propagate zipkin spans and report spans to a zipkin server"},collector:{name:"Collector",description:"Automate spec-driven development & anomaly detection (Early Access)"},"response-transformer-advanced":{name:"Response Transformer Advanced",description:"Transform the response sent by the upstream server on the fly on Kong, before returning the response to the client."},"correlation-id":{name:"Correlation ID",description:"Correlate requests and responses using a unique ID"},"request-transformer-advanced":{name:"Request Transformer Advanced",description:"Use powerful regular expressions, variables and templates to transform API requests"},"request-transformer":{name:"Request Transformer",description:"Modify the request before hitting the upstream server"},"response-transformer":{name:"Response Transformer",description:"Modify the upstream response before returning it to the client"},"route-transformer-advanced":{name:"Route Transformer Advanced",description:"Transforms the routing on the fly in Kong, changing the upstream server/port/path to hit"},"kafka-upstream":{name:"Kafka Upstream",description:"Transform requests into Kafka messages in a topic"},degraphql:{name:"DeGraphQL",description:"Transform a GraphQL upstream into a REST API"},"exit-transformer":{name:"Exit Transformer",description:"Customize Kong exit responses sent downstream"},jq:{name:"jq",description:"Transform JSON objects included in API requests or responses using jq programs"},"file-log":{name:"File Log",description:"Append request and response data to a log file on disk"},"http-log":{name:"HTTP Log",description:"Send request and response logs to an HTTP server"},loggly:{name:"Loggly",description:"Send request and response logs to Loggly"},"statsd-advanced":{name:"StatsD Advanced",description:"Send traffic and Kong performance metrics to StatsD"},statsd:{name:"StatsD",description:"Send request and response logs to StatsD"},syslog:{name:"Syslog",description:"Send request and response logs to Syslog"},"tcp-log":{name:"TCP Log",description:"Send request and response logs to a TCP server"},"udp-log":{name:"UDP Log",description:"Send request and response logs to a UDP server"},"kafka-log":{name:"Kafka Log",description:"Publish request and response logs to a Kafka topic"},session:{name:"Session",description:"Sessions for Kong authentication"},"upstream-tls":{name:"Upstream TLS",description:"Enable TLS on upstream traffic by providing Kong with a list of trusted certificates."},"application-registration":{name:"Portal Application Registration",description:"Allow portal developers to register applications against services"},"konnect-application-auth":{name:"Konnect Application Auth",description:"Allow Konnect portal developers to register applications against services"},acme:{name:"ACME",description:"Let's Encrypt and ACMEv2 integration with Kong"},"grpc-gateway":{name:"gRPC Gateway",description:"Access gRPC services through HTTP REST"},"grpc-web":{name:"gRPC Web",description:"Allow browser clients to call gRPC services"},"upstream-timeout":{name:"Upstream Timeout",description:"Configure read, send and connect timeouts to an upstream"},opentelemetry:{name:"OpenTelemetry",description:"Propagate distributed tracing spans and report low-level spans to a OTLP-compatible server"},"websocket-validator":{name:"WebSocket Validator",description:"Validate individual WebSocket messages against to a user-specified schema before proxying them"},"websocket-size-limit":{name:"WebSocket Size Limit",description:"Allows operators to specify a maximum size for incoming WebSocket messages"},"tls-metadata-headers":{name:"TLS Metadata Headers",description:"Detects client certificates in requests, retrieves the TLS metadata, and proxies this metadata via HTTP headers"},"tls-handshake-modifier":{name:"TLS Handshake Modifier",description:"Requests the client certificate and if it exists, makes it available to other plugins acting on the request"},"oas-validation":{name:"OAS Validation",description:"Validate HTTP requests and responses based on an API specification."},"jwe-decrypt":{name:"Kong JWE Decrypt",description:"The Kong JWE Decrypt plugin makes it possible to decrypt an inbound token(JWE) in a request."},"xml-threat-protection":{name:"XML Threat Protection",description:"Reduce the risk of XML attacks by checking the structure of XML payloads."},saml:{name:"SAML",description:"Security Assertion Markup Language (SAML) is an open standard for exchanging authentication and authorization data between an identity provider and a service provider."},"app-dynamics":{name:"AppDynamics",description:"This plugin integrates Kong with the AppDynamics APM platform so that proxy requests handled by Kong can be identified and analyzed in AppDynamics."},"json-threat-protection":{name:"JSON Threat Protection",description:"Apply size checks on JSON payload and minimize risk of content-level attacks"},"standard-webhooks":{name:"Standard Webhooks",description:"Validate incoming webhooks adhere to the Standard Webhooks specification, to which Kong is a contributor"},"ai-proxy-advanced":{name:"AI Proxy Advanced",description:"Route across different LLMs and models using advanced load balancing algorithms, including semantic routing."},"ai-semantic-cache":{name:"AI Semantic Cache",description:"Semantically cache AI requests to any LLM to reduce latency, improve end-user experiences and optimize GenAI costs."},"ai-semantic-prompt-guard":{name:"AI Semantic Prompt Guard",description:"Semantically and intelligently create allow and deny lists of topics that can be requested across every LLM."},"header-cert-auth":{name:"Header Certificate Authentication",description:"Authenticate clients with MTLS certificate passed in header by a WAF or load balancer"},"upstream-oauth":{name:"Upstream OAuth",description:"Configure Kong to obtain a OAuth2 token to consume an upstream API"},confluent:{name:"Confluent",description:"Streamlines integration with Confluent Cloud and transforms requests into messages published to a Confluent topic."},"service-protection":{name:"Service Protection",description:"Prevent abuse and protect services with absolute limits on the number of requests reaching the service."},"injection-protection":{name:"Injection Protection",description:"Protect against injection attacks by rejecting requests that match common injections patterns."},redirect:{name:"Redirect",description:"Redirect incoming requests to a new URL"},"kafka-consume":{name:"Kafka Consume",description:"Consume messages from Kafka topics over HTTP protocols."},"confluent-consume":{name:"Confluent Consume",description:"Consume messages from Confluent Kafka topics over HTTP protocols"},"request-callout":{name:"Request Callout",description:"Callout to third party APIs as part of request processing."},"ai-sanitizer":{name:"AI Sanitizer",description:"Sanitize personal or sensitive information from prompts before sending to LLM."},"ai-rag-injector":{name:"AI RAG Injector",description:"Attach contextual knowledge from vector databases with flexible template to LLM prompts."},datakit:{name:"Datakit",description:"Datakit is a workflow engine for working with external APIs."},"ai-prompt-compressor":{name:"AI Prompt Compressor",description:"The AI Prompt Compressor reduces costs associated with LLMs by compressing prompts."},"solace-upstream":{name:"Solace Upstream",description:"Transform requests into Solace messages in a Solace queue or topic."},"ai-aws-guardrails":{name:"AI AWS GuardRails",description:"The AI AWS GuardRails enables enforcement of introspection with the AWS GuardRails service for all requests processed by the AI Proxy plugin."},ace:{name:"Konnect Access Control Enforcement",description:"Enable Developer Self-Service for Konnect Dev Portals."},"solace-consume":{name:"Solace Consume",description:"Consume messages from Solace and make them available through HTTP endpoints."},"solace-log":{name:"Solace Log",description:"Publish request and response logs to a Solace topic."},"ai-llm-as-judge":{name:"AI LLM Judge",description:"Evaluate LLM responses with an external LLM service and use accuracy scores to drive dynamic load balancing for `llm/v1/chat` requests."},"ai-mcp-proxy":{name:"AI MCP Proxy",description:"Convert APIs into MCP tools, proxy MCP servers, expose multiple MCP tools, and observe MCP traffic in real time."},"ai-gcp-model-armor":{name:"AI GCP Model Armor",description:"Audit and validate AI Proxy messages with Google Cloud Model Armor before forwarding them to an upstream LLM."},"ai-mcp-oauth2":{name:"AI MCP OAuth2",description:"Secure MCP server access with OAuth2 authentication."},"ai-semantic-response-guard":{name:"AI Semantic Response Guard",description:"Permit or block prompts based on semantic similarity to known LLM responses, preventing misuse of `llm/v1/chat` or `llm/v1/completions` requests."},"ai-lakera-guard":{name:"AI Lakera Guard",description:"Audit and enforce safety policies on LLM requests and responses using the AI AWS Lakera plugin before they reach upstream LLMs."},"ai-a2a-proxy":{name:"AI A2A Proxy",description:"Securely proxy A2A agents, with real-time RPC tracing and monitoring."},"ai-custom-guardrail":{name:"AI Custom Guardrail",description:"Integrate with any 3rd-party Guardrail service, with customizable enforcement modes — choose whether violations block, log, or allow traffic to proceed."},"metering-and-billing":{name:"Metering & Billing",description:"Meter API requests and AI token usage for usage-based billing. Supports flexible customer identification, custom pricing dimensions, and fine-grained traffic filtering. Integrates natively with Konnect Metering & Billing."}},fields:{service:"Service ID",route:"Route ID",consumer:"Consumer ID",consumer_group:"Consumer group ID"},select:{custom_badge_text:"This plugin is data plane node specific",cloned_from_badge:"Cloned from {link}",installed_custom_badge:"Installed custom",streamed_custom_badge:"Streamed custom",unavailable_tooltip:"This plugin is not available",already_exists:"This plugin is already applied to this resource",misc_plugins:"Other plugins",show_all:"Show all",view_more:"View more",view_less:"View less",filter:{title:"Filter plugins",featured:"Featured",type:"Type",clear:"Clear"},list:{table_headers:{name:"Plugin",description:"Description"}},tabs:{kong:{title:"Kong plugins",description:"Kong plugins are bundled by default with Kong Gateway and are available across all control planes.",empty_title:"No plugins",empty_description:"No plugins are available."},custom:{title:"Custom plugins",description:"Custom plugins will be available in this control plane only.",disabled_tooltip:"Custom plugins are not available with this gateway. Create a hybrid or dedicated cloud gateway to leverage custom plugins.",fetch_error:"Unable to load some custom plugins. Bundled plugins are still available.",license_required:"Plugin cloning requires a license to be used.",empty_title:"No custom plugins",empty_description:"No custom plugins have been added to this control plane.",create:{name:"Custom plugin",description:"Upload schema file to create custom plugin"}}},highlighted_plugins:{title:"Highlighted plugins"}},form:{button_deck_customize:"Customize before copying to CLI",disable_data_retrieving:"You do not have permission to select {scope}",disable_source_scope_change:"Changing the {scope} is not allowed when configuring a plugin under it",no_selection:"No selection...",fields:{enabled:{label:"Enabled",on_text:"This plugin is enabled",off_text:"This plugin is disabled"},plugin_status:{label:"Plugin status",text_on:"Enabled",text_off:"Disabled"},instance_name:{label:"Name",placeholder:"Enter a unique name",help:"A custom name for this plugin instance to help with identifying from the list view."},condition:{label:"Execution condition",placeholder:"Enter an expression",tooltip:"An expression used for conditional control over plugin execution. If the expression evaluates to true during the request flow, the plugin is executed; otherwise, it is skipped.",help:{learn:"Learn more",about:"{link} about plugin conditions."}},protocols:{label:"Protocols",placeholder:"Select valid protocols for the plugin",placeholderWithDefaultValues:"Select valid protocols for the plugin. Default protocols: {protocols}",help:"A list of the request protocols that will trigger this plugin. The default value, as well as the possible values allowed on this field, may change depending on the plugin type."},tags:{label:"Tags",help:"An optional set of strings for grouping and filtering, separated by commas.",placeholder:"Tag1, Tag2, Tag3"}},scoping:{label:"Scoped",placeholder:"Search by name or UUID",disable_global_radio:"The plugin is set to 'scoped' by default. To apply a plugin globally, please navigate to the global plugin list page.",global:{label:"Global",help:"All services, routes, and consumers"},gateway_service:{label:"Select a gateway service",help:"The gateway service to which this plugin configuration will apply",placeholder:"Select a gateway service",plural:"Gateway services"},route:{label:"Select a route",help:"The route that this plugin configuration will target",placeholder:"Select a route",plural:"Routes"},consumer:{label:"Select a consumer",help:"The consumer that this plugin configuration will target",placeholder:"Select a consumer",plural:"Consumers"},consumer_group:{label:"Select a consumer group",help:"The consumer group that this plugin configuration will target",placeholder:"Select a consumer group",plural:"Consumer groups"}},grouping:{plugin_configuration:{title:"Plugin configuration",description:"Configuration parameters for this plugin. View advanced parameters for extended configuration.",empty:"This plugin does not have required parameters."},advanced_parameters:{view:"Show additional settings",hide:"Hide additional settings"}},field_rules:{at_least_one_of:"At least one of the following values is required: {parameters}.",only_one_of:"Exactly one of these parameters is required: {parameters}",mutually_required:"These values must be used together: {parameters}.",mutually_exclusive:"Only one of these values can be used: {parameters}.",only_one_of_mutually_required:"Exactly one of the following parameter combinations is required (all parameters within a chosen combination are required):"},sections:{plugin_scope:{title:"Plugin scope",description:"Choose whether this plugin applies to all traffic (global) or is scoped to a specific service, route, or consumer."},general_info:{title:"General information",description:"Add details to help identify and manage your plugin."},plugin_config:{title:"Plugin configuration",description:"Set the plugin's behavior by defining its configuration settings."},plugin_general_info:{description:"Add a name or tags to help you identify and manage this plugin later."},code_mode:{title:"Code editor",description:"Configure this plugin by using YAML configuration."}}},"free-form":{editor_mode:{visual:"Visual editor",code:"Code editor"},"code-lens":{entity:{service:"Service",route:"Route",consumer:"Consumer",consumer_group:"Consumer group",certificate:"Certificate"},field:{name:'{entity} "{value}"',username:'Username "{value}"',custom_id:'Custom ID "{value}"',subject:'Subject "{value}"',expires_after:'Expires after "{value}"'},action:{view_entity:"View {title}",copy_certificate:"Copy certificate",copy_uuid:"Copy UUID",retry_fetch:"Retry fetch (Hover for details)"},unknown_error:"Unknown error"},acl:{mode:{allow:"Use allow list",deny:"Use deny list"}},"ai-mcp-proxy":{default_acl_item_label:"Default ACL #{index}",tool_item_label:"Tool #{index}"},"request-callout":{entity_name:"Request callout",by_lua_placeholder:"Enter Lua script here..."},"jwt-signer":{keyset_url_required:'Provide a valid HTTP/HTTPS URL to ensure signing works correctly when "{signingField}" is enabled and "{headerField}" is set.'},"metering-and-billing":{sections:{plugin_config:{title:"Plugin configuration",description:"Configure the Metering & Billing plugin."},metering:{title:"What to meter"},subject:{title:"Who to bill (subject)",description:"Define how billing subjects are identified."},ingestion:{title:"Connection",description:"Configure how metered data is delivered to the billing service."},queue:{title:"Queue",description:"Configure internal event queue settings."}},fields:{meter_api_requests:{label:"Meter API requests",description:"Emit a usage event for each API Gateway request."},meter_ai_token_usage:{label:"Meter AI token usage",description:"Emit events for LLM input and output tokens on AI Gateway requests. Each request produces separate input/output events so they can be priced independently."},ingest_endpoint:{description:"The URL of the metering data ingest endpoint.",help:"For Konnect Metering & Billing, use the regional endpoint from your Metering & Billing settings. For self-hosted OpenMeter, use your ingest URL."},api_token:{description:"Bearer token for authenticating requests to the ingest endpoint."},look_up_value_in:{label:"Look up subject in",help:"Where to find the customer identifier in the request."},subject_field:{label:"Subject field name",placeholder:"e.g., x-customer-id",help:"e.g. x-customer-id, x-api-key, x-tenant"},queue:{max_coalescing_delay:{label:"Max coalescing delay (s)"},initial_retry_delay:{label:"Initial retry delay (s)"},max_retry_delay:{label:"Max retry delay (s)"},max_retry_time:{label:"Max retry time (s)"}},attributes:{title:"Event attributes",description:"Attach custom dimensions to metered events.",look_up_value_in:{placeholder:"e.g., x-priority-id"},event_property_name:{placeholder:"e.g., priority"}},ssl_verify:{label:"Verify TLS certificate",description:"Disable only for local development with self-signed certificates."},timeout:{label:"Request timeout (ms)"},keepalive:{label:"Connection keep-alive (ms)"}}},datakit:{plugin_config:{title:"Flow editor"},description_code:"Configure this plugin by using YAML configuration. If you are copy/pasting in examples from the documentation - paste from below the <code>config</code> block.",description_flow:"Build flows visually with a drag-and-drop editor for Datakit. Visualize node connections, inputs, and outputs as you design.",description_example:"Start with a use case:",detected_config_format:"Detected {format} configuration. Do you want to convert it to Datakit configuration?",detected_config_format_title:"Convert configuration",detected_config_format_confirm:"Convert",examples:{authenticateThirdPartyWithDynamicUrl:"Authenticate Kong to a third-party service resolved at runtime",authenticateThirdParty:"Authenticate Kong to a third-party service",authenticateWithVaultSecret:"Authenticate to a third-party service using Vault secrets",clearHeaders:"Clear request headers",combineTwoApisIntoOneResponse:"Combine multiple API responses",conditionallyStoreCachedItems:"Conditionally fetch or store cache data",convertJsonIntoXml:"Transform JSON into XML",convertJsonToXmlAndBack:"Transform JSON into XML and back",convertXmlIntoJson:"Transform XML into JSON",manipulateRequestHeaders:"Manipulate request headers"},flow_editor:{mode:"Flow editor",name:"Datakit flow editor",cta:"Go to flow editor",disabled_tooltip:"The flow editor is unavailable due to critical configuration errors or features not supported in the flow editor:<br/><code>{reason}</code>",expand_panel:"Expand panel",collapse_panel:"Collapse panel",return_to_config:"Return to plugin configuration",canvas_panel:{request:"Request",response:"Response",node_count_plural:"{count} nodes",node_count_singular:"1 node"},panel_segments:{nodes:"Nodes",resources:{title:"Resources",vault:{title:"Vault secrets",add_button:"Add vault resource",name_exists_error:"Vault name already exists",name_required_error:"Vault name is required",edit:"Edit",delete:"Delete"},cache:{title:"Cache configuration",add_button:"Add cache configuration",strategy_options:{memory:"Memory",redis:"Redis"},select_redis_configuration:"Select a shared Redis configuration",inline_config:"Inline config",inline_config_preview:"You are using a dedicated Redis configuration, This is a preview of your current setup, please edit it in code editor"}}},vault_secret_picker:{title:"Add secret to Datakit",proceed_button_text:"Add secret",secret_name:{label:"Secret name",placeholder:"Enter a name",help:"A unique identifier for this secret in your Datakit configuration"}},node_panel:{title:"Node types",description:"Drag a node onto the canvas to add it to your data flow.",groups:{external_interaction:"External interaction",control_flow:"Control flow",data_transformation:"Data transformation",data_value:"Data value",authentication:"Authentication"}},examples:"Examples",debug:{label:"Debug",description:'Enables detailed error messages in client responses, making debugging easier. <a href="https://developer.konghq.com/plugins/datakit/#debugging" target="_blank">See the docs</a> for details.'},actions:{zoom_in:"Zoom in",zoom_out:"Zoom out",fit_view:"Zoom to fit",auto_layout:"Auto layout",undo:"Undo",redo:"Redo",duplicate:"Duplicate",remove_from_branch:"Remove from branch",delete:"Delete",view_docs:"View docs",done:"Done"},node_types:{call:{summary:"Call a third-party API",description:"Send an HTTP request and retrieve the response."},jq:{summary:"Transform data and cast variables with jq",description:'The <code>jq</code> node executes a jq script for processing JSON. See the official <a href="https://jqlang.org" target="_blank">jq docs</a> for more details.'},exit:{summary:"Return directly to the client",description:"Trigger an early exit that produces a direct response, rather than forwarding a proxied response."},property:{summary:"Get and set Kong Gateway-specific data",description:"Get and set Kong Gateway host and request properties."},static:{summary:"Configure static input values ahead of time",description:"Emits static values to be used as inputs for other nodes. The <code>static</code> node can help you with hardcoding some known value for an input."},branch:{summary:"Execute nodes based on matching input conditions",description:"Execute different nodes based on matching input conditions, such as a cache hit or miss."},cache:{summary:"Store and fetch cached data",description:"Store data into cache and fetch cached data from cache."},xml_to_json:{summary:"Transform XML to JSON",description:"Transform XML to JSON."},json_to_xml:{summary:"Transform JSON to XML",description:"Transform JSON to XML."},jwt_decode:{summary:"Decode JWT headers and claims",description:"Parse a JWT without verifying its signature."},jwt_sign:{summary:"Create and sign JWTs",description:"Generate a signed JWT from configured claims and a signing key."},jwt_verify:{summary:"Verify JWT signature and claims",description:"Verify a JWT signature and validate claims such as exp, nbf, iss, and aud."},request:{name:"request",description:"Reads incoming client request properties. You cannot specify request node input."},response:{name:"response",description:"Updates properties of the outgoing client response."},service_request:{name:"service request",description:"Updates properties of the request sent to the service being proxied to."},service_response:{name:"service response",description:"Reads response properties from the service being proxied to."},vault:{name:"Vault",description:"Vault is a tool for securely accessing secrets."}},node_properties:{name:"Name",configuration:"Configuration",input:{label:"Inputs configuration",placeholder:"Select a source",add_button:"Add an input",or:"or",input:"Input",fields:"Fields",source:"Source",tooltip:"Fields are part of the node input. A source can connect to either the fields or the input, but not both."},input_name:{label:"Input name",placeholder:"Enter an input name"},jq:{label:"jq script",help:"Refer to {link} for full documentation."},output_value:{label:"Output value",value_name:"Value name",value:"Value",add_button:"Add a value"},property:{get:"get",set:"set"},branch:{placeholder:"Select nodes"},jwt:{static_claims:{label:"Static claims",help:"Enter a JSON object. It will be stored as the node's static claims map.",errors:{invalid_json_object:"Static claims must be a valid JSON object"}}},errors:{invalid_identifier_format:"{fieldName} must start with a letter or underscore and contain only letters, numbers, underscores, or hyphens",invalid_url_format:"Not a valid URL format",not_empty:"{fieldName} is required",not_float:"{fieldName} must be a float",not_integer:"{fieldName} must be an integer",not_number:"{fieldName} must be a number",not_unique:"{fieldName} must be unique",number_range:"{fieldName} must be between {min} and {max}",string_len_range:"{fieldName} must be between {minLength} and {maxLength} characters",reserved_node_name:'"{nodeName}" is a reserved node name',attributes_required:"Provide at least one of attributes_block_name or attributes_name_prefix"}},error:{invalid_connection:"Invalid connection",branch_cycle:"Cannot create a circular branch relationship"},confirm:{title:"Connection conflict",message:{confirm:"Are you sure you want to make this change?",switch:"You can connect an output source to either all inputs of a node or to individual inputs.",override:"Each input can connect to only one output, but one output can connect to many inputs.",branch_replace:"This node already belongs to another branch. Move it to the new branch?"},proceed:"Yes, update"},leave_confirm:"Leave current page? Changes you made may not be saved."},code_editor:{mode:"Code editor"}},vault_picker:{component_error:"The vault secret picker is not available"},tag_helper:"Use comma to separate values. eg: value1, value2",foreign_placeholder:"Enter a UUID of {entity}"}},redis:{title:"Redis configuration",managed_ui:{title:"Redis",shared_configuration:{label:"Use shared configuration",description:"Select an existing shared Redis configuration or create a new one. Any updates to this configuration will automatically apply to all associated plugins.",badge:"Recommended"},dedicated_configuration:{label:"Use locally-scoped configuration",description:"Create and use a Redis configuration specifically for this plugin."},selector:{placeholder:"Filter Redis configurations...",create_new:"New Redis"}},shared_configuration:{label:"Shared configuration",description:"Select an existing shared Redis configuration or create a new one. Changes to this configuration automatically apply to all associated plugins.",title:"Shared Redis configuration",error:"Fetching shared Redis configurations failed."},dedicated_configuration:{label:"Dedicated configuration",description:"Create a Redis configuration that is used only by this plugin. Changes won’t affect other plugins."},config_card:{common_fields:{created_at_label:"Created at",updated_at_label:"Last updated at",type_label:"Redis type"}}},glossary:{plugin:"plugin"},custom_field:{key_auth_identity_realms:{cp_label:"Current control plane",cp_group_label:"Control plane",realm_group_label:"Realms (can only select one)"},kong_identity:{title:"Who should manage authentication and credentials?",description_with_realms:"Use Consumers or centrally managed consumers for Consumer-based authentication. Use Kong Identity for principal-based authentication and advanced integrations.",description_without_realms:"Use Consumers for Consumer-based authentication. Use Kong Identity for principal-based authentication and advanced integrations.",learn_more:"Learn more.",incompatible_data_plane_alert:"We detected that one or more data plane nodes are running a version earlier than 3.15. Requests handled by those data plane nodes will use consumers instead of Kong Identity principals.",kong_identity_label:"Kong Identity",kong_identity_description_key_auth:"Use Kong Identity to authenticate API keys and map requests to Kong Identity principals for advanced integrations. Data plane nodes running versions earlier than 3.15 continue using consumers.",kong_identity_description_basic_auth:"Use Kong Identity to authenticate Basic Auth credentials and map requests to Kong Identity principals for advanced integrations. Data plane nodes running versions earlier than 3.15 continue using consumers.",consumers_label:"Consumers",consumers_description_key_auth:"Use consumer-managed API keys. Consumers provide their API key in a request header, query parameter, or request body to authenticate requests.",consumers_description_basic_auth:"Use consumer-managed Basic Auth credentials. Consumers authenticate requests using a username and password.",centrally_managed_label:"Centrally managed consumers",centrally_managed_description:"Authenticate centrally managed consumers in Konnect using identity realms. Identity realms are scoped to the control plane by default.",identity_realms_required:"To use centrally managed consumers, you must select at least one Centrally managed consumer realm.",error_on_miss_label:"If principal lookup fails",error_on_miss_reject_label:"Reject the request",error_on_miss_reject_description:"Treat the request as unauthenticated if Kong Identity cannot resolve the principal.",error_on_miss_continue_label:"Continue without a principal",error_on_miss_continue_description:"Allow the request to continue without resolving a principal.",configure_title:"Configure Kong Identity",configure_description:"Kong Identity uses principals to represent authenticated services or applications. Create your first principal in Kong Identity to start using principal-based authentication. On data plane nodes running versions earlier than 3.15, authentication continues using consumers.",create_principal:"Create principal",configure_learn_more:"Learn more",leave_prompt_title:"Leave this page?",leave_prompt_message:"Your unsaved changes will be lost if you continue.",leave_prompt_action:"Leave page"}},sp:{window_type:{label:"Rate limit window type",help:"Sets the time window type to either <code>sliding</code> (default) or <code>fixed</code>.<br><ul><li>Sliding windows apply the rate limiting logic while taking into account previous hit rates (from the window that immediately precedes the current) using a dynamic weight.</li><li>Fixed windows consist of buckets that are statically assigned to a definitive time range, each request is mapped to only one fixed window based on its timestamp and will affect only that window&#39;s counters.</li></ul>",options:{fixed:"Fixed",sliding:"Sliding"}},request_limits:{title:"Request limits",subtitle:"Set one or more limits on the number of API requests allowed within a defined timeframe.",label:"Limit",label_index:"Limit {index}",request_number:"Request number",time_interval:"Time interval",interval_determiner:"Every",seconds:"Seconds"},error_message:{label:"Error message",code_placeholder:"Code message",message_placeholder:"Error message",help:"Set a custom error code and message to be returned when the rate limit is exceeded."},start_with_a_use_case:"Start with a use case:",use_cases:{fixed:{hourly_500:{label:"500 requests every hour",description:"A fixed limit of 500 requests per hour resetting sharply on the hour, ensuring no user can exceed this limit."},half_hourly_200:{label:"200 requests every 30 minutes",description:"Users are allowed 200 requests per 30 minutes, resetting exactly on the 30 minute mark with no carryover of unused limits."},daily_500:{label:"500 requests every day",description:"A strict limit of 5000 requests per day resetting promptly at midnight, preventing any burst traffic or inconsistent user experiences."}},sliding:{hourly_100:{label:"100 requests every hour",description:"Maximum of 100 requests every rolling hour, continuously adjusting the count over the course of the hour. No hard limit or known reset."},half_hourly_300:{label:"300 requests every 30 minutes",description:"Each user can make up to 300 requests in any rolling 30 minute period, with older requests dropping off as new requests are made."},hourly_500:{label:"500 requests every hour",description:`Each user is allowed 500 requests per hour.
1
+ (function(ve,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@kong/icons"),require("@kong/kongponents"),require("@vue-flow/background"),require("@vue-flow/controls"),require("@vue-flow/core"),require("@vueuse/core"),require("@kong-ui-public/i18n"),require("@vue-flow/controls/dist/style.css"),require("@vue-flow/core/dist/style.css"),require("@vue-flow/core/dist/theme-default.css"),require("@kong-ui-public/entities-shared"),require("@kong-ui-public/entities-plugins-icon"),require("@kong-ui-public/entities-plugins-metadata"),require("@kong-ui-public/forms"),require("marked"),require("dompurify"),require("@kong-ui-public/monaco-editor"),require("monaco-editor"),require("vue-router"),require("@kong-ui-public/monaco-editor/dist/runtime/style.css"),require("@kong-ui-public/entities-redis-configurations"),require("@kong-ui-public/entities-redis-configurations/dist/style.css"),require("@kong-ui-public/entities-vaults"),require("shiki"),require("zod"),require("axios"),require("@kong-ui-public/entities-vaults/dist/style.css"),require("@kong-ui-public/forms/dist/style.css")):typeof define=="function"&&define.amd?define(["exports","vue","@kong/icons","@kong/kongponents","@vue-flow/background","@vue-flow/controls","@vue-flow/core","@vueuse/core","@kong-ui-public/i18n","@vue-flow/controls/dist/style.css","@vue-flow/core/dist/style.css","@vue-flow/core/dist/theme-default.css","@kong-ui-public/entities-shared","@kong-ui-public/entities-plugins-icon","@kong-ui-public/entities-plugins-metadata","@kong-ui-public/forms","marked","dompurify","@kong-ui-public/monaco-editor","monaco-editor","vue-router","@kong-ui-public/monaco-editor/dist/runtime/style.css","@kong-ui-public/entities-redis-configurations","@kong-ui-public/entities-redis-configurations/dist/style.css","@kong-ui-public/entities-vaults","shiki","zod","axios","@kong-ui-public/entities-vaults/dist/style.css","@kong-ui-public/forms/dist/style.css"],e):(ve=typeof globalThis<"u"?globalThis:ve||self,e(ve["kong-ui-public-entities-plugins"]={},ve.Vue,ve.KongIcons,ve.Kongponents,ve.background,ve.controls,ve.core$1,ve.core,ve["kong-ui-public-i18n"],null,null,null,ve["kong-ui-public-entities-shared"],ve.entitiesPluginsIcon,ve.entitiesPluginsMetadata,ve.forms,ve.marked,ve.DOMPurify,ve.monacoEditor,ve.monaco,ve.VueRouter,null,ve.entitiesRedisConfigurations,null,ve.entitiesVaults,ve.shiki,ve.zod,ve.axios))})(this,function(ve,e,$e,Fe,h1,Gg,xt,Pt,jt,QK,eq,tq,Ie,xr,fe,et,cl,y1,ha,fo,Ar,nq,Hg,rq,ya,_1,ee,Zo){"use strict";var XK=Object.defineProperty;var ZK=(ve,e,$e)=>e in ve?XK(ve,e,{enumerable:!0,configurable:!0,writable:!0,value:$e}):ve[e]=$e;var K=(ve,e,$e)=>ZK(ve,typeof e!="symbol"?e+"":e,$e);var Xo;function b1(n){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const r in n)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>n[r]})}}return t.default=n,Object.freeze(t)}function w1(n,t){for(var r=0;r<t.length;r++){const o=t[r];if(typeof o!="string"&&!Array.isArray(o)){for(const i in o)if(i!=="default"&&!(i in n)){const a=Object.getOwnPropertyDescriptor(o,i);a&&Object.defineProperty(n,i,a.get?a:{enumerable:!0,get:()=>o[i]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}const ul=b1(fo),Jt={actions:{cancel:"Cancel",view_configuration:"View configuration",create:"New plugin",create_custom:"Create",configure:"Configure",copy_id:"Copy ID",copy_json:"Copy JSON",edit:"Edit",enable:"Enable",enabled:"Enabled",delete:"Delete",disabled:"Disabled",confirm_delete:"Yes, delete",view:"View details",configure_dynamic_ordering:"Configure dynamic ordering",go_to_plugins:"Go to plugins",save:"Save",add_entity:"Add {entity}",remove_entity:"Remove {entity}",loading_spinner:"Loading..."},view_configuration:{title:"Configuration",message:"Export configurations for core Kong Gateway objects, like services, routes, and plugins, to either YAML, JSON, or Terraform. This allows for straightforward importing into APIOps tools like decK with YAML, Insomnia and cURL with JSON, or Terraform products with Terraform.",yaml:"YAML",terraform:"Terraform",json:"JSON",deck:"decK"},delete:{title:"Delete a plugin",custom_title:"Delete {name}",custom_plugin:"Custom plugin",description:"This action cannot be reversed.",description_custom:"Please ensure this plugin is not in use. This action cannot be reversed.",plugin_schema_in_use_title:"Unable to delete custom plugin",plugin_schema_in_use_message:"This custom plugin is currently in use in this control plane. Please delete any existing instances before removing this schema.",confirmModalText1:"Are you sure you want to delete",confirmModalText2:"Please ensure this plugin is not in use. This delete action cannot be reversed.",confirm_text:"Type {name} to confirm your action",success_message:"Successfully deleted custom plugin {name}"},copy:{success:"Copied {val} to clipboard",success_brief:"Successfully copied to clipboard",tooltip:"Copy {label}",success_tooltip:"Copied!"},errors:{general:"Plugins could not be retrieved",delete:"The plugin could not be deleted at this time.",copy:"Failed to copy to clipboard",load_results:"Error loading available plugins",load_schema:"Error loading plugin schema"},search:{placeholder:{konnect:"Filter by name",exact:"Filter by exact instance name or ID",kongManager:"Filter by exact instance name or ID",select:"Filter plugins",search_plugins:"Search plugins"},filter:{field:{enabled:"Enabled"}},no_results:'No results found for "{filter}"'},labels:{new:"New"},plugins:{title:"Plugins",list:{toolbar_actions:{new_plugin:"New plugin"},table_headers:{applied_to:"Applied to",applied_to_badges:{consumer:"Consumer",global:"Global",route:"Route",service:"Service",consumer_group:"Consumer group"},id:"ID",name:"Name",instance_name:"Instance name",ordering:"Ordering",ordering_badge:{dynamic:"Dynamic",static:"Static"},enabled:"Enabled",tags:"Tags",updated_at:"Last modified"},empty_state:{title:"Configure a new plugin",description:"Plugins are used to extend Kong functionality."},empty_state_v2:{title:"Configure your first plugin",description:"Plugins extend gateways functionalities, offering features like authentication, rate limiting, and request transformations to enhance security and performance.",create_cta:"New plugin",group:"Plugins created in gateways within this group will automatically appear here.",learn_more:"Learn more"}},meta:{"basic-auth":{name:"Basic Authentication",credential_name:"Basic Auth Credential",description:"Add Basic Authentication to your services"},"hmac-auth":{name:"HMAC Authentication",credential_name:"HMAC Credential",description:"Add HMAC Authentication to your services"},"jwt-signer":{name:"JWT Signer",description:"Verify and (re-)sign one or two tokens in a request"},jwt:{name:"JWT",credential_name:"JWT Credential",description:"Verify and authenticate JSON Web Tokens"},"key-auth":{name:"Key Authentication",credential_name:"Key Auth Credential",description:"Add key authentication to your services"},"key-auth-enc":{name:"Key Authentication Encrypted",credential_name:"Key Auth Encrypted",description:"Add key authentication to your services with an encrypted token"},"ldap-auth-advanced":{name:"LDAP Authentication Advanced",description:"Integrate Kong with a LDAP server"},"ldap-auth":{name:"LDAP Authentication",description:"Integrate Kong with a LDAP server"},"oauth2-introspection":{name:"OAuth 2.0 Introspection",description:"Integrate Kong with a third-party OAuth 2.0 Authorization Server"},oauth2:{name:"OAuth 2.0 Authentication",credential_name:"OAuth 2.0 Application",description:"Add OAuth 2.0 authentication to your services"},"openid-connect":{name:"OpenID Connect",description:"Integrate Kong with a third-party OpenID Connect 1.0 provider"},"mtls-auth":{name:"Mutual TLS Authentication",description:"Secure routes and services with client certificate and mutual TLS authentication"},"vault-auth":{name:"Vault Authentication",description:"Secure routes and services with an access token and secret token, stored securely via Vault"},"bot-detection":{name:"Bot Detection",description:"Detect and clock bots or custom clients"},cors:{name:"CORS",description:"Allow developers to make requests from the browser"},"ip-restriction":{name:"IP Restriction",description:"Whitelist or blacklist IPs that can make requests"},opa:{name:"OPA",description:"Authorize requests against Open Policy Agent"},"kubernetes-sidecar-injector":{name:"Kubernetes Sidecar Injector",description:"This plugin will inject Kong dataplane nodes and form a service mesh on top of Kubernetes"},"request-validator":{name:"Request Validator",description:"Validate requests before they reach their upstream service."},acl:{name:"ACL",credential_name:"Access Control Group",description:"Control which consumers can access services"},canary:{name:"Canary Release",description:"Methodically roll out software changes to a subset of users"},"forward-proxy":{name:"Forward Proxy",description:"Allow Kong to connect to intermediary transparent HTTP proxies"},"proxy-cache":{name:"Proxy Caching",description:"Cache and serve commonly requested responses in Kong"},"proxy-cache-advanced":{name:"Proxy Caching Advanced",description:"Cache and serve commonly requested responses in Kong"},"graphql-proxy-cache-advanced":{name:"GraphQL Proxy Caching Advanced",description:"Cache and serve commonly requested responses in Kong"},"rate-limiting-advanced":{name:"Rate Limiting Advanced",description:"Rate-limit how many HTTP requests a developer can make"},"rate-limiting":{name:"Rate Limiting",description:"Rate-limit how many HTTP requests a developer can make"},"graphql-rate-limiting-advanced":{name:"GraphQL Rate Limiting Advanced",description:"Rate-limit how many HTTP requests a developer can make"},mocking:{name:"Mocking",description:"Provide mock endpoints to test your APIs in development against your services"},"request-size-limiting":{name:"Request Size Limiting",description:"Block requests with bodies greater than a specific size"},"request-termination":{name:"Request Termination",description:"Terminate all requests with a specific response"},"response-ratelimiting":{name:"Response Rate Limiting",description:"Rate-Limiting based on a custom response header value"},"route-by-header":{name:"Route by Header",description:"Route requests based on request headers"},"ai-proxy":{name:"AI Proxy",description:"Directly call a configured LLM, with mediated security and tuning parameters, and using standardised Kong request and response formats."},"ai-prompt-decorator":{name:"AI Prompt Decorator",description:"Prepend and append chat prompts to AI Proxy plugin LLM requests."},"ai-prompt-template":{name:"AI Prompt Template",description:"Define a set of templates, containing string variable placeholders, that can be consumed by users when used with the AI Proxy plugin."},"ai-prompt-guard":{name:"AI Prompt Guard",description:"Define a set of valid, and a set of invalid, regular expression patterns when calling LLM models with the AI Proxy plugin."},"ai-request-transformer":{name:"AI Request Transformer",description:"Use an LLM to transform API request from a user, before sending to the upstream service."},"ai-response-transformer":{name:"AI Response Transformer",description:"Use an LLM to transform API responses from the upstream service, before returning to the user."},"ai-rate-limiting-advanced":{name:"AI Rate Limiting Advanced",description:"Provides rate limiting for the providers used by any AI plugins."},"ai-azure-content-safety":{name:"AI Azure Content Safety",description:"Allows checking and auditing of AI-Proxy plugin messages, using Azure Cognitive Services, before proxying to upstream large-language model."},"aws-lambda":{name:"AWS Lambda",description:"Invoke and manage AWS Lambda functions from Kong"},"azure-functions":{name:"Azure Functions",description:"Invoke Azure functions"},openwhisk:{name:"OpenWhisk",description:"Invoke and manage OpenWhisk actions from Kong"},"pre-function":{name:"Kong Functions (Pre-Plugins)",description:"Add and manage custom lua functions to run before other plugins"},"post-function":{name:"Kong Functions (Post-Plugins)",description:"Add and manage custom lua functions to run after other plugins"},datadog:{name:"Datadog",description:"Visualize metrics on Datadog"},prometheus:{name:"Prometheus",description:"Export performance metrics to Prometheus"},zipkin:{name:"Zipkin",description:"Propagate zipkin spans and report spans to a zipkin server"},collector:{name:"Collector",description:"Automate spec-driven development & anomaly detection (Early Access)"},"response-transformer-advanced":{name:"Response Transformer Advanced",description:"Transform the response sent by the upstream server on the fly on Kong, before returning the response to the client."},"correlation-id":{name:"Correlation ID",description:"Correlate requests and responses using a unique ID"},"request-transformer-advanced":{name:"Request Transformer Advanced",description:"Use powerful regular expressions, variables and templates to transform API requests"},"request-transformer":{name:"Request Transformer",description:"Modify the request before hitting the upstream server"},"response-transformer":{name:"Response Transformer",description:"Modify the upstream response before returning it to the client"},"route-transformer-advanced":{name:"Route Transformer Advanced",description:"Transforms the routing on the fly in Kong, changing the upstream server/port/path to hit"},"kafka-upstream":{name:"Kafka Upstream",description:"Transform requests into Kafka messages in a topic"},degraphql:{name:"DeGraphQL",description:"Transform a GraphQL upstream into a REST API"},"exit-transformer":{name:"Exit Transformer",description:"Customize Kong exit responses sent downstream"},jq:{name:"jq",description:"Transform JSON objects included in API requests or responses using jq programs"},"file-log":{name:"File Log",description:"Append request and response data to a log file on disk"},"http-log":{name:"HTTP Log",description:"Send request and response logs to an HTTP server"},loggly:{name:"Loggly",description:"Send request and response logs to Loggly"},"statsd-advanced":{name:"StatsD Advanced",description:"Send traffic and Kong performance metrics to StatsD"},statsd:{name:"StatsD",description:"Send request and response logs to StatsD"},syslog:{name:"Syslog",description:"Send request and response logs to Syslog"},"tcp-log":{name:"TCP Log",description:"Send request and response logs to a TCP server"},"udp-log":{name:"UDP Log",description:"Send request and response logs to a UDP server"},"kafka-log":{name:"Kafka Log",description:"Publish request and response logs to a Kafka topic"},session:{name:"Session",description:"Sessions for Kong authentication"},"upstream-tls":{name:"Upstream TLS",description:"Enable TLS on upstream traffic by providing Kong with a list of trusted certificates."},"application-registration":{name:"Portal Application Registration",description:"Allow portal developers to register applications against services"},"konnect-application-auth":{name:"Konnect Application Auth",description:"Allow Konnect portal developers to register applications against services"},acme:{name:"ACME",description:"Let's Encrypt and ACMEv2 integration with Kong"},"grpc-gateway":{name:"gRPC Gateway",description:"Access gRPC services through HTTP REST"},"grpc-web":{name:"gRPC Web",description:"Allow browser clients to call gRPC services"},"upstream-timeout":{name:"Upstream Timeout",description:"Configure read, send and connect timeouts to an upstream"},opentelemetry:{name:"OpenTelemetry",description:"Propagate distributed tracing spans and report low-level spans to a OTLP-compatible server"},"websocket-validator":{name:"WebSocket Validator",description:"Validate individual WebSocket messages against to a user-specified schema before proxying them"},"websocket-size-limit":{name:"WebSocket Size Limit",description:"Allows operators to specify a maximum size for incoming WebSocket messages"},"tls-metadata-headers":{name:"TLS Metadata Headers",description:"Detects client certificates in requests, retrieves the TLS metadata, and proxies this metadata via HTTP headers"},"tls-handshake-modifier":{name:"TLS Handshake Modifier",description:"Requests the client certificate and if it exists, makes it available to other plugins acting on the request"},"oas-validation":{name:"OAS Validation",description:"Validate HTTP requests and responses based on an API specification."},"jwe-decrypt":{name:"Kong JWE Decrypt",description:"The Kong JWE Decrypt plugin makes it possible to decrypt an inbound token(JWE) in a request."},"xml-threat-protection":{name:"XML Threat Protection",description:"Reduce the risk of XML attacks by checking the structure of XML payloads."},saml:{name:"SAML",description:"Security Assertion Markup Language (SAML) is an open standard for exchanging authentication and authorization data between an identity provider and a service provider."},"app-dynamics":{name:"AppDynamics",description:"This plugin integrates Kong with the AppDynamics APM platform so that proxy requests handled by Kong can be identified and analyzed in AppDynamics."},"json-threat-protection":{name:"JSON Threat Protection",description:"Apply size checks on JSON payload and minimize risk of content-level attacks"},"standard-webhooks":{name:"Standard Webhooks",description:"Validate incoming webhooks adhere to the Standard Webhooks specification, to which Kong is a contributor"},"ai-proxy-advanced":{name:"AI Proxy Advanced",description:"Route across different LLMs and models using advanced load balancing algorithms, including semantic routing."},"ai-semantic-cache":{name:"AI Semantic Cache",description:"Semantically cache AI requests to any LLM to reduce latency, improve end-user experiences and optimize GenAI costs."},"ai-semantic-prompt-guard":{name:"AI Semantic Prompt Guard",description:"Semantically and intelligently create allow and deny lists of topics that can be requested across every LLM."},"header-cert-auth":{name:"Header Certificate Authentication",description:"Authenticate clients with MTLS certificate passed in header by a WAF or load balancer"},"upstream-oauth":{name:"Upstream OAuth",description:"Configure Kong to obtain a OAuth2 token to consume an upstream API"},confluent:{name:"Confluent",description:"Streamlines integration with Confluent Cloud and transforms requests into messages published to a Confluent topic."},"service-protection":{name:"Service Protection",description:"Prevent abuse and protect services with absolute limits on the number of requests reaching the service."},"injection-protection":{name:"Injection Protection",description:"Protect against injection attacks by rejecting requests that match common injections patterns."},redirect:{name:"Redirect",description:"Redirect incoming requests to a new URL"},"kafka-consume":{name:"Kafka Consume",description:"Consume messages from Kafka topics over HTTP protocols."},"confluent-consume":{name:"Confluent Consume",description:"Consume messages from Confluent Kafka topics over HTTP protocols"},"request-callout":{name:"Request Callout",description:"Callout to third party APIs as part of request processing."},"ai-sanitizer":{name:"AI Sanitizer",description:"Sanitize personal or sensitive information from prompts before sending to LLM."},"ai-rag-injector":{name:"AI RAG Injector",description:"Attach contextual knowledge from vector databases with flexible template to LLM prompts."},datakit:{name:"Datakit",description:"Datakit is a workflow engine for working with external APIs."},"ai-prompt-compressor":{name:"AI Prompt Compressor",description:"The AI Prompt Compressor reduces costs associated with LLMs by compressing prompts."},"solace-upstream":{name:"Solace Upstream",description:"Transform requests into Solace messages in a Solace queue or topic."},"ai-aws-guardrails":{name:"AI AWS GuardRails",description:"The AI AWS GuardRails enables enforcement of introspection with the AWS GuardRails service for all requests processed by the AI Proxy plugin."},ace:{name:"Konnect Access Control Enforcement",description:"Enable Developer Self-Service for Konnect Dev Portals."},"solace-consume":{name:"Solace Consume",description:"Consume messages from Solace and make them available through HTTP endpoints."},"solace-log":{name:"Solace Log",description:"Publish request and response logs to a Solace topic."},"ai-llm-as-judge":{name:"AI LLM Judge",description:"Evaluate LLM responses with an external LLM service and use accuracy scores to drive dynamic load balancing for `llm/v1/chat` requests."},"ai-mcp-proxy":{name:"AI MCP Proxy",description:"Convert APIs into MCP tools, proxy MCP servers, expose multiple MCP tools, and observe MCP traffic in real time."},"ai-gcp-model-armor":{name:"AI GCP Model Armor",description:"Audit and validate AI Proxy messages with Google Cloud Model Armor before forwarding them to an upstream LLM."},"ai-mcp-oauth2":{name:"AI MCP OAuth2",description:"Secure MCP server access with OAuth2 authentication."},"ai-semantic-response-guard":{name:"AI Semantic Response Guard",description:"Permit or block prompts based on semantic similarity to known LLM responses, preventing misuse of `llm/v1/chat` or `llm/v1/completions` requests."},"ai-lakera-guard":{name:"AI Lakera Guard",description:"Audit and enforce safety policies on LLM requests and responses using the AI AWS Lakera plugin before they reach upstream LLMs."},"ai-a2a-proxy":{name:"AI A2A Proxy",description:"Securely proxy A2A agents, with real-time RPC tracing and monitoring."},"ai-custom-guardrail":{name:"AI Custom Guardrail",description:"Integrate with any 3rd-party Guardrail service, with customizable enforcement modes — choose whether violations block, log, or allow traffic to proceed."},"metering-and-billing":{name:"Metering & Billing",description:"Meter API requests and AI token usage for usage-based billing. Supports flexible customer identification, custom pricing dimensions, and fine-grained traffic filtering. Integrates natively with Konnect Metering & Billing."}},fields:{service:"Service ID",route:"Route ID",consumer:"Consumer ID",consumer_group:"Consumer group ID"},select:{custom_badge_text:"This plugin is data plane node specific",cloned_from_badge:"Cloned from {link}",installed_custom_badge:"Installed custom",streamed_custom_badge:"Streamed custom",unavailable_tooltip:"This plugin is not available",already_exists:"This plugin is already applied to this resource",misc_plugins:"Other plugins",show_all:"Show all",view_more:"View more",view_less:"View less",filter:{title:"Filter plugins",featured:"Featured",type:"Type",clear:"Clear"},list:{table_headers:{name:"Plugin",description:"Description"}},tabs:{kong:{title:"Kong plugins",description:"Kong plugins are bundled by default with Kong Gateway and are available across all control planes.",empty_title:"No plugins",empty_description:"No plugins are available."},custom:{title:"Custom plugins",description:"Custom plugins will be available in this control plane only.",disabled_tooltip:"Custom plugins are not available with this gateway. Create a hybrid or dedicated cloud gateway to leverage custom plugins.",fetch_error:"Unable to load some custom plugins. Bundled plugins are still available.",license_required:"Plugin cloning requires a license to be used.",empty_title:"No custom plugins",empty_description:"No custom plugins have been added to this control plane.",create:{name:"Custom plugin",description:"Upload schema file to create custom plugin"}}},highlighted_plugins:{title:"Highlighted plugins"}},form:{button_deck_customize:"Customize before copying to CLI",disable_data_retrieving:"You do not have permission to select {scope}",disable_source_scope_change:"Changing the {scope} is not allowed when configuring a plugin under it",no_selection:"No selection...",fields:{enabled:{label:"Enabled",on_text:"This plugin is enabled",off_text:"This plugin is disabled"},plugin_status:{label:"Plugin status",text_on:"Enabled",text_off:"Disabled"},instance_name:{label:"Name",placeholder:"Enter a unique name",help:"A custom name for this plugin instance to help with identifying from the list view."},condition:{label:"Execution condition",placeholder:"Enter an expression",tooltip:"An expression used for conditional control over plugin execution. If the expression evaluates to true during the request flow, the plugin is executed; otherwise, it is skipped.",help:{learn:"Learn more",about:"{link} about plugin conditions."}},protocols:{label:"Protocols",placeholder:"Select valid protocols for the plugin",placeholderWithDefaultValues:"Select valid protocols for the plugin. Default protocols: {protocols}",help:"A list of the request protocols that will trigger this plugin. The default value, as well as the possible values allowed on this field, may change depending on the plugin type."},tags:{label:"Tags",help:"An optional set of strings for grouping and filtering, separated by commas.",placeholder:"Tag1, Tag2, Tag3"}},scoping:{label:"Scoped",placeholder:"Search by name or UUID",disable_global_radio:"The plugin is set to 'scoped' by default. To apply a plugin globally, please navigate to the global plugin list page.",global:{label:"Global",help:"All services, routes, and consumers"},gateway_service:{label:"Select a gateway service",help:"The gateway service to which this plugin configuration will apply",placeholder:"Select a gateway service",plural:"Gateway services"},route:{label:"Select a route",help:"The route that this plugin configuration will target",placeholder:"Select a route",plural:"Routes"},consumer:{label:"Select a consumer",help:"The consumer that this plugin configuration will target",placeholder:"Select a consumer",plural:"Consumers"},consumer_group:{label:"Select a consumer group",help:"The consumer group that this plugin configuration will target",placeholder:"Select a consumer group",plural:"Consumer groups"}},grouping:{plugin_configuration:{title:"Plugin configuration",description:"Configuration parameters for this plugin. View advanced parameters for extended configuration.",empty:"This plugin does not have required parameters."},advanced_parameters:{view:"Show additional settings",hide:"Hide additional settings"}},field_rules:{at_least_one_of:"At least one of the following values is required: {parameters}.",only_one_of:"Exactly one of these parameters is required: {parameters}",mutually_required:"These values must be used together: {parameters}.",mutually_exclusive:"Only one of these values can be used: {parameters}.",only_one_of_mutually_required:"Exactly one of the following parameter combinations is required (all parameters within a chosen combination are required):"},sections:{plugin_scope:{title:"Plugin scope",description:"Choose whether this plugin applies to all traffic (global) or is scoped to a specific service, route, or consumer."},general_info:{title:"General information",description:"Add details to help identify and manage your plugin."},plugin_config:{title:"Plugin configuration",description:"Set the plugin's behavior by defining its configuration settings."},plugin_general_info:{description:"Add a name or tags to help you identify and manage this plugin later."},code_mode:{title:"Code editor",description:"Configure this plugin by using YAML configuration."}}},"free-form":{editor_mode:{visual:"Visual editor",code:"Code editor"},"code-lens":{entity:{service:"Service",route:"Route",consumer:"Consumer",consumer_group:"Consumer group",certificate:"Certificate"},field:{name:'{entity} "{value}"',username:'Username "{value}"',custom_id:'Custom ID "{value}"',subject:'Subject "{value}"',expires_after:'Expires after "{value}"'},action:{view_entity:"View {title}",copy_certificate:"Copy certificate",copy_uuid:"Copy UUID",retry_fetch:"Retry fetch (Hover for details)"},unknown_error:"Unknown error"},acl:{mode:{allow:"Use allow list",deny:"Use deny list"}},"ai-mcp-proxy":{default_acl_item_label:"Default ACL #{index}",tool_item_label:"Tool #{index}"},"request-callout":{entity_name:"Request callout",by_lua_placeholder:"Enter Lua script here..."},"jwt-signer":{keyset_url_required:'Provide a valid HTTP/HTTPS URL to ensure signing works correctly when "{signingField}" is enabled and "{headerField}" is set.'},"metering-and-billing":{sections:{plugin_config:{title:"Plugin configuration",description:"Configure the Metering & Billing plugin."},metering:{title:"What to meter"},subject:{title:"Who to bill (subject)",description:"Define how billing subjects are identified."},ingestion:{title:"Connection",description:"Configure how metered data is delivered to the billing service."},queue:{title:"Queue",description:"Configure internal event queue settings."}},fields:{meter_api_requests:{label:"Meter API requests",description:"Emit a usage event for each API Gateway request."},meter_ai_token_usage:{label:"Meter AI token usage",description:"Emit events for LLM input and output tokens on AI Gateway requests. Each request produces separate input/output events so they can be priced independently."},ingest_endpoint:{description:"The URL of the metering data ingest endpoint.",help:"For Konnect Metering & Billing, use the regional endpoint from your Metering & Billing settings. For self-hosted OpenMeter, use your ingest URL."},api_token:{description:"Bearer token for authenticating requests to the ingest endpoint."},look_up_value_in:{label:"Look up subject in",help:"Where to find the customer identifier in the request."},subject_field:{label:"Subject field name",placeholder:"e.g., x-customer-id",help:"e.g. x-customer-id, x-api-key, x-tenant"},queue:{max_coalescing_delay:{label:"Max coalescing delay (s)"},initial_retry_delay:{label:"Initial retry delay (s)"},max_retry_delay:{label:"Max retry delay (s)"},max_retry_time:{label:"Max retry time (s)"}},attributes:{title:"Event attributes",description:"Attach custom dimensions to metered events.",look_up_value_in:{placeholder:"e.g., x-priority-id"},event_property_name:{placeholder:"e.g., priority"}},ssl_verify:{label:"Verify TLS certificate",description:"Disable only for local development with self-signed certificates."},timeout:{label:"Request timeout (ms)"},keepalive:{label:"Connection keep-alive (ms)"}}},datakit:{plugin_config:{title:"Flow editor"},description_code:"Configure this plugin by using YAML configuration. If you are copy/pasting in examples from the documentation - paste from below the <code>config</code> block.",description_flow:"Build flows visually with a drag-and-drop editor for Datakit. Visualize node connections, inputs, and outputs as you design.",description_example:"Start with a use case:",detected_config_format:"Detected {format} configuration. Do you want to convert it to Datakit configuration?",detected_config_format_title:"Convert configuration",detected_config_format_confirm:"Convert",examples:{authenticateThirdPartyWithDynamicUrl:"Authenticate Kong to a third-party service resolved at runtime",authenticateThirdParty:"Authenticate Kong to a third-party service",authenticateWithVaultSecret:"Authenticate to a third-party service using Vault secrets",clearHeaders:"Clear request headers",combineTwoApisIntoOneResponse:"Combine multiple API responses",conditionallyStoreCachedItems:"Conditionally fetch or store cache data",convertJsonIntoXml:"Transform JSON into XML",convertJsonToXmlAndBack:"Transform JSON into XML and back",convertXmlIntoJson:"Transform XML into JSON",manipulateRequestHeaders:"Manipulate request headers"},flow_editor:{mode:"Flow editor",name:"Datakit flow editor",cta:"Go to flow editor",disabled_tooltip:"The flow editor is unavailable due to critical configuration errors or features not supported in the flow editor:<br/><code>{reason}</code>",expand_panel:"Expand panel",collapse_panel:"Collapse panel",return_to_config:"Return to plugin configuration",canvas_panel:{request:"Request",response:"Response",node_count_plural:"{count} nodes",node_count_singular:"1 node"},panel_segments:{nodes:"Nodes",resources:{title:"Resources",vault:{title:"Vault secrets",add_button:"Add vault resource",name_exists_error:"Vault name already exists",name_required_error:"Vault name is required",edit:"Edit",delete:"Delete"},cache:{title:"Cache configuration",add_button:"Add cache configuration",strategy_options:{memory:"Memory",redis:"Redis"},select_redis_configuration:"Select a shared Redis configuration",inline_config:"Inline config",inline_config_preview:"You are using a dedicated Redis configuration, This is a preview of your current setup, please edit it in code editor"}}},vault_secret_picker:{title:"Add secret to Datakit",proceed_button_text:"Add secret",secret_name:{label:"Secret name",placeholder:"Enter a name",help:"A unique identifier for this secret in your Datakit configuration"}},node_panel:{title:"Node types",description:"Drag a node onto the canvas to add it to your data flow.",groups:{external_interaction:"External interaction",control_flow:"Control flow",data_transformation:"Data transformation",data_value:"Data value",authentication:"Authentication"}},examples:"Examples",debug:{label:"Debug",description:'Enables detailed error messages in client responses, making debugging easier. <a href="https://developer.konghq.com/plugins/datakit/#debugging" target="_blank">See the docs</a> for details.'},actions:{zoom_in:"Zoom in",zoom_out:"Zoom out",fit_view:"Zoom to fit",auto_layout:"Auto layout",undo:"Undo",redo:"Redo",duplicate:"Duplicate",remove_from_branch:"Remove from branch",delete:"Delete",view_docs:"View docs",done:"Done"},node_types:{call:{summary:"Call a third-party API",description:"Send an HTTP request and retrieve the response."},jq:{summary:"Transform data and cast variables with jq",description:'The <code>jq</code> node executes a jq script for processing JSON. See the official <a href="https://jqlang.org" target="_blank">jq docs</a> for more details.'},exit:{summary:"Return directly to the client",description:"Trigger an early exit that produces a direct response, rather than forwarding a proxied response."},property:{summary:"Get and set Kong Gateway-specific data",description:"Get and set Kong Gateway host and request properties."},static:{summary:"Configure static input values ahead of time",description:"Emits static values to be used as inputs for other nodes. The <code>static</code> node can help you with hardcoding some known value for an input."},branch:{summary:"Execute nodes based on matching input conditions",description:"Execute different nodes based on matching input conditions, such as a cache hit or miss."},cache:{summary:"Store and fetch cached data",description:"Store data into cache and fetch cached data from cache."},xml_to_json:{summary:"Transform XML to JSON",description:"Transform XML to JSON."},json_to_xml:{summary:"Transform JSON to XML",description:"Transform JSON to XML."},jwt_decode:{summary:"Decode JWT headers and claims",description:"Parse a JWT without verifying its signature."},jwt_sign:{summary:"Create and sign JWTs",description:"Generate a signed JWT from configured claims and a signing key."},jwt_verify:{summary:"Verify JWT signature and claims",description:"Verify a JWT signature and validate claims such as exp, nbf, iss, and aud."},request:{name:"request",description:"Reads incoming client request properties. You cannot specify request node input."},response:{name:"response",description:"Updates properties of the outgoing client response."},service_request:{name:"service request",description:"Updates properties of the request sent to the service being proxied to."},service_response:{name:"service response",description:"Reads response properties from the service being proxied to."},vault:{name:"Vault",description:"Vault is a tool for securely accessing secrets."}},node_properties:{name:"Name",configuration:"Configuration",input:{label:"Inputs configuration",placeholder:"Select a source",add_button:"Add an input",or:"or",input:"Input",fields:"Fields",source:"Source",tooltip:"Fields are part of the node input. A source can connect to either the fields or the input, but not both."},input_name:{label:"Input name",placeholder:"Enter an input name"},jq:{label:"jq script",help:"Refer to {link} for full documentation."},output_value:{label:"Output value",value_name:"Value name",value:"Value",add_button:"Add a value"},property:{get:"get",set:"set"},branch:{placeholder:"Select nodes"},jwt:{static_claims:{label:"Static claims",help:"Enter a JSON object. It will be stored as the node's static claims map.",errors:{invalid_json_object:"Static claims must be a valid JSON object"}}},errors:{invalid_identifier_format:"{fieldName} must start with a letter or underscore and contain only letters, numbers, underscores, or hyphens",invalid_url_format:"Not a valid URL format",not_empty:"{fieldName} is required",not_float:"{fieldName} must be a float",not_integer:"{fieldName} must be an integer",not_number:"{fieldName} must be a number",not_unique:"{fieldName} must be unique",number_range:"{fieldName} must be between {min} and {max}",string_len_range:"{fieldName} must be between {minLength} and {maxLength} characters",reserved_node_name:'"{nodeName}" is a reserved node name',attributes_required:"Provide at least one of attributes_block_name or attributes_name_prefix"}},error:{invalid_connection:"Invalid connection",branch_cycle:"Cannot create a circular branch relationship"},confirm:{title:"Connection conflict",message:{confirm:"Are you sure you want to make this change?",switch:"You can connect an output source to either all inputs of a node or to individual inputs.",override:"Each input can connect to only one output, but one output can connect to many inputs.",branch_replace:"This node already belongs to another branch. Move it to the new branch?"},proceed:"Yes, update"},leave_confirm:"Leave current page? Changes you made may not be saved."},code_editor:{mode:"Code editor"}},vault_picker:{component_error:"The vault secret picker is not available"},tag_helper:"Use comma to separate values. eg: value1, value2",foreign_placeholder:"Enter a UUID of {entity}"}},redis:{title:"Redis configuration",managed_ui:{title:"Redis",shared_configuration:{label:"Use shared configuration",description:"Select an existing shared Redis configuration or create a new one. Any updates to this configuration will automatically apply to all associated plugins.",badge:"Recommended"},dedicated_configuration:{label:"Use locally-scoped configuration",description:"Create and use a Redis configuration specifically for this plugin."},selector:{placeholder:"Filter Redis configurations...",create_new:"New Redis"}},shared_configuration:{label:"Shared configuration",description:"Select an existing shared Redis configuration or create a new one. Changes to this configuration automatically apply to all associated plugins.",title:"Shared Redis configuration",error:"Fetching shared Redis configurations failed."},dedicated_configuration:{label:"Dedicated configuration",description:"Create a Redis configuration that is used only by this plugin. Changes won’t affect other plugins."},config_card:{common_fields:{created_at_label:"Created at",updated_at_label:"Last updated at",type_label:"Redis type"}}},glossary:{plugin:"plugin"},custom_field:{key_auth_identity_realms:{cp_label:"Current control plane",cp_group_label:"Control plane",realm_group_label:"Realms (can only select one)"},kong_identity:{title:"Who should manage authentication and credentials?",description_with_realms:"Use Consumers or centrally managed consumers for Consumer-based authentication. Use Kong Identity for principal-based authentication and advanced integrations.",description_without_realms:"Use Consumers for Consumer-based authentication. Use Kong Identity for principal-based authentication and advanced integrations.",learn_more:"Learn more.",incompatible_data_plane_alert:"We detected that one or more data plane nodes are running a version earlier than 3.15. Requests handled by those data plane nodes will use consumers instead of Kong Identity principals.",kong_identity_label:"Kong Identity",kong_identity_description_key_auth:"Use Kong Identity to authenticate API keys and map requests to Kong Identity principals for advanced integrations. Data plane nodes running versions earlier than 3.15 continue using consumers.",kong_identity_description_basic_auth:"Use Kong Identity to authenticate Basic Auth credentials and map requests to Kong Identity principals for advanced integrations. Data plane nodes running versions earlier than 3.15 continue using consumers.",consumers_label:"Consumers",consumers_description_key_auth:"Use consumer-managed API keys. Consumers provide their API key in a request header, query parameter, or request body to authenticate requests.",consumers_description_basic_auth:"Use consumer-managed Basic Auth credentials. Consumers authenticate requests using a username and password.",centrally_managed_label:"Centrally managed consumers",centrally_managed_description:"Authenticate centrally managed consumers in Konnect using identity realms. Identity realms are scoped to the control plane by default.",identity_realms_required:"To use centrally managed consumers, you must select at least one Centrally managed consumer realm.",error_on_miss_label:"If principal lookup fails",error_on_miss_reject_label:"Reject the request",error_on_miss_reject_description:"Treat the request as unauthenticated if Kong Identity cannot resolve the principal.",error_on_miss_continue_label:"Continue without a principal",error_on_miss_continue_description:"Allow the request to continue without resolving a principal.",configure_title:"Configure Kong Identity",configure_description:"Kong Identity uses principals to represent authenticated services or applications. Create your first principal in Kong Identity to start using principal-based authentication. On data plane nodes running versions earlier than 3.15, authentication continues using consumers.",create_principal:"Create principal",configure_learn_more:"Learn more",leave_prompt_title:"Leave this page?",leave_prompt_message:"Your unsaved changes will be lost if you continue.",leave_prompt_action:"Leave page"}},sp:{window_type:{label:"Rate limit window type",help:"Sets the time window type to either <code>sliding</code> (default) or <code>fixed</code>.<br><ul><li>Sliding windows apply the rate limiting logic while taking into account previous hit rates (from the window that immediately precedes the current) using a dynamic weight.</li><li>Fixed windows consist of buckets that are statically assigned to a definitive time range, each request is mapped to only one fixed window based on its timestamp and will affect only that window&#39;s counters.</li></ul>",options:{fixed:"Fixed",sliding:"Sliding"}},request_limits:{title:"Request limits",subtitle:"Set one or more limits on the number of API requests allowed within a defined timeframe.",label:"Limit",label_index:"Limit {index}",request_number:"Request number",time_interval:"Time interval",interval_determiner:"Every",seconds:"Seconds"},error_message:{label:"Error message",code_placeholder:"Code message",message_placeholder:"Error message",help:"Set a custom error code and message to be returned when the rate limit is exceeded."},start_with_a_use_case:"Start with a use case:",use_cases:{fixed:{hourly_500:{label:"500 requests every hour",description:"A fixed limit of 500 requests per hour resetting sharply on the hour, ensuring no user can exceed this limit."},half_hourly_200:{label:"200 requests every 30 minutes",description:"Users are allowed 200 requests per 30 minutes, resetting exactly on the 30 minute mark with no carryover of unused limits."},daily_500:{label:"500 requests every day",description:"A strict limit of 5000 requests per day resetting promptly at midnight, preventing any burst traffic or inconsistent user experiences."}},sliding:{hourly_100:{label:"100 requests every hour",description:"Maximum of 100 requests every rolling hour, continuously adjusting the count over the course of the hour. No hard limit or known reset."},half_hourly_300:{label:"300 requests every 30 minutes",description:"Each user can make up to 300 requests in any rolling 30 minute period, with older requests dropping off as new requests are made."},hourly_500:{label:"500 requests every hour",description:`Each user is allowed 500 requests per hour.
2
2
  If the limit is exceeded and the user receives a 429 error, each additional request within the sliding window (hour)
3
- will extend the wait time by about 12 minutes, continuously adjusting as new requests are made.`}}}},custom_plugin_form:{step1:{title:"Custom plugin type",types:{installed:{label:"Installed custom plugin",description:"Install and manage plugins with full control over deployment and runtime. Requires restarting data planes."},streamed:{label:"Streamed custom plugin",description:"Deploy and update plugins on running data planes without requiring gateway access."},cloned:{label:"Cloned plugin",description:"Duplicate an existing plugin to run multiple instances within a single request."}},compare_trigger:"Compare deployment options",compare_table:{columns:{installed:"Installed custom plugin",streamed:"Streamed custom plugin",cloned:"Cloned plugin"},rows:{main_use_case:{header:"Main use case",installed:"Extend Kong functionality with custom plugins and control who can modify and roll out changes.",streamed:"Extend Kong functionality with plugins without requiring sysadmin access to data plane instances.",cloned:"Modify an existing plugin to run multiple instances with different names or priorities."},file_supplied:{header:"File supplied",installed:{handler:"handler.lua",schema:"schema.lua",additional:"Any additional files or libraries needed"},streamed:{handler:"handler.lua",schema:"schema.lua"}},how_installed:{header:"How it's installed",installed:"Install directly on the data plane",streamed:"Through gateway configuration changes",cloned:"Through gateway configuration changes"},sandboxing:{header:"Sandboxing",streamed:"Follows the standard sandboxing settings. {link}",streamed_link:"Link to docs",cloned:"Inherit the same sandboxing as the original plugins"},data_plane_reload:{header:"Data plane reload"}}}},step2_files:{title:"Custom plugin files",schema_file:{label:"Upload schema file",placeholder:"No file selected",placeholder_edit:"File not changed",button_text:"Select File",help:"Only Lua based schemas are supported by Konnect. Other plugin modules can be in any language as desired. Learn more"},handler_file:{label:"Upload handler file",placeholder:"No file selected",placeholder_edit:"File not changed",button_text:"Select File",help:"Upload plugin handler to the data plane."},plugin_modules:{label:"Plugin modules",alert:"Upload all plugin modules to the data plane: schema.lua, handler.lua"}},step2_clone:{title:"Clone plugin",select_plugin:{label:"Select a plugin",placeholder:"Type to search"}},step3:{title:"General information",description:"Enter a custom name for this custom plugin",name:{label:"Name",placeholder:"Enter a unique name",help:"The name must be identical to the name of the plugin in the schema file."},alias_name:{label:"Alias name",placeholder:"Enter a unique name",help:"Format: ^[a-z][a-z0-9-]*[a-z0-9]$. The name must be unique enough to avoid future conflicts with bundled plugins."},priority:{label:"Priority",tooltip:"Set the execution priority for this cloned plugin",help:{text:"Optional. Use a number to set the absolute execution priority. If priority isn't set, plugins run in alphabetical order. {link} in the docs.",link:"Learn more"}}},errors:{file_read_error:"Failed to read file content. Please try again.",file_too_large:"File size exceeds the maximum limit of 1 MB.",plugin_not_found:"The selected plugin could not be found. Please refresh the list and try again.",no_supported_types:"No supported custom plugin types are available in this context.",unsupported_plugin_type:"Unsupported plugin type {type}."}}};function Qe(){const n=jt.createI18n("en-us",Jt);return{i18n:n,i18nT:jt.i18nTComponent(n)}}const k1=["undo","redo","duplicate","cut","copy","paste"],zg=()=>{};function C1(n){const t=n;return t?!!t.closest('input, textarea, [contenteditable]:not([contenteditable="false"])'):!1}function E1(n){if(!(n.metaKey||n.ctrlKey))return;switch(n.key.toLowerCase()){case"z":return n.shiftKey?"redo":"undo";case"y":return"redo";case"d":return"duplicate";case"x":return"cut";case"c":return"copy";case"v":return"paste"}}const N1=Pt.createSharedComposable(()=>{const n=new Set;Pt.useEventListener("keydown",r=>{if(C1(r.target))return;const o=E1(r);if(o)for(const i of n){if(!e.toValue(i.enabled))continue;const a=i[o];if(a){if(r.defaultPrevented){e.warn(`[useHotkeys] event for "${o}" was already defaultPrevented. Hotkey ignored.`);return}r.preventDefault(),a();return}}},{passive:!1});function t(r){if(!k1.some(i=>typeof r[i]=="function"))return zg;const o={enabled:r.enabled??!0,...r};return n.add(o),()=>n.delete(o)}return{subscribe:t}});function Wg(n={}){if(typeof window>"u")return zg;const t=N1().subscribe(n);return e.onScopeDispose(t),t}const S1="#ecfcff",x1="#f1f0ff",A1="#52596e",v1="#e0e4ea",I1="#007d60",B1="#fffce0",T1="#6c7489",O1="#0044f4",P1="#5f9aff",hd="#000933",Yg="#d60027",V1="#00abd2",Jg="#6f28ff",Xg="#afb7c5",cr="#6c7489",$1="#0044f4",R1="#eefaff",Zg="#007d60",L1="#ecfffb",D1="#995c00",M1="#306fff",dl="12px",Yn="16px",_a="20px",yd="24px",j1="2px",Qg="8px",F1="32px",eh=44,U1=220,th=366,K1=1e3,q1=eh+parseFloat(Qg),fl=1,G1=0,H1=1,z1=2,W1=3,Qo=parseInt(F1,10),ba="application/x-datakit+json",pl={delete:["Delete"],undo:["Mod","Z"],redo:{mac:["Mod","Shift","Z"],windows:["Mod","Y"],linux:["Mod","Shift","Z"]},copy:["Mod","C"],paste:["Mod","V"],duplicate:["Mod","D"]},Jr={padding:80,gaps:{nodes:60,edges:80,ranks:60}},Y1=1600,J1=1.2,X1=0,Z1=200,nh=Symbol("confirm-modal");var rh=typeof global=="object"&&global&&global.Object===Object&&global,Q1=typeof self=="object"&&self&&self.Object===Object&&self,ur=rh||Q1||Function("return this")(),Vn=ur.Symbol,oh=Object.prototype,eE=oh.hasOwnProperty,tE=oh.toString,wa=Vn?Vn.toStringTag:void 0;function nE(n){var t=eE.call(n,wa),r=n[wa];try{n[wa]=void 0;var o=!0}catch{}var i=tE.call(n);return o&&(t?n[wa]=r:delete n[wa]),i}var rE=Object.prototype,oE=rE.toString;function iE(n){return oE.call(n)}var aE="[object Null]",sE="[object Undefined]",ih=Vn?Vn.toStringTag:void 0;function po(n){return n==null?n===void 0?sE:aE:ih&&ih in Object(n)?nE(n):iE(n)}function dr(n){return n!=null&&typeof n=="object"}var lE="[object Symbol]";function _d(n){return typeof n=="symbol"||dr(n)&&po(n)==lE}function bd(n,t){for(var r=-1,o=n==null?0:n.length,i=Array(o);++r<o;)i[r]=t(n[r],r,n);return i}var Jn=Array.isArray,ah=Vn?Vn.prototype:void 0,sh=ah?ah.toString:void 0;function lh(n){if(typeof n=="string")return n;if(Jn(n))return bd(n,lh)+"";if(_d(n))return sh?sh.call(n):"";var t=n+"";return t=="0"&&1/n==-1/0?"-0":t}function mo(n){var t=typeof n;return n!=null&&(t=="object"||t=="function")}function ch(n){return n}var cE="[object AsyncFunction]",uE="[object Function]",dE="[object GeneratorFunction]",fE="[object Proxy]";function ml(n){if(!mo(n))return!1;var t=po(n);return t==uE||t==dE||t==cE||t==fE}var wd=ur["__core-js_shared__"],uh=function(){var n=/[^.]+$/.exec(wd&&wd.keys&&wd.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function pE(n){return!!uh&&uh in n}var mE=Function.prototype,gE=mE.toString;function go(n){if(n!=null){try{return gE.call(n)}catch{}try{return n+""}catch{}}return""}var hE=/[\\^$.*+?()[\]{}|]/g,yE=/^\[object .+?Constructor\]$/,_E=Function.prototype,bE=Object.prototype,wE=_E.toString,kE=bE.hasOwnProperty,CE=RegExp("^"+wE.call(kE).replace(hE,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function EE(n){if(!mo(n)||pE(n))return!1;var t=ml(n)?CE:yE;return t.test(go(n))}function NE(n,t){return n==null?void 0:n[t]}function ho(n,t){var r=NE(n,t);return EE(r)?r:void 0}var kd=ho(ur,"WeakMap"),dh=Object.create,SE=function(){function n(){}return function(t){if(!mo(t))return{};if(dh)return dh(t);n.prototype=t;var r=new n;return n.prototype=void 0,r}}();function xE(n,t,r){switch(r.length){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function AE(n,t){var r=-1,o=n.length;for(t||(t=Array(o));++r<o;)t[r]=n[r];return t}var vE=800,IE=16,BE=Date.now;function TE(n){var t=0,r=0;return function(){var o=BE(),i=IE-(o-r);if(r=o,i>0){if(++t>=vE)return arguments[0]}else t=0;return n.apply(void 0,arguments)}}function OE(n){return function(){return n}}var gl=function(){try{var n=ho(Object,"defineProperty");return n({},"",{}),n}catch{}}(),PE=gl?function(n,t){return gl(n,"toString",{configurable:!0,enumerable:!1,value:OE(t),writable:!0})}:ch,fh=TE(PE);function VE(n,t){for(var r=-1,o=n==null?0:n.length;++r<o&&t(n[r],r,n)!==!1;);return n}function $E(n,t,r,o){for(var i=n.length,a=r+-1;++a<i;)if(t(n[a],a,n))return a;return-1}function RE(n){return n!==n}function LE(n,t,r){for(var o=r-1,i=n.length;++o<i;)if(n[o]===t)return o;return-1}function DE(n,t,r){return t===t?LE(n,t,r):$E(n,RE,r)}function ME(n,t){var r=n==null?0:n.length;return!!r&&DE(n,t,0)>-1}var jE=9007199254740991,FE=/^(?:0|[1-9]\d*)$/;function Cd(n,t){var r=typeof n;return t=t??jE,!!t&&(r=="number"||r!="symbol"&&FE.test(n))&&n>-1&&n%1==0&&n<t}function ph(n,t,r){t=="__proto__"&&gl?gl(n,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):n[t]=r}function Ed(n,t){return n===t||n!==n&&t!==t}var UE=Object.prototype,KE=UE.hasOwnProperty;function Nd(n,t,r){var o=n[t];(!(KE.call(n,t)&&Ed(o,r))||r===void 0&&!(t in n))&&ph(n,t,r)}function ka(n,t,r,o){var i=!r;r||(r={});for(var a=-1,s=t.length;++a<s;){var c=t[a],l=void 0;l===void 0&&(l=n[c]),i?ph(r,c,l):Nd(r,c,l)}return r}var mh=Math.max;function gh(n,t,r){return t=mh(t===void 0?n.length-1:t,0),function(){for(var o=arguments,i=-1,a=mh(o.length-t,0),s=Array(a);++i<a;)s[i]=o[t+i];i=-1;for(var c=Array(t+1);++i<t;)c[i]=o[i];return c[t]=r(s),xE(n,this,c)}}function qE(n,t){return fh(gh(n,t,ch),n+"")}var GE=9007199254740991;function Sd(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=GE}function hl(n){return n!=null&&Sd(n.length)&&!ml(n)}var HE=Object.prototype;function yl(n){var t=n&&n.constructor,r=typeof t=="function"&&t.prototype||HE;return n===r}function zE(n,t){for(var r=-1,o=Array(n);++r<n;)o[r]=t(r);return o}var WE="[object Arguments]";function hh(n){return dr(n)&&po(n)==WE}var yh=Object.prototype,YE=yh.hasOwnProperty,JE=yh.propertyIsEnumerable,_l=hh(function(){return arguments}())?hh:function(n){return dr(n)&&YE.call(n,"callee")&&!JE.call(n,"callee")};function XE(){return!1}var _h=typeof ve=="object"&&ve&&!ve.nodeType&&ve,bh=_h&&typeof module=="object"&&module&&!module.nodeType&&module,ZE=bh&&bh.exports===_h,wh=ZE?ur.Buffer:void 0,QE=wh?wh.isBuffer:void 0,Ca=QE||XE,eN="[object Arguments]",tN="[object Array]",nN="[object Boolean]",rN="[object Date]",oN="[object Error]",iN="[object Function]",aN="[object Map]",sN="[object Number]",lN="[object Object]",cN="[object RegExp]",uN="[object Set]",dN="[object String]",fN="[object WeakMap]",pN="[object ArrayBuffer]",mN="[object DataView]",gN="[object Float32Array]",hN="[object Float64Array]",yN="[object Int8Array]",_N="[object Int16Array]",bN="[object Int32Array]",wN="[object Uint8Array]",kN="[object Uint8ClampedArray]",CN="[object Uint16Array]",EN="[object Uint32Array]",Bt={};Bt[gN]=Bt[hN]=Bt[yN]=Bt[_N]=Bt[bN]=Bt[wN]=Bt[kN]=Bt[CN]=Bt[EN]=!0,Bt[eN]=Bt[tN]=Bt[pN]=Bt[nN]=Bt[mN]=Bt[rN]=Bt[oN]=Bt[iN]=Bt[aN]=Bt[sN]=Bt[lN]=Bt[cN]=Bt[uN]=Bt[dN]=Bt[fN]=!1;function NN(n){return dr(n)&&Sd(n.length)&&!!Bt[po(n)]}function xd(n){return function(t){return n(t)}}var kh=typeof ve=="object"&&ve&&!ve.nodeType&&ve,Ea=kh&&typeof module=="object"&&module&&!module.nodeType&&module,SN=Ea&&Ea.exports===kh,Ad=SN&&rh.process,ei=function(){try{var n=Ea&&Ea.require&&Ea.require("util").types;return n||Ad&&Ad.binding&&Ad.binding("util")}catch{}}(),Ch=ei&&ei.isTypedArray,vd=Ch?xd(Ch):NN,xN=Object.prototype,AN=xN.hasOwnProperty;function Eh(n,t){var r=Jn(n),o=!r&&_l(n),i=!r&&!o&&Ca(n),a=!r&&!o&&!i&&vd(n),s=r||o||i||a,c=s?zE(n.length,String):[],l=c.length;for(var u in n)(t||AN.call(n,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Cd(u,l)))&&c.push(u);return c}function Nh(n,t){return function(r){return n(t(r))}}var vN=Nh(Object.keys,Object),IN=Object.prototype,BN=IN.hasOwnProperty;function Sh(n){if(!yl(n))return vN(n);var t=[];for(var r in Object(n))BN.call(n,r)&&r!="constructor"&&t.push(r);return t}function Id(n){return hl(n)?Eh(n):Sh(n)}function TN(n){var t=[];if(n!=null)for(var r in Object(n))t.push(r);return t}var ON=Object.prototype,PN=ON.hasOwnProperty;function VN(n){if(!mo(n))return TN(n);var t=yl(n),r=[];for(var o in n)o=="constructor"&&(t||!PN.call(n,o))||r.push(o);return r}function Bd(n){return hl(n)?Eh(n,!0):VN(n)}var $N=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,RN=/^\w*$/;function LN(n,t){if(Jn(n))return!1;var r=typeof n;return r=="number"||r=="symbol"||r=="boolean"||n==null||_d(n)?!0:RN.test(n)||!$N.test(n)||t!=null&&n in Object(t)}var Na=ho(Object,"create");function DN(){this.__data__=Na?Na(null):{},this.size=0}function MN(n){var t=this.has(n)&&delete this.__data__[n];return this.size-=t?1:0,t}var jN="__lodash_hash_undefined__",FN=Object.prototype,UN=FN.hasOwnProperty;function KN(n){var t=this.__data__;if(Na){var r=t[n];return r===jN?void 0:r}return UN.call(t,n)?t[n]:void 0}var qN=Object.prototype,GN=qN.hasOwnProperty;function HN(n){var t=this.__data__;return Na?t[n]!==void 0:GN.call(t,n)}var zN="__lodash_hash_undefined__";function WN(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=Na&&t===void 0?zN:t,this}function yo(n){var t=-1,r=n==null?0:n.length;for(this.clear();++t<r;){var o=n[t];this.set(o[0],o[1])}}yo.prototype.clear=DN,yo.prototype.delete=MN,yo.prototype.get=KN,yo.prototype.has=HN,yo.prototype.set=WN;function YN(){this.__data__=[],this.size=0}function bl(n,t){for(var r=n.length;r--;)if(Ed(n[r][0],t))return r;return-1}var JN=Array.prototype,XN=JN.splice;function ZN(n){var t=this.__data__,r=bl(t,n);if(r<0)return!1;var o=t.length-1;return r==o?t.pop():XN.call(t,r,1),--this.size,!0}function QN(n){var t=this.__data__,r=bl(t,n);return r<0?void 0:t[r][1]}function eS(n){return bl(this.__data__,n)>-1}function tS(n,t){var r=this.__data__,o=bl(r,n);return o<0?(++this.size,r.push([n,t])):r[o][1]=t,this}function vr(n){var t=-1,r=n==null?0:n.length;for(this.clear();++t<r;){var o=n[t];this.set(o[0],o[1])}}vr.prototype.clear=YN,vr.prototype.delete=ZN,vr.prototype.get=QN,vr.prototype.has=eS,vr.prototype.set=tS;var Sa=ho(ur,"Map");function nS(){this.size=0,this.__data__={hash:new yo,map:new(Sa||vr),string:new yo}}function rS(n){var t=typeof n;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?n!=="__proto__":n===null}function wl(n,t){var r=n.__data__;return rS(t)?r[typeof t=="string"?"string":"hash"]:r.map}function oS(n){var t=wl(this,n).delete(n);return this.size-=t?1:0,t}function iS(n){return wl(this,n).get(n)}function aS(n){return wl(this,n).has(n)}function sS(n,t){var r=wl(this,n),o=r.size;return r.set(n,t),this.size+=r.size==o?0:1,this}function Ir(n){var t=-1,r=n==null?0:n.length;for(this.clear();++t<r;){var o=n[t];this.set(o[0],o[1])}}Ir.prototype.clear=nS,Ir.prototype.delete=oS,Ir.prototype.get=iS,Ir.prototype.has=aS,Ir.prototype.set=sS;var lS="Expected a function";function Td(n,t){if(typeof n!="function"||t!=null&&typeof t!="function")throw new TypeError(lS);var r=function(){var o=arguments,i=t?t.apply(this,o):o[0],a=r.cache;if(a.has(i))return a.get(i);var s=n.apply(this,o);return r.cache=a.set(i,s)||a,s};return r.cache=new(Td.Cache||Ir),r}Td.Cache=Ir;var cS=500;function uS(n){var t=Td(n,function(o){return r.size===cS&&r.clear(),o}),r=t.cache;return t}var dS=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,fS=/\\(\\)?/g,pS=uS(function(n){var t=[];return n.charCodeAt(0)===46&&t.push(""),n.replace(dS,function(r,o,i,a){t.push(i?a.replace(fS,"$1"):o||r)}),t});function _o(n){return n==null?"":lh(n)}function ti(n,t){return Jn(n)?n:LN(n,t)?[n]:pS(_o(n))}function xa(n){if(typeof n=="string"||_d(n))return n;var t=n+"";return t=="0"&&1/n==-1/0?"-0":t}function Od(n,t){t=ti(t,n);for(var r=0,o=t.length;n!=null&&r<o;)n=n[xa(t[r++])];return r&&r==o?n:void 0}function Aa(n,t,r){var o=n==null?void 0:Od(n,t);return o===void 0?r:o}function Pd(n,t){for(var r=-1,o=t.length,i=n.length;++r<o;)n[i+r]=t[r];return n}var xh=Vn?Vn.isConcatSpreadable:void 0;function mS(n){return Jn(n)||_l(n)||!!(xh&&n&&n[xh])}function gS(n,t,r,o,i){var a=-1,s=n.length;for(r||(r=mS),i||(i=[]);++a<s;){var c=n[a];r(c)?Pd(i,c):i[i.length]=c}return i}function hS(n){var t=n==null?0:n.length;return t?gS(n):[]}function Ah(n){return fh(gh(n,void 0,hS),n+"")}var Vd=Nh(Object.getPrototypeOf,Object),yS="[object Object]",_S=Function.prototype,bS=Object.prototype,vh=_S.toString,wS=bS.hasOwnProperty,kS=vh.call(Object);function CS(n){if(!dr(n)||po(n)!=yS)return!1;var t=Vd(n);if(t===null)return!0;var r=wS.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&vh.call(r)==kS}function Ih(n,t,r){var o=-1,i=n.length;t<0&&(t=-t>i?0:i+t),r=r>i?i:r,r<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(i);++o<i;)a[o]=n[o+t];return a}function ES(n,t,r){var o=n.length;return r=r===void 0?o:r,!t&&r>=o?n:Ih(n,t,r)}var NS="\\ud800-\\udfff",SS="\\u0300-\\u036f",xS="\\ufe20-\\ufe2f",AS="\\u20d0-\\u20ff",vS=SS+xS+AS,IS="\\ufe0e\\ufe0f",BS="\\u200d",TS=RegExp("["+BS+NS+vS+IS+"]");function Bh(n){return TS.test(n)}function OS(n){return n.split("")}var Th="\\ud800-\\udfff",PS="\\u0300-\\u036f",VS="\\ufe20-\\ufe2f",$S="\\u20d0-\\u20ff",RS=PS+VS+$S,LS="\\ufe0e\\ufe0f",DS="["+Th+"]",$d="["+RS+"]",Rd="\\ud83c[\\udffb-\\udfff]",MS="(?:"+$d+"|"+Rd+")",Oh="[^"+Th+"]",Ph="(?:\\ud83c[\\udde6-\\uddff]){2}",Vh="[\\ud800-\\udbff][\\udc00-\\udfff]",jS="\\u200d",$h=MS+"?",Rh="["+LS+"]?",FS="(?:"+jS+"(?:"+[Oh,Ph,Vh].join("|")+")"+Rh+$h+")*",US=Rh+$h+FS,KS="(?:"+[Oh+$d+"?",$d,Ph,Vh,DS].join("|")+")",qS=RegExp(Rd+"(?="+Rd+")|"+KS+US,"g");function GS(n){return n.match(qS)||[]}function HS(n){return Bh(n)?GS(n):OS(n)}function zS(n){return function(t){t=_o(t);var r=Bh(t)?HS(t):void 0,o=r?r[0]:t.charAt(0),i=r?ES(r,1).join(""):t.slice(1);return o[n]()+i}}var Lh=zS("toUpperCase");function WS(n){return Lh(_o(n).toLowerCase())}function YS(n,t,r,o){for(var i=-1,a=n==null?0:n.length;++i<a;)r=t(r,n[i],i,n);return r}function Dh(n){return function(t){return n==null?void 0:n[t]}}var JS={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},XS=Dh(JS),ZS=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,QS="\\u0300-\\u036f",ex="\\ufe20-\\ufe2f",tx="\\u20d0-\\u20ff",nx=QS+ex+tx,rx="["+nx+"]",ox=RegExp(rx,"g");function ix(n){return n=_o(n),n&&n.replace(ZS,XS).replace(ox,"")}var ax=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function sx(n){return n.match(ax)||[]}var lx=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function cx(n){return lx.test(n)}var Mh="\\ud800-\\udfff",ux="\\u0300-\\u036f",dx="\\ufe20-\\ufe2f",fx="\\u20d0-\\u20ff",px=ux+dx+fx,jh="\\u2700-\\u27bf",Fh="a-z\\xdf-\\xf6\\xf8-\\xff",mx="\\xac\\xb1\\xd7\\xf7",gx="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",hx="\\u2000-\\u206f",yx=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Uh="A-Z\\xc0-\\xd6\\xd8-\\xde",_x="\\ufe0e\\ufe0f",Kh=mx+gx+hx+yx,qh="['’]",Gh="["+Kh+"]",bx="["+px+"]",Hh="\\d+",wx="["+jh+"]",zh="["+Fh+"]",Wh="[^"+Mh+Kh+Hh+jh+Fh+Uh+"]",kx="\\ud83c[\\udffb-\\udfff]",Cx="(?:"+bx+"|"+kx+")",Ex="[^"+Mh+"]",Yh="(?:\\ud83c[\\udde6-\\uddff]){2}",Jh="[\\ud800-\\udbff][\\udc00-\\udfff]",ni="["+Uh+"]",Nx="\\u200d",Xh="(?:"+zh+"|"+Wh+")",Sx="(?:"+ni+"|"+Wh+")",Zh="(?:"+qh+"(?:d|ll|m|re|s|t|ve))?",Qh="(?:"+qh+"(?:D|LL|M|RE|S|T|VE))?",ey=Cx+"?",ty="["+_x+"]?",xx="(?:"+Nx+"(?:"+[Ex,Yh,Jh].join("|")+")"+ty+ey+")*",Ax="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",vx="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ix=ty+ey+xx,Bx="(?:"+[wx,Yh,Jh].join("|")+")"+Ix,Tx=RegExp([ni+"?"+zh+"+"+Zh+"(?="+[Gh,ni,"$"].join("|")+")",Sx+"+"+Qh+"(?="+[Gh,ni+Xh,"$"].join("|")+")",ni+"?"+Xh+"+"+Zh,ni+"+"+Qh,vx,Ax,Hh,Bx].join("|"),"g");function Ox(n){return n.match(Tx)||[]}function Px(n,t,r){return n=_o(n),t=t,t===void 0?cx(n)?Ox(n):sx(n):n.match(t)||[]}var Vx="['’]",$x=RegExp(Vx,"g");function Rx(n){return function(t){return YS(Px(ix(t).replace($x,"")),n,"")}}var Lx=Rx(function(n,t,r){return t=t.toLowerCase(),n+(r?WS(t):t)});function Dx(){this.__data__=new vr,this.size=0}function Mx(n){var t=this.__data__,r=t.delete(n);return this.size=t.size,r}function jx(n){return this.__data__.get(n)}function Fx(n){return this.__data__.has(n)}var Ux=200;function Kx(n,t){var r=this.__data__;if(r instanceof vr){var o=r.__data__;if(!Sa||o.length<Ux-1)return o.push([n,t]),this.size=++r.size,this;r=this.__data__=new Ir(o)}return r.set(n,t),this.size=r.size,this}function Br(n){var t=this.__data__=new vr(n);this.size=t.size}Br.prototype.clear=Dx,Br.prototype.delete=Mx,Br.prototype.get=jx,Br.prototype.has=Fx,Br.prototype.set=Kx;function qx(n,t){return n&&ka(t,Id(t),n)}function Gx(n,t){return n&&ka(t,Bd(t),n)}var ny=typeof ve=="object"&&ve&&!ve.nodeType&&ve,ry=ny&&typeof module=="object"&&module&&!module.nodeType&&module,Hx=ry&&ry.exports===ny,oy=Hx?ur.Buffer:void 0,iy=oy?oy.allocUnsafe:void 0;function zx(n,t){if(t)return n.slice();var r=n.length,o=iy?iy(r):new n.constructor(r);return n.copy(o),o}function Wx(n,t){for(var r=-1,o=n==null?0:n.length,i=0,a=[];++r<o;){var s=n[r];t(s,r,n)&&(a[i++]=s)}return a}function ay(){return[]}var Yx=Object.prototype,Jx=Yx.propertyIsEnumerable,sy=Object.getOwnPropertySymbols,Ld=sy?function(n){return n==null?[]:(n=Object(n),Wx(sy(n),function(t){return Jx.call(n,t)}))}:ay;function Xx(n,t){return ka(n,Ld(n),t)}var Zx=Object.getOwnPropertySymbols,ly=Zx?function(n){for(var t=[];n;)Pd(t,Ld(n)),n=Vd(n);return t}:ay;function Qx(n,t){return ka(n,ly(n),t)}function cy(n,t,r){var o=t(n);return Jn(n)?o:Pd(o,r(n))}function Dd(n){return cy(n,Id,Ld)}function uy(n){return cy(n,Bd,ly)}var Md=ho(ur,"DataView"),jd=ho(ur,"Promise"),Fd=ho(ur,"Set"),dy="[object Map]",eA="[object Object]",fy="[object Promise]",py="[object Set]",my="[object WeakMap]",gy="[object DataView]",tA=go(Md),nA=go(Sa),rA=go(jd),oA=go(Fd),iA=go(kd),$n=po;(Md&&$n(new Md(new ArrayBuffer(1)))!=gy||Sa&&$n(new Sa)!=dy||jd&&$n(jd.resolve())!=fy||Fd&&$n(new Fd)!=py||kd&&$n(new kd)!=my)&&($n=function(n){var t=po(n),r=t==eA?n.constructor:void 0,o=r?go(r):"";if(o)switch(o){case tA:return gy;case nA:return dy;case rA:return fy;case oA:return py;case iA:return my}return t});var aA=Object.prototype,sA=aA.hasOwnProperty;function lA(n){var t=n.length,r=new n.constructor(t);return t&&typeof n[0]=="string"&&sA.call(n,"index")&&(r.index=n.index,r.input=n.input),r}var kl=ur.Uint8Array;function Ud(n){var t=new n.constructor(n.byteLength);return new kl(t).set(new kl(n)),t}function cA(n,t){var r=t?Ud(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.byteLength)}var uA=/\w*$/;function dA(n){var t=new n.constructor(n.source,uA.exec(n));return t.lastIndex=n.lastIndex,t}var hy=Vn?Vn.prototype:void 0,yy=hy?hy.valueOf:void 0;function fA(n){return yy?Object(yy.call(n)):{}}function pA(n,t){var r=t?Ud(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.length)}var mA="[object Boolean]",gA="[object Date]",hA="[object Map]",yA="[object Number]",_A="[object RegExp]",bA="[object Set]",wA="[object String]",kA="[object Symbol]",CA="[object ArrayBuffer]",EA="[object DataView]",NA="[object Float32Array]",SA="[object Float64Array]",xA="[object Int8Array]",AA="[object Int16Array]",vA="[object Int32Array]",IA="[object Uint8Array]",BA="[object Uint8ClampedArray]",TA="[object Uint16Array]",OA="[object Uint32Array]";function PA(n,t,r){var o=n.constructor;switch(t){case CA:return Ud(n);case mA:case gA:return new o(+n);case EA:return cA(n,r);case NA:case SA:case xA:case AA:case vA:case IA:case BA:case TA:case OA:return pA(n,r);case hA:return new o;case yA:case wA:return new o(n);case _A:return dA(n);case bA:return new o;case kA:return fA(n)}}function VA(n){return typeof n.constructor=="function"&&!yl(n)?SE(Vd(n)):{}}var $A="[object Map]";function RA(n){return dr(n)&&$n(n)==$A}var _y=ei&&ei.isMap,LA=_y?xd(_y):RA,DA="[object Set]";function MA(n){return dr(n)&&$n(n)==DA}var by=ei&&ei.isSet,jA=by?xd(by):MA,FA=1,UA=2,KA=4,wy="[object Arguments]",qA="[object Array]",GA="[object Boolean]",HA="[object Date]",zA="[object Error]",ky="[object Function]",WA="[object GeneratorFunction]",YA="[object Map]",JA="[object Number]",Cy="[object Object]",XA="[object RegExp]",ZA="[object Set]",QA="[object String]",ev="[object Symbol]",tv="[object WeakMap]",nv="[object ArrayBuffer]",rv="[object DataView]",ov="[object Float32Array]",iv="[object Float64Array]",av="[object Int8Array]",sv="[object Int16Array]",lv="[object Int32Array]",cv="[object Uint8Array]",uv="[object Uint8ClampedArray]",dv="[object Uint16Array]",fv="[object Uint32Array]",At={};At[wy]=At[qA]=At[nv]=At[rv]=At[GA]=At[HA]=At[ov]=At[iv]=At[av]=At[sv]=At[lv]=At[YA]=At[JA]=At[Cy]=At[XA]=At[ZA]=At[QA]=At[ev]=At[cv]=At[uv]=At[dv]=At[fv]=!0,At[zA]=At[ky]=At[tv]=!1;function va(n,t,r,o,i,a){var s,c=t&FA,l=t&UA,u=t&KA;if(r&&(s=i?r(n,o,i,a):r(n)),s!==void 0)return s;if(!mo(n))return n;var p=Jn(n);if(p){if(s=lA(n),!c)return AE(n,s)}else{var d=$n(n),f=d==ky||d==WA;if(Ca(n))return zx(n,c);if(d==Cy||d==wy||f&&!i){if(s=l||f?{}:VA(n),!c)return l?Qx(n,Gx(s,n)):Xx(n,qx(s,n))}else{if(!At[d])return i?n:{};s=PA(n,d,c)}}a||(a=new Br);var m=a.get(n);if(m)return m;a.set(n,s),jA(n)?n.forEach(function(b){s.add(va(b,t,r,b,n,a))}):LA(n)&&n.forEach(function(b,_){s.set(_,va(b,t,r,_,n,a))});var h=u?l?uy:Dd:l?Bd:Id,y=p?void 0:h(n);return VE(y||n,function(b,_){y&&(_=b,b=n[_]),Nd(s,_,va(b,t,r,_,n,a))}),s}var pv=1,mv=4;function Ia(n){return va(n,pv|mv)}var gv="__lodash_hash_undefined__";function hv(n){return this.__data__.set(n,gv),this}function yv(n){return this.__data__.has(n)}function Ba(n){var t=-1,r=n==null?0:n.length;for(this.__data__=new Ir;++t<r;)this.add(n[t])}Ba.prototype.add=Ba.prototype.push=hv,Ba.prototype.has=yv;function _v(n,t){for(var r=-1,o=n==null?0:n.length;++r<o;)if(t(n[r],r,n))return!0;return!1}function Kd(n,t){return n.has(t)}var bv=1,wv=2;function Ey(n,t,r,o,i,a){var s=r&bv,c=n.length,l=t.length;if(c!=l&&!(s&&l>c))return!1;var u=a.get(n),p=a.get(t);if(u&&p)return u==t&&p==n;var d=-1,f=!0,m=r&wv?new Ba:void 0;for(a.set(n,t),a.set(t,n);++d<c;){var h=n[d],y=t[d];if(o)var b=s?o(y,h,d,t,n,a):o(h,y,d,n,t,a);if(b!==void 0){if(b)continue;f=!1;break}if(m){if(!_v(t,function(_,k){if(!Kd(m,k)&&(h===_||i(h,_,r,o,a)))return m.push(k)})){f=!1;break}}else if(!(h===y||i(h,y,r,o,a))){f=!1;break}}return a.delete(n),a.delete(t),f}function kv(n){var t=-1,r=Array(n.size);return n.forEach(function(o,i){r[++t]=[i,o]}),r}function Cv(n){var t=-1,r=Array(n.size);return n.forEach(function(o){r[++t]=o}),r}var Ev=1,Nv=2,Sv="[object Boolean]",xv="[object Date]",Av="[object Error]",vv="[object Map]",Iv="[object Number]",Bv="[object RegExp]",Tv="[object Set]",Ov="[object String]",Pv="[object Symbol]",Vv="[object ArrayBuffer]",$v="[object DataView]",Ny=Vn?Vn.prototype:void 0,qd=Ny?Ny.valueOf:void 0;function Rv(n,t,r,o,i,a,s){switch(r){case $v:if(n.byteLength!=t.byteLength||n.byteOffset!=t.byteOffset)return!1;n=n.buffer,t=t.buffer;case Vv:return!(n.byteLength!=t.byteLength||!a(new kl(n),new kl(t)));case Sv:case xv:case Iv:return Ed(+n,+t);case Av:return n.name==t.name&&n.message==t.message;case Bv:case Ov:return n==t+"";case vv:var c=kv;case Tv:var l=o&Ev;if(c||(c=Cv),n.size!=t.size&&!l)return!1;var u=s.get(n);if(u)return u==t;o|=Nv,s.set(n,t);var p=Ey(c(n),c(t),o,i,a,s);return s.delete(n),p;case Pv:if(qd)return qd.call(n)==qd.call(t)}return!1}var Lv=1,Dv=Object.prototype,Mv=Dv.hasOwnProperty;function jv(n,t,r,o,i,a){var s=r&Lv,c=Dd(n),l=c.length,u=Dd(t),p=u.length;if(l!=p&&!s)return!1;for(var d=l;d--;){var f=c[d];if(!(s?f in t:Mv.call(t,f)))return!1}var m=a.get(n),h=a.get(t);if(m&&h)return m==t&&h==n;var y=!0;a.set(n,t),a.set(t,n);for(var b=s;++d<l;){f=c[d];var _=n[f],k=t[f];if(o)var C=s?o(k,_,f,t,n,a):o(_,k,f,n,t,a);if(!(C===void 0?_===k||i(_,k,r,o,a):C)){y=!1;break}b||(b=f=="constructor")}if(y&&!b){var N=n.constructor,E=t.constructor;N!=E&&"constructor"in n&&"constructor"in t&&!(typeof N=="function"&&N instanceof N&&typeof E=="function"&&E instanceof E)&&(y=!1)}return a.delete(n),a.delete(t),y}var Fv=1,Sy="[object Arguments]",xy="[object Array]",Cl="[object Object]",Uv=Object.prototype,Ay=Uv.hasOwnProperty;function Kv(n,t,r,o,i,a){var s=Jn(n),c=Jn(t),l=s?xy:$n(n),u=c?xy:$n(t);l=l==Sy?Cl:l,u=u==Sy?Cl:u;var p=l==Cl,d=u==Cl,f=l==u;if(f&&Ca(n)){if(!Ca(t))return!1;s=!0,p=!1}if(f&&!p)return a||(a=new Br),s||vd(n)?Ey(n,t,r,o,i,a):Rv(n,t,l,r,o,i,a);if(!(r&Fv)){var m=p&&Ay.call(n,"__wrapped__"),h=d&&Ay.call(t,"__wrapped__");if(m||h){var y=m?n.value():n,b=h?t.value():t;return a||(a=new Br),i(y,b,r,o,a)}}return f?(a||(a=new Br),jv(n,t,r,o,i,a)):!1}function vy(n,t,r,o,i){return n===t?!0:n==null||t==null||!dr(n)&&!dr(t)?n!==n&&t!==t:Kv(n,t,r,o,vy,i)}function qv(n,t){return n!=null&&t in Object(n)}function Iy(n,t,r){t=ti(t,n);for(var o=-1,i=t.length,a=!1;++o<i;){var s=xa(t[o]);if(!(a=n!=null&&r(n,s)))break;n=n[s]}return a||++o!=i?a:(i=n==null?0:n.length,!!i&&Sd(i)&&Cd(s,i)&&(Jn(n)||_l(n)))}function Gv(n,t){return n!=null&&Iy(n,t,qv)}function Hv(n){return dr(n)&&hl(n)}function zv(n){var t=n==null?0:n.length;return t?n[t-1]:void 0}var Wv={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Yv=Dh(Wv),By=/[&<>"']/g,Jv=RegExp(By.source);function Xv(n){return n=_o(n),n&&Jv.test(n)?n.replace(By,Yv):n}var Zv=Object.prototype,Qv=Zv.hasOwnProperty;function eI(n,t){return n!=null&&Qv.call(n,t)}function El(n,t){return n!=null&&Iy(n,t,eI)}var tI=Math.min;function nI(n,t,r){for(var o=ME,i=n[0].length,a=n.length,s=a,c=Array(a),l=1/0,u=[];s--;){var p=n[s];l=tI(p.length,l),c[s]=i>=120&&p.length>=120?new Ba(s&&p):void 0}p=n[0];var d=-1,f=c[0];e:for(;++d<i&&u.length<l;){var m=p[d],h=m;if(m=m!==0?m:0,!(f?Kd(f,h):o(u,h))){for(s=a;--s;){var y=c[s];if(!(y?Kd(y,h):o(n[s],h)))continue e}f&&f.push(h),u.push(m)}}return u}function rI(n){return Hv(n)?n:[]}var oI=qE(function(n){var t=bd(n,rI);return t.length&&t[0]===n[0]?nI(t):[]});function iI(n,t){return t.length<2?n:Od(n,Ih(t,0,-1))}var aI="[object Map]",sI="[object Set]",lI=Object.prototype,cI=lI.hasOwnProperty;function Ty(n){if(n==null)return!0;if(hl(n)&&(Jn(n)||typeof n=="string"||typeof n.splice=="function"||Ca(n)||vd(n)||_l(n)))return!n.length;var t=$n(n);if(t==aI||t==sI)return!n.size;if(yl(n))return!Sh(n).length;for(var r in n)if(cI.call(n,r))return!1;return!0}function Xt(n,t){return vy(n,t)}var uI=Object.prototype,dI=uI.hasOwnProperty;function Oy(n,t){t=ti(t,n);var r=-1,o=t.length;if(!o)return!0;for(;++r<o;){var i=xa(t[r]);if(i==="__proto__"&&!dI.call(n,"__proto__")||(i==="constructor"||i==="prototype")&&r<o-1)return!1}var a=iI(n,t);return a==null||delete a[xa(zv(t))]}function fI(n){return CS(n)?void 0:n}var pI=1,mI=2,gI=4,Xr=Ah(function(n,t){var r={};if(n==null)return r;var o=!1;t=bd(t,function(a){return a=ti(a,n),o||(o=a.length>1),a}),ka(n,uy(n),r),o&&(r=va(r,pI|mI|gI,fI));for(var i=t.length;i--;)Oy(r,t[i]);return r});function Py(n,t,r,o){if(!mo(n))return n;t=ti(t,n);for(var i=-1,a=t.length,s=a-1,c=n;c!=null&&++i<a;){var l=xa(t[i]),u=r;if(l==="__proto__"||l==="constructor"||l==="prototype")return n;if(i!=s){var p=c[l];u=void 0,u===void 0&&(u=mo(p)?p:Cd(t[i+1])?[]:{})}Nd(c,l,u),c=c[l]}return n}function hI(n,t,r){for(var o=-1,i=t.length,a={};++o<i;){var s=t[o],c=Od(n,s);r(c,s)&&Py(a,ti(s,n),c)}return a}function yI(n,t){return hI(n,t,function(r,o){return Gv(n,o)})}var Gd=Ah(function(n,t){return n==null?{}:yI(n,t)});function Vy(n,t,r){return n==null?n:Py(n,t,r)}var _I=0;function Nl(n){var t=++_I;return _o(n)+t}function $y(n,t){return n==null?!0:Oy(n,t)}const ri="{key}",bo={"kong.client.consumer":{dataType:"object",writable:!1,readable:!0},"kong.client.consumer_groups":{dataType:"array",writable:!1,readable:!0},"kong.client.credential":{dataType:"object",writable:!1,readable:!0},"kong.client.get_identity_realm_source":{dataType:"object",writable:!1,readable:!0},"kong.client.forwarded_ip":{dataType:"string",writable:!1,readable:!0},"kong.client.forwarded_port":{dataType:"number",writable:!1,readable:!0},"kong.client.ip":{dataType:"string",writable:!1,readable:!0},"kong.client.port":{dataType:"number",writable:!1,readable:!0},"kong.client.protocol":{dataType:"string",writable:!1,readable:!0},"kong.request.forwarded_host":{dataType:"string",writable:!1,readable:!0},"kong.request.forwarded_port":{dataType:"number",writable:!1,readable:!0},"kong.request.forwarded_scheme":{dataType:"string",writable:!1,readable:!0},"kong.request.port":{dataType:"number",writable:!1,readable:!0},"kong.response.source":{dataType:"string",writable:!1,readable:!0},"kong.router.route":{dataType:"object",writable:!1,readable:!0},"kong.route_id":{dataType:"string",writable:!1,readable:!0},"kong.route_name":{dataType:"string",writable:!1,readable:!0},"kong.router.service":{dataType:"object",writable:!1,readable:!0},"kong.service_name":{dataType:"string",writable:!1,readable:!0},"kong.service_id":{dataType:"string",writable:!1,readable:!0},"kong.service.response.status":{dataType:"number",writable:!1,readable:!0},"kong.version":{dataType:"string",writable:!1,readable:!0},"kong.node.id":{dataType:"string",writable:!1,readable:!0},"kong.configuration.{key}":{dataType:"any",writable:!1,readable:!0},"kong.service.target":{dataType:"string ({host}:{port})",writable:!0,readable:!1},"kong.service.request_scheme":{dataType:"string ({scheme})",writable:!0,readable:!1},"kong.ctx.plugin.{key}":{dataType:"any",writable:!0,readable:!0},"kong.ctx.shared.{key}":{dataType:"any",writable:!0,readable:!0}},Sl=Object.keys(bo).filter(n=>n.includes(ri)).map(n=>n.replace(ri,""));function Hd(n){if(!n||!Oa(n))return;const t=Sl.find(r=>n.startsWith(r));if(t)return n.slice(t.length).replace(ri,"")}function Ta(n){if(!n)return null;const t=Sl.find(r=>n.startsWith(r));return t||n}function Oa(n){return n?Sl.some(t=>n.startsWith(t)):!1}function Ry(n){return n?Oa(n)?Ta(n)+ri:n:null}function zd(n){var r;if(!n)return!1;const t=Ry(n);return t?((r=bo[t])==null?void 0:r.readable)??!1:!1}function Wd(n){var r;if(!n)return!1;const t=Ry(n);return t?((r=bo[t])==null?void 0:r.writable)??!1:!1}const Yd=Symbol("EXPERIMENTAL_FREE_FORM_PROVIDER"),fr={KM_2262_CODE_MODE:"KM-2262-code-mode",KM_2306_CONDITION_FIELD_314:"KM-2306-condition-field-314",KM_2446_DATAKIT_JWT_NODES:"KM-2446-Datakit-JWT-nodes",KM_2503_CUSTOM_PLUGIN_FREEFORM:"KM-2503-custom-plugin-freeform",KM_2485_CLONED_PLUGINS:"KM-2485-cloned-plugins",KHCP_20393_IDENTITY_PRINCIPALS_UI:"khcp-20393-identity-principals-ui"},Ly=Symbol("TOASTER_PROVIDER"),oi="__FREEFORM_SCHEMA_MAP__";function Jd(){const n=(...r)=>{console.warn("TOASTER_PROVIDER is not provided",...r)},t=e.inject(Ly,n);return r=>t(r)}const Dy=["request","service_request","service_response","response","vault"],ii=Dy,My=["call","jq","exit","property","static","branch","cache","xml_to_json","json_to_xml","jwt_decode","jwt_sign","jwt_verify"],jy=["GET","HEAD","POST","PUT","PATCH","DELETE","OPTIONS","TRACE","CONNECT"],Xd=["EdDSA","ES256","ES384","ES512","HS256","HS384","HS512","PS256","PS384","PS512","RS256","RS384","RS512"],je=(n,t)=>{const r=n.__vccOpts||n;for(const[o,i]of t)r[o]=i;return r},bI={},wI={height:"16",viewBox:"0 -960 960 960",width:"16",xmlns:"http://www.w3.org/2000/svg"};function kI(n,t){return e.openBlock(),e.createElementBlock("svg",wI,[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M240-160h480v-400H240v400Zm296.5-143.5Q560-327 560-360t-23.5-56.5Q513-440 480-440t-56.5 23.5Q400-393 400-360t23.5 56.5Q447-280 480-280t56.5-23.5ZM240-160v-400 400Zm0 80q-33 0-56.5-23.5T160-160v-400q0-33 23.5-56.5T240-640h280v-80q0-83 58.5-141.5T720-920q83 0 141.5 58.5T920-720h-80q0-50-35-85t-85-35q-50 0-85 35t-35 85v80h120q33 0 56.5 23.5T800-560v400q0 33-23.5 56.5T720-80H240Z",fill:"currentColor"},null,-1)])])}const CI=je(bI,[["render",kI]]),EI={},NI={height:"16",viewBox:"0 -960 960 960",width:"16",xmlns:"http://www.w3.org/2000/svg"};function SI(n,t){return e.openBlock(),e.createElementBlock("svg",NI,[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q65 0 123 19t107 53l-58 59q-38-24-81-37.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160q133 0 226.5-93.5T800-480q0-18-2-36t-6-35l65-65q11 32 17 66t6 70q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm-56-216L254-466l56-56 114 114 400-401 56 56-456 457Z",fill:"currentColor"},null,-1)])])}const xI=je(EI,[["render",SI]]),Pa=[{id:"external_interaction",colors:{foreground:D1,background:B1},nodes:[{type:"call",icon:$e.NetworkIcon},{type:"cache",icon:$e.CachedIcon}]},{id:"control_flow",colors:{foreground:V1,background:S1},nodes:[{type:"branch",icon:$e.ArrowSplitIcon},{type:"exit",icon:$e.GatewayIcon}]},{id:"data_transformation",colors:{foreground:Jg,background:x1},nodes:[{type:"jq",icon:$e.CodeblockIcon},{type:"xml_to_json",icon:$e.DataObjectIcon},{type:"json_to_xml",icon:$e.CodeIcon}]},{id:"data_value",colors:{foreground:Zg,background:L1},nodes:[{type:"property",icon:$e.StackIcon},{type:"static",icon:$e.DeployIcon}]},{id:"authentication",colors:{foreground:$1,background:R1},nodes:[{type:"jwt_sign",icon:$e.EditSquareIcon},{type:"jwt_decode",icon:CI},{type:"jwt_verify",icon:xI}]}],AI=Pa.reduce((n,t)=>{for(const r of t.nodes)n[r.type]={icon:r.icon,colors:t.colors};return n},{}),ai={vault:{icon:$e.KeyIcon},request:{icon:$e.CloudIcon},service_request:{icon:$e.CloudIcon},service_response:{icon:$e.CloudIcon},response:{icon:$e.CloudIcon}};function vI(n){return Pa.find(({id:t})=>t===n).colors}function Zd(n){return AI[n]??ai[n]}const{t:Qd}=jt.createI18n("en-us",Jt);function si(n){return Qd(`plugins.free-form.datakit.flow_editor.node_types.${n}.description`)}function II(n){return Qd(`plugins.free-form.datakit.flow_editor.node_types.${n}.summary`)}function BI(n){return Qd(`plugins.free-form.datakit.flow_editor.node_panel.groups.${n}`)}const TI={call:{io:{input:{fields:[{name:"headers"},{name:"body"},{name:"query"}]},output:{fields:[{name:"headers"},{name:"body"},{name:"status"}]}}},jq:{io:{input:{fields:[],configurable:!0},output:{fields:[]}}},exit:{io:{input:{fields:[{name:"headers"},{name:"body"}]}}},property:{io:{input:{fields:[],configurable:!0},output:{fields:[]}}},static:{io:{output:{fields:[],configurable:!0}}},branch:{io:{input:{fields:[]},next:{branches:[{name:"then"},{name:"else"}]}}},cache:{io:{input:{fields:[{name:"data"},{name:"key"},{name:"ttl"}]},output:{fields:[{name:"data"},{name:"hit"},{name:"miss"},{name:"stored"}]}}},xml_to_json:{io:{input:{fields:[]},output:{fields:[]}}},json_to_xml:{io:{input:{fields:[],configurable:!0},output:{fields:[]}}},jwt_decode:{io:{input:{fields:[]},output:{fields:[{name:"header"},{name:"payload"},{name:"signature"}]}}},jwt_sign:{io:{input:{fields:[{name:"claims"},{name:"key"}]},output:{fields:[{name:"claims"},{name:"header"},{name:"token"}]}}},jwt_verify:{io:{input:{fields:[{name:"key"},{name:"token"}]},output:{fields:[{name:"claims"},{name:"header"}]}}}};function OI(n){return{id:n.id,title:BI(n.id),colors:vI(n.id),nodeTypes:n.nodes.map(({type:t})=>t)}}function PI(n,t){return{...TI[t.type],type:t.type,icon:t.icon,group:n.id,summary:II(t.type),description:si(t.type)}}const Fy=Pa.reduce((n,t)=>(n[t.id]=OI(t),n),{}),xl=Pa.reduce((n,t)=>{for(const r of t.nodes)n[r.type]=PI(t,r);return n},{}),Uy=Pa.map(n=>({...Fy[n.id],nodes:n.nodes.map(({type:t})=>xl[t])}));function VI(n){return Fy[n]}const Al={request:{type:"request",description:si("request"),io:{output:{fields:[{name:"headers"},{name:"body"},{name:"query"}]}},...ai.request},service_request:{type:"service_request",description:si("service_request"),io:{input:{fields:[{name:"headers"},{name:"body"},{name:"query"}]}},...ai.service_request},service_response:{type:"service_response",description:si("service_response"),io:{output:{fields:[{name:"headers"},{name:"body"}]}},...ai.service_response},response:{type:"response",description:si("response"),io:{input:{fields:[{name:"headers"},{name:"body"}]}},...ai.response},vault:{type:"vault",io:{output:{fields:[],configurable:!0}},...ai.vault,hidden:!0}},ef=Object.keys(Al),tf=n=>ef.includes(n),$I=n=>[...ef,...My].includes(n),mn=n=>ef.includes(n),vl=n=>mn(n.type),nf=n=>!!(n!=null&&n.startsWith("node:")),Va=n=>Object.prototype.hasOwnProperty.call(n,"ownerId");function Tr(n){return Ia(n)}function rf(n,t){if(n.length!==t.length)return!1;if(n.length===0)return!0;const r=new Set(t);return n.every(o=>r.has(o))}function li(n){return`${n}:${Nl()}`}function Il(n){const[t,r]=n.split(".");return{nodeName:t,fieldName:r}}function Ky(n){const[t,r]=n.split(".");return{nodeId:t,fieldId:r}}function ci(n){return mn(n)?Al[n]:xl[n]}function qy(n){var i,a,s,c;const t=ci(n),r=((a=(i=t.io)==null?void 0:i.input)==null?void 0:a.fields.map(({name:l})=>l))??[],o=((c=(s=t.io)==null?void 0:s.output)==null?void 0:c.fields.map(({name:l})=>l))??[];return{input:r,output:o}}function $a(n){var r,o,i;return((i=(o=(r=ci(n).io)==null?void 0:r.next)==null?void 0:o.branches)==null?void 0:i.map(({name:a})=>a))??[]}function Gy(n){return(n??[]).map(t=>({id:li("field"),name:t}))}function Zr(n,t,r){if(r)return n.fields[t].find(o=>o.name===r)}function Qr(n,t,r){if(r)return n.fields[t].find(o=>o.id===r)}function of(n,t){return t?n.fields.output.some(r=>r.id===t):!0}function Hy(n,t){return t?n.fields.input.some(r=>r.id===t):!0}function RI(n){const t=["request","service_request","vault"].includes(n)?"request":"response",r=Al[n];return{name:n,phase:t,position:{x:0,y:0},fields:qy(r.type),expanded:{},hidden:r.hidden}}function zy(n,t){const o=(typeof n=="string"&&$I(n)?n.toUpperCase():n).replace(/_\d+$/,"");for(let i=1;;i++){const a=`${o}_${i}`;if(!t.has(a))return a}}function af(n,t){return`${n}:${t}`}function LI(n){const t=n.lastIndexOf(":");if(t===-1)throw new Error(`Invalid group ID format: ${n}`);const r=n.slice(0,t),o=n.slice(t+1);return{nodeId:r,branch:o}}function Bl(n,t){return`${n}:${t}`}function Wy(n,t,r,o,i){return{id:af(n,t),ownerId:n,branch:t,phase:r,memberIds:[...o],position:i!=null&&i.position?{...i.position}:void 0,dimensions:i!=null&&i.dimensions?{...i.dimensions}:void 0}}function Tl(n,t,r){const o=t?Qr(n,r,t):void 0;return`${n.name}${o?`.${o.name}`:""}`}function Ra(n,t){const r=t(n.source),o=t(n.target);return[Tl(r,n.sourceField,"output"),Tl(o,n.targetField,"input")]}function sf(n,t,r,o,i){const a=i(n),s=i(r);return[Tl(a,t,"output"),Tl(s,o,"input")]}function Yy(n){if(n.length===0)throw new Error("getBoundingRect requires at least one rect");let t=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY;for(const{x:a,y:s,width:c,height:l}of n){if(![a,s,c,l].every(Number.isFinite))throw new Error("Rect values must be finite numbers");if(c<0||l<0)throw new RangeError("Rect width and height must be non-negative");const u=a+c,p=s+l;if(!Number.isFinite(u)||!Number.isFinite(p))throw new RangeError("Rect boundaries must be finite numbers");a<t&&(t=a),s<r&&(r=s),u>o&&(o=u),p>i&&(i=p)}return{x:t,y:r,width:o-t,height:i-r}}var Ct=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),Xn=Ct((n,t)=>{var r=Object.defineProperty,o=(V,R,X)=>R in V?r(V,R,{enumerable:!0,configurable:!0,writable:!0,value:X}):V[R]=X,i=(V,R)=>()=>(R||V((R={exports:{}}).exports,R),R.exports),a=(V,R,X)=>o(V,typeof R!="symbol"?R+"":R,X),s=i((V,R)=>{var X="\0",Y="\0",ne="",M=class{constructor(G){a(this,"_isDirected",!0),a(this,"_isMultigraph",!1),a(this,"_isCompound",!1),a(this,"_label"),a(this,"_defaultNodeLabelFn",()=>{}),a(this,"_defaultEdgeLabelFn",()=>{}),a(this,"_nodes",{}),a(this,"_in",{}),a(this,"_preds",{}),a(this,"_out",{}),a(this,"_sucs",{}),a(this,"_edgeObjs",{}),a(this,"_edgeLabels",{}),a(this,"_nodeCount",0),a(this,"_edgeCount",0),a(this,"_parent"),a(this,"_children"),G&&(this._isDirected=Object.hasOwn(G,"directed")?G.directed:!0,this._isMultigraph=Object.hasOwn(G,"multigraph")?G.multigraph:!1,this._isCompound=Object.hasOwn(G,"compound")?G.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[Y]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(G){return this._label=G,this}graph(){return this._label}setDefaultNodeLabel(G){return this._defaultNodeLabelFn=G,typeof G!="function"&&(this._defaultNodeLabelFn=()=>G),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var G=this;return this.nodes().filter(v=>Object.keys(G._in[v]).length===0)}sinks(){var G=this;return this.nodes().filter(v=>Object.keys(G._out[v]).length===0)}setNodes(G,v){var q=arguments,ie=this;return G.forEach(function(oe){q.length>1?ie.setNode(oe,v):ie.setNode(oe)}),this}setNode(G,v){return Object.hasOwn(this._nodes,G)?(arguments.length>1&&(this._nodes[G]=v),this):(this._nodes[G]=arguments.length>1?v:this._defaultNodeLabelFn(G),this._isCompound&&(this._parent[G]=Y,this._children[G]={},this._children[Y][G]=!0),this._in[G]={},this._preds[G]={},this._out[G]={},this._sucs[G]={},++this._nodeCount,this)}node(G){return this._nodes[G]}hasNode(G){return Object.hasOwn(this._nodes,G)}removeNode(G){var v=this;if(Object.hasOwn(this._nodes,G)){var q=ie=>v.removeEdge(v._edgeObjs[ie]);delete this._nodes[G],this._isCompound&&(this._removeFromParentsChildList(G),delete this._parent[G],this.children(G).forEach(function(ie){v.setParent(ie)}),delete this._children[G]),Object.keys(this._in[G]).forEach(q),delete this._in[G],delete this._preds[G],Object.keys(this._out[G]).forEach(q),delete this._out[G],delete this._sucs[G],--this._nodeCount}return this}setParent(G,v){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(v===void 0)v=Y;else{v+="";for(var q=v;q!==void 0;q=this.parent(q))if(q===G)throw new Error("Setting "+v+" as parent of "+G+" would create a cycle");this.setNode(v)}return this.setNode(G),this._removeFromParentsChildList(G),this._parent[G]=v,this._children[v][G]=!0,this}_removeFromParentsChildList(G){delete this._children[this._parent[G]][G]}parent(G){if(this._isCompound){var v=this._parent[G];if(v!==Y)return v}}children(G=Y){if(this._isCompound){var v=this._children[G];if(v)return Object.keys(v)}else{if(G===Y)return this.nodes();if(this.hasNode(G))return[]}}predecessors(G){var v=this._preds[G];if(v)return Object.keys(v)}successors(G){var v=this._sucs[G];if(v)return Object.keys(v)}neighbors(G){var v=this.predecessors(G);if(v){let ie=new Set(v);for(var q of this.successors(G))ie.add(q);return Array.from(ie.values())}}isLeaf(G){var v;return this.isDirected()?v=this.successors(G):v=this.neighbors(G),v.length===0}filterNodes(G){var v=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});v.setGraph(this.graph());var q=this;Object.entries(this._nodes).forEach(function([ke,ye]){G(ke)&&v.setNode(ke,ye)}),Object.values(this._edgeObjs).forEach(function(ke){v.hasNode(ke.v)&&v.hasNode(ke.w)&&v.setEdge(ke,q.edge(ke))});var ie={};function oe(ke){var ye=q.parent(ke);return ye===void 0||v.hasNode(ye)?(ie[ke]=ye,ye):ye in ie?ie[ye]:oe(ye)}return this._isCompound&&v.nodes().forEach(ke=>v.setParent(ke,oe(ke))),v}setDefaultEdgeLabel(G){return this._defaultEdgeLabelFn=G,typeof G!="function"&&(this._defaultEdgeLabelFn=()=>G),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(G,v){var q=this,ie=arguments;return G.reduce(function(oe,ke){return ie.length>1?q.setEdge(oe,ke,v):q.setEdge(oe,ke),ke}),this}setEdge(){var G,v,q,ie,oe=!1,ke=arguments[0];typeof ke=="object"&&ke!==null&&"v"in ke?(G=ke.v,v=ke.w,q=ke.name,arguments.length===2&&(ie=arguments[1],oe=!0)):(G=ke,v=arguments[1],q=arguments[3],arguments.length>2&&(ie=arguments[2],oe=!0)),G=""+G,v=""+v,q!==void 0&&(q=""+q);var ye=Z(this._isDirected,G,v,q);if(Object.hasOwn(this._edgeLabels,ye))return oe&&(this._edgeLabels[ye]=ie),this;if(q!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(G),this.setNode(v),this._edgeLabels[ye]=oe?ie:this._defaultEdgeLabelFn(G,v,q);var ce=F(this._isDirected,G,v,q);return G=ce.v,v=ce.w,Object.freeze(ce),this._edgeObjs[ye]=ce,te(this._preds[v],G),te(this._sucs[G],v),this._in[v][ye]=ce,this._out[G][ye]=ce,this._edgeCount++,this}edge(G,v,q){var ie=arguments.length===1?J(this._isDirected,arguments[0]):Z(this._isDirected,G,v,q);return this._edgeLabels[ie]}edgeAsObj(){let G=this.edge(...arguments);return typeof G!="object"?{label:G}:G}hasEdge(G,v,q){var ie=arguments.length===1?J(this._isDirected,arguments[0]):Z(this._isDirected,G,v,q);return Object.hasOwn(this._edgeLabels,ie)}removeEdge(G,v,q){var ie=arguments.length===1?J(this._isDirected,arguments[0]):Z(this._isDirected,G,v,q),oe=this._edgeObjs[ie];return oe&&(G=oe.v,v=oe.w,delete this._edgeLabels[ie],delete this._edgeObjs[ie],$(this._preds[v],G),$(this._sucs[G],v),delete this._in[v][ie],delete this._out[G][ie],this._edgeCount--),this}inEdges(G,v){return this.isDirected()?this.filterEdges(this._in[G],G,v):this.nodeEdges(G,v)}outEdges(G,v){return this.isDirected()?this.filterEdges(this._out[G],G,v):this.nodeEdges(G,v)}nodeEdges(G,v){if(G in this._nodes)return this.filterEdges({...this._in[G],...this._out[G]},G,v)}filterEdges(G,v,q){if(G){var ie=Object.values(G);return q?ie.filter(function(oe){return oe.v===v&&oe.w===q||oe.v===q&&oe.w===v}):ie}}};function te(G,v){G[v]?G[v]++:G[v]=1}function $(G,v){--G[v]||delete G[v]}function Z(G,v,q,ie){var oe=""+v,ke=""+q;if(!G&&oe>ke){var ye=oe;oe=ke,ke=ye}return oe+ne+ke+ne+(ie===void 0?X:ie)}function F(G,v,q,ie){var oe=""+v,ke=""+q;if(!G&&oe>ke){var ye=oe;oe=ke,ke=ye}var ce={v:oe,w:ke};return ie&&(ce.name=ie),ce}function J(G,v){return Z(G,v.v,v.w,v.name)}R.exports=M}),c=i((V,R)=>{R.exports="3.0.2"}),l=i((V,R)=>{R.exports={Graph:s(),version:c()}}),u=i((V,R)=>{var X=s();R.exports={write:Y,read:te};function Y($){var Z={options:{directed:$.isDirected(),multigraph:$.isMultigraph(),compound:$.isCompound()},nodes:ne($),edges:M($)};return $.graph()!==void 0&&(Z.value=structuredClone($.graph())),Z}function ne($){return $.nodes().map(function(Z){var F=$.node(Z),J=$.parent(Z),G={v:Z};return F!==void 0&&(G.value=F),J!==void 0&&(G.parent=J),G})}function M($){return $.edges().map(function(Z){var F=$.edge(Z),J={v:Z.v,w:Z.w};return Z.name!==void 0&&(J.name=Z.name),F!==void 0&&(J.value=F),J})}function te($){var Z=new X($.options).setGraph($.value);return $.nodes.forEach(function(F){Z.setNode(F.v,F.value),F.parent&&Z.setParent(F.v,F.parent)}),$.edges.forEach(function(F){Z.setEdge({v:F.v,w:F.w,name:F.name},F.value)}),Z}}),p=i((V,R)=>{R.exports=Y;var X=()=>1;function Y(M,te,$,Z){return ne(M,String(te),$||X,Z||function(F){return M.outEdges(F)})}function ne(M,te,$,Z){var F={},J=!0,G=0,v=M.nodes(),q=function(ye){var ce=$(ye);F[ye.v].distance+ce<F[ye.w].distance&&(F[ye.w]={distance:F[ye.v].distance+ce,predecessor:ye.v},J=!0)},ie=function(){v.forEach(function(ye){Z(ye).forEach(function(ce){var he=ce.v===ye?ce.v:ce.w,Oe=he===ce.v?ce.w:ce.v;q({v:he,w:Oe})})})};v.forEach(function(ye){var ce=ye===te?0:Number.POSITIVE_INFINITY;F[ye]={distance:ce}});for(var oe=v.length,ke=1;ke<oe&&(J=!1,G++,ie(),!!J);ke++);if(G===oe-1&&(J=!1,ie(),J))throw new Error("The graph contains a negative weight cycle");return F}}),d=i((V,R)=>{R.exports=X;function X(Y){var ne={},M=[],te;function $(Z){Object.hasOwn(ne,Z)||(ne[Z]=!0,te.push(Z),Y.successors(Z).forEach($),Y.predecessors(Z).forEach($))}return Y.nodes().forEach(function(Z){te=[],$(Z),te.length&&M.push(te)}),M}}),f=i((V,R)=>{var X=class{constructor(){a(this,"_arr",[]),a(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(Y){return Y.key})}has(Y){return Object.hasOwn(this._keyIndices,Y)}priority(Y){var ne=this._keyIndices[Y];if(ne!==void 0)return this._arr[ne].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(Y,ne){var M=this._keyIndices;if(Y=String(Y),!Object.hasOwn(M,Y)){var te=this._arr,$=te.length;return M[Y]=$,te.push({key:Y,priority:ne}),this._decrease($),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var Y=this._arr.pop();return delete this._keyIndices[Y.key],this._heapify(0),Y.key}decrease(Y,ne){var M=this._keyIndices[Y];if(ne>this._arr[M].priority)throw new Error("New priority is greater than current priority. Key: "+Y+" Old: "+this._arr[M].priority+" New: "+ne);this._arr[M].priority=ne,this._decrease(M)}_heapify(Y){var ne=this._arr,M=2*Y,te=M+1,$=Y;M<ne.length&&($=ne[M].priority<ne[$].priority?M:$,te<ne.length&&($=ne[te].priority<ne[$].priority?te:$),$!==Y&&(this._swap(Y,$),this._heapify($)))}_decrease(Y){for(var ne=this._arr,M=ne[Y].priority,te;Y!==0&&(te=Y>>1,!(ne[te].priority<M));)this._swap(Y,te),Y=te}_swap(Y,ne){var M=this._arr,te=this._keyIndices,$=M[Y],Z=M[ne];M[Y]=Z,M[ne]=$,te[Z.key]=Y,te[$.key]=ne}};R.exports=X}),m=i((V,R)=>{var X=f();R.exports=ne;var Y=()=>1;function ne(te,$,Z,F){var J=function(G){return te.outEdges(G)};return M(te,String($),Z||Y,F||J)}function M(te,$,Z,F){var J={},G=new X,v,q,ie=function(oe){var ke=oe.v!==v?oe.v:oe.w,ye=J[ke],ce=Z(oe),he=q.distance+ce;if(ce<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+oe+" Weight: "+ce);he<ye.distance&&(ye.distance=he,ye.predecessor=v,G.decrease(ke,he))};for(te.nodes().forEach(function(oe){var ke=oe===$?0:Number.POSITIVE_INFINITY;J[oe]={distance:ke},G.add(oe,ke)});G.size()>0&&(v=G.removeMin(),q=J[v],q.distance!==Number.POSITIVE_INFINITY);)F(v).forEach(ie);return J}}),h=i((V,R)=>{var X=m();R.exports=Y;function Y(ne,M,te){return ne.nodes().reduce(function($,Z){return $[Z]=X(ne,Z,M,te),$},{})}}),y=i((V,R)=>{R.exports=X;function X(ne,M,te){if(ne[M].predecessor!==void 0)throw new Error("Invalid source vertex");if(ne[te].predecessor===void 0&&te!==M)throw new Error("Invalid destination vertex");return{weight:ne[te].distance,path:Y(ne,M,te)}}function Y(ne,M,te){for(var $=[],Z=te;Z!==M;)$.push(Z),Z=ne[Z].predecessor;return $.push(M),$.reverse()}}),b=i((V,R)=>{R.exports=X;function X(Y){var ne=0,M=[],te={},$=[];function Z(F){var J=te[F]={onStack:!0,lowlink:ne,index:ne++};if(M.push(F),Y.successors(F).forEach(function(q){Object.hasOwn(te,q)?te[q].onStack&&(J.lowlink=Math.min(J.lowlink,te[q].index)):(Z(q),J.lowlink=Math.min(J.lowlink,te[q].lowlink))}),J.lowlink===J.index){var G=[],v;do v=M.pop(),te[v].onStack=!1,G.push(v);while(F!==v);$.push(G)}}return Y.nodes().forEach(function(F){Object.hasOwn(te,F)||Z(F)}),$}}),_=i((V,R)=>{var X=b();R.exports=Y;function Y(ne){return X(ne).filter(function(M){return M.length>1||M.length===1&&ne.hasEdge(M[0],M[0])})}}),k=i((V,R)=>{R.exports=Y;var X=()=>1;function Y(M,te,$){return ne(M,te||X,$||function(Z){return M.outEdges(Z)})}function ne(M,te,$){var Z={},F=M.nodes();return F.forEach(function(J){Z[J]={},Z[J][J]={distance:0},F.forEach(function(G){J!==G&&(Z[J][G]={distance:Number.POSITIVE_INFINITY})}),$(J).forEach(function(G){var v=G.v===J?G.w:G.v,q=te(G);Z[J][v]={distance:q,predecessor:J}})}),F.forEach(function(J){var G=Z[J];F.forEach(function(v){var q=Z[v];F.forEach(function(ie){var oe=q[J],ke=G[ie],ye=q[ie],ce=oe.distance+ke.distance;ce<ye.distance&&(ye.distance=ce,ye.predecessor=ke.predecessor)})})}),Z}}),C=i((V,R)=>{function X(ne){var M={},te={},$=[];function Z(F){if(Object.hasOwn(te,F))throw new Y;Object.hasOwn(M,F)||(te[F]=!0,M[F]=!0,ne.predecessors(F).forEach(Z),delete te[F],$.push(F))}if(ne.sinks().forEach(Z),Object.keys(M).length!==ne.nodeCount())throw new Y;return $}var Y=class extends Error{constructor(){super(...arguments)}};R.exports=X,X.CycleException=Y}),N=i((V,R)=>{var X=C();R.exports=Y;function Y(ne){try{X(ne)}catch(M){if(M instanceof X.CycleException)return!1;throw M}return!0}}),E=i((V,R)=>{R.exports=X;function X(ne,M,te,$,Z){Array.isArray(M)||(M=[M]);var F=(ne.isDirected()?ne.successors:ne.neighbors).bind(ne),J={};return M.forEach(function(G){if(!ne.hasNode(G))throw new Error("Graph does not have node: "+G);Z=Y(ne,G,te==="post",J,F,$,Z)}),Z}function Y(ne,M,te,$,Z,F,J){return Object.hasOwn($,M)||($[M]=!0,te||(J=F(J,M)),Z(M).forEach(function(G){J=Y(ne,G,te,$,Z,F,J)}),te&&(J=F(J,M))),J}}),w=i((V,R)=>{var X=E();R.exports=Y;function Y(ne,M,te){return X(ne,M,te,function($,Z){return $.push(Z),$},[])}}),S=i((V,R)=>{var X=w();R.exports=Y;function Y(ne,M){return X(ne,M,"post")}}),I=i((V,R)=>{var X=w();R.exports=Y;function Y(ne,M){return X(ne,M,"pre")}}),U=i((V,R)=>{var X=s(),Y=f();R.exports=ne;function ne(M,te){var $=new X,Z={},F=new Y,J;function G(q){var ie=q.v===J?q.w:q.v,oe=F.priority(ie);if(oe!==void 0){var ke=te(q);ke<oe&&(Z[ie]=J,F.decrease(ie,ke))}}if(M.nodeCount()===0)return $;M.nodes().forEach(function(q){F.add(q,Number.POSITIVE_INFINITY),$.setNode(q)}),F.decrease(M.nodes()[0],0);for(var v=!1;F.size()>0;){if(J=F.removeMin(),Object.hasOwn(Z,J))$.setEdge(J,Z[J]);else{if(v)throw new Error("Input graph is not connected: "+M);v=!0}M.nodeEdges(J).forEach(G)}return $}}),x=i((V,R)=>{var X=m(),Y=p();R.exports=ne;function ne(te,$,Z,F){return M(te,$,Z,F||function(J){return te.outEdges(J)})}function M(te,$,Z,F){if(Z===void 0)return X(te,$,Z,F);for(var J=!1,G=te.nodes(),v=0;v<G.length;v++){for(var q=F(G[v]),ie=0;ie<q.length;ie++){var oe=q[ie],ke=oe.v===G[v]?oe.v:oe.w,ye=ke===oe.v?oe.w:oe.v;Z({v:ke,w:ye})<0&&(J=!0)}if(J)return Y(te,$,Z,F)}return X(te,$,Z,F)}}),A=i((V,R)=>{R.exports={bellmanFord:p(),components:d(),dijkstra:m(),dijkstraAll:h(),extractPath:y(),findCycles:_(),floydWarshall:k(),isAcyclic:N(),postorder:S(),preorder:I(),prim:U(),shortestPaths:x(),reduce:E(),tarjan:b(),topsort:C()}}),T=l();t.exports={Graph:T.Graph,json:u(),alg:A(),version:T.version}}),DI=Ct((n,t)=>{var r=class{constructor(){let a={};a._next=a._prev=a,this._sentinel=a}dequeue(){let a=this._sentinel,s=a._prev;if(s!==a)return o(s),s}enqueue(a){let s=this._sentinel;a._prev&&a._next&&o(a),a._next=s._next,s._next._prev=a,s._next=a,a._prev=s}toString(){let a=[],s=this._sentinel,c=s._prev;for(;c!==s;)a.push(JSON.stringify(c,i)),c=c._prev;return"["+a.join(", ")+"]"}};function o(a){a._prev._next=a._next,a._next._prev=a._prev,delete a._next,delete a._prev}function i(a,s){if(a!=="_next"&&a!=="_prev")return s}t.exports=r}),MI=Ct((n,t)=>{var r=Xn().Graph,o=DI();t.exports=a;var i=()=>1;function a(d,f){if(d.nodeCount()<=1)return[];let m=l(d,f||i);return s(m.graph,m.buckets,m.zeroIdx).flatMap(h=>d.outEdges(h.v,h.w))}function s(d,f,m){let h=[],y=f[f.length-1],b=f[0],_;for(;d.nodeCount();){for(;_=b.dequeue();)c(d,f,m,_);for(;_=y.dequeue();)c(d,f,m,_);if(d.nodeCount()){for(let k=f.length-2;k>0;--k)if(_=f[k].dequeue(),_){h=h.concat(c(d,f,m,_,!0));break}}}return h}function c(d,f,m,h,y){let b=y?[]:void 0;return d.inEdges(h.v).forEach(_=>{let k=d.edge(_),C=d.node(_.v);y&&b.push({v:_.v,w:_.w}),C.out-=k,u(f,m,C)}),d.outEdges(h.v).forEach(_=>{let k=d.edge(_),C=_.w,N=d.node(C);N.in-=k,u(f,m,N)}),d.removeNode(h.v),b}function l(d,f){let m=new r,h=0,y=0;d.nodes().forEach(k=>{m.setNode(k,{v:k,in:0,out:0})}),d.edges().forEach(k=>{let C=m.edge(k.v,k.w)||0,N=f(k),E=C+N;m.setEdge(k.v,k.w,E),y=Math.max(y,m.node(k.v).out+=N),h=Math.max(h,m.node(k.w).in+=N)});let b=p(y+h+3).map(()=>new o),_=h+1;return m.nodes().forEach(k=>{u(b,_,m.node(k))}),{graph:m,buckets:b,zeroIdx:_}}function u(d,f,m){m.out?m.in?d[m.out-m.in+f].enqueue(m):d[d.length-1].enqueue(m):d[0].enqueue(m)}function p(d){let f=[];for(let m=0;m<d;m++)f.push(m);return f}}),Gt=Ct((n,t)=>{var r=Xn().Graph;t.exports={addBorderNode:f,addDummyNode:o,applyWithChunking:y,asNonCompoundGraph:a,buildLayerMatrix:u,intersectRect:l,mapValues:I,maxRank:b,normalizeRanks:p,notime:C,partition:_,pick:S,predecessorWeights:c,range:w,removeEmptyRanks:d,simplify:i,successorWeights:s,time:k,uniqueId:E,zipObject:U};function o(x,A,T,V){for(var R=V;x.hasNode(R);)R=E(V);return T.dummy=A,x.setNode(R,T),R}function i(x){let A=new r().setGraph(x.graph());return x.nodes().forEach(T=>A.setNode(T,x.node(T))),x.edges().forEach(T=>{let V=A.edge(T.v,T.w)||{weight:0,minlen:1},R=x.edge(T);A.setEdge(T.v,T.w,{weight:V.weight+R.weight,minlen:Math.max(V.minlen,R.minlen)})}),A}function a(x){let A=new r({multigraph:x.isMultigraph()}).setGraph(x.graph());return x.nodes().forEach(T=>{x.children(T).length||A.setNode(T,x.node(T))}),x.edges().forEach(T=>{A.setEdge(T,x.edge(T))}),A}function s(x){let A=x.nodes().map(T=>{let V={};return x.outEdges(T).forEach(R=>{V[R.w]=(V[R.w]||0)+x.edge(R).weight}),V});return U(x.nodes(),A)}function c(x){let A=x.nodes().map(T=>{let V={};return x.inEdges(T).forEach(R=>{V[R.v]=(V[R.v]||0)+x.edge(R).weight}),V});return U(x.nodes(),A)}function l(x,A){let T=x.x,V=x.y,R=A.x-T,X=A.y-V,Y=x.width/2,ne=x.height/2;if(!R&&!X)throw new Error("Not possible to find intersection inside of the rectangle");let M,te;return Math.abs(X)*Y>Math.abs(R)*ne?(X<0&&(ne=-ne),M=ne*R/X,te=ne):(R<0&&(Y=-Y),M=Y,te=Y*X/R),{x:T+M,y:V+te}}function u(x){let A=w(b(x)+1).map(()=>[]);return x.nodes().forEach(T=>{let V=x.node(T),R=V.rank;R!==void 0&&(A[R][V.order]=T)}),A}function p(x){let A=x.nodes().map(V=>{let R=x.node(V).rank;return R===void 0?Number.MAX_VALUE:R}),T=y(Math.min,A);x.nodes().forEach(V=>{let R=x.node(V);Object.hasOwn(R,"rank")&&(R.rank-=T)})}function d(x){let A=x.nodes().map(Y=>x.node(Y).rank).filter(Y=>Y!==void 0),T=y(Math.min,A),V=[];x.nodes().forEach(Y=>{let ne=x.node(Y).rank-T;V[ne]||(V[ne]=[]),V[ne].push(Y)});let R=0,X=x.graph().nodeRankFactor;Array.from(V).forEach((Y,ne)=>{Y===void 0&&ne%X!==0?--R:Y!==void 0&&R&&Y.forEach(M=>x.node(M).rank+=R)})}function f(x,A,T,V){let R={width:0,height:0};return arguments.length>=4&&(R.rank=T,R.order=V),o(x,"border",R,A)}function m(x,A=h){let T=[];for(let V=0;V<x.length;V+=A){let R=x.slice(V,V+A);T.push(R)}return T}var h=65535;function y(x,A){if(A.length>h){let T=m(A);return x.apply(null,T.map(V=>x.apply(null,V)))}else return x.apply(null,A)}function b(x){let A=x.nodes().map(T=>{let V=x.node(T).rank;return V===void 0?Number.MIN_VALUE:V});return y(Math.max,A)}function _(x,A){let T={lhs:[],rhs:[]};return x.forEach(V=>{A(V)?T.lhs.push(V):T.rhs.push(V)}),T}function k(x,A){let T=Date.now();try{return A()}finally{console.log(x+" time: "+(Date.now()-T)+"ms")}}function C(x,A){return A()}var N=0;function E(x){var A=++N;return x+(""+A)}function w(x,A,T=1){A==null&&(A=x,x=0);let V=X=>X<A;T<0&&(V=X=>A<X);let R=[];for(let X=x;V(X);X+=T)R.push(X);return R}function S(x,A){let T={};for(let V of A)x[V]!==void 0&&(T[V]=x[V]);return T}function I(x,A){let T=A;return typeof A=="string"&&(T=V=>V[A]),Object.entries(x).reduce((V,[R,X])=>(V[R]=T(X,R),V),{})}function U(x,A){return x.reduce((T,V,R)=>(T[V]=A[R],T),{})}}),jI=Ct((n,t)=>{var r=MI(),o=Gt().uniqueId;t.exports={run:i,undo:s};function i(c){(c.graph().acyclicer==="greedy"?r(c,l(c)):a(c)).forEach(u=>{let p=c.edge(u);c.removeEdge(u),p.forwardName=u.name,p.reversed=!0,c.setEdge(u.w,u.v,p,o("rev"))});function l(u){return p=>u.edge(p).weight}}function a(c){let l=[],u={},p={};function d(f){Object.hasOwn(p,f)||(p[f]=!0,u[f]=!0,c.outEdges(f).forEach(m=>{Object.hasOwn(u,m.w)?l.push(m):d(m.w)}),delete u[f])}return c.nodes().forEach(d),l}function s(c){c.edges().forEach(l=>{let u=c.edge(l);if(u.reversed){c.removeEdge(l);let p=u.forwardName;delete u.reversed,delete u.forwardName,c.setEdge(l.w,l.v,u,p)}})}}),FI=Ct((n,t)=>{var r=Gt();t.exports={run:o,undo:a};function o(s){s.graph().dummyChains=[],s.edges().forEach(c=>i(s,c))}function i(s,c){let l=c.v,u=s.node(l).rank,p=c.w,d=s.node(p).rank,f=c.name,m=s.edge(c),h=m.labelRank;if(d===u+1)return;s.removeEdge(c);let y,b,_;for(_=0,++u;u<d;++_,++u)m.points=[],b={width:0,height:0,edgeLabel:m,edgeObj:c,rank:u},y=r.addDummyNode(s,"edge",b,"_d"),u===h&&(b.width=m.width,b.height=m.height,b.dummy="edge-label",b.labelpos=m.labelpos),s.setEdge(l,y,{weight:m.weight},f),_===0&&s.graph().dummyChains.push(y),l=y;s.setEdge(l,p,{weight:m.weight},f)}function a(s){s.graph().dummyChains.forEach(c=>{let l=s.node(c),u=l.edgeLabel,p;for(s.setEdge(l.edgeObj,u);l.dummy;)p=s.successors(c)[0],s.removeNode(c),u.points.push({x:l.x,y:l.y}),l.dummy==="edge-label"&&(u.x=l.x,u.y=l.y,u.width=l.width,u.height=l.height),c=p,l=s.node(c)})}}),Ol=Ct((n,t)=>{var{applyWithChunking:r}=Gt();t.exports={longestPath:o,slack:i};function o(a){var s={};function c(l){var u=a.node(l);if(Object.hasOwn(s,l))return u.rank;s[l]=!0;let p=a.outEdges(l).map(f=>f==null?Number.POSITIVE_INFINITY:c(f.w)-a.edge(f).minlen);var d=r(Math.min,p);return d===Number.POSITIVE_INFINITY&&(d=0),u.rank=d}a.sources().forEach(c)}function i(a,s){return a.node(s.w).rank-a.node(s.v).rank-a.edge(s).minlen}}),Jy=Ct((n,t)=>{var r=Xn().Graph,o=Ol().slack;t.exports=i;function i(l){var u=new r({directed:!1}),p=l.nodes()[0],d=l.nodeCount();u.setNode(p,{});for(var f,m;a(u,l)<d;)f=s(u,l),m=u.hasNode(f.v)?o(l,f):-o(l,f),c(u,l,m);return u}function a(l,u){function p(d){u.nodeEdges(d).forEach(f=>{var m=f.v,h=d===m?f.w:m;!l.hasNode(h)&&!o(u,f)&&(l.setNode(h,{}),l.setEdge(d,h,{}),p(h))})}return l.nodes().forEach(p),l.nodeCount()}function s(l,u){return u.edges().reduce((p,d)=>{let f=Number.POSITIVE_INFINITY;return l.hasNode(d.v)!==l.hasNode(d.w)&&(f=o(u,d)),f<p[0]?[f,d]:p},[Number.POSITIVE_INFINITY,null])[1]}function c(l,u,p){l.nodes().forEach(d=>u.node(d).rank+=p)}}),UI=Ct((n,t)=>{var r=Jy(),o=Ol().slack,i=Ol().longestPath,a=Xn().alg.preorder,s=Xn().alg.postorder,c=Gt().simplify;t.exports=l,l.initLowLimValues=f,l.initCutValues=u,l.calcCutValue=d,l.leaveEdge=h,l.enterEdge=y,l.exchangeEdges=b;function l(N){N=c(N),i(N);var E=r(N);f(E),u(E,N);for(var w,S;w=h(E);)S=y(E,N,w),b(E,N,w,S)}function u(N,E){var w=s(N,N.nodes());w=w.slice(0,w.length-1),w.forEach(S=>p(N,E,S))}function p(N,E,w){var S=N.node(w),I=S.parent;N.edge(w,I).cutvalue=d(N,E,w)}function d(N,E,w){var S=N.node(w),I=S.parent,U=!0,x=E.edge(w,I),A=0;return x||(U=!1,x=E.edge(I,w)),A=x.weight,E.nodeEdges(w).forEach(T=>{var V=T.v===w,R=V?T.w:T.v;if(R!==I){var X=V===U,Y=E.edge(T).weight;if(A+=X?Y:-Y,k(N,w,R)){var ne=N.edge(w,R).cutvalue;A+=X?-ne:ne}}}),A}function f(N,E){arguments.length<2&&(E=N.nodes()[0]),m(N,{},1,E)}function m(N,E,w,S,I){var U=w,x=N.node(S);return E[S]=!0,N.neighbors(S).forEach(A=>{Object.hasOwn(E,A)||(w=m(N,E,w,A,S))}),x.low=U,x.lim=w++,I?x.parent=I:delete x.parent,w}function h(N){return N.edges().find(E=>N.edge(E).cutvalue<0)}function y(N,E,w){var S=w.v,I=w.w;E.hasEdge(S,I)||(S=w.w,I=w.v);var U=N.node(S),x=N.node(I),A=U,T=!1;U.lim>x.lim&&(A=x,T=!0);var V=E.edges().filter(R=>T===C(N,N.node(R.v),A)&&T!==C(N,N.node(R.w),A));return V.reduce((R,X)=>o(E,X)<o(E,R)?X:R)}function b(N,E,w,S){var I=w.v,U=w.w;N.removeEdge(I,U),N.setEdge(S.v,S.w,{}),f(N),u(N,E),_(N,E)}function _(N,E){var w=N.nodes().find(I=>!E.node(I).parent),S=a(N,w);S=S.slice(1),S.forEach(I=>{var U=N.node(I).parent,x=E.edge(I,U),A=!1;x||(x=E.edge(U,I),A=!0),E.node(I).rank=E.node(U).rank+(A?x.minlen:-x.minlen)})}function k(N,E,w){return N.hasEdge(E,w)}function C(N,E,w){return w.low<=E.lim&&E.lim<=w.lim}}),KI=Ct((n,t)=>{var r=Ol(),o=r.longestPath,i=Jy(),a=UI();t.exports=s;function s(p){var d=p.graph().ranker;if(d instanceof Function)return d(p);switch(p.graph().ranker){case"network-simplex":u(p);break;case"tight-tree":l(p);break;case"longest-path":c(p);break;case"none":break;default:u(p)}}var c=o;function l(p){o(p),i(p)}function u(p){a(p)}}),qI=Ct((n,t)=>{t.exports=r;function r(a){let s=i(a);a.graph().dummyChains.forEach(c=>{let l=a.node(c),u=l.edgeObj,p=o(a,s,u.v,u.w),d=p.path,f=p.lca,m=0,h=d[m],y=!0;for(;c!==u.w;){if(l=a.node(c),y){for(;(h=d[m])!==f&&a.node(h).maxRank<l.rank;)m++;h===f&&(y=!1)}if(!y){for(;m<d.length-1&&a.node(h=d[m+1]).minRank<=l.rank;)m++;h=d[m]}a.setParent(c,h),c=a.successors(c)[0]}})}function o(a,s,c,l){let u=[],p=[],d=Math.min(s[c].low,s[l].low),f=Math.max(s[c].lim,s[l].lim),m,h;m=c;do m=a.parent(m),u.push(m);while(m&&(s[m].low>d||f>s[m].lim));for(h=m,m=l;(m=a.parent(m))!==h;)p.push(m);return{path:u.concat(p.reverse()),lca:h}}function i(a){let s={},c=0;function l(u){let p=c;a.children(u).forEach(l),s[u]={low:p,lim:c++}}return a.children().forEach(l),s}}),GI=Ct((n,t)=>{var r=Gt();t.exports={run:o,cleanup:c};function o(l){let u=r.addDummyNode(l,"root",{},"_root"),p=a(l),d=Object.values(p),f=r.applyWithChunking(Math.max,d)-1,m=2*f+1;l.graph().nestingRoot=u,l.edges().forEach(y=>l.edge(y).minlen*=m);let h=s(l)+1;l.children().forEach(y=>i(l,u,m,h,f,p,y)),l.graph().nodeRankFactor=m}function i(l,u,p,d,f,m,h){let y=l.children(h);if(!y.length){h!==u&&l.setEdge(u,h,{weight:0,minlen:p});return}let b=r.addBorderNode(l,"_bt"),_=r.addBorderNode(l,"_bb"),k=l.node(h);l.setParent(b,h),k.borderTop=b,l.setParent(_,h),k.borderBottom=_,y.forEach(C=>{i(l,u,p,d,f,m,C);let N=l.node(C),E=N.borderTop?N.borderTop:C,w=N.borderBottom?N.borderBottom:C,S=N.borderTop?d:2*d,I=E!==w?1:f-m[h]+1;l.setEdge(b,E,{weight:S,minlen:I,nestingEdge:!0}),l.setEdge(w,_,{weight:S,minlen:I,nestingEdge:!0})}),l.parent(h)||l.setEdge(u,b,{weight:0,minlen:f+m[h]})}function a(l){var u={};function p(d,f){var m=l.children(d);m&&m.length&&m.forEach(h=>p(h,f+1)),u[d]=f}return l.children().forEach(d=>p(d,1)),u}function s(l){return l.edges().reduce((u,p)=>u+l.edge(p).weight,0)}function c(l){var u=l.graph();l.removeNode(u.nestingRoot),delete u.nestingRoot,l.edges().forEach(p=>{var d=l.edge(p);d.nestingEdge&&l.removeEdge(p)})}}),HI=Ct((n,t)=>{var r=Gt();t.exports=o;function o(a){function s(c){let l=a.children(c),u=a.node(c);if(l.length&&l.forEach(s),Object.hasOwn(u,"minRank")){u.borderLeft=[],u.borderRight=[];for(let p=u.minRank,d=u.maxRank+1;p<d;++p)i(a,"borderLeft","_bl",c,u,p),i(a,"borderRight","_br",c,u,p)}}a.children().forEach(s)}function i(a,s,c,l,u,p){let d={width:0,height:0,rank:p,borderType:s},f=u[s][p-1],m=r.addDummyNode(a,"border",d,c);u[s][p]=m,a.setParent(m,l),f&&a.setEdge(f,m,{weight:1})}}),zI=Ct((n,t)=>{t.exports={adjust:r,undo:o};function r(p){let d=p.graph().rankdir.toLowerCase();(d==="lr"||d==="rl")&&i(p)}function o(p){let d=p.graph().rankdir.toLowerCase();(d==="bt"||d==="rl")&&s(p),(d==="lr"||d==="rl")&&(l(p),i(p))}function i(p){p.nodes().forEach(d=>a(p.node(d))),p.edges().forEach(d=>a(p.edge(d)))}function a(p){let d=p.width;p.width=p.height,p.height=d}function s(p){p.nodes().forEach(d=>c(p.node(d))),p.edges().forEach(d=>{let f=p.edge(d);f.points.forEach(c),Object.hasOwn(f,"y")&&c(f)})}function c(p){p.y=-p.y}function l(p){p.nodes().forEach(d=>u(p.node(d))),p.edges().forEach(d=>{let f=p.edge(d);f.points.forEach(u),Object.hasOwn(f,"x")&&u(f)})}function u(p){let d=p.x;p.x=p.y,p.y=d}}),WI=Ct((n,t)=>{var r=Gt();t.exports=o;function o(i){let a={},s=i.nodes().filter(d=>!i.children(d).length),c=s.map(d=>i.node(d).rank),l=r.applyWithChunking(Math.max,c),u=r.range(l+1).map(()=>[]);function p(d){if(a[d])return;a[d]=!0;let f=i.node(d);u[f.rank].push(d),i.successors(d).forEach(p)}return s.sort((d,f)=>i.node(d).rank-i.node(f).rank).forEach(p),u}}),YI=Ct((n,t)=>{var r=Gt().zipObject;t.exports=o;function o(a,s){let c=0;for(let l=1;l<s.length;++l)c+=i(a,s[l-1],s[l]);return c}function i(a,s,c){let l=r(c,c.map((h,y)=>y)),u=s.flatMap(h=>a.outEdges(h).map(y=>({pos:l[y.w],weight:a.edge(y).weight})).sort((y,b)=>y.pos-b.pos)),p=1;for(;p<c.length;)p<<=1;let d=2*p-1;p-=1;let f=new Array(d).fill(0),m=0;return u.forEach(h=>{let y=h.pos+p;f[y]+=h.weight;let b=0;for(;y>0;)y%2&&(b+=f[y+1]),y=y-1>>1,f[y]+=h.weight;m+=h.weight*b}),m}}),JI=Ct((n,t)=>{t.exports=r;function r(o,i=[]){return i.map(a=>{let s=o.inEdges(a);if(s.length){let c=s.reduce((l,u)=>{let p=o.edge(u),d=o.node(u.v);return{sum:l.sum+p.weight*d.order,weight:l.weight+p.weight}},{sum:0,weight:0});return{v:a,barycenter:c.sum/c.weight,weight:c.weight}}else return{v:a}})}}),XI=Ct((n,t)=>{var r=Gt();t.exports=o;function o(s,c){let l={};s.forEach((p,d)=>{let f=l[p.v]={indegree:0,in:[],out:[],vs:[p.v],i:d};p.barycenter!==void 0&&(f.barycenter=p.barycenter,f.weight=p.weight)}),c.edges().forEach(p=>{let d=l[p.v],f=l[p.w];d!==void 0&&f!==void 0&&(f.indegree++,d.out.push(l[p.w]))});let u=Object.values(l).filter(p=>!p.indegree);return i(u)}function i(s){let c=[];function l(p){return d=>{d.merged||(d.barycenter===void 0||p.barycenter===void 0||d.barycenter>=p.barycenter)&&a(p,d)}}function u(p){return d=>{d.in.push(p),--d.indegree===0&&s.push(d)}}for(;s.length;){let p=s.pop();c.push(p),p.in.reverse().forEach(l(p)),p.out.forEach(u(p))}return c.filter(p=>!p.merged).map(p=>r.pick(p,["vs","i","barycenter","weight"]))}function a(s,c){let l=0,u=0;s.weight&&(l+=s.barycenter*s.weight,u+=s.weight),c.weight&&(l+=c.barycenter*c.weight,u+=c.weight),s.vs=c.vs.concat(s.vs),s.barycenter=l/u,s.weight=u,s.i=Math.min(c.i,s.i),c.merged=!0}}),ZI=Ct((n,t)=>{var r=Gt();t.exports=o;function o(s,c){let l=r.partition(s,b=>Object.hasOwn(b,"barycenter")),u=l.lhs,p=l.rhs.sort((b,_)=>_.i-b.i),d=[],f=0,m=0,h=0;u.sort(a(!!c)),h=i(d,p,h),u.forEach(b=>{h+=b.vs.length,d.push(b.vs),f+=b.barycenter*b.weight,m+=b.weight,h=i(d,p,h)});let y={vs:d.flat(!0)};return m&&(y.barycenter=f/m,y.weight=m),y}function i(s,c,l){let u;for(;c.length&&(u=c[c.length-1]).i<=l;)c.pop(),s.push(u.vs),l++;return l}function a(s){return(c,l)=>c.barycenter<l.barycenter?-1:c.barycenter>l.barycenter?1:s?l.i-c.i:c.i-l.i}}),QI=Ct((n,t)=>{var r=JI(),o=XI(),i=ZI();t.exports=a;function a(l,u,p,d){let f=l.children(u),m=l.node(u),h=m?m.borderLeft:void 0,y=m?m.borderRight:void 0,b={};h&&(f=f.filter(N=>N!==h&&N!==y));let _=r(l,f);_.forEach(N=>{if(l.children(N.v).length){let E=a(l,N.v,p,d);b[N.v]=E,Object.hasOwn(E,"barycenter")&&c(N,E)}});let k=o(_,p);s(k,b);let C=i(k,d);if(h&&(C.vs=[h,C.vs,y].flat(!0),l.predecessors(h).length)){let N=l.node(l.predecessors(h)[0]),E=l.node(l.predecessors(y)[0]);Object.hasOwn(C,"barycenter")||(C.barycenter=0,C.weight=0),C.barycenter=(C.barycenter*C.weight+N.order+E.order)/(C.weight+2),C.weight+=2}return C}function s(l,u){l.forEach(p=>{p.vs=p.vs.flatMap(d=>u[d]?u[d].vs:d)})}function c(l,u){l.barycenter!==void 0?(l.barycenter=(l.barycenter*l.weight+u.barycenter*u.weight)/(l.weight+u.weight),l.weight+=u.weight):(l.barycenter=u.barycenter,l.weight=u.weight)}}),eB=Ct((n,t)=>{var r=Xn().Graph,o=Gt();t.exports=i;function i(s,c,l,u){u||(u=s.nodes());let p=a(s),d=new r({compound:!0}).setGraph({root:p}).setDefaultNodeLabel(f=>s.node(f));return u.forEach(f=>{let m=s.node(f),h=s.parent(f);(m.rank===c||m.minRank<=c&&c<=m.maxRank)&&(d.setNode(f),d.setParent(f,h||p),s[l](f).forEach(y=>{let b=y.v===f?y.w:y.v,_=d.edge(b,f),k=_!==void 0?_.weight:0;d.setEdge(b,f,{weight:s.edge(y).weight+k})}),Object.hasOwn(m,"minRank")&&d.setNode(f,{borderLeft:m.borderLeft[c],borderRight:m.borderRight[c]}))}),d}function a(s){for(var c;s.hasNode(c=o.uniqueId("_root")););return c}}),tB=Ct((n,t)=>{t.exports=r;function r(o,i,a){let s={},c;a.forEach(l=>{let u=o.parent(l),p,d;for(;u;){if(p=o.parent(u),p?(d=s[p],s[p]=u):(d=c,c=u),d&&d!==u){i.setEdge(d,u);return}u=p}})}}),nB=Ct((n,t)=>{var r=WI(),o=YI(),i=QI(),a=eB(),s=tB(),c=Xn().Graph,l=Gt();t.exports=u;function u(m,h={}){if(typeof h.customOrder=="function"){h.customOrder(m,u);return}let y=l.maxRank(m),b=p(m,l.range(1,y+1),"inEdges"),_=p(m,l.range(y-1,-1,-1),"outEdges"),k=r(m);if(f(m,k),h.disableOptimalOrderHeuristic)return;let C=Number.POSITIVE_INFINITY,N,E=h.constraints||[];for(let w=0,S=0;S<4;++w,++S){d(w%2?b:_,w%4>=2,E),k=l.buildLayerMatrix(m);let I=o(m,k);I<C?(S=0,N=Object.assign({},k),C=I):I===C&&(N=structuredClone(k))}f(m,N)}function p(m,h,y){let b=new Map,_=(k,C)=>{b.has(k)||b.set(k,[]),b.get(k).push(C)};for(let k of m.nodes()){let C=m.node(k);if(typeof C.rank=="number"&&_(C.rank,k),typeof C.minRank=="number"&&typeof C.maxRank=="number")for(let N=C.minRank;N<=C.maxRank;N++)N!==C.rank&&_(N,k)}return h.map(function(k){return a(m,k,y,b.get(k)||[])})}function d(m,h,y){let b=new c;m.forEach(function(_){y.forEach(N=>b.setEdge(N.left,N.right));let k=_.graph().root,C=i(_,k,b,h);C.vs.forEach((N,E)=>_.node(N).order=E),s(_,b,C.vs)})}function f(m,h){Object.values(h).forEach(y=>y.forEach((b,_)=>m.node(b).order=_))}}),rB=Ct((n,t)=>{var r=Xn().Graph,o=Gt();t.exports={positionX:y,findType1Conflicts:i,findType2Conflicts:a,addConflict:c,hasConflict:l,verticalAlignment:u,horizontalCompaction:p,alignCoordinates:m,findSmallestWidthAlignment:f,balance:h};function i(k,C){let N={};function E(w,S){let I=0,U=0,x=w.length,A=S[S.length-1];return S.forEach((T,V)=>{let R=s(k,T),X=R?k.node(R).order:x;(R||T===A)&&(S.slice(U,V+1).forEach(Y=>{k.predecessors(Y).forEach(ne=>{let M=k.node(ne),te=M.order;(te<I||X<te)&&!(M.dummy&&k.node(Y).dummy)&&c(N,ne,Y)})}),U=V+1,I=X)}),S}return C.length&&C.reduce(E),N}function a(k,C){let N={};function E(S,I,U,x,A){let T;o.range(I,U).forEach(V=>{T=S[V],k.node(T).dummy&&k.predecessors(T).forEach(R=>{let X=k.node(R);X.dummy&&(X.order<x||X.order>A)&&c(N,R,T)})})}function w(S,I){let U=-1,x,A=0;return I.forEach((T,V)=>{if(k.node(T).dummy==="border"){let R=k.predecessors(T);R.length&&(x=k.node(R[0]).order,E(I,A,V,U,x),A=V,U=x)}E(I,A,I.length,x,S.length)}),I}return C.length&&C.reduce(w),N}function s(k,C){if(k.node(C).dummy)return k.predecessors(C).find(N=>k.node(N).dummy)}function c(k,C,N){if(C>N){let w=C;C=N,N=w}let E=k[C];E||(k[C]=E={}),E[N]=!0}function l(k,C,N){if(C>N){let E=C;C=N,N=E}return!!k[C]&&Object.hasOwn(k[C],N)}function u(k,C,N,E){let w={},S={},I={};return C.forEach(U=>{U.forEach((x,A)=>{w[x]=x,S[x]=x,I[x]=A})}),C.forEach(U=>{let x=-1;U.forEach(A=>{let T=E(A);if(T.length){T=T.sort((R,X)=>I[R]-I[X]);let V=(T.length-1)/2;for(let R=Math.floor(V),X=Math.ceil(V);R<=X;++R){let Y=T[R];S[A]===A&&x<I[Y]&&!l(N,A,Y)&&(S[Y]=A,S[A]=w[A]=w[Y],x=I[Y])}}})}),{root:w,align:S}}function p(k,C,N,E,w){let S={},I=d(k,C,N,w),U=w?"borderLeft":"borderRight";function x(V,R){let X=I.nodes().slice(),Y={},ne=X.pop();for(;ne;){if(Y[ne])V(ne);else{Y[ne]=!0,X.push(ne);for(let M of R(ne))X.push(M)}ne=X.pop()}}function A(V){S[V]=I.inEdges(V).reduce((R,X)=>Math.max(R,S[X.v]+I.edge(X)),0)}function T(V){let R=I.outEdges(V).reduce((Y,ne)=>Math.min(Y,S[ne.w]-I.edge(ne)),Number.POSITIVE_INFINITY),X=k.node(V);R!==Number.POSITIVE_INFINITY&&X.borderType!==U&&(S[V]=Math.max(S[V],R))}return x(A,I.predecessors.bind(I)),x(T,I.successors.bind(I)),Object.keys(E).forEach(V=>S[V]=S[N[V]]),S}function d(k,C,N,E){let w=new r,S=k.graph(),I=b(S.nodesep,S.edgesep,E);return C.forEach(U=>{let x;U.forEach(A=>{let T=N[A];if(w.setNode(T),x){var V=N[x],R=w.edge(V,T);w.setEdge(V,T,Math.max(I(k,A,x),R||0))}x=A})}),w}function f(k,C){return Object.values(C).reduce((N,E)=>{let w=Number.NEGATIVE_INFINITY,S=Number.POSITIVE_INFINITY;Object.entries(E).forEach(([U,x])=>{let A=_(k,U)/2;w=Math.max(x+A,w),S=Math.min(x-A,S)});let I=w-S;return I<N[0]&&(N=[I,E]),N},[Number.POSITIVE_INFINITY,null])[1]}function m(k,C){let N=Object.values(C),E=o.applyWithChunking(Math.min,N),w=o.applyWithChunking(Math.max,N);["u","d"].forEach(S=>{["l","r"].forEach(I=>{let U=S+I,x=k[U];if(x===C)return;let A=Object.values(x),T=E-o.applyWithChunking(Math.min,A);I!=="l"&&(T=w-o.applyWithChunking(Math.max,A)),T&&(k[U]=o.mapValues(x,V=>V+T))})})}function h(k,C){return o.mapValues(k.ul,(N,E)=>{if(C)return k[C.toLowerCase()][E];{let w=Object.values(k).map(S=>S[E]).sort((S,I)=>S-I);return(w[1]+w[2])/2}})}function y(k){let C=o.buildLayerMatrix(k),N=Object.assign(i(k,C),a(k,C)),E={},w;["u","d"].forEach(I=>{w=I==="u"?C:Object.values(C).reverse(),["l","r"].forEach(U=>{U==="r"&&(w=w.map(V=>Object.values(V).reverse()));let x=(I==="u"?k.predecessors:k.successors).bind(k),A=u(k,w,N,x),T=p(k,w,A.root,A.align,U==="r");U==="r"&&(T=o.mapValues(T,V=>-V)),E[I+U]=T})});let S=f(k,E);return m(E,S),h(E,k.graph().align)}function b(k,C,N){return(E,w,S)=>{let I=E.node(w),U=E.node(S),x=0,A;if(x+=I.width/2,Object.hasOwn(I,"labelpos"))switch(I.labelpos.toLowerCase()){case"l":A=-I.width/2;break;case"r":A=I.width/2;break}if(A&&(x+=N?A:-A),A=0,x+=(I.dummy?C:k)/2,x+=(U.dummy?C:k)/2,x+=U.width/2,Object.hasOwn(U,"labelpos"))switch(U.labelpos.toLowerCase()){case"l":A=U.width/2;break;case"r":A=-U.width/2;break}return A&&(x+=N?A:-A),A=0,x}}function _(k,C){return k.node(C).width}}),oB=Ct((n,t)=>{var r=Gt(),o=rB().positionX;t.exports=i;function i(s){s=r.asNonCompoundGraph(s),a(s),Object.entries(o(s)).forEach(([c,l])=>s.node(c).x=l)}function a(s){let c=r.buildLayerMatrix(s),l=s.graph().ranksep,u=s.graph().rankalign,p=0;c.forEach(d=>{let f=d.reduce((m,h)=>{let y=s.node(h).height;return m>y?m:y},0);d.forEach(m=>{let h=s.node(m);u==="top"?h.y=p+h.height/2:u==="bottom"?h.y=p+f-h.height/2:h.y=p+f/2}),p+=f+l})}}),iB=Ct((n,t)=>{var r=jI(),o=FI(),i=KI(),a=Gt().normalizeRanks,s=qI(),c=Gt().removeEmptyRanks,l=GI(),u=HI(),p=zI(),d=nB(),f=oB(),m=Gt(),h=Xn().Graph;t.exports=y;function y(v,q={}){let ie=q.debugTiming?m.time:m.notime;return ie("layout",()=>{let oe=ie(" buildLayoutGraph",()=>x(v));return ie(" runLayout",()=>b(oe,ie,q)),ie(" updateInputGraph",()=>_(v,oe)),oe})}function b(v,q,ie){q(" makeSpaceForEdgeLabels",()=>A(v)),q(" removeSelfEdges",()=>$(v)),q(" acyclic",()=>r.run(v)),q(" nestingGraph.run",()=>l.run(v)),q(" rank",()=>i(m.asNonCompoundGraph(v))),q(" injectEdgeLabelProxies",()=>T(v)),q(" removeEmptyRanks",()=>c(v)),q(" nestingGraph.cleanup",()=>l.cleanup(v)),q(" normalizeRanks",()=>a(v)),q(" assignRankMinMax",()=>V(v)),q(" removeEdgeLabelProxies",()=>R(v)),q(" normalize.run",()=>o.run(v)),q(" parentDummyChains",()=>s(v)),q(" addBorderSegments",()=>u(v)),q(" order",()=>d(v,ie)),q(" insertSelfEdges",()=>Z(v)),q(" adjustCoordinateSystem",()=>p.adjust(v)),q(" position",()=>f(v)),q(" positionSelfEdges",()=>F(v)),q(" removeBorderNodes",()=>te(v)),q(" normalize.undo",()=>o.undo(v)),q(" fixupEdgeLabelCoords",()=>ne(v)),q(" undoCoordinateSystem",()=>p.undo(v)),q(" translateGraph",()=>X(v)),q(" assignNodeIntersects",()=>Y(v)),q(" reversePoints",()=>M(v)),q(" acyclic.undo",()=>r.undo(v))}function _(v,q){v.nodes().forEach(ie=>{let oe=v.node(ie),ke=q.node(ie);oe&&(oe.x=ke.x,oe.y=ke.y,oe.order=ke.order,oe.rank=ke.rank,q.children(ie).length&&(oe.width=ke.width,oe.height=ke.height))}),v.edges().forEach(ie=>{let oe=v.edge(ie),ke=q.edge(ie);oe.points=ke.points,Object.hasOwn(ke,"x")&&(oe.x=ke.x,oe.y=ke.y)}),v.graph().width=q.graph().width,v.graph().height=q.graph().height}var k=["nodesep","edgesep","ranksep","marginx","marginy"],C={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb",rankalign:"center"},N=["acyclicer","ranker","rankdir","align","rankalign"],E=["width","height","rank"],w={width:0,height:0},S=["minlen","weight","width","height","labeloffset"],I={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},U=["labelpos"];function x(v){let q=new h({multigraph:!0,compound:!0}),ie=G(v.graph());return q.setGraph(Object.assign({},C,J(ie,k),m.pick(ie,N))),v.nodes().forEach(oe=>{let ke=G(v.node(oe)),ye=J(ke,E);Object.keys(w).forEach(ce=>{ye[ce]===void 0&&(ye[ce]=w[ce])}),q.setNode(oe,ye),q.setParent(oe,v.parent(oe))}),v.edges().forEach(oe=>{let ke=G(v.edge(oe));q.setEdge(oe,Object.assign({},I,J(ke,S),m.pick(ke,U)))}),q}function A(v){let q=v.graph();q.ranksep/=2,v.edges().forEach(ie=>{let oe=v.edge(ie);oe.minlen*=2,oe.labelpos.toLowerCase()!=="c"&&(q.rankdir==="TB"||q.rankdir==="BT"?oe.width+=oe.labeloffset:oe.height+=oe.labeloffset)})}function T(v){v.edges().forEach(q=>{let ie=v.edge(q);if(ie.width&&ie.height){let oe=v.node(q.v),ke={rank:(v.node(q.w).rank-oe.rank)/2+oe.rank,e:q};m.addDummyNode(v,"edge-proxy",ke,"_ep")}})}function V(v){let q=0;v.nodes().forEach(ie=>{let oe=v.node(ie);oe.borderTop&&(oe.minRank=v.node(oe.borderTop).rank,oe.maxRank=v.node(oe.borderBottom).rank,q=Math.max(q,oe.maxRank))}),v.graph().maxRank=q}function R(v){v.nodes().forEach(q=>{let ie=v.node(q);ie.dummy==="edge-proxy"&&(v.edge(ie.e).labelRank=ie.rank,v.removeNode(q))})}function X(v){let q=Number.POSITIVE_INFINITY,ie=0,oe=Number.POSITIVE_INFINITY,ke=0,ye=v.graph(),ce=ye.marginx||0,he=ye.marginy||0;function Oe(De){let Be=De.x,qe=De.y,We=De.width,nt=De.height;q=Math.min(q,Be-We/2),ie=Math.max(ie,Be+We/2),oe=Math.min(oe,qe-nt/2),ke=Math.max(ke,qe+nt/2)}v.nodes().forEach(De=>Oe(v.node(De))),v.edges().forEach(De=>{let Be=v.edge(De);Object.hasOwn(Be,"x")&&Oe(Be)}),q-=ce,oe-=he,v.nodes().forEach(De=>{let Be=v.node(De);Be.x-=q,Be.y-=oe}),v.edges().forEach(De=>{let Be=v.edge(De);Be.points.forEach(qe=>{qe.x-=q,qe.y-=oe}),Object.hasOwn(Be,"x")&&(Be.x-=q),Object.hasOwn(Be,"y")&&(Be.y-=oe)}),ye.width=ie-q+ce,ye.height=ke-oe+he}function Y(v){v.edges().forEach(q=>{let ie=v.edge(q),oe=v.node(q.v),ke=v.node(q.w),ye,ce;ie.points?(ye=ie.points[0],ce=ie.points[ie.points.length-1]):(ie.points=[],ye=ke,ce=oe),ie.points.unshift(m.intersectRect(oe,ye)),ie.points.push(m.intersectRect(ke,ce))})}function ne(v){v.edges().forEach(q=>{let ie=v.edge(q);if(Object.hasOwn(ie,"x"))switch((ie.labelpos==="l"||ie.labelpos==="r")&&(ie.width-=ie.labeloffset),ie.labelpos){case"l":ie.x-=ie.width/2+ie.labeloffset;break;case"r":ie.x+=ie.width/2+ie.labeloffset;break}})}function M(v){v.edges().forEach(q=>{let ie=v.edge(q);ie.reversed&&ie.points.reverse()})}function te(v){v.nodes().forEach(q=>{if(v.children(q).length){let ie=v.node(q),oe=v.node(ie.borderTop),ke=v.node(ie.borderBottom),ye=v.node(ie.borderLeft[ie.borderLeft.length-1]),ce=v.node(ie.borderRight[ie.borderRight.length-1]);ie.width=Math.abs(ce.x-ye.x),ie.height=Math.abs(ke.y-oe.y),ie.x=ye.x+ie.width/2,ie.y=oe.y+ie.height/2}}),v.nodes().forEach(q=>{v.node(q).dummy==="border"&&v.removeNode(q)})}function $(v){v.edges().forEach(q=>{if(q.v===q.w){var ie=v.node(q.v);ie.selfEdges||(ie.selfEdges=[]),ie.selfEdges.push({e:q,label:v.edge(q)}),v.removeEdge(q)}})}function Z(v){var q=m.buildLayerMatrix(v);q.forEach(ie=>{var oe=0;ie.forEach((ke,ye)=>{var ce=v.node(ke);ce.order=ye+oe,(ce.selfEdges||[]).forEach(he=>{m.addDummyNode(v,"selfedge",{width:he.label.width,height:he.label.height,rank:ce.rank,order:ye+ ++oe,e:he.e,label:he.label},"_se")}),delete ce.selfEdges})})}function F(v){v.nodes().forEach(q=>{var ie=v.node(q);if(ie.dummy==="selfedge"){var oe=v.node(ie.e.v),ke=oe.x+oe.width/2,ye=oe.y,ce=ie.x-ke,he=oe.height/2;v.setEdge(ie.e,ie.label),v.removeNode(q),ie.label.points=[{x:ke+2*ce/3,y:ye-he},{x:ke+5*ce/6,y:ye-he},{x:ke+ce,y:ye},{x:ke+5*ce/6,y:ye+he},{x:ke+2*ce/3,y:ye+he}],ie.label.x=ie.x,ie.label.y=ie.y}})}function J(v,q){return m.mapValues(m.pick(v,q),Number)}function G(v){var q={};return v&&Object.entries(v).forEach(([ie,oe])=>{typeof ie=="string"&&(ie=ie.toLowerCase()),q[ie]=oe}),q}}),aB=Ct((n,t)=>{var r=Gt(),o=Xn().Graph;t.exports={debugOrdering:i};function i(a){let s=r.buildLayerMatrix(a),c=new o({compound:!0,multigraph:!0}).setGraph({});return a.nodes().forEach(l=>{c.setNode(l,{label:l}),c.setParent(l,"layer"+a.node(l).rank)}),a.edges().forEach(l=>c.setEdge(l.v,l.w,{},l.name)),s.forEach((l,u)=>{let p="layer"+u;c.setNode(p,{rank:"same"}),l.reduce((d,f)=>(c.setEdge(d,f,{style:"invis"}),f))}),c}}),sB=Ct((n,t)=>{t.exports="2.0.4"}),lB=Ct((n,t)=>{t.exports={graphlib:Xn(),layout:iB(),debug:aB(),util:{time:Gt().time,notime:Gt().notime},version:sB()}});const Xy=lB();/*! For license information please see dagre.esm.js.LEGAL.txt */function cB(n){return n.map(({source:t,target:r})=>({source:t,target:r}))}function uB(n){const t=[];for(const r of n)for(const o of r.memberIds)t.push({source:r.ownerId,target:o});return t}function Zy(n,t){return[...cB(n),...uB(t)]}function Pl(n,t){const r=new Map;for(const{source:o,target:i}of n)r.has(o)||r.set(o,[]),r.get(o).push(i),r.has(i)||r.set(i,[]);return t&&(r.has(t.source)||r.set(t.source,[]),r.get(t.source).push(t.target),r.has(t.target)||r.set(t.target,[])),r}function lf(n){const t=new Set,r=new Set;function o(i){if(r.has(i))return!0;if(t.has(i))return!1;t.add(i),r.add(i);for(const a of n.get(i)??[])if(o(a))return!0;return r.delete(i),!1}for(const i of n.keys())if(o(i))return!0;return!1}function cf(n,t){const r=n.config;if(!r)return[];const o=r[t];return Array.isArray(o)?o.filter(i=>typeof i=="string"&&nf(i)):[]}function dB({state:n,groupMapById:t,getNodeById:r,history:o}){const i=e.computed(()=>{const A=new Map;for(const T of n.value.groups)for(const V of T.memberIds)A.set(V,{ownerId:T.ownerId,branch:T.branch});return A}),a=e.computed(()=>{const A=new Map;for(const T of n.value.groups)for(const V of T.memberIds)A.set(V,T);return A}),s=e.computed(()=>{const A=new Map;for(const T of n.value.groups)A.has(T.ownerId)||A.set(T.ownerId,[]),A.get(T.ownerId).push(T);return A}),c=e.computed(()=>Zy(n.value.edges,n.value.groups)),l=e.computed(()=>Pl(c.value));function u(A,T){return A?$a(A.type).includes(T):!1}function p(A,T){if(T===A.id)return!1;const V=r(T);return!(!V||mn(V.type)||V.phase!==A.phase)}function d(A,T){const V=[],R=new Set;for(const X of T)R.has(X)||(R.add(X),p(A,X)&&V.push(X));return V}function f(A,T,V){const R=r(A);return u(R,T)?d(R,V):[]}function m(A,T,V){const R=af(A.id,T),X=t.value.get(R);V.length>0?X?(X.phase!==A.phase&&(X.phase=A.phase),rf(X.memberIds,V)||(X.position=void 0,X.dimensions=void 0,X.memberIds=[...V])):n.value.groups.push(Wy(A.id,T,A.phase,V)):X&&(n.value.groups=n.value.groups.filter(Y=>Y.id!==R))}function h(A,T,V,R={}){const X=r(A);if(!u(X,T))return!1;const Y=d(X,V),ne=cf(X,T);if(rf(ne,Y))return!1;const M=X.config??(X.config={});return Y.length>0?M[T]=[...Y]:(delete M[T],Object.keys(M).length===0&&delete X.config),m(X,T,Y),(R.commit??!0)&&o.commit(R.tag),!0}function y(A,T={}){const V=n.value.groups.filter(R=>R.ownerId!==A);return V.length===n.value.groups.length?!1:(n.value.groups=V,(T.commit??!0)&&o.commit(T.tag),!0)}function b(A,T){const V=t.value.get(af(A,T));if(V)return[...V.memberIds];const R=r(A);return R?cf(R,T):[]}function _(A){return i.value.get(A)}function k(A){const T=[];let V=a.value.get(A);for(;V;)T.push(V.id),V=a.value.get(V.ownerId);return T}function C(A,T){const V=k(T);if(V.length===0)return!1;const R=new Set(k(A));return R.size===0?!0:V.some(X=>!R.has(X))}function N(A,T){if(A===T)return!0;const V=new Set,R=[T];for(;R.length>0;){const X=R.pop();if(V.has(X))continue;if(V.add(X),X===A)return!0;const Y=l.value.get(X);if(Y)for(const ne of Y)V.has(ne)||R.push(ne)}return!1}function E(A,T,V){const R=r(A);return!(!u(R,T)||!p(R,V)||N(A,V))}function w(A,T,V,R={}){const X=r(A);if(!X||!E(A,T,V))return!1;const Y=cf(X,T);if(Y.includes(V))return!1;S(V,{commit:!1});const ne=[...Y,V];return h(A,T,ne,{commit:!1})?((R.commit??!0)&&o.commit(R.tag),!0):!1}function S(A,T={}){const V=_(A);if(!V)return!1;const R=b(V.ownerId,V.branch),X=R.filter(Y=>Y!==A);return X.length===R.length?!1:h(V.ownerId,V.branch,X,T)}function I(A){let T=0;const V=new Set;let R=a.value.get(A);for(;R&&!V.has(R.id);)T+=1,V.add(R.id),R=a.value.get(R.ownerId);return T}function U(A){const T=t.value.get(A);return T?I(T.ownerId):0}function x(A){return A?t.value.has(A):!1}return{memberGroupMap:a,groupsByOwner:s,findMembership:_,getMembers:b,wouldCreateCycle:N,setMembers:h,prepareMembers:f,addMember:w,removeMember:S,clear:y,getNodeDepth:I,getGroupDepth:U,isGroupId:x,isEdgeEnteringGroup:C,canAddMember:E}}function fB(n,t){const{commit:r,undo:o,redo:i,canUndo:a,canRedo:s,clear:c,reset:l,undoStack:u,redoStack:p}=Pt.useManualRefHistory(n,{capacity:t==null?void 0:t.capacity,clone:t==null?void 0:t.clone});let d;function f(C){var N;(N=t==null?void 0:t.onHistoryChange)==null||N.call(t,C,n.value)}function m(C){if(!C){d=void 0,r(),f("commit");return}if(C!=="*"&&d!==C){d=C,r(),f("commit");return}r(),u.value.shift(),f("commit")}function h(){o(),d=void 0,f("undo")}function y(){i(),d=void 0,f("redo")}function b(){c(),d=void 0,f("clear")}function _(){l(),d=void 0,f("reset")}function k(){o(),p.value.shift(),d=void 0,f("revert")}return{canUndo:a,canRedo:s,commit:m,undo:h,redo:y,clear:b,reset:_,revert:k}}function pB(n){var t,r;return((r=(t=n.config)==null?void 0:t.resources)==null?void 0:r.vault)||{}}function mB(n){const{resources:t}=n.config||{};return t!=null&&t.vault?Object.keys(t.vault):[]}function gB(n){const t=Object.entries(n);if(t.length===0)return;const r={};for(const[o,i]of t)r[o]=i;return r}function Qy(n,t){var b,_,k,C,N,E,w;const r=((b=n.config)==null?void 0:b.nodes)??[],o=((_=n.__ui_data)==null?void 0:_.nodes)??[],i=((k=n.__ui_data)==null?void 0:k.groups)??[],a=new Map(o.map(S=>[S.name,S])),s=new Map(i.map(S=>[S.name,S])),c=[],l=[],u=new Map,p=[],d=[],f=new Map,m=S=>{const I=new Set,U=[...S];for(;U.length>0;){const x=U.shift();if(!I.has(x)&&(I.add(x),tf(x)||(u.get(x).phase="request"),!!f.has(x)))for(const A of f.get(x))I.has(A)||U.push(A)}};let h=!1;for(const S of r){const I=a.get(S.name);!I&&!h&&(h=!0);const U=t_({type:S.type,configNode:S,uiNode:I,pluginData:n});c.push(U),u.set(U.name,U)}for(const S of c){const I=$a(S.type);if(!I.length)continue;const U=S.config;if(U)for(const x of I){const A=U[x];if(!Array.isArray(A)){s.has(Bl(S.name,x))&&(h=!0);continue}const T=[];for(const V of A){if(typeof V!="string")continue;const R=u.get(V);R&&!mn(R.type)&&T.push(R.id)}if(T.length){U[x]=T;const V=Bl(S.name,x),R=s.get(V),X=R?{position:Tr(R.position)}:void 0,Y=Wy(S.id,x,S.phase,T,X);p.push(Y),!R&&!h&&(h=!0)}else delete U[x],s.has(Bl(S.name,x))&&(h=!0)}}for(const S of ii)if(!u.has(S)){let I=a.get(S);I||(h||(h=!0),I=RI(S));const U=t_({type:S,uiNode:I,pluginData:n});c.push(U),u.set(U.name,U)}for(const S of r)_B(S,d);for(const S of d){const I=u.get(S.source),U=u.get(S.target);if(!I||!U){I||console.warn(`[initEditorState] skip: source "${S.source}" not found`),U||console.warn(`[initEditorState] skip: target "${S.target}" not found`);continue}f.has(S.source)||f.set(S.source,new Set),f.get(S.source).add(S.target),f.has(S.target)||f.set(S.target,new Set),f.get(S.target).add(S.source),l.push({id:li("edge"),source:I.id,sourceField:(C=Zr(I,"output",S.sourceField))==null?void 0:C.id,target:U.id,targetField:(N=Zr(U,"input",S.targetField))==null?void 0:N.id})}m(["request","service_request"]);let y=null;return(w=(E=n.config)==null?void 0:E.resources)!=null&&w.cache&&(y={...n.config.resources.cache},n.partials&&(y.partial_id=n.partials[0].id)),{nodes:c,edges:l,groups:p,pendingLayout:h?t?"keepHistory":"clearHistory":!1,pendingFitView:!0,...y?{cacheConfig:y}:{}}}function e_(n){const{type:t,name:r,phase:o,position:i,fields:a,config:s}=n,c=qy(t),l=ci(t);return{id:li("node"),type:t,name:r??t,phase:o??"request",position:i??{x:0,y:0},expanded:{},fields:{input:Gy((a==null?void 0:a.input)??c.input),output:Gy((a==null?void 0:a.output)??c.output)},hidden:n.hidden||l.hidden,config:s?Tr(s):{}}}function hB(n){return mn(n)?n==="request"||n==="service_request"?"request":"response":"request"}function t_({type:n,configNode:t,uiNode:r,pluginData:o}){return e_({type:n,name:t==null?void 0:t.name,phase:(r==null?void 0:r.phase)??hB(n),position:r==null?void 0:r.position,fields:bB({type:n,uiNode:r,configNode:t,pluginData:o}),hidden:r==null?void 0:r.hidden,config:wB({type:n,configNode:t,pluginData:o})})}function yB(n){const{type:t,name:r,input:o,inputs:i,output:a,outputs:s,...c}=n;return Tr(c)}function _B(n,t){const r=n.name;if(n.input){const{nodeName:o,fieldName:i}=Il(n.input);o&&t.push({source:o,sourceField:i,target:r})}if(n.inputs)for(const[o,i]of Object.entries(n.inputs)){if(!i)continue;const{nodeName:a,fieldName:s}=Il(i);a&&t.push({source:a,sourceField:s,target:r,targetField:o})}if(n.output){const{nodeName:o,fieldName:i}=Il(n.output);o&&t.push({source:r,target:o,targetField:i})}if(n.outputs)for(const[o,i]of Object.entries(n.outputs)){if(!i)continue;const{nodeName:a,fieldName:s}=Il(i);a&&t.push({source:r,sourceField:o,target:a,targetField:s})}}function bB({type:n,uiNode:t,configNode:r,pluginData:o}){var c,l,u,p;const i=ci(n),a=i==null?void 0:i.io;if(!a)return;const s={};if((c=a.input)!=null&&c.configurable&&(t?s.input=((l=t.fields)==null?void 0:l.input)??[]:r!=null&&r.inputs&&(s.input=Object.keys(r.inputs))),(u=a.output)!=null&&u.configurable){if(t)s.output=((p=t.fields)==null?void 0:p.output)??[];else{const d=new Set;r!=null&&r.outputs&&Object.keys(r.outputs).forEach(f=>d.add(f)),(r==null?void 0:r.type)==="static"&&r.values&&Object.keys(r.values).forEach(f=>d.add(f)),d.size&&(s.output=Array.from(d))}n==="vault"&&(s.output=mB(o))}return Object.keys(s).length?s:void 0}function wB({type:n,configNode:t,pluginData:r}){return n==="vault"?pB(r):t?yB(t):void 0}function kB(n){const t=e.computed(()=>{const d=new Map;return n.value.nodes.forEach(f=>d.set(f.id,f)),d}),r=e.computed(()=>n.value.edges),o=e.computed(()=>n.value.groups),i=e.computed(()=>Zy(r.value,o.value));function a(d){return Pl(i.value,d?{source:d.source,target:d.target}:void 0)}function s(d){const f=t.value.get(d.source),m=t.value.get(d.target);if(!f||!m)return d;const h=Hy(f,d.sourceField)&&!of(f,d.sourceField),y=of(m,d.targetField);return h&&y?{source:d.target,sourceField:d.targetField,target:d.source,targetField:d.sourceField}:d}function c(d){const f=s(d),m=[],h=t.value.get(f.source),y=t.value.get(f.target);if(h||m.push("source node not found"),y||m.push("target node not found"),!h||!y)return{ok:!1,errors:m};of(h,f.sourceField)||m.push("source handle is not an output field"),Hy(y,f.targetField)||m.push("target handle is not an input field"),y.name==="request"&&m.push('cannot target "request"'),h.name==="response"&&m.push('cannot source from "response"');const b=r.value.some(C=>C.target===f.target&&!C.targetField),_=r.value.some(C=>C.target===f.target&&!!C.targetField);(b&&f.targetField||_&&!f.targetField)&&m.push("cannot mix whole-node and field-level inputs on same target"),f.targetField&&r.value.some(C=>C.target===f.target&&C.targetField===f.targetField)&&m.push("target field already connected"),!f.targetField&&r.value.some(C=>C.target===f.target&&!C.targetField)&&m.push("target input already taken"),f.source===f.target&&m.push("self-loop not allowed");const k=a({source:f.source,target:f.target});return lf(k)&&m.push("connection introduces a cycle"),m.length?{ok:!1,errors:m}:{ok:!0}}function l(){const d=[];for(const f of ii)[...t.value.values()].some(m=>m.name===f)||d.push(`missing implicit node "${f}"`);for(const f of r.value){const m=t.value.get(f.source);t.value.get(f.target).name==="request"&&d.push(`edge "${f.id}" targets "request"`),m.name==="response"&&d.push(`edge "${f.id}" sources from "response"`)}return lf(a())&&d.push("graph contains cycle"),d.length?{ok:!1,errors:d}:{ok:!0}}function u(d){return c(d).ok}function p(d){return!d.source||!d.target?!1:u({source:d.source,sourceField:d.sourceHandle,target:d.target,targetField:d.targetHandle})}return{canonicalizeConnection:s,validateConnection:c,validateGraph:l,isValidConnection:u,isValidVueFlowConnection:p,buildAdjacency:Pl}}const[uf,CB]=Pt.createInjectionState(function(t,r={}){const o=e.ref(Qy(t)),i=e.ref(),a=e.ref(),s=e.ref(!1),c=e.ref(!1),l=fB(o,{capacity:200,clone:Tr,onHistoryChange:Q=>{var le,de;Q!=="clear"&&((de=r.onChange)==null||de.call(r,nt(),se(),Re(),(le=o.value.cacheConfig)==null?void 0:le.partial_id))}}),u=e.ref(!1),p=e.ref(new Set);function d(){o.value.pendingLayout=!1,l.commit("*")}function f(Q=!0){o.value.pendingFitView!==Q&&(o.value.pendingFitView=Q,l.commit("*"))}const m=e.computed(()=>{const Q={request:0,response:0};return o.value.nodes.forEach(le=>{mn(le.type)||Q[le.phase]++}),Q}),h=e.computed(()=>new Map(o.value.nodes.map(Q=>[Q.id,Q]))),y=e.computed(()=>new Map(o.value.nodes.map(Q=>[Q.name,Q]))),b=e.computed(()=>{const Q=new Map,le=new Map;for(const de of o.value.edges)Q.set(de.id,de),le.has(de.source)||le.set(de.source,new Set),le.get(de.source).add(de.id),le.has(de.target)||le.set(de.target,new Set),le.get(de.target).add(de.id);return{edgeMapById:Q,edgeIdMapByNodeId:le}}),_=e.computed(()=>b.value.edgeMapById),k=e.computed(()=>b.value.edgeIdMapByNodeId),C=e.computed(()=>new Map(o.value.groups.map(Q=>[Q.id,Q]))),N=e.computed(()=>new Set(o.value.nodes.map(Q=>Q.name))),E=dB({state:o,groupMapById:C,getNodeById:A,history:l}),{canonicalizeConnection:w,validateConnection:S,validateGraph:I,isValidConnection:U,isValidVueFlowConnection:x}=kB(o);function A(Q){return h.value.get(Q)}function T(Q){return y.value.get(Q)}function V(Q){return _.value.get(Q)}function R(Q){if(!k.value.has(Q))return[];const le=[];return k.value.get(Q).forEach(de=>{const _e=V(de);_e&&le.push(_e)}),le}function X(Q){return R(Q).filter(le=>le.target===Q)}function Y(Q){return R(Q).filter(le=>le.source===Q)}const ne=e.computed(()=>i.value?A(i.value):void 0);function M(Q){i.value=Q}function te(Q){a.value=Q}function $(Q){if(mn(Q.type))throw new Error("[createNode] implicit nodes are fixed.");return e_({type:Q.type,name:Q.name||(mn(Q.type)?void 0:zy(Q.type,N.value)),phase:Q.phase,position:Q.position,fields:Q.fields,config:Q.config})}function Z(Q,le=!0){const de=$(Q);if(de)return o.value.nodes.push(de),le&&l.commit(),u.value=!0,de.id}function F(Q,le,de=!0){const _e=A(Q);if(!_e||mn(_e.type))return;const xe={...Tr(_e),id:li("node"),name:zy(_e.name,N.value),position:le??{x:_e.position.x+20,y:_e.position.y+20}},Ne=$a(xe.type);if(Ne.length&&xe.config){for(const g of Ne)delete xe.config[g];Object.keys(xe.config).length===0&&delete xe.config}return o.value.nodes.push(xe),de&&l.commit(),u.value=!0,xe.id}function J(Q,le=!0){if(!A(Q))return;o.value.edges=o.value.edges.filter(xe=>xe.source!==Q&&xe.target!==Q),E.clear(Q,{commit:!1}),E.removeMember(Q,{commit:!1}),o.value.nodes=o.value.nodes.filter(xe=>xe.id!==Q),i.value===Q&&(i.value=void 0);const _e=I();_e.ok||console.warn("[removeNode] topology invalid:",_e.errors.join("; ")),le&&l.commit()}function G(Q,le,de=!0,_e){const xe=A(Q);if(!xe)return;if(tf(xe.name)){console.warn("[renameNode] implicit node name is reserved.");return}xe.name!==le&&(xe.name=le,de&&l.commit(_e))}function v(Q,le,de=!0){const _e=A(Q);_e&&(_e.position={...le},de&&l.commit())}function q(Q,le,de=!0){const _e=C.value.get(Q);if(!_e)return;const xe=_e.position;xe&&xe.x===le.x&&xe.y===le.y||(_e.position={...le},de&&l.commit())}function ie(Q,le,de=!0){const _e=C.value.get(Q);if(!_e)return!1;const xe={...le.position},Ne={...le.dimensions},g=_e.position&&_e.position.x===xe.x&&_e.position.y===xe.y,O=_e.dimensions&&_e.dimensions.width===Ne.width&&_e.dimensions.height===Ne.height;return g&&O?!1:(_e.position=xe,_e.dimensions=Ne,de&&l.commit(),!0)}function oe(Q,le,de,_e=!0,xe){const Ne=A(Q);if(!Ne)return;const g=de??!Ne.expanded[le];g!==!!Ne.expanded[le]&&(Ne.expanded[le]=g,_e&&l.commit(xe??`toggle:${Q}:${le}`))}function ke(Q,le,de=!0,_e){const xe=A(Q);xe&&(xe.config=Tr(le),de&&l.commit(_e))}function ye(Q,le,de,_e=!0){const xe=A(Q);if(!xe)return;const Ne=xe.fields[le];if(Ne.some(g=>g.name===de)){console.warn(`[addField] field "${de}" already exists on ${le}.`);return}Ne.push({id:li("field"),name:de}),le==="input"?xe.fields.input=Ne:xe.fields.output=Ne,_e&&l.commit()}function ce(Q,le,de,_e=!0){const xe=A(Q);if(!xe)return;const Ne=xe.fields.input,g=xe.fields.output,O=Ne.find(j=>j.id===le)??g.find(j=>j.id===le);O&&(O.name=de,_e&&l.commit())}function he(Q,le,de=!0,_e=!0){const xe=A(Q);if(!xe)return;const Ne=xe.fields.input,g=xe.fields.output,O=Ne.findIndex(ae=>ae.id===le);O>=0&&Ne.splice(O,1);const j=g.findIndex(ae=>ae.id===le);j>=0&&g.splice(j,1),xe.fields.input=Ne,xe.fields.output=g,de&&(o.value.edges=o.value.edges.filter(ae=>ae.sourceField!==le&&ae.targetField!==le));const W=I();W.ok||console.warn("[removeField] topology invalid:",W.errors.join("; ")),_e&&l.commit()}function Oe(Q,le=!0){const de=w(Q),_e=S(de);if(!_e.ok){console.warn("[connectEdge] invalid connection:",_e.errors.join("; "));return}const xe={id:li("edge"),...de};o.value.edges.push(xe);const Ne=I();if(!Ne.ok){o.value.edges.pop(),console.warn("[connectEdge] topology invalid:",Ne.errors.join("; "));return}return le&&l.commit(),xe.id}function De(Q,le,de=!0){Be(Q,!1),Oe(le,!1),de&&l.commit()}function Be(Q,le=!0){const de=o.value.edges.findIndex(Ne=>Ne.id===Q);if(de<0)return;const _e=o.value.edges[de];o.value.edges.splice(de,1);const xe=I();if(!xe.ok){o.value.edges.splice(de,0,_e),console.warn("[disconnectEdge] topology invalid:",xe.errors.join("; "));return}le&&l.commit()}function qe(Q,le=!0){const de=X(Q);for(const _e of de)Be(_e.id,!1);le&&l.commit()}function We(Q,le=!0){const de=Y(Q);for(const _e of de)Be(_e.id,!1);le&&l.commit()}function nt(){var le,de,_e,xe,Ne;const Q=[];for(const g of o.value.nodes){if(mn(g.type))continue;let O;const j={};let W;const ae={};for(const ue of o.value.edges.filter(P=>P.target===g.id)){const P=A(ue.source);if(!P)continue;const z=(le=Qr(P,"output",ue.sourceField))==null?void 0:le.name,D=z?`${P.name}.${z}`:P.name,pe=(de=Qr(g,"input",ue.targetField))==null?void 0:de.name;pe?j[pe]=D:O===void 0&&(O=D)}for(const ue of o.value.edges.filter(P=>P.source===g.id)){const P=A(ue.target);if(!P)continue;const z=P.type;if(!mn(z)||!((_e=Al[z].io)!=null&&_e.input))continue;const D=(xe=Qr(P,"input",ue.targetField))==null?void 0:xe.name,pe=D?`${P.name}.${D}`:P.name,we=(Ne=Qr(g,"output",ue.sourceField))==null?void 0:Ne.name;we?ae[we]=pe:W===void 0&&(W=pe)}const be={...Tr(g.config),name:g.name,type:g.type},L=$a(g.type);if(L.length)for(const ue of L){const P=be[ue];if(!Array.isArray(P))continue;const z=[];for(const D of P){const pe=A(D);pe&&z.push(pe.name)}z.length?be[ue]=Array.from(new Set(z)):delete be[ue]}Object.keys(j).length>0?be.inputs=j:O!==void 0&&(be.input=O),Object.keys(ae).length>0?be.outputs=ae:W!==void 0&&(be.output=W),Q.push(be)}return Q}function lt(){return o.value.nodes.map(Q=>Tr({name:Q.name,phase:Q.phase,position:{...Q.position},expanded:{...Q.expanded},fields:{input:Q.fields.input.map(le=>le.name),output:Q.fields.output.map(le=>le.name)}}))}function Re(){const Q={},le=T("vault");if(le){const de=gB(le.config);de&&Object.keys(de).length>0&&(Q.vault=de)}if(o.value.cacheConfig){const{strategy:de,redis:_e,memory:xe}=o.value.cacheConfig;Q.cache={strategy:de,redis:_e,memory:xe}}if(Object.keys(Q).length!==0)return Q}function Ce(){const Q=[];for(const le of o.value.groups){const de=A(le.ownerId);if(!de)continue;const _e=le.position;_e&&Q.push({name:Bl(de.name,le.branch),position:{..._e}})}return Q}function se(){return{nodes:lt(),groups:Ce()}}function re(Q,le){le&&l.commit(),o.value=Qy(Q,le),le||l.clear()}return{state:o,selection:i,portalSelection:a,modalOpen:s,skipValidation:u,invalidConfigNodeIds:p,propertiesPanelOpen:c,configNodeCounts:m,nodeMapById:h,nodeMapByName:y,edgeMapById:_,edgeIdMapByNodeId:k,groupMapById:C,getNodeById:A,getNodeByName:T,getEdgeById:V,getEdgesByNodeId:R,getInEdgesByNodeId:X,getOutEdgesByNodeId:Y,selectedNode:ne,selectNode:M,selectPortalEdge:te,createNode:$,addNode:Z,duplicateNode:F,removeNode:J,renameNode:G,moveNode:v,moveGroup:q,setGroupLayout:ie,toggleExpanded:oe,replaceConfig:ke,branchGroups:E,addField:ye,renameField:ce,removeField:he,connectEdge:Oe,replaceConnection:De,disconnectEdge:Be,disconnectInEdges:qe,disconnectOutEdges:We,toConfigNodes:nt,toUINodes:lt,toUIGroups:Ce,toUIData:se,load:re,commit:l.commit,undo:l.undo,redo:l.redo,canUndo:l.canUndo,canRedo:l.canRedo,clear:l.clear,reset:l.reset,revert:l.revert,isValidConnection:U,isValidVueFlowConnection:x,validateGraph:()=>I(),clearPendingLayout:d,setPendingFitView:f}});function $t(){const n=CB();if(!n)throw new Error("Editor state is not provided. Ensure you are using provideEditorStore in a parent component.");return n}function EB(n){const{branchLayout:t,phase:r,layoutOptions:o,nodes:i,edges:a}=n,{findNode:s}=xt.useVueFlow(),{state:c,branchGroups:l,getNodeById:u,moveNode:p,commit:d}=$t(),{getNodeDepth:f,isGroupId:m,groupsByOwner:h}=l,{isBranchEdgeId:y,updateGroupLayout:b,translateGroupTree:_,waitForLayoutFlush:k}=t,{viewport:C,padding:N=Jr.padding,gaps:E=Jr.gaps}=o,{nodes:w=Jr.gaps.nodes,edges:S=Jr.gaps.edges,ranks:I=Jr.gaps.ranks}=E;async function U(T=!0){const V=new Map(i.value.map(v=>[v.id,v.data])),R=new Map,X=new Map,Y=v=>{if(!v)return;let q=X.get(v);return q||(q=s(v),q&&X.set(v,q),q)},ne=new Map,M=v=>{let q=ne.get(v);return q!==void 0||(q=f(v),ne.set(v,q)),q},te=v=>{if(!Va(v.data))return v.parentNode;const q=Y(v.data.ownerId);if(!q)throw new Error(`Cannot find owner node '${v.data.ownerId}' for group node '${v.id}' via findNode`);return q.parentNode};for(const v of a.value){if(y(v.id))continue;const q=v.source,ie=v.target;if(m(q)||m(ie))continue;const oe=Y(q),ke=Y(ie);if(oe){if(!ke)throw new Error(`Cannot find target node '${ie}' for edge '${v.id}' via findNode`)}else throw new Error(`Cannot find source node '${q}' for edge '${v.id}' via findNode`);if(te(oe)===te(ke))continue;let ye=oe,ce=ke,he=M(ye.id),Oe=M(ce.id);for(;he!==Oe;)if(he>Oe){const De=te(ye);if(!De)throw new Error(`Expected node '${ye.id}' to have parent, but it does not`);const Be=Y(De);if(!Be)throw new Error(`Cannot find parent node '${De}' for node '${ye.id}' via findNode`);ye=Be,he--}else if(Oe>he){const De=te(ce);if(!De)throw new Error(`Expected node '${ce.id}' to have parent, but it does not`);const Be=Y(De);if(!Be)throw new Error(`Cannot find parent node '${De}' for node '${ce.id}' via findNode`);ce=Be,Oe--}for(;he>=0;){const De=te(ye),Be=te(ce);if(De===Be){R.has(he)||R.set(he,[]),R.get(he).push({v:ye.id,w:ce.id});break}if(De){if(!Be){const nt=`Expected node '${ce.id}' to have parent, but it does not`;throw console.error(nt,ce),new Error(nt)}}else{const nt=`Expected node '${ye.id}' to have parent, but it does not`;throw console.error(nt,ye),new Error(nt)}const qe=Y(De),We=Y(Be);if(qe){if(!We)throw new Error(`Cannot find parent node '${Be}' for node '${ce.id}' via findNode`)}else throw new Error(`Cannot find parent node '${De}' for node '${ye.id}' via findNode`);ye=qe,ce=We,he--,Oe--}}const $=c.value.groups.toSorted((v,q)=>M(q.ownerId)-M(v.ownerId));for(const v of $)x(v.memberIds.reduce((q,ie)=>{const oe=u(ie);if(!oe)return console.warn(`Cannot find node '${ie}' of group '${v.id}' by getNodeById`),q;if(oe.phase!==r)return q;if(oe.type==="branch"){const ke=h.value.get(oe.id);ke&&q.push(...ke)}return V.delete(oe.id),q.push(oe),q},[]),{virtualEdges:R.get(M(v.ownerId)),cachedFindNode:Y}),await e.nextTick(),b(v.id,!1),await k();const Z=V.values().toArray();for(const v of Z){if(Va(v)||v.type!=="branch")continue;const q=h.value.get(v.id);q&&Z.push(...q)}const{autoNodes:F,leftNode:J,rightNode:G}=A(Z);x(F,{leftNode:J,rightNode:G,virtualEdges:R.get(0),cachedFindNode:Y}),T&&d()}function x(T,V){var ye,ce,he,Oe,De;const{leftNode:R,rightNode:X,virtualEdges:Y,cachedFindNode:ne}=V||{},M=R?(ne??s)(R.id):void 0,te=X?(ne??s)(X.id):void 0;let $;if(T.length>0){$=new Xy.graphlib.Graph({multigraph:!0}),$.setGraph({rankdir:r==="request"?"LR":"RL",nodesep:w,edgesep:S,ranksep:I});const Be=new Set;for(const qe of T){const We=(ne??s)(qe.id);if(!We){console.warn(`Cannot find graph node '${qe.id}' in ${r} phase`);continue}Be.add(qe.id),Va(qe)?$.setNode(qe.id,{...qe.dimensions??We.dimensions}):$.setNode(qe.id,{...We.dimensions})}for(const qe of a.value)!Be.has(qe.source)||!Be.has(qe.target)||$.setEdge(qe.source,qe.target,{points:[]});Y==null||Y.forEach(qe=>$.setEdge(qe,{points:[]})),Xy.layout($)}const Z=[],F=Be=>({x:Be.x-Be.width/2,y:Be.y-Be.height/2,width:Be.width,height:Be.height});if(T.length>0){if(!$)throw new Error("Expected dagreGraph to be initialized");for(const Be of T){const qe=$.node(Be.id),We=F(qe);Z.push(We),Va(Be)?_(Be.id,We,We.x+Qo,We.y+Qo):p(Be.id,{x:We.x,y:We.y},!1)}}const J=Z.length>0?Yy(Z):{x:0,y:0,width:0,height:0},G=J.width,v=J.height,q=J.x,ie=J.x+J.width,oe=Math.max(0,Math.min(e.toValue(C==null?void 0:C.width)??Number.POSITIVE_INFINITY,Y1)-G-2*w-(((ye=M==null?void 0:M.dimensions)==null?void 0:ye.width)??0)-(((ce=te==null?void 0:te.dimensions)==null?void 0:ce.width)??0)-2*N),ke=J.y+v/2;R&&p(R.id,{x:q-w-oe/2-(((he=M==null?void 0:M.dimensions)==null?void 0:he.width)??0),y:ke-(((Oe=M==null?void 0:M.dimensions)==null?void 0:Oe.height)??0)/2},!1),X&&p(X.id,{x:ie+w+oe/2,y:ke-(((De=te==null?void 0:te.dimensions)==null?void 0:De.height)??0)/2},!1)}function A(T){let V,R;const X=[];for(const Y of T){if(Va(Y)){X.push(Y);continue}switch(Y.name){case"request":{if(r!=="request")throw new Error(`Unexpected request node in ${r} phase`);if(V)throw new Error("Duplicated request node in request phase");V=Y;break}case"service_request":{if(r!=="request")throw new Error(`Unexpected service_request node in ${r} phase`);if(R)throw new Error("Duplicated service_request node in request phase");R=Y;break}case"service_response":{if(r!=="response")throw new Error(`Unexpected service_response node in ${r} phase`);if(R)throw new Error("Duplicated service_response node in response phase");R=Y;break}case"response":{if(r!=="response")throw new Error(`Unexpected response node in ${r} phase`);if(V)throw new Error("Duplicated response node in response phase");V=Y;break}default:{X.push(Y);break}}}return{autoNodes:X,leftNode:V,rightNode:R}}return{autoLayout:U}}function NB({phase:n,groupMapById:t,getNodeDepth:r,canAddMember:o,draggingId:i}){const a=e.shallowRef(),s=e.shallowRef();function c(d){a.value=d,s.value=void 0}function l(){a.value&&(a.value=void 0,s.value=void 0)}function u(d){let f;const m=i==null?void 0:i.value;return t.value.forEach(h=>{if(h.phase!==n||m&&nf(m)&&!o(h.ownerId,h.branch,m))return;const y=h.position,b=h.dimensions;if(!y||!b||!(d.x>=y.x&&d.x<=y.x+b.width&&d.y>=y.y&&d.y<=y.y+b.height))return;const k=r(h.ownerId);(!f||k>f.depth)&&(f={depth:k,id:h.id})}),f==null?void 0:f.id}function p(d){if(!a.value){s.value=void 0;return}if(!d){s.value=void 0;return}s.value=u(d)}return{activeGroupId:s,start:c,updateActiveGroup:p,end:l}}function SB({phase:n,readonly:t,flowId:r,draggingId:o}){const{findNode:i}=xt.useVueFlow(r),a=$t(),{state:s,groupMapById:c,getNodeById:l,moveNode:u,moveGroup:p,setGroupLayout:d,commit:f,branchGroups:m}=a,{memberGroupMap:h,groupsByOwner:y,getNodeDepth:b,getGroupDepth:_}=m,k=te=>!!te&&te.startsWith("branch:");function C(te){const $=[];for(const Z of te.memberIds){const F=l(Z);F&&$.push(F)}return $}const N=e.computed(()=>{const te=new Map;return h.value.forEach(($,Z)=>{if($.phase!==n||!$.position)return;const F=l(Z);F&&(F.phase!==n||F.hidden||te.set(Z,$))}),te}),E=e.computed(()=>{const te=new Map;return y.value.forEach(($,Z)=>{const F=$.filter(J=>J.phase===n);F.length>0&&te.set(Z,F)}),te}),w=e.computed(()=>{const te=[];for(const $ of s.value.groups){const Z=l($.ownerId);if(!Z||Z.phase!==n)continue;const F=$.position,J=$.dimensions;if(!F||!J)continue;const G=C($).filter(q=>q.phase===n&&!q.hidden),v=_($.id);te.push({id:$.id,type:"group",position:F,width:J.width,height:J.height,data:{...$,memberIds:G.map(q=>q.id)},draggable:!t,selectable:!1,zIndex:v*fl+G1})}return te}),S=e.computed(()=>{let te=0;for(const $ of s.value.groups){if($.phase!==n)continue;const Z=_($.id);Z>te&&(te=Z)}return te}),I=e.computed(()=>{const te=[];for(const $ of s.value.groups){if($.phase!==n||!$.position||!$.dimensions)continue;const Z=l($.ownerId);if(!Z||Z.phase!==n||Z.hidden||!C($).filter(v=>v.phase===n&&!v.hidden).length)continue;const J=Math.max(b(Z.id),_($.id))+S.value+1,G={id:`branch:${$.id}`,source:Z.id,target:$.id,sourceHandle:`branch@${$.branch}`,targetHandle:"input",markerEnd:xt.MarkerType.ArrowClosed,selectable:!1,focusable:!1,updatable:!1,data:{type:"branch",ownerId:Z.id,branch:$.branch,groupId:$.id},zIndex:J*fl+z1};te.push(G)}return te}),U=new Map,x=new Map;let A;function T(te,$=!0){if(te.phase!==n)return;const Z=C(te).filter(q=>q.phase===n&&!q.hidden);if(!Z.length)return;const F=[];for(const q of Z){const ie=i(q.id),oe=ie==null?void 0:ie.dimensions,ke=(oe==null?void 0:oe.width)??0,ye=(oe==null?void 0:oe.height)??0;if(ke<=0||ye<=0)return;F.push({...q.position,width:ke,height:ye});const ce=y.value.get(q.id)??[];for(const he of ce){if(he.phase!==n)continue;const Oe=U.get(he.id),De=(Oe==null?void 0:Oe.position)??he.position,Be=(Oe==null?void 0:Oe.dimensions)??he.dimensions;!De||!Be||F.push({x:De.x,y:De.y,width:Be.width,height:Be.height})}}const J=Yy(F),G=J.width+Qo*2,v=J.height+Qo*2;return{position:{x:Math.round(J.x-Qo),y:Math.round(J.y-Qo)},dimensions:{width:Math.round(G),height:Math.round(v)},commit:$}}function V(){if(U.size===0){A=void 0;return}const te=[];let $=!1;U.forEach((Z,F)=>{const J=d(F,Z,!1);te.push({id:F,changed:J,commit:Z.commit}),Z.commit&&J&&!$&&($=!0)}),U.clear(),A=void 0;for(const{id:Z,changed:F,commit:J}of te){if(!F)continue;const G=c.value.get(Z);if(!G)continue;const v=N.value.get(G.ownerId);v&&x.set(v.id,{commit:J})}if(x.size>0){const Z=Array.from(x);x.clear();for(const[F,{commit:J}]of Z)X(F,J)}$&&f("*")}function R(){U.size!==0&&(A||(A=e.nextTick().then(V)))}function X(te,$=!0){const Z=c.value.get(te);if(!Z)return;const F=T(Z,$);F&&(U.set(te,F),R())}function Y(te,$,Z,F){const J=c.value.get(te);if(!J)return;if(!J.position){p(te,$,!1),X(te);return}if(Z===0&&F===0){p(te,$,!1);return}p(te,$,!1);const G=[te],v=new Set([te]),q=new Set;for(;G.length;){const ie=G.shift(),oe=c.value.get(ie);if(!oe)continue;const ke=C(oe).filter(ye=>ye.phase===n&&!ye.hidden);for(const ye of ke){q.has(ye.id)||(u(ye.id,{x:ye.position.x+Z,y:ye.position.y+F},!1),q.add(ye.id));const ce=E.value.get(ye.id)??[];for(const he of ce){if(v.has(he.id))continue;const Oe=c.value.get(he.id);Oe!=null&&Oe.position&&p(he.id,{x:Oe.position.x+Z,y:Oe.position.y+F},!1),v.add(he.id),G.push(he.id)}}}}function ne(te,$){const Z=o==null?void 0:o.value;if(!Z)return!1;if(Z===te||$.some(F=>Z===F))return!0;for(const F of $){const J=E.value.get(F)??[];if(J!=null&&J.some(G=>G.id===Z))return!0}return!1}const M=new Map;return e.watch(()=>s.value.groups.filter($=>$.phase===n).map($=>{const Z=$.memberIds.map(F=>{var q,ie;const J=i(F),G=Math.round(((q=J==null?void 0:J.dimensions)==null?void 0:q.width)??0),v=Math.round(((ie=J==null?void 0:J.dimensions)==null?void 0:ie.height)??0);return`${F}:${G}x${v}`});return{id:$.id,memberIds:$.memberIds,signature:Z.join(",")}}),te=>{const $=new Set(te.map(Z=>Z.id));for(const Z of M.keys())$.has(Z)||M.delete(Z);for(const Z of te)ne(Z.id,Z.memberIds)||M.get(Z.id)===Z.signature||(M.set(Z.id,Z.signature),X(Z.id))},{deep:!0,flush:"post"}),{groupsByOwner:E,memberGroupMap:N,groupNodes:w,branchEdges:I,isBranchEdgeId:k,updateGroupLayout:X,translateGroupTree:Y,getNodeDepth:b,maxGroupDepth:S,waitForLayoutFlush:()=>A??Promise.resolve()}}function xB(n){e.provide(nh,n)}function n_(){return e.inject(nh,void 0)}function r_(){const n=n_();if(!n)throw new Error("Confirm modal not provided");return n}function AB(n){const{readonly:t,flowId:r}=n,o=xt.useVueFlow(r),{onNodesChange:i,onEdgesChange:a,onPaneClick:s,findEdge:c}=o,{disconnectEdge:l,commit:u,portalSelection:p,selectPortalEdge:d}=$t();i(f=>{f.some(m=>m.type==="select"&&"selected"in m&&m.selected)&&d(void 0)}),a(f=>{const m=f.some(y=>y.type==="select"&&"selected"in y&&y.selected),h=p.value?f.some(y=>y.type==="remove"&&y.id===p.value):!1;(m||h)&&d(void 0)}),s(()=>d(void 0)),Pt.useEventListener("keydown",f=>{if(t||f.key!=="Delete"&&f.key!=="Backspace")return;const m=p.value;!m||c(m)||(f.preventDefault(),l(m,!1),d(void 0),u())})}function o_(n){const t=n.match(/^(input|output)(?:s@(.*))?$/);if(t)return{io:t[1],field:t[2]}}const vB={default:T1,hover:P1,selected:O1};let i_,df;function Vl(n){const t=n.id===i_?"selected":n.id===df?"hover":"default",r=vB[t],{markerEnd:o}=n,i=typeof o=="object"?{...o,color:r}:{type:o,color:r},a=n.zIndex??0,s=t==="selected"?a+2:t==="hover"?a+1:a;return{...n,style:{...n.style,stroke:r,strokeWidth:t==="selected"?1.5:void 0},markerEnd:i,zIndex:s}}const[IB,BB]=Pt.createInjectionState(function(n){const{phase:t,flowId:r,layoutOptions:o,readonly:i}=n,{viewport:a,padding:s=Jr.padding,gaps:c=Jr.gaps}=o,{nodes:l=Jr.gaps.nodes}=c,u=xt.useVueFlow(r),p=$t(),d=n_(),f=Jd(),{i18n:{t:m}}=Qe(),{findNode:h,fitView:y,deleteKeyCode:b,onNodeDrag:_,onNodeDragStop:k,onConnect:C,onNodesChange:N,onEdgesChange:E,onEdgeUpdate:w,onEdgeMouseEnter:S,onEdgeMouseLeave:I,getNodes:U,setNodes:x,setEdges:A,addSelectedNodes:T,screenToFlowCoordinate:V}=u;b.value=["Delete","Backspace"];const{state:R,commit:X,moveNode:Y,selectNode:ne,removeNode:M,getNodeById:te,connectEdge:$,disconnectEdge:Z,getInEdgesByNodeId:F,branchGroups:J,commit:G,reset:v,groupMapById:q}=p,{isGroupId:ie,canAddMember:oe}=J,ke=e.shallowRef(),ye=P=>{ke.value=P},ce=e.readonly(ke);function he(P,z){const D=te(P.source),pe=te(P.target);return!!(D&&pe&&D.phase===z&&pe.phase===z)}const Oe=SB({phase:t,readonly:i,flowId:r,draggingId:ce}),{memberGroupMap:De,groupNodes:Be,branchEdges:qe,isBranchEdgeId:We,updateGroupLayout:nt,translateGroupTree:lt,getNodeDepth:Re,maxGroupDepth:Ce}=Oe,{activeGroupId:se,start:re,updateActiveGroup:Q,end:le}=NB({phase:t,groupMapById:q,getNodeDepth:Re,canAddMember:oe,draggingId:ce}),de=e.computed(()=>R.value.nodes.filter(P=>P.phase===t&&!P.hidden).map(P=>{const z=De.value.get(P.id),D=z==null?void 0:z.position,pe=z==null?void 0:z.dimensions,we=z&&D&&pe?{x:P.position.x-D.x,y:P.position.y-D.y}:P.position,Se=Re(P.id),Ve=!!(z&&D&&pe),Me=(Ve?Se:0)+Ce.value+1;return{id:P.id,type:"flow",position:we,data:P,deletable:!i&&!vl(P),parentNode:Ve?z.id:void 0,zIndex:Me*fl+W1}})),_e=e.computed(()=>R.value.edges.filter(P=>he(P,t)).filter(P=>!J.isEdgeEnteringGroup(P.source,P.target)).filter(P=>{const z=te(P.source),D=te(P.target);return!(z!=null&&z.hidden)&&!(D!=null&&D.hidden)}).map(P=>{const z=te(P.source),D=te(P.target);if(!z||!D){const we=[];throw z||we.push(`source node "${P.source}"`),D||we.push(`target node "${P.target}"`),new Error(`Missing ${we.join(" and ")} for edge "${P.id}" in phase "${t}"`)}const pe=Math.max(Re(P.source),Re(P.target))+Ce.value+1;return Vl({id:P.id,source:P.source,target:P.target,sourceHandle:P.sourceField?`outputs@${P.sourceField}`:"output",targetHandle:P.targetField?`inputs@${P.targetField}`:"input",markerEnd:xt.MarkerType.ArrowClosed,data:P,updatable:!i,zIndex:pe*fl+H1})})),xe=e.computed(()=>[...qe.value,..._e.value]),{autoLayout:Ne}=EB({phase:t,layoutOptions:o,branchLayout:Oe,nodes:de,edges:xe});AB({readonly:i,flowId:r}),e.watch([de,Be,xe],([P,z,D])=>{x([...z,...P]),A(D)},{immediate:!0});const g=e.computed(()=>({padding:s/Math.max(e.toValue(a==null?void 0:a.width)??0,e.toValue(a==null?void 0:a.height)??0)}));async function O({source:P,sourceHandle:z,target:D,targetHandle:pe}){if(!z||!pe)return;const we=o_(z),Se=o_(pe);if((we==null?void 0:we.io)==="input"||(Se==null?void 0:Se.io)==="output"||z==="output"&&pe==="output")return;const Ve=F(D);let Me=!1,Ze=!1;const Ye=[],Te=[],Ae=(Se==null?void 0:Se.io)==="input"?Ve.filter(vt=>!vt.targetField):Ve.filter(vt=>!!vt.targetField);Ae.length>0&&(Me=!0,Ae.forEach(vt=>{Te.push(Ra(vt,te)),Z(vt.id,!1)}));const bt=(Se==null?void 0:Se.io)==="input"?Se!=null&&Se.field?Ve.filter(vt=>vt.targetField===Se.field):Ve.filter(vt=>!!vt.targetField):Ve.filter(vt=>!vt.targetField);if(bt.length>0){if(bt.some(en=>en.source===P&&en.target===D&&en.targetField===(Se==null?void 0:Se.field)&&en.sourceField===(we==null?void 0:we.field)))return;Ze=!0,bt.forEach(en=>{Te.push(Ra(en,te)),Z(en.id,!1)})}if(!$({source:P,sourceField:we==null?void 0:we.field,target:D,targetField:Se==null?void 0:Se.field},!1)){v(),f({message:m("plugins.free-form.datakit.flow_editor.error.invalid_connection"),appearance:"danger"});return}if(Ye.push(sf(P,we==null?void 0:we.field,D,Se==null?void 0:Se.field,te)),Me||Ze){if(!d)throw v(),new Error("Expected confirm modal to be provided here when reachable");if(!await d(m(Me?"plugins.free-form.datakit.flow_editor.confirm.message.switch":"plugins.free-form.datakit.flow_editor.confirm.message.override"),Ye,Te)){v();return}}G()}C(O);let j=!1;const W=()=>{j&&(j=!1,G())};N(P=>{P.filter(pe=>pe.type==="select").filter(pe=>!ie(pe.id)).sort((pe,we)=>pe.selected===we.selected?0:pe.selected?1:-1).forEach(pe=>{ne(pe.selected?pe.id:void 0)});let D=!1;P.forEach(pe=>{if(pe.type==="remove"){if(ie(pe.id))return;D=!0,M(pe.id,!1)}}),D&&!j&&(j=!0,queueMicrotask(W))}),_(({node:P,event:z})=>{var Ve,Me,Ze;if(!P)return;if(ie(P.id)){const Ye=P.id;ye(Ye),Q(void 0);const Te=q.value.get(Ye);if(!Te)return;const Ae=Te.position??{...P.position},bt=P.position.x-Ae.x,lr=P.position.y-Ae.y;lt(Ye,P.position,bt,lr);const vt=De.value.get(Te.ownerId);vt&&nt(vt.id,!1);return}const D=P.id;re("canvas"),ye(D);const pe=P.parentNode;let we={...P.position};if(pe&&ie(pe)){const Ye=q.value.get(pe);Ye!=null&&Ye.position&&(we={x:Ye.position.x+P.position.x,y:Ye.position.y+P.position.y})}if(Y(D,we,!1),!vl(te(D))){const Ye={x:we.x,y:we.y,width:((Ve=P.dimensions)==null?void 0:Ve.width)??0,height:((Me=P.dimensions)==null?void 0:Me.height)??0},Te=z&&"clientX"in z?V({x:z.clientX,y:z.clientY}):void 0,Ae={x:Ye.x+Ye.width/2,y:Ye.y+Ye.height/2};Q(Te??Ae)}const Se=pe&&ie(pe)?pe:(Ze=De.value.get(D))==null?void 0:Ze.id;Se&&nt(Se,!1)}),k(({node:P})=>{var Se;if(!P)return;if(ye(void 0),ie(P.id)){X();return}const z=P.id,D=P.parentNode;let pe={...P.position};if(D&&ie(D)){const Ve=q.value.get(D);Ve!=null&&Ve.position&&(pe={x:Ve.position.x+P.position.x,y:Ve.position.y+P.position.y})}Y(z,pe,!1);const we=D&&ie(D)?D:(Se=De.value.get(z))==null?void 0:Se.id;we&&nt(we,!1),Ee(z),le(),X()}),E(P=>{P.filter(pe=>pe.type==="select").sort((pe,we)=>pe.selected===we.selected?0:pe.selected?1:-1).forEach(pe=>{We(pe.id)||(i_=pe.selected?pe.id:void 0,A(we=>we.map(Se=>Se.id!==pe.id||!Se.markerEnd?Se:Vl({...Se,zIndex:pe.selected?1:void 0}))))});let D=!1;P.forEach(pe=>{if(pe.type==="remove"){if(We(pe.id))return;D=!0,Z(pe.id,!1)}}),D&&!j&&(j=!0,queueMicrotask(W))}),S(({edge:P})=>{We(P.id)||(df=P.id,A(z=>z.map(D=>D.id!==P.id?D:Vl(D))))}),I(({edge:P})=>{We(P.id)||(df=void 0,A(z=>z.map(D=>D.id!==P.id?D:Vl(D))))}),w(({edge:P,connection:z})=>{We(P.id)||(Z(P.id,!1),O(z))});function ae(P){y({...g.value,...P})}async function be(P){return ne(P),new Promise(z=>setTimeout(()=>{const D=h(P);T(D?[D]:[]),z()},0))}function L(P){const z=U.value.filter(({type:Ae})=>Ae!=="group"),D=z.find(({id:Ae})=>Ae===P);if(!D)throw new Error(`Node ${P} not found`);const{x:pe,y:we}=D.data.position,{width:Se,height:Ve}=D.dimensions,Me=we,Ze=we+Ve,Ye=z.filter(({id:Ae})=>Ae!==P).filter(({data:{position:{y:Ae}},dimensions:{height:bt}})=>Ae<Ze&&Ae+bt>Me).map(({data:{position:{x:Ae}},dimensions:{width:bt}})=>({left:Ae,right:Ae+bt})).sort((Ae,bt)=>Ae.left-bt.left);let Te=pe+Se+l;for(const{left:Ae,right:bt}of Ye)if(!(bt<=Te)){if(Te+Se<=Ae)return{x:Te,y:Me};Te=Math.max(Te,bt)+l}return{x:Te,y:Me}}function ge(P){if(!P)return;const z=h(P);if(!z)throw new Error(`Node ${P} not found`);const{position:{x:D},dimensions:{width:pe}}=z,we=D+pe,{viewport:Se,dimensions:Ve,setViewport:Me}=u,{x:Ze,y:Ye,zoom:Te}=Se.value,{width:Ae}=Ve.value,bt=D*Te+Ze,lr=we*Te+Ze,vt=Ae-th-l;if(lr<=vt)return;let en=vt-lr;bt+en<0&&(en=-bt),en!==0&&Me({x:Ze+en,y:Ye,zoom:Te},{duration:Z1})}function Ee(P){if(!se.value)return!1;const{nodeId:z,branch:D}=LI(se.value),pe=J.addMember(z,D,P,{commit:!1});return Q(void 0),pe}return{vueFlowStore:u,editorStore:p,readonly:i,nodes:de,edges:xe,selectNode:be,autoLayout:Ne,placeToRight:L,scrollRightToReveal:ge,fitViewParams:g,fitView:ae,groupDrop:{activeGroupId:se,startPanelDrag:()=>re("panel"),endPanelDrag:le,updateActiveGroup:Q,attachNodeToActiveGroup:Ee}}});let ui=null;function TB(){var t;if(ui)return ui;if(typeof navigator>"u")return ui="windows";const n=((t=navigator.userAgentData)==null?void 0:t.platform)||navigator.platform||navigator.userAgent;return/Mac|iPhone|iPad|iPod/i.test(n)?ui="mac":/Linux/i.test(n)&&!/Android/i.test(n)?ui="linux":ui="windows"}const OB={Shift:"⇧",Alt:"⌥",Ctrl:"⌃",Meta:"⌘",Mod:"⌘",Enter:"↩",ArrowUp:"↑",ArrowDown:"↓",ArrowLeft:"←",ArrowRight:"→",Tab:"⇥",Esc:"⎋",Space:"Space",Delete:"⌫"},PB={Shift:"Shift",Alt:"Alt",Ctrl:"Ctrl",Meta:"Win",Mod:"Ctrl",Enter:"Enter",ArrowUp:"Up",ArrowDown:"Down",ArrowLeft:"Left",ArrowRight:"Right",Tab:"Tab",Esc:"Esc",Space:"Spacebar",Delete:"Delete"},VB={Shift:"Shift",Alt:"Alt",Ctrl:"Ctrl",Meta:"Super",Mod:"Ctrl",Enter:"Enter",ArrowUp:"Up",ArrowDown:"Down",ArrowLeft:"Left",ArrowRight:"Right",Tab:"Tab",Esc:"Esc",Space:"Space",Delete:"Delete"};function $B(n,t={}){const r=t.platform??TB(),o=t.joiner??(r==="mac"?"":" + "),i=r==="mac"?OB:r==="linux"?VB:PB;return(Array.isArray(n)?n:n[r]).map(s=>s in i?i[s]:s).join(o)}const RB={key:0,class:"label"},LB={class:"keys"},$l=je(e.defineComponent({__name:"HotkeyLabel",props:{label:{},keys:{},reverse:{type:Boolean}},setup(n){const t=$B(n.keys);return(r,o)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(["dk-hotkey-label",{reverse:n.reverse}])},[n.label?(e.openBlock(),e.createElementBlock("span",RB,e.toDisplayString(n.label),1)):e.createCommentVNode("",!0),e.createElementVNode("kbd",LB,e.toDisplayString(e.unref(t)),1)],2))}}),[["__scopeId","data-v-7ca86b0d"]]),DB=["onClick"],MB={key:0,class:"additional-count"},a_=24,jB=16,Rl=je(e.defineComponent({__name:"NodePortal",props:{expanded:{type:Boolean,default:()=>{}},reversed:{type:Boolean},targets:{}},setup(n){const t=Number.parseFloat(j1)||0,r={target:"body"},{portalSelection:o,selectPortalEdge:i}=$t(),a=e.ref(!1),s=e.computed(()=>{const h=o.value;return h?n.targets.some(y=>y.edgeId===h):!1}),c=e.computed(()=>n.expanded!==void 0?n.expanded||s.value:a.value||s.value),l=()=>a_*n.targets.length+t*(n.targets.length-1),u=e.computed(()=>({width:c.value?`${l()}px`:"fit-content"})),p=h=>{i(h)},d=h=>o.value===h,f=e.computed(()=>n.targets.map((h,y)=>{const b=(a_+t)*y;return{edgeId:h.edgeId,key:`${h.node.id}-${h.fieldName??"node"}-${y}`,icon:Zd(h.node.type).icon,tooltip:h.fieldName?`${h.node.name}.${h.fieldName}`:h.node.name,highlighted:d(h.edgeId),tooltipEl:null,style:y===0?{width:"fit-content",zIndex:n.targets.length}:{position:"absolute",...n.reversed?{left:`${b}px`,transform:c.value?"translateX(0)":`translateX(-${b}px)`}:{right:0,transform:c.value?`translateX(-${b}px)`:"translateX(0)"},zIndex:n.targets.length-y}}})),m=e.computed(()=>Math.max(n.targets.length-1,0));return(h,y)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["dk-node-portal",{expanded:c.value,reversed:n.reversed}]),onClick:y[0]||(y[0]=e.withModifiers(()=>{},["stop"])),onDragstart:y[1]||(y[1]=e.withModifiers(()=>{},["stop"])),onMousedown:y[2]||(y[2]=e.withModifiers(()=>{},["stop"])),onMouseenter:y[3]||(y[3]=b=>a.value=!0),onMouseleave:y[4]||(y[4]=b=>a.value=!1)},[e.createElementVNode("div",{class:"target-boxes",style:e.normalizeStyle(u.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(b,_)=>(e.openBlock(),e.createBlock(e.unref(Fe.KTooltip),{key:b.key,class:"target-box-wrapper","kpop-attributes":r,placement:"top",style:e.normalizeStyle(b.style),text:b.tooltip},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["target-box",{highlighted:b.highlighted}]),onClick:e.withModifiers(k=>p(b.edgeId),["stop"])},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(b.icon),{color:`var(--kui-color-text-neutral, ${e.unref(cr)})`,size:jB},null,8,["color"])),_===0&&m.value>0?(e.openBlock(),e.createElementBlock("span",MB," +"+e.toDisplayString(m.value),1)):e.createCommentVNode("",!0)],10,DB)]),_:2},1032,["style","text"]))),128))],4)],34))}}),[["__scopeId","data-v-45ce7484"]]),Ll=je(e.defineComponent({__name:"HandleTwig",props:{color:{},position:{default:()=>xt.Position.Left},size:{default:()=>Number.parseFloat(Qg)},type:{}},setup(n){e.useCssVars(r=>({v64bbaf90:r.color}));const t=e.computed(()=>({width:`${n.size}px`,minWidth:`${n.size}px`}));return(r,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["handle-twig",[n.type,n.position===e.unref(xt.Position).Left?"left":"right"]]),style:e.normalizeStyle(t.value)},null,6))}}),[["__scopeId","data-v-74b600f2"]]),ff=je(e.defineComponent({__name:"NodeBadge",props:{type:{},size:{},iconOnly:{type:Boolean}},setup(n){e.useCssVars(r=>{var o,i;return{v3b4ea967:(o=t.value.colors)==null?void 0:o.background,v00febd7c:(i=t.value.colors)==null?void 0:i.foreground}});const t=e.computed(()=>Zd(n.type));return(r,o)=>{var a;const i=e.resolveComponent("KBadge");return e.openBlock(),e.createBlock(i,{appearance:"neutral",class:e.normalizeClass(["dk-node-badge",{"icon-only":n.iconOnly,"has-colors":!!t.value.colors}]),size:n.size},e.createSlots({default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(n.type),1)]),_:2},[(a=t.value)!=null&&a.icon?{name:"icon",fn:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value.icon)))]),key:"0"}:void 0]),1032,["class","size"])}}}),[["__scopeId","data-v-409d29e5"]]),FB={class:"body"},UB={class:"name"},KB={class:"handle"},qB={class:"handle-label-wrapper"},GB={class:"handle-label-wrapper"},HB={class:"handle-label text"},zB={class:"handle"},WB={class:"handle-label-wrapper"},YB={class:"handle-label-wrapper"},JB={class:"handle-label text"},XB={key:2,class:"branch-handles"},ZB={class:"handle-label-wrapper"},QB={class:"handle-label text"},s_=je(e.defineComponent({__name:"FlowNode",props:{data:{},error:{type:Boolean},readonly:{type:Boolean}},setup(n){const t=e.useSlots(),{t:r}=jt.createI18n("en-us",Jt),o=BB(),{getInEdgesByNodeId:i,getOutEdgesByNodeId:a,getNodeById:s,toggleExpanded:c,duplicateNode:l,removeNode:u,propertiesPanelOpen:p,branchGroups:d}=$t(),f=e.computed(()=>ci(n.data.type)),m=e.computed(()=>n.data.fields.input.length>0),h=e.computed(()=>n.data.fields.output.length>0),y=e.computed(()=>m.value&&i(n.data.id).every(F=>F.targetField===void 0)),b=e.computed(()=>h.value&&a(n.data.id).every(F=>F.sourceField===void 0)),_=e.computed(()=>n.data.expanded.input??!1),k=e.computed(()=>n.data.expanded.output??!1),C=e.computed(()=>{var F,J,G;return((G=(J=(F=f.value.io)==null?void 0:F.next)==null?void 0:J.branches)==null?void 0:G.map(({name:v})=>v))??[]}),N=e.computed(()=>C.value.length>0),E=e.computed(()=>d.findMembership(n.data.id)),w=e.computed(()=>{var F,J;if(n.data.type==="property"){const G=(F=n.data.config)==null?void 0:F.property;return Wd(G)}return(J=f.value.io)==null?void 0:J.input}),S=e.computed(()=>{var F,J;if(n.data.type==="property"){const G=(F=n.data.config)==null?void 0:F.property;return zd(G)}return(J=f.value.io)==null?void 0:J.output}),I=e.computed(()=>vl(n.data)),U=e.computed(()=>n.data.phase==="response"),x=e.computed(()=>n.data.phase==="request"?xt.Position.Left:xt.Position.Right),A=e.computed(()=>n.data.phase==="request"?xt.Position.Right:xt.Position.Left),T=e.computed(()=>n.data.phase==="request"?xt.Position.Right:xt.Position.Left),V=e.computed(()=>vl(n.data)?r(`plugins.free-form.datakit.flow_editor.node_types.${n.data.type}.name`):n.data.name),R=e.computed(()=>I.value?A1:v1);function X(F){return F==="input"?U.value:!U.value}function Y(F){const J=new Map,G=F==="input"?i(n.data.id):a(n.data.id);for(const v of G){const q=s(F==="input"?v.source:v.target);if(!q)continue;if(F==="input"){const ce=q.type==="vault",he=q.phase!==n.data.phase,Oe=d.isEdgeEnteringGroup(q.id,n.data.id);if(!(ce||he||Oe))continue}else{const ce=q.phase!==n.data.phase,he=d.isEdgeEnteringGroup(n.data.id,q.id);if(!(ce||he))continue}const ie=F==="input"?v.targetField||"input":v.sourceField||"output";let oe;if(F==="input"&&v.sourceField){const ce=q.fields.output.find(he=>he.id===v.sourceField);oe=ce==null?void 0:ce.name}else if(F==="output"&&v.targetField){const ce=q.fields.input.find(he=>he.id===v.targetField);oe=ce==null?void 0:ce.name}const ke={edgeId:v.id,node:q,fieldName:oe},ye=J.get(ie);ye?ye.push(ke):J.set(ie,[ke])}return J}const ne=e.computed(()=>Y("input")),M=e.computed(()=>Y("output"));function te(F){!o||o.readonly||F==="input"&&!y.value||F==="output"&&!b.value||c(n.data.id,F)}async function $(){if(!o||o.readonly)return;const F=l(n.data.id,o.placeToRight(n.data.id));await o.selectNode(F),o.scrollRightToReveal(F),p.value=!0}function Z(){d.removeMember(n.data.id)}return e.watch(y,F=>{F||c(n.data.id,"input",!0,!0,"*")},{immediate:!0}),e.watch(b,F=>{F||c(n.data.id,"output",!0,!0,"*")},{immediate:!0}),e.watch(()=>n.data.fields.input,(F,J)=>{Xt(F,J)||c(n.data.id,"input",F.length>0,!0,"*")},{deep:!0}),e.watch(()=>n.data.fields.output,(F,J)=>{Xt(F,J)||c(n.data.id,"output",F.length>0,!0,"*")},{deep:!0}),(F,J)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["dk-flow-node",{reversed:U.value,implicit:I.value,readonly:n.readonly}])},[e.createElementVNode("div",FB,[I.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(Fe.KTooltip),{key:0,class:"badge",placement:"top",text:n.data.type},{default:e.withCtx(()=>[e.createVNode(ff,{"icon-only":"",size:"small",type:n.data.type},null,8,["type"])]),_:1},8,["text"])),e.createElementVNode("div",UB,e.toDisplayString(V.value),1),n.error?(e.openBlock(),e.createBlock(e.unref($e.WarningIcon),{key:1,class:"error-icon",color:`var(--kui-color-text-danger, ${e.unref(Yg)})`,size:16},null,8,["color"])):e.createCommentVNode("",!0),t.actions?e.renderSlot(F.$slots,"actions",{key:2,data:n.data},void 0,!0):I.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(Fe.KDropdown),{key:3,class:"menu",disabled:n.readonly,"kpop-attributes":{offset:"4px",target:"body",popoverClasses:"dk-flow-node-menu"},width:"160",onClick:J[1]||(J[1]=e.withModifiers(()=>{},["stop"]))},{items:e.withCtx(()=>[e.createVNode(e.unref(Fe.KDropdownItem),{onClick:$},{default:e.withCtx(()=>[e.createVNode($l,{keys:e.unref(pl).duplicate,label:e.unref(r)("plugins.free-form.datakit.flow_editor.actions.duplicate")},null,8,["keys","label"])]),_:1}),E.value?(e.openBlock(),e.createBlock(e.unref(Fe.KDropdownItem),{key:0,onClick:Z},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("plugins.free-form.datakit.flow_editor.actions.remove_from_branch")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(Fe.KDropdownItem),{danger:"",onClick:J[0]||(J[0]=G=>e.unref(u)(n.data.id))},{default:e.withCtx(()=>[e.createVNode($l,{keys:e.unref(pl).delete,label:e.unref(r)("plugins.free-form.datakit.flow_editor.actions.delete")},null,8,["keys","label"])]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(Fe.KButton),{appearance:"tertiary",class:"menu-trigger",icon:"",size:"small"},{default:e.withCtx(()=>[e.createVNode(e.unref($e.MoreIcon),{color:`var(--kui-color-text, ${e.unref(hd)})`},null,8,["color"])]),_:1})]),_:1},8,["disabled"]))]),t["before-handles"]?e.renderSlot(F.$slots,"before-handles",{key:0,data:n.data},void 0,!0):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["handles",{reversed:U.value}])},[w.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["input-handles",{"has-fields":m.value}])},[e.createElementVNode("div",KB,[e.createVNode(e.unref(xt.Handle),{id:"input",position:x.value,type:"target"},null,8,["position"]),ne.value.has("input")?(e.openBlock(),e.createBlock(Rl,{key:0,mode:"input",reversed:X("input"),targets:ne.value.get("input")},null,8,["reversed","targets"])):e.createCommentVNode("",!0),e.createElementVNode("div",qB,[e.createElementVNode("div",{class:e.normalizeClass(["handle-label trigger",{collapsible:y.value}]),onClick:J[2]||(J[2]=e.withModifiers(G=>te("input"),["stop"]))},[J[4]||(J[4]=e.createElementVNode("div",{class:"text"}," inputs ",-1)),m.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[_.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref($e.UnfoldMoreIcon),{key:0,size:`var(--kui-icon-size-20, ${e.unref(dl)})`},null,8,["size"])),_.value?(e.openBlock(),e.createBlock(e.unref($e.UnfoldLessIcon),{key:1,color:y.value?void 0:`var(--kui-color-text-disabled, ${e.unref(Xg)})`,size:`var(--kui-icon-size-20, ${e.unref(dl)})`},null,8,["color","size"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)],2),m.value&&_.value?(e.openBlock(),e.createBlock(Ll,{key:0,color:R.value,position:x.value,type:"bar"},null,8,["color","position"])):e.createCommentVNode("",!0)])]),m.value&&_.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(n.data.fields.input,(G,v)=>(e.openBlock(),e.createElementBlock("div",{key:`inputs-${G.id}`,class:"handle indented"},[e.createVNode(e.unref(xt.Handle),{id:`inputs@${G.id}`,position:x.value,type:"target"},null,8,["id","position"]),ne.value.has(G.id)?(e.openBlock(),e.createBlock(Rl,{key:0,mode:"input",reversed:X("input"),targets:ne.value.get(G.id)},null,8,["reversed","targets"])):e.createCommentVNode("",!0),e.createElementVNode("div",GB,[e.createElementVNode("div",HB,e.toDisplayString(G.name),1),e.createVNode(Ll,{color:R.value,position:x.value,type:v<n.data.fields.input.length-1?"trident":"corner"},null,8,["color","position","type"])])]))),128)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),S.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["output-handles",{"has-fields":h.value}])},[e.createElementVNode("div",zB,[e.createElementVNode("div",WB,[e.createElementVNode("div",{class:e.normalizeClass(["handle-label trigger",{collapsible:b.value}]),onClick:J[3]||(J[3]=e.withModifiers(G=>te("output"),["stop"]))},[J[5]||(J[5]=e.createElementVNode("div",{class:"text"}," outputs ",-1)),h.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[k.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref($e.UnfoldMoreIcon),{key:0,size:`var(--kui-icon-size-20, ${e.unref(dl)})`},null,8,["size"])),k.value?(e.openBlock(),e.createBlock(e.unref($e.UnfoldLessIcon),{key:1,color:b.value?void 0:`var(--kui-color-text-disabled, ${e.unref(Xg)})`,size:`var(--kui-icon-size-20, ${e.unref(dl)})`},null,8,["color","size"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)],2),h.value&&k.value?(e.openBlock(),e.createBlock(Ll,{key:0,color:R.value,position:A.value,type:"bar"},null,8,["color","position"])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(xt.Handle),{id:"output",position:A.value,type:"source"},null,8,["position"]),M.value.has("output")?(e.openBlock(),e.createBlock(Rl,{key:0,mode:"output",reversed:X("output"),targets:M.value.get("output")},null,8,["reversed","targets"])):e.createCommentVNode("",!0)]),h.value&&k.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(n.data.fields.output,(G,v)=>(e.openBlock(),e.createElementBlock("div",{key:`outputs-${G.id}`,class:"handle indented"},[e.createElementVNode("div",YB,[e.createElementVNode("div",JB,e.toDisplayString(G.name),1),e.createVNode(Ll,{color:R.value,position:A.value,type:v<n.data.fields.output.length-1?"trident":"corner"},null,8,["color","position","type"])]),e.createVNode(e.unref(xt.Handle),{id:`outputs@${G.id}`,position:A.value,type:"source"},null,8,["id","position"]),M.value.has(G.id)?(e.openBlock(),e.createBlock(Rl,{key:0,mode:"output",reversed:X("output"),targets:M.value.get(G.id)},null,8,["reversed","targets"])):e.createCommentVNode("",!0)]))),128)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),N.value?(e.openBlock(),e.createElementBlock("div",XB,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,G=>(e.openBlock(),e.createElementBlock("div",{key:`branch-${G}`,class:"handle"},[e.createElementVNode("div",ZB,[e.createElementVNode("div",QB,e.toDisplayString(G),1)]),e.createVNode(e.unref(xt.Handle),{id:`branch@${G}`,connectable:!1,position:T.value,type:"source"},null,8,["id","position"])]))),128))])):e.createCommentVNode("",!0)],2),t["after-handles"]?e.renderSlot(F.$slots,"after-handles",{key:1,data:n.data},void 0,!0):e.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-1de3b7cb"]]),eT=je(e.defineComponent({__name:"GroupNode",props:{data:{},active:{type:Boolean}},setup(n){const t=n,r=e.computed(()=>t.data.phase==="response"),o=e.computed(()=>r.value?xt.Position.Right:xt.Position.Left);return(i,a)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["dk-branch-group-node",{reversed:r.value,"drop-target":n.active}])},[e.createVNode(e.unref(xt.Handle),{id:"input",connectable:!1,position:o.value,type:"target"},null,8,["position"])],2))}}),[["__scopeId","data-v-cf30ffea"]]),pf=je(e.defineComponent({__name:"FlowCanvas",props:{flowId:{},phase:{},mode:{}},emits:["initialized","nodes-change","node-click"],setup(n,{expose:t,emit:r}){const o=e.useSlots(),i=r,a=e.useTemplateRef("flowCanvas"),s=Pt.useElementBounding(a),{i18n:{t:c}}=Qe(),l=e.computed(()=>{const oe=n.mode==="edit"||n.mode==="inspect";return{panOnDrag:oe?void 0:!1,panOnScroll:oe?void 0:!1,zoomOnDoubleClick:oe?void 0:!1,zoomOnPinch:oe?void 0:!1,zoomOnScroll:oe?void 0:!1}}),{vueFlowStore:u,editorStore:p,autoLayout:d,fitViewParams:f,fitView:m,selectNode:h,placeToRight:y,scrollRightToReveal:b,groupDrop:_}=IB({phase:n.phase,flowId:n.flowId,layoutOptions:{viewport:{width:s.width,height:s.height}},readonly:n.mode!=="edit"}),{addNode:k,propertiesPanelOpen:C,invalidConfigNodeIds:N,selectedNode:E,duplicateNode:w,commit:S,selectPortalEdge:I}=p,{screenToFlowCoordinate:U,zoomIn:x,zoomOut:A,viewport:T,maxZoom:V,minZoom:R}=u,{activeGroupId:X,startPanelDrag:Y,endPanelDrag:ne,updateActiveGroup:M,attachNodeToActiveGroup:te}=_;function $(oe){var ye;const ke=(ye=oe.dataTransfer)==null?void 0:ye.types.find(ce=>ce.startsWith(`${ba}/`));if(ke)return ke.replace(`${ba}/`,"")}function Z(oe){var ke,ye;if(n.mode==="inspect"){if(((ke=oe==null?void 0:oe.node)==null?void 0:ke.type)==="group")return;i("node-click",oe.node.data);return}if(n.mode==="edit"){if(((ye=oe==null?void 0:oe.node)==null?void 0:ye.type)==="group"){h(void 0),I(void 0);return}C.value=!0}}function F(oe){n.mode==="edit"&&(oe.preventDefault(),M(U({x:oe.clientX,y:oe.clientY})))}function J(oe){var qe;if(n.mode!=="edit")return;const ke=(qe=oe.dataTransfer)==null?void 0:qe.getData(ba);if(!ke)return;oe.preventDefault();const ye=JSON.parse(ke);if(ye.action!=="create-node")return;const ce=U({x:oe.clientX,y:oe.clientY}),{type:he,anchor:Oe}=ye.data,De={type:he,phase:n.phase,position:{x:ce.x-Oe.offsetX,y:ce.y-Oe.offsetY}},Be=k(De,!1);if(!Be){ne();return}te(Be),S(),h(Be),C.value=!0,ne()}async function G(){i("initialized"),n.mode==="inspect"&&setTimeout(async()=>{await d(!1),setTimeout(()=>m(),0)},0)}async function v(){await d(),setTimeout(()=>m(),0)}const q=e.computed(()=>{if(n.mode==="preview")return[];const oe=[{name:"zoom_in",icon:$e.AddIcon,action:x,disabled:T.value.zoom>=V.value},{name:"zoom_out",icon:$e.RemoveIcon,action:A,disabled:T.value.zoom<=R.value},{name:"fit_view",icon:$e.FullscreenIcon,action:m}];return n.mode==="edit"&&oe.push({name:"auto_layout",icon:$e.AutoLayoutIcon,action:v}),oe});n.mode==="edit"&&(Pt.useEventListener("dragstart",oe=>{$(oe)&&Y()}),Pt.useEventListener("dragend",()=>{ne()}));async function ie(){const oe=E.value;if(n.mode!=="edit"||!oe||oe.phase!==n.phase)return;const ke=w(oe.id,y(oe.id));ke&&(await h(ke),C.value=!0,b(ke))}return Wg({enabled:e.computed(()=>!!E.value&&n.mode==="edit"&&E.value.phase===n.phase),duplicate:ie}),t({autoLayout:d,fitView:m}),(oe,ke)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"flowCanvas",ref:a,class:"dk-flow-canvas"},[e.createVNode(e.unref(xt.VueFlow),e.mergeProps({id:n.flowId,class:["flow",{readonly:n.mode!=="edit",inspect:n.mode==="inspect"}]},l.value,{"connect-on-click":!1,"elements-selectable":n.mode==="edit"||n.mode==="inspect","max-zoom":e.unref(J1),"min-zoom":e.unref(X1),"multi-selection-key-code":null,"nodes-connectable":n.mode==="edit","nodes-draggable":n.mode==="edit",onDragover:F,onDrop:J,onNodeClick:Z,onNodesChange:ke[0]||(ke[0]=ye=>i("nodes-change")),onNodesInitialized:G}),{"node-flow":e.withCtx(({data:ye})=>[e.createVNode(s_,{data:ye,error:e.unref(N).has(ye.id),readonly:n.mode!=="edit"},e.createSlots({_:2},[o["node-before-handles"]?{name:"before-handles",fn:e.withCtx(()=>[e.renderSlot(oe.$slots,"node-before-handles",{data:ye},void 0,!0)]),key:"0"}:void 0,o["node-actions"]?{name:"actions",fn:e.withCtx(()=>[e.renderSlot(oe.$slots,"node-actions",{data:ye},void 0,!0)]),key:"1"}:void 0,o["node-after-handles"]?{name:"after-handles",fn:e.withCtx(()=>[e.renderSlot(oe.$slots,"node-after-handles",{data:ye},void 0,!0)]),key:"2"}:void 0]),1032,["data","error","readonly"])]),"node-group":e.withCtx(({data:ye})=>[e.createVNode(eT,{active:e.unref(X)===ye.id,data:ye},null,8,["active","data"])]),default:e.withCtx(()=>[e.createVNode(e.unref(h1.Background)),e.createVNode(e.unref(Gg.Controls),{"fit-view-params":e.unref(f),position:"bottom-left","show-fit-view":!1,"show-interactive":!1,"show-zoom":!1},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(q.value,ye=>(e.openBlock(),e.createBlock(e.unref(Fe.KTooltip),{key:ye.name,placement:"right",text:e.unref(c)(`plugins.free-form.datakit.flow_editor.actions.${ye.name}`)},{default:e.withCtx(()=>[e.createVNode(e.unref(Gg.ControlButton),{disabled:ye.disabled,onClick:e.withModifiers(ye.action,["stop"])},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(ye.icon),{size:18}))]),_:2},1032,["disabled","onClick"])]),_:2},1032,["text"]))),128))]),_:1},8,["fit-view-params"])]),_:3},16,["id","class","elements-selectable","max-zoom","min-zoom","nodes-connectable","nodes-draggable"])],512))}}),[["__scopeId","data-v-11561a7e"]]);function l_(){const n=["methods","logout_methods"];return{setFieldType:(p,d,f)=>{var m,h,y;if(!(!p||!d||!f))switch(f.type){case"boolean":p[d]={type:Ie.ConfigurationSchemaType.BadgeStatus,...p[d]};break;case"string":f.encrypted?p[d]={type:Ie.ConfigurationSchemaType.Redacted,...p[d]}:p[d]={type:Ie.ConfigurationSchemaType.Text,...p[d]};break;case"set":((m=f.elements)==null?void 0:m.type)==="string"&&(p[d]={type:Ie.ConfigurationSchemaType.BadgeTag,...p[d]});break;case"array":n.includes(d)?p[d]={type:Ie.ConfigurationSchemaType.BadgeMethod,...p[d]}:((h=f.elements)==null?void 0:h.type)==="string"?f.encrypted?p[d]={type:Ie.ConfigurationSchemaType.RedactedArray,...p[d]}:p[d]={type:Ie.ConfigurationSchemaType.BadgeTag,...p[d]}:((y=f.elements)==null?void 0:y.type)==="record"&&(p[d]={type:Ie.ConfigurationSchemaType.Json,...p[d]});break;case"record":p[d]={type:Ie.ConfigurationSchemaType.Json,...p[d]};break;default:p[d]={type:Ie.ConfigurationSchemaType.Text,...p[d]};break}},convertToDotNotation:p=>p.replace(/-/g,"."),unFlattenObject:p=>{const d={};for(const f in p){const m=f.split(".");m.reduce((h,y,b)=>h[y]||(h[y]=isNaN(m[b+1])?m.length-1===b?p[f]:{}:[]),d)}return d},dismissField:(p,d,f="redis",m=!1)=>{const h=new RegExp("(?<=-redis-).*");if(typeof p!="object"||p===null)return p;f==="redis"?Object.keys(p).forEach(y=>{y.match(h)&&delete p[y]}):m?p[f]=null:delete p[f],Object.assign(p,d)},isObjectEmpty:p=>Object.keys(p).length===0,unsetNullForeignKey:(p,d)=>{["service.id","route.id","consumer.id","consumer_group.id"].indexOf(p)>-1&&d[p]===null&&(delete d[p],d[p.replace(".id","")]=null)},formatPluginFieldLabel:p=>p.replace(/_/g," ").split("-").map(d=>d.charAt(0).toUpperCase()+d.slice(1)).join("-"),getTallestPluginCardHeight:p=>{let d=0;if(p.length)for(let f=0;f<p.length;f++){const m=p[f].$el;d=m.offsetHeight>d?m.offsetHeight:d}return d},getToggleVisibility:(p,d)=>{var f,m;if(p&&d){const h=(m=(f=window==null?void 0:window.getComputedStyle(p))==null?void 0:f.getPropertyValue("grid-template-columns"))==null?void 0:m.split(" ").length;return d>h}return!0}}}var Dl=(n=>(n.REDIS_CE="redis-ce",n.REDIS_EE="redis-ee",n))(Dl||{});const Ml=["Featured"],mf=[fe.PluginGroup.AUTHENTICATION,fe.PluginGroup.AI,fe.PluginGroup.SECURITY,fe.PluginGroup.TRAFFIC_CONTROL,fe.PluginGroup.SERVERLESS,fe.PluginGroup.ANALYTICS_AND_MONITORING,fe.PluginGroup.TRANSFORMATIONS,fe.PluginGroup.LOGGING,fe.PluginGroup.DEPLOYMENT,fe.PluginGroup.WEBSOCKET,fe.PluginGroup.MONETIZATION,fe.PluginGroup.CUSTOM_PLUGINS],jl=[fe.PluginGroup.AI,fe.PluginGroup.ANALYTICS_AND_MONITORING,fe.PluginGroup.AUTHENTICATION,fe.PluginGroup.LOGGING,fe.PluginGroup.MONETIZATION,fe.PluginGroup.SECURITY,fe.PluginGroup.SERVERLESS,fe.PluginGroup.TRAFFIC_CONTROL,fe.PluginGroup.TRANSFORMATIONS,fe.PluginGroup.CUSTOM_PLUGINS];var wo=(n=>(n.SERVICE="service_id",n.ROUTE="route_id",n.CONSUMER="consumer_id",n.CONSUMER_GROUP="consumer_group_id",n))(wo||{});const ko=n=>{const t=Object.fromEntries(n.fields.map(r=>Object.entries(r)[0]));return"id"in t||(t.id={}),t},Co={label:"Tags",name:"tags",type:"input",inputType:"text",valueType:"array",valueArrayType:"string",placeholder:"Enter list of tags",help:"An optional set of strings for grouping and filtering, separated by commas.",hint:"e.g. tag1, tag2, tag3"},di={getColumnFields:ko,tags:Co,id:{label:"ID"},enabled:{label:"Enabled",indexed:!0,type:"boolean"},created_at:{label:"Created"},updated_at:{label:"Last updated"},fields:{arrayItems(n){const t=n.inputAttributes||{};return delete n.inputAttributes,{type:"array",itemContainerComponent:"FieldArrayItem",fieldClasses:"kong-form-array-field",fieldItemsClasses:"kong-form-array-field-item",newElementButtonLabelClasses:"kong-form-new-element-button-label",inputAttributes:{class:"form-control",style:{minWidth:"200px"},...t},removeElementButtonLabel:"remove",styleClasses:"kong-form-field-wrapper",inputType:"text",valueType:"array",valueArrayType:"string",...n}}}},c_={fields:[{group:{hint:"The arbitrary group name to associate to the consumer."}},{tags:Co}]},tT={fields:[{id:{uuid:!0,type:"string",auto:!0}},{created_at:{auto:!0,timestamp:!0,type:"integer"}},{consumer:{reference:"consumers",type:"foreign",on_delete:"cascade",required:!0}},{group:{required:!0,type:"string",hint:"The arbitrary group name to associate to the consumer."}},{tags:{elements:{type:"string",required:!0},type:"set"}}]},u_={fields:[{username:{}},{password:{inputType:"password"}},{tags:Co}]},nT={fields:[{id:{uuid:!0,type:"string",auto:!0}},{created_at:{auto:!0,timestamp:!0,type:"integer"}},{consumer:{reference:"consumers",type:"foreign",on_delete:"cascade",required:!0}},{username:{required:!0,type:"string",unique:!0}},{password:{type:"string",required:!0,encrypted:!0}},{tags:{elements:{type:"string",required:!0},type:"set"}}]},d_=e.defineComponent({name:"KeyAuthIdentityRealmsBase",__name:"Base",props:e.mergeModels({realms:{}},{modelValue:{default:[{scope:"cp",id:null,region:null}]},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const t=n,r=e.useModel(n,"modelValue"),{i18n:o}=st.useI18n(),{t:i}=o,a={value:"current-cp",label:i("custom_field.key_auth_identity_realms.cp_label"),group:i("custom_field.key_auth_identity_realms.cp_group_label")},s=e.inject(et.FORMS_CONFIG),{axiosInstance:c}=Ie.useAxios(s==null?void 0:s.axiosRequestConfig),l=()=>{if((s==null?void 0:s.app)==="konnect"){const h=/\b(us|eu|au|me|in|sg)\b/.exec((s==null?void 0:s.apiBaseUrl)||"");if(h)return{region:h[1]}}return{}},u=e.ref(!0),p=e.ref([a]),d=async()=>{if((s==null?void 0:s.app)==="konnect")try{u.value=!0;let h=`${s==null?void 0:s.apiBaseUrl}/v1/realms`;const y=[];do{const b=await c.get(h);b&&b.data&&b.data.data&&y.push(...b.data.data.map(_=>({value:_.id,label:_.name,group:i("custom_field.key_auth_identity_realms.realm_group_label")}))),h=b.data.meta.next?`${s==null?void 0:s.apiBaseUrl}${b.data.meta.next}`:null}while(h);p.value=[a,...y]}catch(h){console.error("Failed to fetch Konnect realms",h)}finally{u.value=!1}},f=e.computed(()=>r.value.map(h=>h.id||"current-cp")),m=h=>{const y=h.includes("current-cp")?[{scope:"cp",id:null,region:null}]:[],b=r.value.filter(({scope:E})=>E!=="cp").map(({id:E})=>E),_=h.filter(E=>E!=="current-cp"),N=(b.length!==_.length||b.some(E=>!_.includes(E))?_.filter(E=>!b.includes(E)):_).map(E=>({...l(),scope:"realm",id:E}));r.value=[...y,...N]};return e.onMounted(()=>{t.realms===void 0&&d()}),e.watch(()=>t.realms,h=>{h&&(p.value=[a,...h.map(y=>({...y,group:i("custom_field.key_auth_identity_realms.realm_group_label")}))],u.value=!1)},{immediate:!0}),(h,y)=>{const b=e.resolveComponent("KMultiselect");return e.openBlock(),e.createBlock(b,{items:p.value,loading:u.value,"model-value":f.value,"onUpdate:modelValue":m},null,8,["items","loading","model-value"])}}}),rT={class:"field-wrapper"},oT=je(e.defineComponent({__name:"VfgAdapter",props:{disabled:{type:Boolean},formOptions:{},model:{},schema:{},vfg:{},errors:{},hint:{}},emits:["modelUpdated"],setup(n,{expose:t,emit:r}){const o=n,i=r,{clearValidationErrors:a,value:s}=et.composables.useAbstractFields({model:e.toRef(()=>o.model),schema:o.schema,formOptions:o.formOptions,emitModelUpdated:c=>{i("modelUpdated",c.value,c.model)}});return t({clearValidationErrors:a}),(c,l)=>(e.openBlock(),e.createElementBlock("div",rT,[e.createVNode(d_,{modelValue:e.unref(s),"onUpdate:modelValue":l[0]||(l[0]=u=>e.isRef(s)?s.value=u:null)},null,8,["modelValue"])]))}}),[["__scopeId","data-v-269e85ed"]]),f_={fields:[{key:{submitWhenNull:!1,hint:`You can optionally set your own unique key to authenticate the
3
+ will extend the wait time by about 12 minutes, continuously adjusting as new requests are made.`}}}},custom_plugin_form:{step1:{title:"Custom plugin type",types:{installed:{label:"Installed custom plugin",description:"Install and manage plugins with full control over deployment and runtime. Requires restarting data planes."},streamed:{label:"Streamed custom plugin",description:"Deploy and update plugins on running data planes without requiring gateway access."},cloned:{label:"Cloned plugin",description:"Duplicate an existing plugin to run multiple instances within a single request."}},compare_trigger:"Compare deployment options",compare_table:{columns:{installed:"Installed custom plugin",streamed:"Streamed custom plugin",cloned:"Cloned plugin"},rows:{main_use_case:{header:"Main use case",installed:"Extend Kong functionality with custom plugins and control who can modify and roll out changes.",streamed:"Extend Kong functionality with plugins without requiring sysadmin access to data plane instances.",cloned:"Modify an existing plugin to run multiple instances with different names or priorities."},file_supplied:{header:"File supplied",installed:{handler:"handler.lua",schema:"schema.lua",additional:"Any additional files or libraries needed"},streamed:{handler:"handler.lua",schema:"schema.lua"}},how_installed:{header:"How it's installed",installed:"Install directly on the data plane",streamed:"Through gateway configuration changes",cloned:"Through gateway configuration changes"},sandboxing:{header:"Sandboxing",streamed:"Follows the standard sandboxing settings. {link}",streamed_link:"Link to docs",cloned:"Inherit the same sandboxing as the original plugins"},data_plane_reload:{header:"Data plane reload"}}}},step2_files:{title:"Custom plugin files",schema_file:{label:"Upload schema file",placeholder:"No file selected",placeholder_edit:"File not changed",button_text:"Select File",help:"Only Lua based schemas are supported by Konnect. Other plugin modules can be in any language as desired. Learn more"},handler_file:{label:"Upload handler file",placeholder:"No file selected",placeholder_edit:"File not changed",button_text:"Select File",help:"Upload plugin handler to the data plane."},plugin_modules:{label:"Plugin modules",alert:"Upload all plugin modules to the data plane: schema.lua, handler.lua"}},step2_clone:{title:"Clone plugin",select_plugin:{label:"Select a plugin",placeholder:"Type to search"}},step3:{title:"General information",description:"Enter a custom name for this custom plugin",name:{label:"Name",placeholder:"Enter a unique name",help:"The name must be identical to the name of the plugin in the schema file."},alias_name:{label:"Alias name",placeholder:"Enter a unique name",help:"Format: ^[a-z][a-z0-9-]*[a-z0-9]$. The name must be unique enough to avoid future conflicts with bundled plugins."},priority:{label:"Priority",tooltip:"Set the execution priority for this cloned plugin",help:{text:"Optional. Use a number to set the absolute execution priority. If priority isn't set, plugins run in alphabetical order. {link} in the docs.",link:"Learn more"}}},errors:{file_read_error:"Failed to read file content. Please try again.",file_too_large:"File size exceeds the maximum limit of 1 MB.",plugin_not_found:"The selected plugin could not be found. Please refresh the list and try again.",no_supported_types:"No supported custom plugin types are available in this context.",unsupported_plugin_type:"Unsupported plugin type {type}."}}};function Qe(){const n=jt.createI18n("en-us",Jt);return{i18n:n,i18nT:jt.i18nTComponent(n)}}const k1=["undo","redo","duplicate","cut","copy","paste"],zg=()=>{};function C1(n){const t=n;return t?!!t.closest('input, textarea, [contenteditable]:not([contenteditable="false"])'):!1}function E1(n){if(!(n.metaKey||n.ctrlKey))return;switch(n.key.toLowerCase()){case"z":return n.shiftKey?"redo":"undo";case"y":return"redo";case"d":return"duplicate";case"x":return"cut";case"c":return"copy";case"v":return"paste"}}const N1=Pt.createSharedComposable(()=>{const n=new Set;Pt.useEventListener("keydown",r=>{if(C1(r.target))return;const o=E1(r);if(o)for(const i of n){if(!e.toValue(i.enabled))continue;const a=i[o];if(a){if(r.defaultPrevented){e.warn(`[useHotkeys] event for "${o}" was already defaultPrevented. Hotkey ignored.`);return}r.preventDefault(),a();return}}},{passive:!1});function t(r){if(!k1.some(i=>typeof r[i]=="function"))return zg;const o={enabled:r.enabled??!0,...r};return n.add(o),()=>n.delete(o)}return{subscribe:t}});function Wg(n={}){if(typeof window>"u")return zg;const t=N1().subscribe(n);return e.onScopeDispose(t),t}const S1="#ecfcff",x1="#f1f0ff",A1="#52596e",v1="#e0e4ea",I1="#007d60",B1="#fffce0",T1="#6c7489",O1="#0044f4",P1="#5f9aff",hd="#000933",Yg="#d60027",V1="#00abd2",Jg="#6f28ff",Xg="#afb7c5",cr="#6c7489",$1="#0044f4",R1="#eefaff",Zg="#007d60",L1="#ecfffb",D1="#995c00",M1="#306fff",dl="12px",Yn="16px",_a="20px",yd="24px",j1="2px",Qg="8px",F1="32px",eh=44,U1=220,th=366,K1=1e3,q1=eh+parseFloat(Qg),fl=1,G1=0,H1=1,z1=2,W1=3,Qo=parseInt(F1,10),ba="application/x-datakit+json",pl={delete:["Delete"],undo:["Mod","Z"],redo:{mac:["Mod","Shift","Z"],windows:["Mod","Y"],linux:["Mod","Shift","Z"]},copy:["Mod","C"],paste:["Mod","V"],duplicate:["Mod","D"]},Jr={padding:80,gaps:{nodes:60,edges:80,ranks:60}},Y1=1600,J1=1.2,X1=0,Z1=200,nh=Symbol("confirm-modal");var rh=typeof global=="object"&&global&&global.Object===Object&&global,Q1=typeof self=="object"&&self&&self.Object===Object&&self,ur=rh||Q1||Function("return this")(),Vn=ur.Symbol,oh=Object.prototype,eE=oh.hasOwnProperty,tE=oh.toString,wa=Vn?Vn.toStringTag:void 0;function nE(n){var t=eE.call(n,wa),r=n[wa];try{n[wa]=void 0;var o=!0}catch{}var i=tE.call(n);return o&&(t?n[wa]=r:delete n[wa]),i}var rE=Object.prototype,oE=rE.toString;function iE(n){return oE.call(n)}var aE="[object Null]",sE="[object Undefined]",ih=Vn?Vn.toStringTag:void 0;function po(n){return n==null?n===void 0?sE:aE:ih&&ih in Object(n)?nE(n):iE(n)}function dr(n){return n!=null&&typeof n=="object"}var lE="[object Symbol]";function _d(n){return typeof n=="symbol"||dr(n)&&po(n)==lE}function bd(n,t){for(var r=-1,o=n==null?0:n.length,i=Array(o);++r<o;)i[r]=t(n[r],r,n);return i}var Jn=Array.isArray,ah=Vn?Vn.prototype:void 0,sh=ah?ah.toString:void 0;function lh(n){if(typeof n=="string")return n;if(Jn(n))return bd(n,lh)+"";if(_d(n))return sh?sh.call(n):"";var t=n+"";return t=="0"&&1/n==-1/0?"-0":t}function mo(n){var t=typeof n;return n!=null&&(t=="object"||t=="function")}function ch(n){return n}var cE="[object AsyncFunction]",uE="[object Function]",dE="[object GeneratorFunction]",fE="[object Proxy]";function ml(n){if(!mo(n))return!1;var t=po(n);return t==uE||t==dE||t==cE||t==fE}var wd=ur["__core-js_shared__"],uh=function(){var n=/[^.]+$/.exec(wd&&wd.keys&&wd.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function pE(n){return!!uh&&uh in n}var mE=Function.prototype,gE=mE.toString;function go(n){if(n!=null){try{return gE.call(n)}catch{}try{return n+""}catch{}}return""}var hE=/[\\^$.*+?()[\]{}|]/g,yE=/^\[object .+?Constructor\]$/,_E=Function.prototype,bE=Object.prototype,wE=_E.toString,kE=bE.hasOwnProperty,CE=RegExp("^"+wE.call(kE).replace(hE,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function EE(n){if(!mo(n)||pE(n))return!1;var t=ml(n)?CE:yE;return t.test(go(n))}function NE(n,t){return n==null?void 0:n[t]}function ho(n,t){var r=NE(n,t);return EE(r)?r:void 0}var kd=ho(ur,"WeakMap"),dh=Object.create,SE=function(){function n(){}return function(t){if(!mo(t))return{};if(dh)return dh(t);n.prototype=t;var r=new n;return n.prototype=void 0,r}}();function xE(n,t,r){switch(r.length){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function AE(n,t){var r=-1,o=n.length;for(t||(t=Array(o));++r<o;)t[r]=n[r];return t}var vE=800,IE=16,BE=Date.now;function TE(n){var t=0,r=0;return function(){var o=BE(),i=IE-(o-r);if(r=o,i>0){if(++t>=vE)return arguments[0]}else t=0;return n.apply(void 0,arguments)}}function OE(n){return function(){return n}}var gl=function(){try{var n=ho(Object,"defineProperty");return n({},"",{}),n}catch{}}(),PE=gl?function(n,t){return gl(n,"toString",{configurable:!0,enumerable:!1,value:OE(t),writable:!0})}:ch,fh=TE(PE);function VE(n,t){for(var r=-1,o=n==null?0:n.length;++r<o&&t(n[r],r,n)!==!1;);return n}function $E(n,t,r,o){for(var i=n.length,a=r+-1;++a<i;)if(t(n[a],a,n))return a;return-1}function RE(n){return n!==n}function LE(n,t,r){for(var o=r-1,i=n.length;++o<i;)if(n[o]===t)return o;return-1}function DE(n,t,r){return t===t?LE(n,t,r):$E(n,RE,r)}function ME(n,t){var r=n==null?0:n.length;return!!r&&DE(n,t,0)>-1}var jE=9007199254740991,FE=/^(?:0|[1-9]\d*)$/;function Cd(n,t){var r=typeof n;return t=t??jE,!!t&&(r=="number"||r!="symbol"&&FE.test(n))&&n>-1&&n%1==0&&n<t}function ph(n,t,r){t=="__proto__"&&gl?gl(n,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):n[t]=r}function Ed(n,t){return n===t||n!==n&&t!==t}var UE=Object.prototype,KE=UE.hasOwnProperty;function Nd(n,t,r){var o=n[t];(!(KE.call(n,t)&&Ed(o,r))||r===void 0&&!(t in n))&&ph(n,t,r)}function ka(n,t,r,o){var i=!r;r||(r={});for(var a=-1,s=t.length;++a<s;){var c=t[a],l=void 0;l===void 0&&(l=n[c]),i?ph(r,c,l):Nd(r,c,l)}return r}var mh=Math.max;function gh(n,t,r){return t=mh(t===void 0?n.length-1:t,0),function(){for(var o=arguments,i=-1,a=mh(o.length-t,0),s=Array(a);++i<a;)s[i]=o[t+i];i=-1;for(var c=Array(t+1);++i<t;)c[i]=o[i];return c[t]=r(s),xE(n,this,c)}}function qE(n,t){return fh(gh(n,t,ch),n+"")}var GE=9007199254740991;function Sd(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=GE}function hl(n){return n!=null&&Sd(n.length)&&!ml(n)}var HE=Object.prototype;function yl(n){var t=n&&n.constructor,r=typeof t=="function"&&t.prototype||HE;return n===r}function zE(n,t){for(var r=-1,o=Array(n);++r<n;)o[r]=t(r);return o}var WE="[object Arguments]";function hh(n){return dr(n)&&po(n)==WE}var yh=Object.prototype,YE=yh.hasOwnProperty,JE=yh.propertyIsEnumerable,_l=hh(function(){return arguments}())?hh:function(n){return dr(n)&&YE.call(n,"callee")&&!JE.call(n,"callee")};function XE(){return!1}var _h=typeof ve=="object"&&ve&&!ve.nodeType&&ve,bh=_h&&typeof module=="object"&&module&&!module.nodeType&&module,ZE=bh&&bh.exports===_h,wh=ZE?ur.Buffer:void 0,QE=wh?wh.isBuffer:void 0,Ca=QE||XE,eN="[object Arguments]",tN="[object Array]",nN="[object Boolean]",rN="[object Date]",oN="[object Error]",iN="[object Function]",aN="[object Map]",sN="[object Number]",lN="[object Object]",cN="[object RegExp]",uN="[object Set]",dN="[object String]",fN="[object WeakMap]",pN="[object ArrayBuffer]",mN="[object DataView]",gN="[object Float32Array]",hN="[object Float64Array]",yN="[object Int8Array]",_N="[object Int16Array]",bN="[object Int32Array]",wN="[object Uint8Array]",kN="[object Uint8ClampedArray]",CN="[object Uint16Array]",EN="[object Uint32Array]",Bt={};Bt[gN]=Bt[hN]=Bt[yN]=Bt[_N]=Bt[bN]=Bt[wN]=Bt[kN]=Bt[CN]=Bt[EN]=!0,Bt[eN]=Bt[tN]=Bt[pN]=Bt[nN]=Bt[mN]=Bt[rN]=Bt[oN]=Bt[iN]=Bt[aN]=Bt[sN]=Bt[lN]=Bt[cN]=Bt[uN]=Bt[dN]=Bt[fN]=!1;function NN(n){return dr(n)&&Sd(n.length)&&!!Bt[po(n)]}function xd(n){return function(t){return n(t)}}var kh=typeof ve=="object"&&ve&&!ve.nodeType&&ve,Ea=kh&&typeof module=="object"&&module&&!module.nodeType&&module,SN=Ea&&Ea.exports===kh,Ad=SN&&rh.process,ei=function(){try{var n=Ea&&Ea.require&&Ea.require("util").types;return n||Ad&&Ad.binding&&Ad.binding("util")}catch{}}(),Ch=ei&&ei.isTypedArray,vd=Ch?xd(Ch):NN,xN=Object.prototype,AN=xN.hasOwnProperty;function Eh(n,t){var r=Jn(n),o=!r&&_l(n),i=!r&&!o&&Ca(n),a=!r&&!o&&!i&&vd(n),s=r||o||i||a,c=s?zE(n.length,String):[],l=c.length;for(var u in n)(t||AN.call(n,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Cd(u,l)))&&c.push(u);return c}function Nh(n,t){return function(r){return n(t(r))}}var vN=Nh(Object.keys,Object),IN=Object.prototype,BN=IN.hasOwnProperty;function Sh(n){if(!yl(n))return vN(n);var t=[];for(var r in Object(n))BN.call(n,r)&&r!="constructor"&&t.push(r);return t}function Id(n){return hl(n)?Eh(n):Sh(n)}function TN(n){var t=[];if(n!=null)for(var r in Object(n))t.push(r);return t}var ON=Object.prototype,PN=ON.hasOwnProperty;function VN(n){if(!mo(n))return TN(n);var t=yl(n),r=[];for(var o in n)o=="constructor"&&(t||!PN.call(n,o))||r.push(o);return r}function Bd(n){return hl(n)?Eh(n,!0):VN(n)}var $N=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,RN=/^\w*$/;function LN(n,t){if(Jn(n))return!1;var r=typeof n;return r=="number"||r=="symbol"||r=="boolean"||n==null||_d(n)?!0:RN.test(n)||!$N.test(n)||t!=null&&n in Object(t)}var Na=ho(Object,"create");function DN(){this.__data__=Na?Na(null):{},this.size=0}function MN(n){var t=this.has(n)&&delete this.__data__[n];return this.size-=t?1:0,t}var jN="__lodash_hash_undefined__",FN=Object.prototype,UN=FN.hasOwnProperty;function KN(n){var t=this.__data__;if(Na){var r=t[n];return r===jN?void 0:r}return UN.call(t,n)?t[n]:void 0}var qN=Object.prototype,GN=qN.hasOwnProperty;function HN(n){var t=this.__data__;return Na?t[n]!==void 0:GN.call(t,n)}var zN="__lodash_hash_undefined__";function WN(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=Na&&t===void 0?zN:t,this}function yo(n){var t=-1,r=n==null?0:n.length;for(this.clear();++t<r;){var o=n[t];this.set(o[0],o[1])}}yo.prototype.clear=DN,yo.prototype.delete=MN,yo.prototype.get=KN,yo.prototype.has=HN,yo.prototype.set=WN;function YN(){this.__data__=[],this.size=0}function bl(n,t){for(var r=n.length;r--;)if(Ed(n[r][0],t))return r;return-1}var JN=Array.prototype,XN=JN.splice;function ZN(n){var t=this.__data__,r=bl(t,n);if(r<0)return!1;var o=t.length-1;return r==o?t.pop():XN.call(t,r,1),--this.size,!0}function QN(n){var t=this.__data__,r=bl(t,n);return r<0?void 0:t[r][1]}function eS(n){return bl(this.__data__,n)>-1}function tS(n,t){var r=this.__data__,o=bl(r,n);return o<0?(++this.size,r.push([n,t])):r[o][1]=t,this}function vr(n){var t=-1,r=n==null?0:n.length;for(this.clear();++t<r;){var o=n[t];this.set(o[0],o[1])}}vr.prototype.clear=YN,vr.prototype.delete=ZN,vr.prototype.get=QN,vr.prototype.has=eS,vr.prototype.set=tS;var Sa=ho(ur,"Map");function nS(){this.size=0,this.__data__={hash:new yo,map:new(Sa||vr),string:new yo}}function rS(n){var t=typeof n;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?n!=="__proto__":n===null}function wl(n,t){var r=n.__data__;return rS(t)?r[typeof t=="string"?"string":"hash"]:r.map}function oS(n){var t=wl(this,n).delete(n);return this.size-=t?1:0,t}function iS(n){return wl(this,n).get(n)}function aS(n){return wl(this,n).has(n)}function sS(n,t){var r=wl(this,n),o=r.size;return r.set(n,t),this.size+=r.size==o?0:1,this}function Ir(n){var t=-1,r=n==null?0:n.length;for(this.clear();++t<r;){var o=n[t];this.set(o[0],o[1])}}Ir.prototype.clear=nS,Ir.prototype.delete=oS,Ir.prototype.get=iS,Ir.prototype.has=aS,Ir.prototype.set=sS;var lS="Expected a function";function Td(n,t){if(typeof n!="function"||t!=null&&typeof t!="function")throw new TypeError(lS);var r=function(){var o=arguments,i=t?t.apply(this,o):o[0],a=r.cache;if(a.has(i))return a.get(i);var s=n.apply(this,o);return r.cache=a.set(i,s)||a,s};return r.cache=new(Td.Cache||Ir),r}Td.Cache=Ir;var cS=500;function uS(n){var t=Td(n,function(o){return r.size===cS&&r.clear(),o}),r=t.cache;return t}var dS=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,fS=/\\(\\)?/g,pS=uS(function(n){var t=[];return n.charCodeAt(0)===46&&t.push(""),n.replace(dS,function(r,o,i,a){t.push(i?a.replace(fS,"$1"):o||r)}),t});function _o(n){return n==null?"":lh(n)}function ti(n,t){return Jn(n)?n:LN(n,t)?[n]:pS(_o(n))}function xa(n){if(typeof n=="string"||_d(n))return n;var t=n+"";return t=="0"&&1/n==-1/0?"-0":t}function Od(n,t){t=ti(t,n);for(var r=0,o=t.length;n!=null&&r<o;)n=n[xa(t[r++])];return r&&r==o?n:void 0}function Aa(n,t,r){var o=n==null?void 0:Od(n,t);return o===void 0?r:o}function Pd(n,t){for(var r=-1,o=t.length,i=n.length;++r<o;)n[i+r]=t[r];return n}var xh=Vn?Vn.isConcatSpreadable:void 0;function mS(n){return Jn(n)||_l(n)||!!(xh&&n&&n[xh])}function gS(n,t,r,o,i){var a=-1,s=n.length;for(r||(r=mS),i||(i=[]);++a<s;){var c=n[a];r(c)?Pd(i,c):i[i.length]=c}return i}function hS(n){var t=n==null?0:n.length;return t?gS(n):[]}function Ah(n){return fh(gh(n,void 0,hS),n+"")}var Vd=Nh(Object.getPrototypeOf,Object),yS="[object Object]",_S=Function.prototype,bS=Object.prototype,vh=_S.toString,wS=bS.hasOwnProperty,kS=vh.call(Object);function CS(n){if(!dr(n)||po(n)!=yS)return!1;var t=Vd(n);if(t===null)return!0;var r=wS.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&vh.call(r)==kS}function Ih(n,t,r){var o=-1,i=n.length;t<0&&(t=-t>i?0:i+t),r=r>i?i:r,r<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(i);++o<i;)a[o]=n[o+t];return a}function ES(n,t,r){var o=n.length;return r=r===void 0?o:r,!t&&r>=o?n:Ih(n,t,r)}var NS="\\ud800-\\udfff",SS="\\u0300-\\u036f",xS="\\ufe20-\\ufe2f",AS="\\u20d0-\\u20ff",vS=SS+xS+AS,IS="\\ufe0e\\ufe0f",BS="\\u200d",TS=RegExp("["+BS+NS+vS+IS+"]");function Bh(n){return TS.test(n)}function OS(n){return n.split("")}var Th="\\ud800-\\udfff",PS="\\u0300-\\u036f",VS="\\ufe20-\\ufe2f",$S="\\u20d0-\\u20ff",RS=PS+VS+$S,LS="\\ufe0e\\ufe0f",DS="["+Th+"]",$d="["+RS+"]",Rd="\\ud83c[\\udffb-\\udfff]",MS="(?:"+$d+"|"+Rd+")",Oh="[^"+Th+"]",Ph="(?:\\ud83c[\\udde6-\\uddff]){2}",Vh="[\\ud800-\\udbff][\\udc00-\\udfff]",jS="\\u200d",$h=MS+"?",Rh="["+LS+"]?",FS="(?:"+jS+"(?:"+[Oh,Ph,Vh].join("|")+")"+Rh+$h+")*",US=Rh+$h+FS,KS="(?:"+[Oh+$d+"?",$d,Ph,Vh,DS].join("|")+")",qS=RegExp(Rd+"(?="+Rd+")|"+KS+US,"g");function GS(n){return n.match(qS)||[]}function HS(n){return Bh(n)?GS(n):OS(n)}function zS(n){return function(t){t=_o(t);var r=Bh(t)?HS(t):void 0,o=r?r[0]:t.charAt(0),i=r?ES(r,1).join(""):t.slice(1);return o[n]()+i}}var Lh=zS("toUpperCase");function WS(n){return Lh(_o(n).toLowerCase())}function YS(n,t,r,o){for(var i=-1,a=n==null?0:n.length;++i<a;)r=t(r,n[i],i,n);return r}function Dh(n){return function(t){return n==null?void 0:n[t]}}var JS={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},XS=Dh(JS),ZS=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,QS="\\u0300-\\u036f",ex="\\ufe20-\\ufe2f",tx="\\u20d0-\\u20ff",nx=QS+ex+tx,rx="["+nx+"]",ox=RegExp(rx,"g");function ix(n){return n=_o(n),n&&n.replace(ZS,XS).replace(ox,"")}var ax=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function sx(n){return n.match(ax)||[]}var lx=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function cx(n){return lx.test(n)}var Mh="\\ud800-\\udfff",ux="\\u0300-\\u036f",dx="\\ufe20-\\ufe2f",fx="\\u20d0-\\u20ff",px=ux+dx+fx,jh="\\u2700-\\u27bf",Fh="a-z\\xdf-\\xf6\\xf8-\\xff",mx="\\xac\\xb1\\xd7\\xf7",gx="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",hx="\\u2000-\\u206f",yx=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Uh="A-Z\\xc0-\\xd6\\xd8-\\xde",_x="\\ufe0e\\ufe0f",Kh=mx+gx+hx+yx,qh="['’]",Gh="["+Kh+"]",bx="["+px+"]",Hh="\\d+",wx="["+jh+"]",zh="["+Fh+"]",Wh="[^"+Mh+Kh+Hh+jh+Fh+Uh+"]",kx="\\ud83c[\\udffb-\\udfff]",Cx="(?:"+bx+"|"+kx+")",Ex="[^"+Mh+"]",Yh="(?:\\ud83c[\\udde6-\\uddff]){2}",Jh="[\\ud800-\\udbff][\\udc00-\\udfff]",ni="["+Uh+"]",Nx="\\u200d",Xh="(?:"+zh+"|"+Wh+")",Sx="(?:"+ni+"|"+Wh+")",Zh="(?:"+qh+"(?:d|ll|m|re|s|t|ve))?",Qh="(?:"+qh+"(?:D|LL|M|RE|S|T|VE))?",ey=Cx+"?",ty="["+_x+"]?",xx="(?:"+Nx+"(?:"+[Ex,Yh,Jh].join("|")+")"+ty+ey+")*",Ax="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",vx="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ix=ty+ey+xx,Bx="(?:"+[wx,Yh,Jh].join("|")+")"+Ix,Tx=RegExp([ni+"?"+zh+"+"+Zh+"(?="+[Gh,ni,"$"].join("|")+")",Sx+"+"+Qh+"(?="+[Gh,ni+Xh,"$"].join("|")+")",ni+"?"+Xh+"+"+Zh,ni+"+"+Qh,vx,Ax,Hh,Bx].join("|"),"g");function Ox(n){return n.match(Tx)||[]}function Px(n,t,r){return n=_o(n),t=t,t===void 0?cx(n)?Ox(n):sx(n):n.match(t)||[]}var Vx="['’]",$x=RegExp(Vx,"g");function Rx(n){return function(t){return YS(Px(ix(t).replace($x,"")),n,"")}}var Lx=Rx(function(n,t,r){return t=t.toLowerCase(),n+(r?WS(t):t)});function Dx(){this.__data__=new vr,this.size=0}function Mx(n){var t=this.__data__,r=t.delete(n);return this.size=t.size,r}function jx(n){return this.__data__.get(n)}function Fx(n){return this.__data__.has(n)}var Ux=200;function Kx(n,t){var r=this.__data__;if(r instanceof vr){var o=r.__data__;if(!Sa||o.length<Ux-1)return o.push([n,t]),this.size=++r.size,this;r=this.__data__=new Ir(o)}return r.set(n,t),this.size=r.size,this}function Br(n){var t=this.__data__=new vr(n);this.size=t.size}Br.prototype.clear=Dx,Br.prototype.delete=Mx,Br.prototype.get=jx,Br.prototype.has=Fx,Br.prototype.set=Kx;function qx(n,t){return n&&ka(t,Id(t),n)}function Gx(n,t){return n&&ka(t,Bd(t),n)}var ny=typeof ve=="object"&&ve&&!ve.nodeType&&ve,ry=ny&&typeof module=="object"&&module&&!module.nodeType&&module,Hx=ry&&ry.exports===ny,oy=Hx?ur.Buffer:void 0,iy=oy?oy.allocUnsafe:void 0;function zx(n,t){if(t)return n.slice();var r=n.length,o=iy?iy(r):new n.constructor(r);return n.copy(o),o}function Wx(n,t){for(var r=-1,o=n==null?0:n.length,i=0,a=[];++r<o;){var s=n[r];t(s,r,n)&&(a[i++]=s)}return a}function ay(){return[]}var Yx=Object.prototype,Jx=Yx.propertyIsEnumerable,sy=Object.getOwnPropertySymbols,Ld=sy?function(n){return n==null?[]:(n=Object(n),Wx(sy(n),function(t){return Jx.call(n,t)}))}:ay;function Xx(n,t){return ka(n,Ld(n),t)}var Zx=Object.getOwnPropertySymbols,ly=Zx?function(n){for(var t=[];n;)Pd(t,Ld(n)),n=Vd(n);return t}:ay;function Qx(n,t){return ka(n,ly(n),t)}function cy(n,t,r){var o=t(n);return Jn(n)?o:Pd(o,r(n))}function Dd(n){return cy(n,Id,Ld)}function uy(n){return cy(n,Bd,ly)}var Md=ho(ur,"DataView"),jd=ho(ur,"Promise"),Fd=ho(ur,"Set"),dy="[object Map]",eA="[object Object]",fy="[object Promise]",py="[object Set]",my="[object WeakMap]",gy="[object DataView]",tA=go(Md),nA=go(Sa),rA=go(jd),oA=go(Fd),iA=go(kd),$n=po;(Md&&$n(new Md(new ArrayBuffer(1)))!=gy||Sa&&$n(new Sa)!=dy||jd&&$n(jd.resolve())!=fy||Fd&&$n(new Fd)!=py||kd&&$n(new kd)!=my)&&($n=function(n){var t=po(n),r=t==eA?n.constructor:void 0,o=r?go(r):"";if(o)switch(o){case tA:return gy;case nA:return dy;case rA:return fy;case oA:return py;case iA:return my}return t});var aA=Object.prototype,sA=aA.hasOwnProperty;function lA(n){var t=n.length,r=new n.constructor(t);return t&&typeof n[0]=="string"&&sA.call(n,"index")&&(r.index=n.index,r.input=n.input),r}var kl=ur.Uint8Array;function Ud(n){var t=new n.constructor(n.byteLength);return new kl(t).set(new kl(n)),t}function cA(n,t){var r=t?Ud(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.byteLength)}var uA=/\w*$/;function dA(n){var t=new n.constructor(n.source,uA.exec(n));return t.lastIndex=n.lastIndex,t}var hy=Vn?Vn.prototype:void 0,yy=hy?hy.valueOf:void 0;function fA(n){return yy?Object(yy.call(n)):{}}function pA(n,t){var r=t?Ud(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.length)}var mA="[object Boolean]",gA="[object Date]",hA="[object Map]",yA="[object Number]",_A="[object RegExp]",bA="[object Set]",wA="[object String]",kA="[object Symbol]",CA="[object ArrayBuffer]",EA="[object DataView]",NA="[object Float32Array]",SA="[object Float64Array]",xA="[object Int8Array]",AA="[object Int16Array]",vA="[object Int32Array]",IA="[object Uint8Array]",BA="[object Uint8ClampedArray]",TA="[object Uint16Array]",OA="[object Uint32Array]";function PA(n,t,r){var o=n.constructor;switch(t){case CA:return Ud(n);case mA:case gA:return new o(+n);case EA:return cA(n,r);case NA:case SA:case xA:case AA:case vA:case IA:case BA:case TA:case OA:return pA(n,r);case hA:return new o;case yA:case wA:return new o(n);case _A:return dA(n);case bA:return new o;case kA:return fA(n)}}function VA(n){return typeof n.constructor=="function"&&!yl(n)?SE(Vd(n)):{}}var $A="[object Map]";function RA(n){return dr(n)&&$n(n)==$A}var _y=ei&&ei.isMap,LA=_y?xd(_y):RA,DA="[object Set]";function MA(n){return dr(n)&&$n(n)==DA}var by=ei&&ei.isSet,jA=by?xd(by):MA,FA=1,UA=2,KA=4,wy="[object Arguments]",qA="[object Array]",GA="[object Boolean]",HA="[object Date]",zA="[object Error]",ky="[object Function]",WA="[object GeneratorFunction]",YA="[object Map]",JA="[object Number]",Cy="[object Object]",XA="[object RegExp]",ZA="[object Set]",QA="[object String]",ev="[object Symbol]",tv="[object WeakMap]",nv="[object ArrayBuffer]",rv="[object DataView]",ov="[object Float32Array]",iv="[object Float64Array]",av="[object Int8Array]",sv="[object Int16Array]",lv="[object Int32Array]",cv="[object Uint8Array]",uv="[object Uint8ClampedArray]",dv="[object Uint16Array]",fv="[object Uint32Array]",At={};At[wy]=At[qA]=At[nv]=At[rv]=At[GA]=At[HA]=At[ov]=At[iv]=At[av]=At[sv]=At[lv]=At[YA]=At[JA]=At[Cy]=At[XA]=At[ZA]=At[QA]=At[ev]=At[cv]=At[uv]=At[dv]=At[fv]=!0,At[zA]=At[ky]=At[tv]=!1;function va(n,t,r,o,i,a){var s,c=t&FA,l=t&UA,u=t&KA;if(r&&(s=i?r(n,o,i,a):r(n)),s!==void 0)return s;if(!mo(n))return n;var p=Jn(n);if(p){if(s=lA(n),!c)return AE(n,s)}else{var d=$n(n),f=d==ky||d==WA;if(Ca(n))return zx(n,c);if(d==Cy||d==wy||f&&!i){if(s=l||f?{}:VA(n),!c)return l?Qx(n,Gx(s,n)):Xx(n,qx(s,n))}else{if(!At[d])return i?n:{};s=PA(n,d,c)}}a||(a=new Br);var m=a.get(n);if(m)return m;a.set(n,s),jA(n)?n.forEach(function(b){s.add(va(b,t,r,b,n,a))}):LA(n)&&n.forEach(function(b,_){s.set(_,va(b,t,r,_,n,a))});var h=u?l?uy:Dd:l?Bd:Id,y=p?void 0:h(n);return VE(y||n,function(b,_){y&&(_=b,b=n[_]),Nd(s,_,va(b,t,r,_,n,a))}),s}var pv=1,mv=4;function Ia(n){return va(n,pv|mv)}var gv="__lodash_hash_undefined__";function hv(n){return this.__data__.set(n,gv),this}function yv(n){return this.__data__.has(n)}function Ba(n){var t=-1,r=n==null?0:n.length;for(this.__data__=new Ir;++t<r;)this.add(n[t])}Ba.prototype.add=Ba.prototype.push=hv,Ba.prototype.has=yv;function _v(n,t){for(var r=-1,o=n==null?0:n.length;++r<o;)if(t(n[r],r,n))return!0;return!1}function Kd(n,t){return n.has(t)}var bv=1,wv=2;function Ey(n,t,r,o,i,a){var s=r&bv,c=n.length,l=t.length;if(c!=l&&!(s&&l>c))return!1;var u=a.get(n),p=a.get(t);if(u&&p)return u==t&&p==n;var d=-1,f=!0,m=r&wv?new Ba:void 0;for(a.set(n,t),a.set(t,n);++d<c;){var h=n[d],y=t[d];if(o)var b=s?o(y,h,d,t,n,a):o(h,y,d,n,t,a);if(b!==void 0){if(b)continue;f=!1;break}if(m){if(!_v(t,function(_,k){if(!Kd(m,k)&&(h===_||i(h,_,r,o,a)))return m.push(k)})){f=!1;break}}else if(!(h===y||i(h,y,r,o,a))){f=!1;break}}return a.delete(n),a.delete(t),f}function kv(n){var t=-1,r=Array(n.size);return n.forEach(function(o,i){r[++t]=[i,o]}),r}function Cv(n){var t=-1,r=Array(n.size);return n.forEach(function(o){r[++t]=o}),r}var Ev=1,Nv=2,Sv="[object Boolean]",xv="[object Date]",Av="[object Error]",vv="[object Map]",Iv="[object Number]",Bv="[object RegExp]",Tv="[object Set]",Ov="[object String]",Pv="[object Symbol]",Vv="[object ArrayBuffer]",$v="[object DataView]",Ny=Vn?Vn.prototype:void 0,qd=Ny?Ny.valueOf:void 0;function Rv(n,t,r,o,i,a,s){switch(r){case $v:if(n.byteLength!=t.byteLength||n.byteOffset!=t.byteOffset)return!1;n=n.buffer,t=t.buffer;case Vv:return!(n.byteLength!=t.byteLength||!a(new kl(n),new kl(t)));case Sv:case xv:case Iv:return Ed(+n,+t);case Av:return n.name==t.name&&n.message==t.message;case Bv:case Ov:return n==t+"";case vv:var c=kv;case Tv:var l=o&Ev;if(c||(c=Cv),n.size!=t.size&&!l)return!1;var u=s.get(n);if(u)return u==t;o|=Nv,s.set(n,t);var p=Ey(c(n),c(t),o,i,a,s);return s.delete(n),p;case Pv:if(qd)return qd.call(n)==qd.call(t)}return!1}var Lv=1,Dv=Object.prototype,Mv=Dv.hasOwnProperty;function jv(n,t,r,o,i,a){var s=r&Lv,c=Dd(n),l=c.length,u=Dd(t),p=u.length;if(l!=p&&!s)return!1;for(var d=l;d--;){var f=c[d];if(!(s?f in t:Mv.call(t,f)))return!1}var m=a.get(n),h=a.get(t);if(m&&h)return m==t&&h==n;var y=!0;a.set(n,t),a.set(t,n);for(var b=s;++d<l;){f=c[d];var _=n[f],k=t[f];if(o)var C=s?o(k,_,f,t,n,a):o(_,k,f,n,t,a);if(!(C===void 0?_===k||i(_,k,r,o,a):C)){y=!1;break}b||(b=f=="constructor")}if(y&&!b){var N=n.constructor,E=t.constructor;N!=E&&"constructor"in n&&"constructor"in t&&!(typeof N=="function"&&N instanceof N&&typeof E=="function"&&E instanceof E)&&(y=!1)}return a.delete(n),a.delete(t),y}var Fv=1,Sy="[object Arguments]",xy="[object Array]",Cl="[object Object]",Uv=Object.prototype,Ay=Uv.hasOwnProperty;function Kv(n,t,r,o,i,a){var s=Jn(n),c=Jn(t),l=s?xy:$n(n),u=c?xy:$n(t);l=l==Sy?Cl:l,u=u==Sy?Cl:u;var p=l==Cl,d=u==Cl,f=l==u;if(f&&Ca(n)){if(!Ca(t))return!1;s=!0,p=!1}if(f&&!p)return a||(a=new Br),s||vd(n)?Ey(n,t,r,o,i,a):Rv(n,t,l,r,o,i,a);if(!(r&Fv)){var m=p&&Ay.call(n,"__wrapped__"),h=d&&Ay.call(t,"__wrapped__");if(m||h){var y=m?n.value():n,b=h?t.value():t;return a||(a=new Br),i(y,b,r,o,a)}}return f?(a||(a=new Br),jv(n,t,r,o,i,a)):!1}function vy(n,t,r,o,i){return n===t?!0:n==null||t==null||!dr(n)&&!dr(t)?n!==n&&t!==t:Kv(n,t,r,o,vy,i)}function qv(n,t){return n!=null&&t in Object(n)}function Iy(n,t,r){t=ti(t,n);for(var o=-1,i=t.length,a=!1;++o<i;){var s=xa(t[o]);if(!(a=n!=null&&r(n,s)))break;n=n[s]}return a||++o!=i?a:(i=n==null?0:n.length,!!i&&Sd(i)&&Cd(s,i)&&(Jn(n)||_l(n)))}function Gv(n,t){return n!=null&&Iy(n,t,qv)}function Hv(n){return dr(n)&&hl(n)}function zv(n){var t=n==null?0:n.length;return t?n[t-1]:void 0}var Wv={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Yv=Dh(Wv),By=/[&<>"']/g,Jv=RegExp(By.source);function Xv(n){return n=_o(n),n&&Jv.test(n)?n.replace(By,Yv):n}var Zv=Object.prototype,Qv=Zv.hasOwnProperty;function eI(n,t){return n!=null&&Qv.call(n,t)}function El(n,t){return n!=null&&Iy(n,t,eI)}var tI=Math.min;function nI(n,t,r){for(var o=ME,i=n[0].length,a=n.length,s=a,c=Array(a),l=1/0,u=[];s--;){var p=n[s];l=tI(p.length,l),c[s]=i>=120&&p.length>=120?new Ba(s&&p):void 0}p=n[0];var d=-1,f=c[0];e:for(;++d<i&&u.length<l;){var m=p[d],h=m;if(m=m!==0?m:0,!(f?Kd(f,h):o(u,h))){for(s=a;--s;){var y=c[s];if(!(y?Kd(y,h):o(n[s],h)))continue e}f&&f.push(h),u.push(m)}}return u}function rI(n){return Hv(n)?n:[]}var oI=qE(function(n){var t=bd(n,rI);return t.length&&t[0]===n[0]?nI(t):[]});function iI(n,t){return t.length<2?n:Od(n,Ih(t,0,-1))}var aI="[object Map]",sI="[object Set]",lI=Object.prototype,cI=lI.hasOwnProperty;function Ty(n){if(n==null)return!0;if(hl(n)&&(Jn(n)||typeof n=="string"||typeof n.splice=="function"||Ca(n)||vd(n)||_l(n)))return!n.length;var t=$n(n);if(t==aI||t==sI)return!n.size;if(yl(n))return!Sh(n).length;for(var r in n)if(cI.call(n,r))return!1;return!0}function Xt(n,t){return vy(n,t)}var uI=Object.prototype,dI=uI.hasOwnProperty;function Oy(n,t){t=ti(t,n);var r=-1,o=t.length;if(!o)return!0;for(;++r<o;){var i=xa(t[r]);if(i==="__proto__"&&!dI.call(n,"__proto__")||(i==="constructor"||i==="prototype")&&r<o-1)return!1}var a=iI(n,t);return a==null||delete a[xa(zv(t))]}function fI(n){return CS(n)?void 0:n}var pI=1,mI=2,gI=4,Xr=Ah(function(n,t){var r={};if(n==null)return r;var o=!1;t=bd(t,function(a){return a=ti(a,n),o||(o=a.length>1),a}),ka(n,uy(n),r),o&&(r=va(r,pI|mI|gI,fI));for(var i=t.length;i--;)Oy(r,t[i]);return r});function Py(n,t,r,o){if(!mo(n))return n;t=ti(t,n);for(var i=-1,a=t.length,s=a-1,c=n;c!=null&&++i<a;){var l=xa(t[i]),u=r;if(l==="__proto__"||l==="constructor"||l==="prototype")return n;if(i!=s){var p=c[l];u=void 0,u===void 0&&(u=mo(p)?p:Cd(t[i+1])?[]:{})}Nd(c,l,u),c=c[l]}return n}function hI(n,t,r){for(var o=-1,i=t.length,a={};++o<i;){var s=t[o],c=Od(n,s);r(c,s)&&Py(a,ti(s,n),c)}return a}function yI(n,t){return hI(n,t,function(r,o){return Gv(n,o)})}var Gd=Ah(function(n,t){return n==null?{}:yI(n,t)});function Vy(n,t,r){return n==null?n:Py(n,t,r)}var _I=0;function Nl(n){var t=++_I;return _o(n)+t}function $y(n,t){return n==null?!0:Oy(n,t)}const ri="{key}",bo={"kong.client.consumer":{dataType:"object",writable:!1,readable:!0},"kong.client.consumer_groups":{dataType:"array",writable:!1,readable:!0},"kong.client.credential":{dataType:"object",writable:!1,readable:!0},"kong.client.get_identity_realm_source":{dataType:"object",writable:!1,readable:!0},"kong.client.forwarded_ip":{dataType:"string",writable:!1,readable:!0},"kong.client.forwarded_port":{dataType:"number",writable:!1,readable:!0},"kong.client.ip":{dataType:"string",writable:!1,readable:!0},"kong.client.port":{dataType:"number",writable:!1,readable:!0},"kong.client.protocol":{dataType:"string",writable:!1,readable:!0},"kong.request.forwarded_host":{dataType:"string",writable:!1,readable:!0},"kong.request.forwarded_port":{dataType:"number",writable:!1,readable:!0},"kong.request.forwarded_scheme":{dataType:"string",writable:!1,readable:!0},"kong.request.port":{dataType:"number",writable:!1,readable:!0},"kong.response.source":{dataType:"string",writable:!1,readable:!0},"kong.router.route":{dataType:"object",writable:!1,readable:!0},"kong.route_id":{dataType:"string",writable:!1,readable:!0},"kong.route_name":{dataType:"string",writable:!1,readable:!0},"kong.router.service":{dataType:"object",writable:!1,readable:!0},"kong.service_name":{dataType:"string",writable:!1,readable:!0},"kong.service_id":{dataType:"string",writable:!1,readable:!0},"kong.service.response.status":{dataType:"number",writable:!1,readable:!0},"kong.version":{dataType:"string",writable:!1,readable:!0},"kong.node.id":{dataType:"string",writable:!1,readable:!0},"kong.configuration.{key}":{dataType:"any",writable:!1,readable:!0},"kong.service.target":{dataType:"string ({host}:{port})",writable:!0,readable:!1},"kong.service.request_scheme":{dataType:"string ({scheme})",writable:!0,readable:!1},"kong.ctx.plugin.{key}":{dataType:"any",writable:!0,readable:!0},"kong.ctx.shared.{key}":{dataType:"any",writable:!0,readable:!0}},Sl=Object.keys(bo).filter(n=>n.includes(ri)).map(n=>n.replace(ri,""));function Hd(n){if(!n||!Oa(n))return;const t=Sl.find(r=>n.startsWith(r));if(t)return n.slice(t.length).replace(ri,"")}function Ta(n){if(!n)return null;const t=Sl.find(r=>n.startsWith(r));return t||n}function Oa(n){return n?Sl.some(t=>n.startsWith(t)):!1}function Ry(n){return n?Oa(n)?Ta(n)+ri:n:null}function zd(n){var r;if(!n)return!1;const t=Ry(n);return t?((r=bo[t])==null?void 0:r.readable)??!1:!1}function Wd(n){var r;if(!n)return!1;const t=Ry(n);return t?((r=bo[t])==null?void 0:r.writable)??!1:!1}const Yd=Symbol("EXPERIMENTAL_FREE_FORM_PROVIDER"),fr={KM_2262_CODE_MODE:"KM-2262-code-mode",KM_2306_CONDITION_FIELD_314:"KM-2306-condition-field-314",KM_2446_DATAKIT_JWT_NODES:"KM-2446-Datakit-JWT-nodes",KM_2503_CUSTOM_PLUGIN_FREEFORM:"KM-2503-custom-plugin-freeform",KM_2485_CLONED_PLUGINS:"KM-2485-cloned-plugins",KHCP_20393_IDENTITY_PRINCIPALS_UI:"khcp-20393-identity-principals-ui"},Ly=Symbol("TOASTER_PROVIDER"),oi="__FREEFORM_SCHEMA_MAP__";function Jd(){const n=(...r)=>{console.warn("TOASTER_PROVIDER is not provided",...r)},t=e.inject(Ly,n);return r=>t(r)}const Dy=["request","service_request","service_response","response","vault"],ii=Dy,My=["call","jq","exit","property","static","branch","cache","xml_to_json","json_to_xml","jwt_decode","jwt_sign","jwt_verify"],jy=["GET","HEAD","POST","PUT","PATCH","DELETE","OPTIONS","TRACE","CONNECT"],Xd=["EdDSA","ES256","ES384","ES512","HS256","HS384","HS512","PS256","PS384","PS512","RS256","RS384","RS512"],je=(n,t)=>{const r=n.__vccOpts||n;for(const[o,i]of t)r[o]=i;return r},bI={},wI={height:"16",viewBox:"0 -960 960 960",width:"16",xmlns:"http://www.w3.org/2000/svg"};function kI(n,t){return e.openBlock(),e.createElementBlock("svg",wI,[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M240-160h480v-400H240v400Zm296.5-143.5Q560-327 560-360t-23.5-56.5Q513-440 480-440t-56.5 23.5Q400-393 400-360t23.5 56.5Q447-280 480-280t56.5-23.5ZM240-160v-400 400Zm0 80q-33 0-56.5-23.5T160-160v-400q0-33 23.5-56.5T240-640h280v-80q0-83 58.5-141.5T720-920q83 0 141.5 58.5T920-720h-80q0-50-35-85t-85-35q-50 0-85 35t-35 85v80h120q33 0 56.5 23.5T800-560v400q0 33-23.5 56.5T720-80H240Z",fill:"currentColor"},null,-1)])])}const CI=je(bI,[["render",kI]]),EI={},NI={height:"16",viewBox:"0 -960 960 960",width:"16",xmlns:"http://www.w3.org/2000/svg"};function SI(n,t){return e.openBlock(),e.createElementBlock("svg",NI,[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q65 0 123 19t107 53l-58 59q-38-24-81-37.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160q133 0 226.5-93.5T800-480q0-18-2-36t-6-35l65-65q11 32 17 66t6 70q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm-56-216L254-466l56-56 114 114 400-401 56 56-456 457Z",fill:"currentColor"},null,-1)])])}const xI=je(EI,[["render",SI]]),Pa=[{id:"external_interaction",colors:{foreground:D1,background:B1},nodes:[{type:"call",icon:$e.NetworkIcon},{type:"cache",icon:$e.CachedIcon}]},{id:"control_flow",colors:{foreground:V1,background:S1},nodes:[{type:"branch",icon:$e.ArrowSplitIcon},{type:"exit",icon:$e.GatewayIcon}]},{id:"data_transformation",colors:{foreground:Jg,background:x1},nodes:[{type:"jq",icon:$e.CodeblockIcon},{type:"xml_to_json",icon:$e.DataObjectIcon},{type:"json_to_xml",icon:$e.CodeIcon}]},{id:"data_value",colors:{foreground:Zg,background:L1},nodes:[{type:"property",icon:$e.StackIcon},{type:"static",icon:$e.DeployIcon}]},{id:"authentication",colors:{foreground:$1,background:R1},nodes:[{type:"jwt_sign",icon:$e.EditSquareIcon},{type:"jwt_decode",icon:CI},{type:"jwt_verify",icon:xI}]}],AI=Pa.reduce((n,t)=>{for(const r of t.nodes)n[r.type]={icon:r.icon,colors:t.colors};return n},{}),ai={vault:{icon:$e.KeyIcon},request:{icon:$e.CloudIcon},service_request:{icon:$e.CloudIcon},service_response:{icon:$e.CloudIcon},response:{icon:$e.CloudIcon}};function vI(n){return Pa.find(({id:t})=>t===n).colors}function Zd(n){return AI[n]??ai[n]}const{t:Qd}=jt.createI18n("en-us",Jt);function si(n){return Qd(`plugins.free-form.datakit.flow_editor.node_types.${n}.description`)}function II(n){return Qd(`plugins.free-form.datakit.flow_editor.node_types.${n}.summary`)}function BI(n){return Qd(`plugins.free-form.datakit.flow_editor.node_panel.groups.${n}`)}const TI={call:{io:{input:{fields:[{name:"headers"},{name:"body"},{name:"query"}]},output:{fields:[{name:"headers"},{name:"body"},{name:"status"}]}}},jq:{io:{input:{fields:[],configurable:!0},output:{fields:[]}}},exit:{io:{input:{fields:[{name:"headers"},{name:"body"}]}}},property:{io:{input:{fields:[],configurable:!0},output:{fields:[]}}},static:{io:{output:{fields:[],configurable:!0}}},branch:{io:{input:{fields:[]},next:{branches:[{name:"then"},{name:"else"}]}}},cache:{io:{input:{fields:[{name:"data"},{name:"key"},{name:"ttl"}]},output:{fields:[{name:"data"},{name:"hit"},{name:"miss"},{name:"stored"}]}}},xml_to_json:{io:{input:{fields:[]},output:{fields:[]}}},json_to_xml:{io:{input:{fields:[],configurable:!0},output:{fields:[]}}},jwt_decode:{io:{input:{fields:[]},output:{fields:[{name:"header"},{name:"payload"},{name:"signature"}]}}},jwt_sign:{io:{input:{fields:[{name:"claims"},{name:"key"}]},output:{fields:[{name:"claims"},{name:"header"},{name:"token"}]}}},jwt_verify:{io:{input:{fields:[{name:"key"},{name:"token"}]},output:{fields:[{name:"claims"},{name:"header"}]}}}};function OI(n){return{id:n.id,title:BI(n.id),colors:vI(n.id),nodeTypes:n.nodes.map(({type:t})=>t)}}function PI(n,t){return{...TI[t.type],type:t.type,icon:t.icon,group:n.id,summary:II(t.type),description:si(t.type)}}const Fy=Pa.reduce((n,t)=>(n[t.id]=OI(t),n),{}),xl=Pa.reduce((n,t)=>{for(const r of t.nodes)n[r.type]=PI(t,r);return n},{}),Uy=Pa.map(n=>({...Fy[n.id],nodes:n.nodes.map(({type:t})=>xl[t])}));function VI(n){return Fy[n]}const Al={request:{type:"request",description:si("request"),io:{output:{fields:[{name:"headers"},{name:"body"},{name:"query"}]}},...ai.request},service_request:{type:"service_request",description:si("service_request"),io:{input:{fields:[{name:"headers"},{name:"body"},{name:"query"}]}},...ai.service_request},service_response:{type:"service_response",description:si("service_response"),io:{output:{fields:[{name:"headers"},{name:"body"}]}},...ai.service_response},response:{type:"response",description:si("response"),io:{input:{fields:[{name:"headers"},{name:"body"}]}},...ai.response},vault:{type:"vault",io:{output:{fields:[],configurable:!0}},...ai.vault,hidden:!0}},ef=Object.keys(Al),tf=n=>ef.includes(n),$I=n=>[...ef,...My].includes(n),mn=n=>ef.includes(n),vl=n=>mn(n.type),nf=n=>!!(n!=null&&n.startsWith("node:")),Va=n=>Object.prototype.hasOwnProperty.call(n,"ownerId");function Tr(n){return Ia(n)}function rf(n,t){if(n.length!==t.length)return!1;if(n.length===0)return!0;const r=new Set(t);return n.every(o=>r.has(o))}function li(n){return`${n}:${Nl()}`}function Il(n){const[t,r]=n.split(".");return{nodeName:t,fieldName:r}}function Ky(n){const[t,r]=n.split(".");return{nodeId:t,fieldId:r}}function ci(n){return mn(n)?Al[n]:xl[n]}function qy(n){var i,a,s,c;const t=ci(n),r=((a=(i=t.io)==null?void 0:i.input)==null?void 0:a.fields.map(({name:l})=>l))??[],o=((c=(s=t.io)==null?void 0:s.output)==null?void 0:c.fields.map(({name:l})=>l))??[];return{input:r,output:o}}function $a(n){var r,o,i;return((i=(o=(r=ci(n).io)==null?void 0:r.next)==null?void 0:o.branches)==null?void 0:i.map(({name:a})=>a))??[]}function Gy(n){return(n??[]).map(t=>({id:li("field"),name:t}))}function Zr(n,t,r){if(r)return n.fields[t].find(o=>o.name===r)}function Qr(n,t,r){if(r)return n.fields[t].find(o=>o.id===r)}function of(n,t){return t?n.fields.output.some(r=>r.id===t):!0}function Hy(n,t){return t?n.fields.input.some(r=>r.id===t):!0}function RI(n){const t=["request","service_request","vault"].includes(n)?"request":"response",r=Al[n];return{name:n,phase:t,position:{x:0,y:0},fields:qy(r.type),expanded:{},hidden:r.hidden}}function zy(n,t){const o=(typeof n=="string"&&$I(n)?n.toUpperCase():n).replace(/_\d+$/,"");for(let i=1;;i++){const a=`${o}_${i}`;if(!t.has(a))return a}}function af(n,t){return`${n}:${t}`}function LI(n){const t=n.lastIndexOf(":");if(t===-1)throw new Error(`Invalid group ID format: ${n}`);const r=n.slice(0,t),o=n.slice(t+1);return{nodeId:r,branch:o}}function Bl(n,t){return`${n}:${t}`}function Wy(n,t,r,o,i){return{id:af(n,t),ownerId:n,branch:t,phase:r,memberIds:[...o],position:i!=null&&i.position?{...i.position}:void 0,dimensions:i!=null&&i.dimensions?{...i.dimensions}:void 0}}function Tl(n,t,r){const o=t?Qr(n,r,t):void 0;return`${n.name}${o?`.${o.name}`:""}`}function Ra(n,t){const r=t(n.source),o=t(n.target);return[Tl(r,n.sourceField,"output"),Tl(o,n.targetField,"input")]}function sf(n,t,r,o,i){const a=i(n),s=i(r);return[Tl(a,t,"output"),Tl(s,o,"input")]}function Yy(n){if(n.length===0)throw new Error("getBoundingRect requires at least one rect");let t=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY;for(const{x:a,y:s,width:c,height:l}of n){if(![a,s,c,l].every(Number.isFinite))throw new Error("Rect values must be finite numbers");if(c<0||l<0)throw new RangeError("Rect width and height must be non-negative");const u=a+c,p=s+l;if(!Number.isFinite(u)||!Number.isFinite(p))throw new RangeError("Rect boundaries must be finite numbers");a<t&&(t=a),s<r&&(r=s),u>o&&(o=u),p>i&&(i=p)}return{x:t,y:r,width:o-t,height:i-r}}var Ct=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),Xn=Ct((n,t)=>{var r=Object.defineProperty,o=(V,R,X)=>R in V?r(V,R,{enumerable:!0,configurable:!0,writable:!0,value:X}):V[R]=X,i=(V,R)=>()=>(R||V((R={exports:{}}).exports,R),R.exports),a=(V,R,X)=>o(V,typeof R!="symbol"?R+"":R,X),s=i((V,R)=>{var X="\0",Y="\0",ne="",M=class{constructor(G){a(this,"_isDirected",!0),a(this,"_isMultigraph",!1),a(this,"_isCompound",!1),a(this,"_label"),a(this,"_defaultNodeLabelFn",()=>{}),a(this,"_defaultEdgeLabelFn",()=>{}),a(this,"_nodes",{}),a(this,"_in",{}),a(this,"_preds",{}),a(this,"_out",{}),a(this,"_sucs",{}),a(this,"_edgeObjs",{}),a(this,"_edgeLabels",{}),a(this,"_nodeCount",0),a(this,"_edgeCount",0),a(this,"_parent"),a(this,"_children"),G&&(this._isDirected=Object.hasOwn(G,"directed")?G.directed:!0,this._isMultigraph=Object.hasOwn(G,"multigraph")?G.multigraph:!1,this._isCompound=Object.hasOwn(G,"compound")?G.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[Y]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(G){return this._label=G,this}graph(){return this._label}setDefaultNodeLabel(G){return this._defaultNodeLabelFn=G,typeof G!="function"&&(this._defaultNodeLabelFn=()=>G),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var G=this;return this.nodes().filter(v=>Object.keys(G._in[v]).length===0)}sinks(){var G=this;return this.nodes().filter(v=>Object.keys(G._out[v]).length===0)}setNodes(G,v){var q=arguments,ie=this;return G.forEach(function(oe){q.length>1?ie.setNode(oe,v):ie.setNode(oe)}),this}setNode(G,v){return Object.hasOwn(this._nodes,G)?(arguments.length>1&&(this._nodes[G]=v),this):(this._nodes[G]=arguments.length>1?v:this._defaultNodeLabelFn(G),this._isCompound&&(this._parent[G]=Y,this._children[G]={},this._children[Y][G]=!0),this._in[G]={},this._preds[G]={},this._out[G]={},this._sucs[G]={},++this._nodeCount,this)}node(G){return this._nodes[G]}hasNode(G){return Object.hasOwn(this._nodes,G)}removeNode(G){var v=this;if(Object.hasOwn(this._nodes,G)){var q=ie=>v.removeEdge(v._edgeObjs[ie]);delete this._nodes[G],this._isCompound&&(this._removeFromParentsChildList(G),delete this._parent[G],this.children(G).forEach(function(ie){v.setParent(ie)}),delete this._children[G]),Object.keys(this._in[G]).forEach(q),delete this._in[G],delete this._preds[G],Object.keys(this._out[G]).forEach(q),delete this._out[G],delete this._sucs[G],--this._nodeCount}return this}setParent(G,v){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(v===void 0)v=Y;else{v+="";for(var q=v;q!==void 0;q=this.parent(q))if(q===G)throw new Error("Setting "+v+" as parent of "+G+" would create a cycle");this.setNode(v)}return this.setNode(G),this._removeFromParentsChildList(G),this._parent[G]=v,this._children[v][G]=!0,this}_removeFromParentsChildList(G){delete this._children[this._parent[G]][G]}parent(G){if(this._isCompound){var v=this._parent[G];if(v!==Y)return v}}children(G=Y){if(this._isCompound){var v=this._children[G];if(v)return Object.keys(v)}else{if(G===Y)return this.nodes();if(this.hasNode(G))return[]}}predecessors(G){var v=this._preds[G];if(v)return Object.keys(v)}successors(G){var v=this._sucs[G];if(v)return Object.keys(v)}neighbors(G){var v=this.predecessors(G);if(v){let ie=new Set(v);for(var q of this.successors(G))ie.add(q);return Array.from(ie.values())}}isLeaf(G){var v;return this.isDirected()?v=this.successors(G):v=this.neighbors(G),v.length===0}filterNodes(G){var v=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});v.setGraph(this.graph());var q=this;Object.entries(this._nodes).forEach(function([ke,ye]){G(ke)&&v.setNode(ke,ye)}),Object.values(this._edgeObjs).forEach(function(ke){v.hasNode(ke.v)&&v.hasNode(ke.w)&&v.setEdge(ke,q.edge(ke))});var ie={};function oe(ke){var ye=q.parent(ke);return ye===void 0||v.hasNode(ye)?(ie[ke]=ye,ye):ye in ie?ie[ye]:oe(ye)}return this._isCompound&&v.nodes().forEach(ke=>v.setParent(ke,oe(ke))),v}setDefaultEdgeLabel(G){return this._defaultEdgeLabelFn=G,typeof G!="function"&&(this._defaultEdgeLabelFn=()=>G),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(G,v){var q=this,ie=arguments;return G.reduce(function(oe,ke){return ie.length>1?q.setEdge(oe,ke,v):q.setEdge(oe,ke),ke}),this}setEdge(){var G,v,q,ie,oe=!1,ke=arguments[0];typeof ke=="object"&&ke!==null&&"v"in ke?(G=ke.v,v=ke.w,q=ke.name,arguments.length===2&&(ie=arguments[1],oe=!0)):(G=ke,v=arguments[1],q=arguments[3],arguments.length>2&&(ie=arguments[2],oe=!0)),G=""+G,v=""+v,q!==void 0&&(q=""+q);var ye=Z(this._isDirected,G,v,q);if(Object.hasOwn(this._edgeLabels,ye))return oe&&(this._edgeLabels[ye]=ie),this;if(q!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(G),this.setNode(v),this._edgeLabels[ye]=oe?ie:this._defaultEdgeLabelFn(G,v,q);var ce=F(this._isDirected,G,v,q);return G=ce.v,v=ce.w,Object.freeze(ce),this._edgeObjs[ye]=ce,te(this._preds[v],G),te(this._sucs[G],v),this._in[v][ye]=ce,this._out[G][ye]=ce,this._edgeCount++,this}edge(G,v,q){var ie=arguments.length===1?J(this._isDirected,arguments[0]):Z(this._isDirected,G,v,q);return this._edgeLabels[ie]}edgeAsObj(){let G=this.edge(...arguments);return typeof G!="object"?{label:G}:G}hasEdge(G,v,q){var ie=arguments.length===1?J(this._isDirected,arguments[0]):Z(this._isDirected,G,v,q);return Object.hasOwn(this._edgeLabels,ie)}removeEdge(G,v,q){var ie=arguments.length===1?J(this._isDirected,arguments[0]):Z(this._isDirected,G,v,q),oe=this._edgeObjs[ie];return oe&&(G=oe.v,v=oe.w,delete this._edgeLabels[ie],delete this._edgeObjs[ie],$(this._preds[v],G),$(this._sucs[G],v),delete this._in[v][ie],delete this._out[G][ie],this._edgeCount--),this}inEdges(G,v){return this.isDirected()?this.filterEdges(this._in[G],G,v):this.nodeEdges(G,v)}outEdges(G,v){return this.isDirected()?this.filterEdges(this._out[G],G,v):this.nodeEdges(G,v)}nodeEdges(G,v){if(G in this._nodes)return this.filterEdges({...this._in[G],...this._out[G]},G,v)}filterEdges(G,v,q){if(G){var ie=Object.values(G);return q?ie.filter(function(oe){return oe.v===v&&oe.w===q||oe.v===q&&oe.w===v}):ie}}};function te(G,v){G[v]?G[v]++:G[v]=1}function $(G,v){--G[v]||delete G[v]}function Z(G,v,q,ie){var oe=""+v,ke=""+q;if(!G&&oe>ke){var ye=oe;oe=ke,ke=ye}return oe+ne+ke+ne+(ie===void 0?X:ie)}function F(G,v,q,ie){var oe=""+v,ke=""+q;if(!G&&oe>ke){var ye=oe;oe=ke,ke=ye}var ce={v:oe,w:ke};return ie&&(ce.name=ie),ce}function J(G,v){return Z(G,v.v,v.w,v.name)}R.exports=M}),c=i((V,R)=>{R.exports="3.0.2"}),l=i((V,R)=>{R.exports={Graph:s(),version:c()}}),u=i((V,R)=>{var X=s();R.exports={write:Y,read:te};function Y($){var Z={options:{directed:$.isDirected(),multigraph:$.isMultigraph(),compound:$.isCompound()},nodes:ne($),edges:M($)};return $.graph()!==void 0&&(Z.value=structuredClone($.graph())),Z}function ne($){return $.nodes().map(function(Z){var F=$.node(Z),J=$.parent(Z),G={v:Z};return F!==void 0&&(G.value=F),J!==void 0&&(G.parent=J),G})}function M($){return $.edges().map(function(Z){var F=$.edge(Z),J={v:Z.v,w:Z.w};return Z.name!==void 0&&(J.name=Z.name),F!==void 0&&(J.value=F),J})}function te($){var Z=new X($.options).setGraph($.value);return $.nodes.forEach(function(F){Z.setNode(F.v,F.value),F.parent&&Z.setParent(F.v,F.parent)}),$.edges.forEach(function(F){Z.setEdge({v:F.v,w:F.w,name:F.name},F.value)}),Z}}),p=i((V,R)=>{R.exports=Y;var X=()=>1;function Y(M,te,$,Z){return ne(M,String(te),$||X,Z||function(F){return M.outEdges(F)})}function ne(M,te,$,Z){var F={},J=!0,G=0,v=M.nodes(),q=function(ye){var ce=$(ye);F[ye.v].distance+ce<F[ye.w].distance&&(F[ye.w]={distance:F[ye.v].distance+ce,predecessor:ye.v},J=!0)},ie=function(){v.forEach(function(ye){Z(ye).forEach(function(ce){var he=ce.v===ye?ce.v:ce.w,Oe=he===ce.v?ce.w:ce.v;q({v:he,w:Oe})})})};v.forEach(function(ye){var ce=ye===te?0:Number.POSITIVE_INFINITY;F[ye]={distance:ce}});for(var oe=v.length,ke=1;ke<oe&&(J=!1,G++,ie(),!!J);ke++);if(G===oe-1&&(J=!1,ie(),J))throw new Error("The graph contains a negative weight cycle");return F}}),d=i((V,R)=>{R.exports=X;function X(Y){var ne={},M=[],te;function $(Z){Object.hasOwn(ne,Z)||(ne[Z]=!0,te.push(Z),Y.successors(Z).forEach($),Y.predecessors(Z).forEach($))}return Y.nodes().forEach(function(Z){te=[],$(Z),te.length&&M.push(te)}),M}}),f=i((V,R)=>{var X=class{constructor(){a(this,"_arr",[]),a(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(Y){return Y.key})}has(Y){return Object.hasOwn(this._keyIndices,Y)}priority(Y){var ne=this._keyIndices[Y];if(ne!==void 0)return this._arr[ne].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(Y,ne){var M=this._keyIndices;if(Y=String(Y),!Object.hasOwn(M,Y)){var te=this._arr,$=te.length;return M[Y]=$,te.push({key:Y,priority:ne}),this._decrease($),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var Y=this._arr.pop();return delete this._keyIndices[Y.key],this._heapify(0),Y.key}decrease(Y,ne){var M=this._keyIndices[Y];if(ne>this._arr[M].priority)throw new Error("New priority is greater than current priority. Key: "+Y+" Old: "+this._arr[M].priority+" New: "+ne);this._arr[M].priority=ne,this._decrease(M)}_heapify(Y){var ne=this._arr,M=2*Y,te=M+1,$=Y;M<ne.length&&($=ne[M].priority<ne[$].priority?M:$,te<ne.length&&($=ne[te].priority<ne[$].priority?te:$),$!==Y&&(this._swap(Y,$),this._heapify($)))}_decrease(Y){for(var ne=this._arr,M=ne[Y].priority,te;Y!==0&&(te=Y>>1,!(ne[te].priority<M));)this._swap(Y,te),Y=te}_swap(Y,ne){var M=this._arr,te=this._keyIndices,$=M[Y],Z=M[ne];M[Y]=Z,M[ne]=$,te[Z.key]=Y,te[$.key]=ne}};R.exports=X}),m=i((V,R)=>{var X=f();R.exports=ne;var Y=()=>1;function ne(te,$,Z,F){var J=function(G){return te.outEdges(G)};return M(te,String($),Z||Y,F||J)}function M(te,$,Z,F){var J={},G=new X,v,q,ie=function(oe){var ke=oe.v!==v?oe.v:oe.w,ye=J[ke],ce=Z(oe),he=q.distance+ce;if(ce<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+oe+" Weight: "+ce);he<ye.distance&&(ye.distance=he,ye.predecessor=v,G.decrease(ke,he))};for(te.nodes().forEach(function(oe){var ke=oe===$?0:Number.POSITIVE_INFINITY;J[oe]={distance:ke},G.add(oe,ke)});G.size()>0&&(v=G.removeMin(),q=J[v],q.distance!==Number.POSITIVE_INFINITY);)F(v).forEach(ie);return J}}),h=i((V,R)=>{var X=m();R.exports=Y;function Y(ne,M,te){return ne.nodes().reduce(function($,Z){return $[Z]=X(ne,Z,M,te),$},{})}}),y=i((V,R)=>{R.exports=X;function X(ne,M,te){if(ne[M].predecessor!==void 0)throw new Error("Invalid source vertex");if(ne[te].predecessor===void 0&&te!==M)throw new Error("Invalid destination vertex");return{weight:ne[te].distance,path:Y(ne,M,te)}}function Y(ne,M,te){for(var $=[],Z=te;Z!==M;)$.push(Z),Z=ne[Z].predecessor;return $.push(M),$.reverse()}}),b=i((V,R)=>{R.exports=X;function X(Y){var ne=0,M=[],te={},$=[];function Z(F){var J=te[F]={onStack:!0,lowlink:ne,index:ne++};if(M.push(F),Y.successors(F).forEach(function(q){Object.hasOwn(te,q)?te[q].onStack&&(J.lowlink=Math.min(J.lowlink,te[q].index)):(Z(q),J.lowlink=Math.min(J.lowlink,te[q].lowlink))}),J.lowlink===J.index){var G=[],v;do v=M.pop(),te[v].onStack=!1,G.push(v);while(F!==v);$.push(G)}}return Y.nodes().forEach(function(F){Object.hasOwn(te,F)||Z(F)}),$}}),_=i((V,R)=>{var X=b();R.exports=Y;function Y(ne){return X(ne).filter(function(M){return M.length>1||M.length===1&&ne.hasEdge(M[0],M[0])})}}),k=i((V,R)=>{R.exports=Y;var X=()=>1;function Y(M,te,$){return ne(M,te||X,$||function(Z){return M.outEdges(Z)})}function ne(M,te,$){var Z={},F=M.nodes();return F.forEach(function(J){Z[J]={},Z[J][J]={distance:0},F.forEach(function(G){J!==G&&(Z[J][G]={distance:Number.POSITIVE_INFINITY})}),$(J).forEach(function(G){var v=G.v===J?G.w:G.v,q=te(G);Z[J][v]={distance:q,predecessor:J}})}),F.forEach(function(J){var G=Z[J];F.forEach(function(v){var q=Z[v];F.forEach(function(ie){var oe=q[J],ke=G[ie],ye=q[ie],ce=oe.distance+ke.distance;ce<ye.distance&&(ye.distance=ce,ye.predecessor=ke.predecessor)})})}),Z}}),C=i((V,R)=>{function X(ne){var M={},te={},$=[];function Z(F){if(Object.hasOwn(te,F))throw new Y;Object.hasOwn(M,F)||(te[F]=!0,M[F]=!0,ne.predecessors(F).forEach(Z),delete te[F],$.push(F))}if(ne.sinks().forEach(Z),Object.keys(M).length!==ne.nodeCount())throw new Y;return $}var Y=class extends Error{constructor(){super(...arguments)}};R.exports=X,X.CycleException=Y}),N=i((V,R)=>{var X=C();R.exports=Y;function Y(ne){try{X(ne)}catch(M){if(M instanceof X.CycleException)return!1;throw M}return!0}}),E=i((V,R)=>{R.exports=X;function X(ne,M,te,$,Z){Array.isArray(M)||(M=[M]);var F=(ne.isDirected()?ne.successors:ne.neighbors).bind(ne),J={};return M.forEach(function(G){if(!ne.hasNode(G))throw new Error("Graph does not have node: "+G);Z=Y(ne,G,te==="post",J,F,$,Z)}),Z}function Y(ne,M,te,$,Z,F,J){return Object.hasOwn($,M)||($[M]=!0,te||(J=F(J,M)),Z(M).forEach(function(G){J=Y(ne,G,te,$,Z,F,J)}),te&&(J=F(J,M))),J}}),w=i((V,R)=>{var X=E();R.exports=Y;function Y(ne,M,te){return X(ne,M,te,function($,Z){return $.push(Z),$},[])}}),S=i((V,R)=>{var X=w();R.exports=Y;function Y(ne,M){return X(ne,M,"post")}}),I=i((V,R)=>{var X=w();R.exports=Y;function Y(ne,M){return X(ne,M,"pre")}}),U=i((V,R)=>{var X=s(),Y=f();R.exports=ne;function ne(M,te){var $=new X,Z={},F=new Y,J;function G(q){var ie=q.v===J?q.w:q.v,oe=F.priority(ie);if(oe!==void 0){var ke=te(q);ke<oe&&(Z[ie]=J,F.decrease(ie,ke))}}if(M.nodeCount()===0)return $;M.nodes().forEach(function(q){F.add(q,Number.POSITIVE_INFINITY),$.setNode(q)}),F.decrease(M.nodes()[0],0);for(var v=!1;F.size()>0;){if(J=F.removeMin(),Object.hasOwn(Z,J))$.setEdge(J,Z[J]);else{if(v)throw new Error("Input graph is not connected: "+M);v=!0}M.nodeEdges(J).forEach(G)}return $}}),x=i((V,R)=>{var X=m(),Y=p();R.exports=ne;function ne(te,$,Z,F){return M(te,$,Z,F||function(J){return te.outEdges(J)})}function M(te,$,Z,F){if(Z===void 0)return X(te,$,Z,F);for(var J=!1,G=te.nodes(),v=0;v<G.length;v++){for(var q=F(G[v]),ie=0;ie<q.length;ie++){var oe=q[ie],ke=oe.v===G[v]?oe.v:oe.w,ye=ke===oe.v?oe.w:oe.v;Z({v:ke,w:ye})<0&&(J=!0)}if(J)return Y(te,$,Z,F)}return X(te,$,Z,F)}}),A=i((V,R)=>{R.exports={bellmanFord:p(),components:d(),dijkstra:m(),dijkstraAll:h(),extractPath:y(),findCycles:_(),floydWarshall:k(),isAcyclic:N(),postorder:S(),preorder:I(),prim:U(),shortestPaths:x(),reduce:E(),tarjan:b(),topsort:C()}}),T=l();t.exports={Graph:T.Graph,json:u(),alg:A(),version:T.version}}),DI=Ct((n,t)=>{var r=class{constructor(){let a={};a._next=a._prev=a,this._sentinel=a}dequeue(){let a=this._sentinel,s=a._prev;if(s!==a)return o(s),s}enqueue(a){let s=this._sentinel;a._prev&&a._next&&o(a),a._next=s._next,s._next._prev=a,s._next=a,a._prev=s}toString(){let a=[],s=this._sentinel,c=s._prev;for(;c!==s;)a.push(JSON.stringify(c,i)),c=c._prev;return"["+a.join(", ")+"]"}};function o(a){a._prev._next=a._next,a._next._prev=a._prev,delete a._next,delete a._prev}function i(a,s){if(a!=="_next"&&a!=="_prev")return s}t.exports=r}),MI=Ct((n,t)=>{var r=Xn().Graph,o=DI();t.exports=a;var i=()=>1;function a(d,f){if(d.nodeCount()<=1)return[];let m=l(d,f||i);return s(m.graph,m.buckets,m.zeroIdx).flatMap(h=>d.outEdges(h.v,h.w))}function s(d,f,m){let h=[],y=f[f.length-1],b=f[0],_;for(;d.nodeCount();){for(;_=b.dequeue();)c(d,f,m,_);for(;_=y.dequeue();)c(d,f,m,_);if(d.nodeCount()){for(let k=f.length-2;k>0;--k)if(_=f[k].dequeue(),_){h=h.concat(c(d,f,m,_,!0));break}}}return h}function c(d,f,m,h,y){let b=y?[]:void 0;return d.inEdges(h.v).forEach(_=>{let k=d.edge(_),C=d.node(_.v);y&&b.push({v:_.v,w:_.w}),C.out-=k,u(f,m,C)}),d.outEdges(h.v).forEach(_=>{let k=d.edge(_),C=_.w,N=d.node(C);N.in-=k,u(f,m,N)}),d.removeNode(h.v),b}function l(d,f){let m=new r,h=0,y=0;d.nodes().forEach(k=>{m.setNode(k,{v:k,in:0,out:0})}),d.edges().forEach(k=>{let C=m.edge(k.v,k.w)||0,N=f(k),E=C+N;m.setEdge(k.v,k.w,E),y=Math.max(y,m.node(k.v).out+=N),h=Math.max(h,m.node(k.w).in+=N)});let b=p(y+h+3).map(()=>new o),_=h+1;return m.nodes().forEach(k=>{u(b,_,m.node(k))}),{graph:m,buckets:b,zeroIdx:_}}function u(d,f,m){m.out?m.in?d[m.out-m.in+f].enqueue(m):d[d.length-1].enqueue(m):d[0].enqueue(m)}function p(d){let f=[];for(let m=0;m<d;m++)f.push(m);return f}}),Gt=Ct((n,t)=>{var r=Xn().Graph;t.exports={addBorderNode:f,addDummyNode:o,applyWithChunking:y,asNonCompoundGraph:a,buildLayerMatrix:u,intersectRect:l,mapValues:I,maxRank:b,normalizeRanks:p,notime:C,partition:_,pick:S,predecessorWeights:c,range:w,removeEmptyRanks:d,simplify:i,successorWeights:s,time:k,uniqueId:E,zipObject:U};function o(x,A,T,V){for(var R=V;x.hasNode(R);)R=E(V);return T.dummy=A,x.setNode(R,T),R}function i(x){let A=new r().setGraph(x.graph());return x.nodes().forEach(T=>A.setNode(T,x.node(T))),x.edges().forEach(T=>{let V=A.edge(T.v,T.w)||{weight:0,minlen:1},R=x.edge(T);A.setEdge(T.v,T.w,{weight:V.weight+R.weight,minlen:Math.max(V.minlen,R.minlen)})}),A}function a(x){let A=new r({multigraph:x.isMultigraph()}).setGraph(x.graph());return x.nodes().forEach(T=>{x.children(T).length||A.setNode(T,x.node(T))}),x.edges().forEach(T=>{A.setEdge(T,x.edge(T))}),A}function s(x){let A=x.nodes().map(T=>{let V={};return x.outEdges(T).forEach(R=>{V[R.w]=(V[R.w]||0)+x.edge(R).weight}),V});return U(x.nodes(),A)}function c(x){let A=x.nodes().map(T=>{let V={};return x.inEdges(T).forEach(R=>{V[R.v]=(V[R.v]||0)+x.edge(R).weight}),V});return U(x.nodes(),A)}function l(x,A){let T=x.x,V=x.y,R=A.x-T,X=A.y-V,Y=x.width/2,ne=x.height/2;if(!R&&!X)throw new Error("Not possible to find intersection inside of the rectangle");let M,te;return Math.abs(X)*Y>Math.abs(R)*ne?(X<0&&(ne=-ne),M=ne*R/X,te=ne):(R<0&&(Y=-Y),M=Y,te=Y*X/R),{x:T+M,y:V+te}}function u(x){let A=w(b(x)+1).map(()=>[]);return x.nodes().forEach(T=>{let V=x.node(T),R=V.rank;R!==void 0&&(A[R][V.order]=T)}),A}function p(x){let A=x.nodes().map(V=>{let R=x.node(V).rank;return R===void 0?Number.MAX_VALUE:R}),T=y(Math.min,A);x.nodes().forEach(V=>{let R=x.node(V);Object.hasOwn(R,"rank")&&(R.rank-=T)})}function d(x){let A=x.nodes().map(Y=>x.node(Y).rank).filter(Y=>Y!==void 0),T=y(Math.min,A),V=[];x.nodes().forEach(Y=>{let ne=x.node(Y).rank-T;V[ne]||(V[ne]=[]),V[ne].push(Y)});let R=0,X=x.graph().nodeRankFactor;Array.from(V).forEach((Y,ne)=>{Y===void 0&&ne%X!==0?--R:Y!==void 0&&R&&Y.forEach(M=>x.node(M).rank+=R)})}function f(x,A,T,V){let R={width:0,height:0};return arguments.length>=4&&(R.rank=T,R.order=V),o(x,"border",R,A)}function m(x,A=h){let T=[];for(let V=0;V<x.length;V+=A){let R=x.slice(V,V+A);T.push(R)}return T}var h=65535;function y(x,A){if(A.length>h){let T=m(A);return x.apply(null,T.map(V=>x.apply(null,V)))}else return x.apply(null,A)}function b(x){let A=x.nodes().map(T=>{let V=x.node(T).rank;return V===void 0?Number.MIN_VALUE:V});return y(Math.max,A)}function _(x,A){let T={lhs:[],rhs:[]};return x.forEach(V=>{A(V)?T.lhs.push(V):T.rhs.push(V)}),T}function k(x,A){let T=Date.now();try{return A()}finally{console.log(x+" time: "+(Date.now()-T)+"ms")}}function C(x,A){return A()}var N=0;function E(x){var A=++N;return x+(""+A)}function w(x,A,T=1){A==null&&(A=x,x=0);let V=X=>X<A;T<0&&(V=X=>A<X);let R=[];for(let X=x;V(X);X+=T)R.push(X);return R}function S(x,A){let T={};for(let V of A)x[V]!==void 0&&(T[V]=x[V]);return T}function I(x,A){let T=A;return typeof A=="string"&&(T=V=>V[A]),Object.entries(x).reduce((V,[R,X])=>(V[R]=T(X,R),V),{})}function U(x,A){return x.reduce((T,V,R)=>(T[V]=A[R],T),{})}}),jI=Ct((n,t)=>{var r=MI(),o=Gt().uniqueId;t.exports={run:i,undo:s};function i(c){(c.graph().acyclicer==="greedy"?r(c,l(c)):a(c)).forEach(u=>{let p=c.edge(u);c.removeEdge(u),p.forwardName=u.name,p.reversed=!0,c.setEdge(u.w,u.v,p,o("rev"))});function l(u){return p=>u.edge(p).weight}}function a(c){let l=[],u={},p={};function d(f){Object.hasOwn(p,f)||(p[f]=!0,u[f]=!0,c.outEdges(f).forEach(m=>{Object.hasOwn(u,m.w)?l.push(m):d(m.w)}),delete u[f])}return c.nodes().forEach(d),l}function s(c){c.edges().forEach(l=>{let u=c.edge(l);if(u.reversed){c.removeEdge(l);let p=u.forwardName;delete u.reversed,delete u.forwardName,c.setEdge(l.w,l.v,u,p)}})}}),FI=Ct((n,t)=>{var r=Gt();t.exports={run:o,undo:a};function o(s){s.graph().dummyChains=[],s.edges().forEach(c=>i(s,c))}function i(s,c){let l=c.v,u=s.node(l).rank,p=c.w,d=s.node(p).rank,f=c.name,m=s.edge(c),h=m.labelRank;if(d===u+1)return;s.removeEdge(c);let y,b,_;for(_=0,++u;u<d;++_,++u)m.points=[],b={width:0,height:0,edgeLabel:m,edgeObj:c,rank:u},y=r.addDummyNode(s,"edge",b,"_d"),u===h&&(b.width=m.width,b.height=m.height,b.dummy="edge-label",b.labelpos=m.labelpos),s.setEdge(l,y,{weight:m.weight},f),_===0&&s.graph().dummyChains.push(y),l=y;s.setEdge(l,p,{weight:m.weight},f)}function a(s){s.graph().dummyChains.forEach(c=>{let l=s.node(c),u=l.edgeLabel,p;for(s.setEdge(l.edgeObj,u);l.dummy;)p=s.successors(c)[0],s.removeNode(c),u.points.push({x:l.x,y:l.y}),l.dummy==="edge-label"&&(u.x=l.x,u.y=l.y,u.width=l.width,u.height=l.height),c=p,l=s.node(c)})}}),Ol=Ct((n,t)=>{var{applyWithChunking:r}=Gt();t.exports={longestPath:o,slack:i};function o(a){var s={};function c(l){var u=a.node(l);if(Object.hasOwn(s,l))return u.rank;s[l]=!0;let p=a.outEdges(l).map(f=>f==null?Number.POSITIVE_INFINITY:c(f.w)-a.edge(f).minlen);var d=r(Math.min,p);return d===Number.POSITIVE_INFINITY&&(d=0),u.rank=d}a.sources().forEach(c)}function i(a,s){return a.node(s.w).rank-a.node(s.v).rank-a.edge(s).minlen}}),Jy=Ct((n,t)=>{var r=Xn().Graph,o=Ol().slack;t.exports=i;function i(l){var u=new r({directed:!1}),p=l.nodes()[0],d=l.nodeCount();u.setNode(p,{});for(var f,m;a(u,l)<d;)f=s(u,l),m=u.hasNode(f.v)?o(l,f):-o(l,f),c(u,l,m);return u}function a(l,u){function p(d){u.nodeEdges(d).forEach(f=>{var m=f.v,h=d===m?f.w:m;!l.hasNode(h)&&!o(u,f)&&(l.setNode(h,{}),l.setEdge(d,h,{}),p(h))})}return l.nodes().forEach(p),l.nodeCount()}function s(l,u){return u.edges().reduce((p,d)=>{let f=Number.POSITIVE_INFINITY;return l.hasNode(d.v)!==l.hasNode(d.w)&&(f=o(u,d)),f<p[0]?[f,d]:p},[Number.POSITIVE_INFINITY,null])[1]}function c(l,u,p){l.nodes().forEach(d=>u.node(d).rank+=p)}}),UI=Ct((n,t)=>{var r=Jy(),o=Ol().slack,i=Ol().longestPath,a=Xn().alg.preorder,s=Xn().alg.postorder,c=Gt().simplify;t.exports=l,l.initLowLimValues=f,l.initCutValues=u,l.calcCutValue=d,l.leaveEdge=h,l.enterEdge=y,l.exchangeEdges=b;function l(N){N=c(N),i(N);var E=r(N);f(E),u(E,N);for(var w,S;w=h(E);)S=y(E,N,w),b(E,N,w,S)}function u(N,E){var w=s(N,N.nodes());w=w.slice(0,w.length-1),w.forEach(S=>p(N,E,S))}function p(N,E,w){var S=N.node(w),I=S.parent;N.edge(w,I).cutvalue=d(N,E,w)}function d(N,E,w){var S=N.node(w),I=S.parent,U=!0,x=E.edge(w,I),A=0;return x||(U=!1,x=E.edge(I,w)),A=x.weight,E.nodeEdges(w).forEach(T=>{var V=T.v===w,R=V?T.w:T.v;if(R!==I){var X=V===U,Y=E.edge(T).weight;if(A+=X?Y:-Y,k(N,w,R)){var ne=N.edge(w,R).cutvalue;A+=X?-ne:ne}}}),A}function f(N,E){arguments.length<2&&(E=N.nodes()[0]),m(N,{},1,E)}function m(N,E,w,S,I){var U=w,x=N.node(S);return E[S]=!0,N.neighbors(S).forEach(A=>{Object.hasOwn(E,A)||(w=m(N,E,w,A,S))}),x.low=U,x.lim=w++,I?x.parent=I:delete x.parent,w}function h(N){return N.edges().find(E=>N.edge(E).cutvalue<0)}function y(N,E,w){var S=w.v,I=w.w;E.hasEdge(S,I)||(S=w.w,I=w.v);var U=N.node(S),x=N.node(I),A=U,T=!1;U.lim>x.lim&&(A=x,T=!0);var V=E.edges().filter(R=>T===C(N,N.node(R.v),A)&&T!==C(N,N.node(R.w),A));return V.reduce((R,X)=>o(E,X)<o(E,R)?X:R)}function b(N,E,w,S){var I=w.v,U=w.w;N.removeEdge(I,U),N.setEdge(S.v,S.w,{}),f(N),u(N,E),_(N,E)}function _(N,E){var w=N.nodes().find(I=>!E.node(I).parent),S=a(N,w);S=S.slice(1),S.forEach(I=>{var U=N.node(I).parent,x=E.edge(I,U),A=!1;x||(x=E.edge(U,I),A=!0),E.node(I).rank=E.node(U).rank+(A?x.minlen:-x.minlen)})}function k(N,E,w){return N.hasEdge(E,w)}function C(N,E,w){return w.low<=E.lim&&E.lim<=w.lim}}),KI=Ct((n,t)=>{var r=Ol(),o=r.longestPath,i=Jy(),a=UI();t.exports=s;function s(p){var d=p.graph().ranker;if(d instanceof Function)return d(p);switch(p.graph().ranker){case"network-simplex":u(p);break;case"tight-tree":l(p);break;case"longest-path":c(p);break;case"none":break;default:u(p)}}var c=o;function l(p){o(p),i(p)}function u(p){a(p)}}),qI=Ct((n,t)=>{t.exports=r;function r(a){let s=i(a);a.graph().dummyChains.forEach(c=>{let l=a.node(c),u=l.edgeObj,p=o(a,s,u.v,u.w),d=p.path,f=p.lca,m=0,h=d[m],y=!0;for(;c!==u.w;){if(l=a.node(c),y){for(;(h=d[m])!==f&&a.node(h).maxRank<l.rank;)m++;h===f&&(y=!1)}if(!y){for(;m<d.length-1&&a.node(h=d[m+1]).minRank<=l.rank;)m++;h=d[m]}a.setParent(c,h),c=a.successors(c)[0]}})}function o(a,s,c,l){let u=[],p=[],d=Math.min(s[c].low,s[l].low),f=Math.max(s[c].lim,s[l].lim),m,h;m=c;do m=a.parent(m),u.push(m);while(m&&(s[m].low>d||f>s[m].lim));for(h=m,m=l;(m=a.parent(m))!==h;)p.push(m);return{path:u.concat(p.reverse()),lca:h}}function i(a){let s={},c=0;function l(u){let p=c;a.children(u).forEach(l),s[u]={low:p,lim:c++}}return a.children().forEach(l),s}}),GI=Ct((n,t)=>{var r=Gt();t.exports={run:o,cleanup:c};function o(l){let u=r.addDummyNode(l,"root",{},"_root"),p=a(l),d=Object.values(p),f=r.applyWithChunking(Math.max,d)-1,m=2*f+1;l.graph().nestingRoot=u,l.edges().forEach(y=>l.edge(y).minlen*=m);let h=s(l)+1;l.children().forEach(y=>i(l,u,m,h,f,p,y)),l.graph().nodeRankFactor=m}function i(l,u,p,d,f,m,h){let y=l.children(h);if(!y.length){h!==u&&l.setEdge(u,h,{weight:0,minlen:p});return}let b=r.addBorderNode(l,"_bt"),_=r.addBorderNode(l,"_bb"),k=l.node(h);l.setParent(b,h),k.borderTop=b,l.setParent(_,h),k.borderBottom=_,y.forEach(C=>{i(l,u,p,d,f,m,C);let N=l.node(C),E=N.borderTop?N.borderTop:C,w=N.borderBottom?N.borderBottom:C,S=N.borderTop?d:2*d,I=E!==w?1:f-m[h]+1;l.setEdge(b,E,{weight:S,minlen:I,nestingEdge:!0}),l.setEdge(w,_,{weight:S,minlen:I,nestingEdge:!0})}),l.parent(h)||l.setEdge(u,b,{weight:0,minlen:f+m[h]})}function a(l){var u={};function p(d,f){var m=l.children(d);m&&m.length&&m.forEach(h=>p(h,f+1)),u[d]=f}return l.children().forEach(d=>p(d,1)),u}function s(l){return l.edges().reduce((u,p)=>u+l.edge(p).weight,0)}function c(l){var u=l.graph();l.removeNode(u.nestingRoot),delete u.nestingRoot,l.edges().forEach(p=>{var d=l.edge(p);d.nestingEdge&&l.removeEdge(p)})}}),HI=Ct((n,t)=>{var r=Gt();t.exports=o;function o(a){function s(c){let l=a.children(c),u=a.node(c);if(l.length&&l.forEach(s),Object.hasOwn(u,"minRank")){u.borderLeft=[],u.borderRight=[];for(let p=u.minRank,d=u.maxRank+1;p<d;++p)i(a,"borderLeft","_bl",c,u,p),i(a,"borderRight","_br",c,u,p)}}a.children().forEach(s)}function i(a,s,c,l,u,p){let d={width:0,height:0,rank:p,borderType:s},f=u[s][p-1],m=r.addDummyNode(a,"border",d,c);u[s][p]=m,a.setParent(m,l),f&&a.setEdge(f,m,{weight:1})}}),zI=Ct((n,t)=>{t.exports={adjust:r,undo:o};function r(p){let d=p.graph().rankdir.toLowerCase();(d==="lr"||d==="rl")&&i(p)}function o(p){let d=p.graph().rankdir.toLowerCase();(d==="bt"||d==="rl")&&s(p),(d==="lr"||d==="rl")&&(l(p),i(p))}function i(p){p.nodes().forEach(d=>a(p.node(d))),p.edges().forEach(d=>a(p.edge(d)))}function a(p){let d=p.width;p.width=p.height,p.height=d}function s(p){p.nodes().forEach(d=>c(p.node(d))),p.edges().forEach(d=>{let f=p.edge(d);f.points.forEach(c),Object.hasOwn(f,"y")&&c(f)})}function c(p){p.y=-p.y}function l(p){p.nodes().forEach(d=>u(p.node(d))),p.edges().forEach(d=>{let f=p.edge(d);f.points.forEach(u),Object.hasOwn(f,"x")&&u(f)})}function u(p){let d=p.x;p.x=p.y,p.y=d}}),WI=Ct((n,t)=>{var r=Gt();t.exports=o;function o(i){let a={},s=i.nodes().filter(d=>!i.children(d).length),c=s.map(d=>i.node(d).rank),l=r.applyWithChunking(Math.max,c),u=r.range(l+1).map(()=>[]);function p(d){if(a[d])return;a[d]=!0;let f=i.node(d);u[f.rank].push(d),i.successors(d).forEach(p)}return s.sort((d,f)=>i.node(d).rank-i.node(f).rank).forEach(p),u}}),YI=Ct((n,t)=>{var r=Gt().zipObject;t.exports=o;function o(a,s){let c=0;for(let l=1;l<s.length;++l)c+=i(a,s[l-1],s[l]);return c}function i(a,s,c){let l=r(c,c.map((h,y)=>y)),u=s.flatMap(h=>a.outEdges(h).map(y=>({pos:l[y.w],weight:a.edge(y).weight})).sort((y,b)=>y.pos-b.pos)),p=1;for(;p<c.length;)p<<=1;let d=2*p-1;p-=1;let f=new Array(d).fill(0),m=0;return u.forEach(h=>{let y=h.pos+p;f[y]+=h.weight;let b=0;for(;y>0;)y%2&&(b+=f[y+1]),y=y-1>>1,f[y]+=h.weight;m+=h.weight*b}),m}}),JI=Ct((n,t)=>{t.exports=r;function r(o,i=[]){return i.map(a=>{let s=o.inEdges(a);if(s.length){let c=s.reduce((l,u)=>{let p=o.edge(u),d=o.node(u.v);return{sum:l.sum+p.weight*d.order,weight:l.weight+p.weight}},{sum:0,weight:0});return{v:a,barycenter:c.sum/c.weight,weight:c.weight}}else return{v:a}})}}),XI=Ct((n,t)=>{var r=Gt();t.exports=o;function o(s,c){let l={};s.forEach((p,d)=>{let f=l[p.v]={indegree:0,in:[],out:[],vs:[p.v],i:d};p.barycenter!==void 0&&(f.barycenter=p.barycenter,f.weight=p.weight)}),c.edges().forEach(p=>{let d=l[p.v],f=l[p.w];d!==void 0&&f!==void 0&&(f.indegree++,d.out.push(l[p.w]))});let u=Object.values(l).filter(p=>!p.indegree);return i(u)}function i(s){let c=[];function l(p){return d=>{d.merged||(d.barycenter===void 0||p.barycenter===void 0||d.barycenter>=p.barycenter)&&a(p,d)}}function u(p){return d=>{d.in.push(p),--d.indegree===0&&s.push(d)}}for(;s.length;){let p=s.pop();c.push(p),p.in.reverse().forEach(l(p)),p.out.forEach(u(p))}return c.filter(p=>!p.merged).map(p=>r.pick(p,["vs","i","barycenter","weight"]))}function a(s,c){let l=0,u=0;s.weight&&(l+=s.barycenter*s.weight,u+=s.weight),c.weight&&(l+=c.barycenter*c.weight,u+=c.weight),s.vs=c.vs.concat(s.vs),s.barycenter=l/u,s.weight=u,s.i=Math.min(c.i,s.i),c.merged=!0}}),ZI=Ct((n,t)=>{var r=Gt();t.exports=o;function o(s,c){let l=r.partition(s,b=>Object.hasOwn(b,"barycenter")),u=l.lhs,p=l.rhs.sort((b,_)=>_.i-b.i),d=[],f=0,m=0,h=0;u.sort(a(!!c)),h=i(d,p,h),u.forEach(b=>{h+=b.vs.length,d.push(b.vs),f+=b.barycenter*b.weight,m+=b.weight,h=i(d,p,h)});let y={vs:d.flat(!0)};return m&&(y.barycenter=f/m,y.weight=m),y}function i(s,c,l){let u;for(;c.length&&(u=c[c.length-1]).i<=l;)c.pop(),s.push(u.vs),l++;return l}function a(s){return(c,l)=>c.barycenter<l.barycenter?-1:c.barycenter>l.barycenter?1:s?l.i-c.i:c.i-l.i}}),QI=Ct((n,t)=>{var r=JI(),o=XI(),i=ZI();t.exports=a;function a(l,u,p,d){let f=l.children(u),m=l.node(u),h=m?m.borderLeft:void 0,y=m?m.borderRight:void 0,b={};h&&(f=f.filter(N=>N!==h&&N!==y));let _=r(l,f);_.forEach(N=>{if(l.children(N.v).length){let E=a(l,N.v,p,d);b[N.v]=E,Object.hasOwn(E,"barycenter")&&c(N,E)}});let k=o(_,p);s(k,b);let C=i(k,d);if(h&&(C.vs=[h,C.vs,y].flat(!0),l.predecessors(h).length)){let N=l.node(l.predecessors(h)[0]),E=l.node(l.predecessors(y)[0]);Object.hasOwn(C,"barycenter")||(C.barycenter=0,C.weight=0),C.barycenter=(C.barycenter*C.weight+N.order+E.order)/(C.weight+2),C.weight+=2}return C}function s(l,u){l.forEach(p=>{p.vs=p.vs.flatMap(d=>u[d]?u[d].vs:d)})}function c(l,u){l.barycenter!==void 0?(l.barycenter=(l.barycenter*l.weight+u.barycenter*u.weight)/(l.weight+u.weight),l.weight+=u.weight):(l.barycenter=u.barycenter,l.weight=u.weight)}}),eB=Ct((n,t)=>{var r=Xn().Graph,o=Gt();t.exports=i;function i(s,c,l,u){u||(u=s.nodes());let p=a(s),d=new r({compound:!0}).setGraph({root:p}).setDefaultNodeLabel(f=>s.node(f));return u.forEach(f=>{let m=s.node(f),h=s.parent(f);(m.rank===c||m.minRank<=c&&c<=m.maxRank)&&(d.setNode(f),d.setParent(f,h||p),s[l](f).forEach(y=>{let b=y.v===f?y.w:y.v,_=d.edge(b,f),k=_!==void 0?_.weight:0;d.setEdge(b,f,{weight:s.edge(y).weight+k})}),Object.hasOwn(m,"minRank")&&d.setNode(f,{borderLeft:m.borderLeft[c],borderRight:m.borderRight[c]}))}),d}function a(s){for(var c;s.hasNode(c=o.uniqueId("_root")););return c}}),tB=Ct((n,t)=>{t.exports=r;function r(o,i,a){let s={},c;a.forEach(l=>{let u=o.parent(l),p,d;for(;u;){if(p=o.parent(u),p?(d=s[p],s[p]=u):(d=c,c=u),d&&d!==u){i.setEdge(d,u);return}u=p}})}}),nB=Ct((n,t)=>{var r=WI(),o=YI(),i=QI(),a=eB(),s=tB(),c=Xn().Graph,l=Gt();t.exports=u;function u(m,h={}){if(typeof h.customOrder=="function"){h.customOrder(m,u);return}let y=l.maxRank(m),b=p(m,l.range(1,y+1),"inEdges"),_=p(m,l.range(y-1,-1,-1),"outEdges"),k=r(m);if(f(m,k),h.disableOptimalOrderHeuristic)return;let C=Number.POSITIVE_INFINITY,N,E=h.constraints||[];for(let w=0,S=0;S<4;++w,++S){d(w%2?b:_,w%4>=2,E),k=l.buildLayerMatrix(m);let I=o(m,k);I<C?(S=0,N=Object.assign({},k),C=I):I===C&&(N=structuredClone(k))}f(m,N)}function p(m,h,y){let b=new Map,_=(k,C)=>{b.has(k)||b.set(k,[]),b.get(k).push(C)};for(let k of m.nodes()){let C=m.node(k);if(typeof C.rank=="number"&&_(C.rank,k),typeof C.minRank=="number"&&typeof C.maxRank=="number")for(let N=C.minRank;N<=C.maxRank;N++)N!==C.rank&&_(N,k)}return h.map(function(k){return a(m,k,y,b.get(k)||[])})}function d(m,h,y){let b=new c;m.forEach(function(_){y.forEach(N=>b.setEdge(N.left,N.right));let k=_.graph().root,C=i(_,k,b,h);C.vs.forEach((N,E)=>_.node(N).order=E),s(_,b,C.vs)})}function f(m,h){Object.values(h).forEach(y=>y.forEach((b,_)=>m.node(b).order=_))}}),rB=Ct((n,t)=>{var r=Xn().Graph,o=Gt();t.exports={positionX:y,findType1Conflicts:i,findType2Conflicts:a,addConflict:c,hasConflict:l,verticalAlignment:u,horizontalCompaction:p,alignCoordinates:m,findSmallestWidthAlignment:f,balance:h};function i(k,C){let N={};function E(w,S){let I=0,U=0,x=w.length,A=S[S.length-1];return S.forEach((T,V)=>{let R=s(k,T),X=R?k.node(R).order:x;(R||T===A)&&(S.slice(U,V+1).forEach(Y=>{k.predecessors(Y).forEach(ne=>{let M=k.node(ne),te=M.order;(te<I||X<te)&&!(M.dummy&&k.node(Y).dummy)&&c(N,ne,Y)})}),U=V+1,I=X)}),S}return C.length&&C.reduce(E),N}function a(k,C){let N={};function E(S,I,U,x,A){let T;o.range(I,U).forEach(V=>{T=S[V],k.node(T).dummy&&k.predecessors(T).forEach(R=>{let X=k.node(R);X.dummy&&(X.order<x||X.order>A)&&c(N,R,T)})})}function w(S,I){let U=-1,x,A=0;return I.forEach((T,V)=>{if(k.node(T).dummy==="border"){let R=k.predecessors(T);R.length&&(x=k.node(R[0]).order,E(I,A,V,U,x),A=V,U=x)}E(I,A,I.length,x,S.length)}),I}return C.length&&C.reduce(w),N}function s(k,C){if(k.node(C).dummy)return k.predecessors(C).find(N=>k.node(N).dummy)}function c(k,C,N){if(C>N){let w=C;C=N,N=w}let E=k[C];E||(k[C]=E={}),E[N]=!0}function l(k,C,N){if(C>N){let E=C;C=N,N=E}return!!k[C]&&Object.hasOwn(k[C],N)}function u(k,C,N,E){let w={},S={},I={};return C.forEach(U=>{U.forEach((x,A)=>{w[x]=x,S[x]=x,I[x]=A})}),C.forEach(U=>{let x=-1;U.forEach(A=>{let T=E(A);if(T.length){T=T.sort((R,X)=>I[R]-I[X]);let V=(T.length-1)/2;for(let R=Math.floor(V),X=Math.ceil(V);R<=X;++R){let Y=T[R];S[A]===A&&x<I[Y]&&!l(N,A,Y)&&(S[Y]=A,S[A]=w[A]=w[Y],x=I[Y])}}})}),{root:w,align:S}}function p(k,C,N,E,w){let S={},I=d(k,C,N,w),U=w?"borderLeft":"borderRight";function x(V,R){let X=I.nodes().slice(),Y={},ne=X.pop();for(;ne;){if(Y[ne])V(ne);else{Y[ne]=!0,X.push(ne);for(let M of R(ne))X.push(M)}ne=X.pop()}}function A(V){S[V]=I.inEdges(V).reduce((R,X)=>Math.max(R,S[X.v]+I.edge(X)),0)}function T(V){let R=I.outEdges(V).reduce((Y,ne)=>Math.min(Y,S[ne.w]-I.edge(ne)),Number.POSITIVE_INFINITY),X=k.node(V);R!==Number.POSITIVE_INFINITY&&X.borderType!==U&&(S[V]=Math.max(S[V],R))}return x(A,I.predecessors.bind(I)),x(T,I.successors.bind(I)),Object.keys(E).forEach(V=>S[V]=S[N[V]]),S}function d(k,C,N,E){let w=new r,S=k.graph(),I=b(S.nodesep,S.edgesep,E);return C.forEach(U=>{let x;U.forEach(A=>{let T=N[A];if(w.setNode(T),x){var V=N[x],R=w.edge(V,T);w.setEdge(V,T,Math.max(I(k,A,x),R||0))}x=A})}),w}function f(k,C){return Object.values(C).reduce((N,E)=>{let w=Number.NEGATIVE_INFINITY,S=Number.POSITIVE_INFINITY;Object.entries(E).forEach(([U,x])=>{let A=_(k,U)/2;w=Math.max(x+A,w),S=Math.min(x-A,S)});let I=w-S;return I<N[0]&&(N=[I,E]),N},[Number.POSITIVE_INFINITY,null])[1]}function m(k,C){let N=Object.values(C),E=o.applyWithChunking(Math.min,N),w=o.applyWithChunking(Math.max,N);["u","d"].forEach(S=>{["l","r"].forEach(I=>{let U=S+I,x=k[U];if(x===C)return;let A=Object.values(x),T=E-o.applyWithChunking(Math.min,A);I!=="l"&&(T=w-o.applyWithChunking(Math.max,A)),T&&(k[U]=o.mapValues(x,V=>V+T))})})}function h(k,C){return o.mapValues(k.ul,(N,E)=>{if(C)return k[C.toLowerCase()][E];{let w=Object.values(k).map(S=>S[E]).sort((S,I)=>S-I);return(w[1]+w[2])/2}})}function y(k){let C=o.buildLayerMatrix(k),N=Object.assign(i(k,C),a(k,C)),E={},w;["u","d"].forEach(I=>{w=I==="u"?C:Object.values(C).reverse(),["l","r"].forEach(U=>{U==="r"&&(w=w.map(V=>Object.values(V).reverse()));let x=(I==="u"?k.predecessors:k.successors).bind(k),A=u(k,w,N,x),T=p(k,w,A.root,A.align,U==="r");U==="r"&&(T=o.mapValues(T,V=>-V)),E[I+U]=T})});let S=f(k,E);return m(E,S),h(E,k.graph().align)}function b(k,C,N){return(E,w,S)=>{let I=E.node(w),U=E.node(S),x=0,A;if(x+=I.width/2,Object.hasOwn(I,"labelpos"))switch(I.labelpos.toLowerCase()){case"l":A=-I.width/2;break;case"r":A=I.width/2;break}if(A&&(x+=N?A:-A),A=0,x+=(I.dummy?C:k)/2,x+=(U.dummy?C:k)/2,x+=U.width/2,Object.hasOwn(U,"labelpos"))switch(U.labelpos.toLowerCase()){case"l":A=U.width/2;break;case"r":A=-U.width/2;break}return A&&(x+=N?A:-A),A=0,x}}function _(k,C){return k.node(C).width}}),oB=Ct((n,t)=>{var r=Gt(),o=rB().positionX;t.exports=i;function i(s){s=r.asNonCompoundGraph(s),a(s),Object.entries(o(s)).forEach(([c,l])=>s.node(c).x=l)}function a(s){let c=r.buildLayerMatrix(s),l=s.graph().ranksep,u=s.graph().rankalign,p=0;c.forEach(d=>{let f=d.reduce((m,h)=>{let y=s.node(h).height;return m>y?m:y},0);d.forEach(m=>{let h=s.node(m);u==="top"?h.y=p+h.height/2:u==="bottom"?h.y=p+f-h.height/2:h.y=p+f/2}),p+=f+l})}}),iB=Ct((n,t)=>{var r=jI(),o=FI(),i=KI(),a=Gt().normalizeRanks,s=qI(),c=Gt().removeEmptyRanks,l=GI(),u=HI(),p=zI(),d=nB(),f=oB(),m=Gt(),h=Xn().Graph;t.exports=y;function y(v,q={}){let ie=q.debugTiming?m.time:m.notime;return ie("layout",()=>{let oe=ie(" buildLayoutGraph",()=>x(v));return ie(" runLayout",()=>b(oe,ie,q)),ie(" updateInputGraph",()=>_(v,oe)),oe})}function b(v,q,ie){q(" makeSpaceForEdgeLabels",()=>A(v)),q(" removeSelfEdges",()=>$(v)),q(" acyclic",()=>r.run(v)),q(" nestingGraph.run",()=>l.run(v)),q(" rank",()=>i(m.asNonCompoundGraph(v))),q(" injectEdgeLabelProxies",()=>T(v)),q(" removeEmptyRanks",()=>c(v)),q(" nestingGraph.cleanup",()=>l.cleanup(v)),q(" normalizeRanks",()=>a(v)),q(" assignRankMinMax",()=>V(v)),q(" removeEdgeLabelProxies",()=>R(v)),q(" normalize.run",()=>o.run(v)),q(" parentDummyChains",()=>s(v)),q(" addBorderSegments",()=>u(v)),q(" order",()=>d(v,ie)),q(" insertSelfEdges",()=>Z(v)),q(" adjustCoordinateSystem",()=>p.adjust(v)),q(" position",()=>f(v)),q(" positionSelfEdges",()=>F(v)),q(" removeBorderNodes",()=>te(v)),q(" normalize.undo",()=>o.undo(v)),q(" fixupEdgeLabelCoords",()=>ne(v)),q(" undoCoordinateSystem",()=>p.undo(v)),q(" translateGraph",()=>X(v)),q(" assignNodeIntersects",()=>Y(v)),q(" reversePoints",()=>M(v)),q(" acyclic.undo",()=>r.undo(v))}function _(v,q){v.nodes().forEach(ie=>{let oe=v.node(ie),ke=q.node(ie);oe&&(oe.x=ke.x,oe.y=ke.y,oe.order=ke.order,oe.rank=ke.rank,q.children(ie).length&&(oe.width=ke.width,oe.height=ke.height))}),v.edges().forEach(ie=>{let oe=v.edge(ie),ke=q.edge(ie);oe.points=ke.points,Object.hasOwn(ke,"x")&&(oe.x=ke.x,oe.y=ke.y)}),v.graph().width=q.graph().width,v.graph().height=q.graph().height}var k=["nodesep","edgesep","ranksep","marginx","marginy"],C={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb",rankalign:"center"},N=["acyclicer","ranker","rankdir","align","rankalign"],E=["width","height","rank"],w={width:0,height:0},S=["minlen","weight","width","height","labeloffset"],I={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},U=["labelpos"];function x(v){let q=new h({multigraph:!0,compound:!0}),ie=G(v.graph());return q.setGraph(Object.assign({},C,J(ie,k),m.pick(ie,N))),v.nodes().forEach(oe=>{let ke=G(v.node(oe)),ye=J(ke,E);Object.keys(w).forEach(ce=>{ye[ce]===void 0&&(ye[ce]=w[ce])}),q.setNode(oe,ye),q.setParent(oe,v.parent(oe))}),v.edges().forEach(oe=>{let ke=G(v.edge(oe));q.setEdge(oe,Object.assign({},I,J(ke,S),m.pick(ke,U)))}),q}function A(v){let q=v.graph();q.ranksep/=2,v.edges().forEach(ie=>{let oe=v.edge(ie);oe.minlen*=2,oe.labelpos.toLowerCase()!=="c"&&(q.rankdir==="TB"||q.rankdir==="BT"?oe.width+=oe.labeloffset:oe.height+=oe.labeloffset)})}function T(v){v.edges().forEach(q=>{let ie=v.edge(q);if(ie.width&&ie.height){let oe=v.node(q.v),ke={rank:(v.node(q.w).rank-oe.rank)/2+oe.rank,e:q};m.addDummyNode(v,"edge-proxy",ke,"_ep")}})}function V(v){let q=0;v.nodes().forEach(ie=>{let oe=v.node(ie);oe.borderTop&&(oe.minRank=v.node(oe.borderTop).rank,oe.maxRank=v.node(oe.borderBottom).rank,q=Math.max(q,oe.maxRank))}),v.graph().maxRank=q}function R(v){v.nodes().forEach(q=>{let ie=v.node(q);ie.dummy==="edge-proxy"&&(v.edge(ie.e).labelRank=ie.rank,v.removeNode(q))})}function X(v){let q=Number.POSITIVE_INFINITY,ie=0,oe=Number.POSITIVE_INFINITY,ke=0,ye=v.graph(),ce=ye.marginx||0,he=ye.marginy||0;function Oe(De){let Be=De.x,Ge=De.y,We=De.width,nt=De.height;q=Math.min(q,Be-We/2),ie=Math.max(ie,Be+We/2),oe=Math.min(oe,Ge-nt/2),ke=Math.max(ke,Ge+nt/2)}v.nodes().forEach(De=>Oe(v.node(De))),v.edges().forEach(De=>{let Be=v.edge(De);Object.hasOwn(Be,"x")&&Oe(Be)}),q-=ce,oe-=he,v.nodes().forEach(De=>{let Be=v.node(De);Be.x-=q,Be.y-=oe}),v.edges().forEach(De=>{let Be=v.edge(De);Be.points.forEach(Ge=>{Ge.x-=q,Ge.y-=oe}),Object.hasOwn(Be,"x")&&(Be.x-=q),Object.hasOwn(Be,"y")&&(Be.y-=oe)}),ye.width=ie-q+ce,ye.height=ke-oe+he}function Y(v){v.edges().forEach(q=>{let ie=v.edge(q),oe=v.node(q.v),ke=v.node(q.w),ye,ce;ie.points?(ye=ie.points[0],ce=ie.points[ie.points.length-1]):(ie.points=[],ye=ke,ce=oe),ie.points.unshift(m.intersectRect(oe,ye)),ie.points.push(m.intersectRect(ke,ce))})}function ne(v){v.edges().forEach(q=>{let ie=v.edge(q);if(Object.hasOwn(ie,"x"))switch((ie.labelpos==="l"||ie.labelpos==="r")&&(ie.width-=ie.labeloffset),ie.labelpos){case"l":ie.x-=ie.width/2+ie.labeloffset;break;case"r":ie.x+=ie.width/2+ie.labeloffset;break}})}function M(v){v.edges().forEach(q=>{let ie=v.edge(q);ie.reversed&&ie.points.reverse()})}function te(v){v.nodes().forEach(q=>{if(v.children(q).length){let ie=v.node(q),oe=v.node(ie.borderTop),ke=v.node(ie.borderBottom),ye=v.node(ie.borderLeft[ie.borderLeft.length-1]),ce=v.node(ie.borderRight[ie.borderRight.length-1]);ie.width=Math.abs(ce.x-ye.x),ie.height=Math.abs(ke.y-oe.y),ie.x=ye.x+ie.width/2,ie.y=oe.y+ie.height/2}}),v.nodes().forEach(q=>{v.node(q).dummy==="border"&&v.removeNode(q)})}function $(v){v.edges().forEach(q=>{if(q.v===q.w){var ie=v.node(q.v);ie.selfEdges||(ie.selfEdges=[]),ie.selfEdges.push({e:q,label:v.edge(q)}),v.removeEdge(q)}})}function Z(v){var q=m.buildLayerMatrix(v);q.forEach(ie=>{var oe=0;ie.forEach((ke,ye)=>{var ce=v.node(ke);ce.order=ye+oe,(ce.selfEdges||[]).forEach(he=>{m.addDummyNode(v,"selfedge",{width:he.label.width,height:he.label.height,rank:ce.rank,order:ye+ ++oe,e:he.e,label:he.label},"_se")}),delete ce.selfEdges})})}function F(v){v.nodes().forEach(q=>{var ie=v.node(q);if(ie.dummy==="selfedge"){var oe=v.node(ie.e.v),ke=oe.x+oe.width/2,ye=oe.y,ce=ie.x-ke,he=oe.height/2;v.setEdge(ie.e,ie.label),v.removeNode(q),ie.label.points=[{x:ke+2*ce/3,y:ye-he},{x:ke+5*ce/6,y:ye-he},{x:ke+ce,y:ye},{x:ke+5*ce/6,y:ye+he},{x:ke+2*ce/3,y:ye+he}],ie.label.x=ie.x,ie.label.y=ie.y}})}function J(v,q){return m.mapValues(m.pick(v,q),Number)}function G(v){var q={};return v&&Object.entries(v).forEach(([ie,oe])=>{typeof ie=="string"&&(ie=ie.toLowerCase()),q[ie]=oe}),q}}),aB=Ct((n,t)=>{var r=Gt(),o=Xn().Graph;t.exports={debugOrdering:i};function i(a){let s=r.buildLayerMatrix(a),c=new o({compound:!0,multigraph:!0}).setGraph({});return a.nodes().forEach(l=>{c.setNode(l,{label:l}),c.setParent(l,"layer"+a.node(l).rank)}),a.edges().forEach(l=>c.setEdge(l.v,l.w,{},l.name)),s.forEach((l,u)=>{let p="layer"+u;c.setNode(p,{rank:"same"}),l.reduce((d,f)=>(c.setEdge(d,f,{style:"invis"}),f))}),c}}),sB=Ct((n,t)=>{t.exports="2.0.4"}),lB=Ct((n,t)=>{t.exports={graphlib:Xn(),layout:iB(),debug:aB(),util:{time:Gt().time,notime:Gt().notime},version:sB()}});const Xy=lB();/*! For license information please see dagre.esm.js.LEGAL.txt */function cB(n){return n.map(({source:t,target:r})=>({source:t,target:r}))}function uB(n){const t=[];for(const r of n)for(const o of r.memberIds)t.push({source:r.ownerId,target:o});return t}function Zy(n,t){return[...cB(n),...uB(t)]}function Pl(n,t){const r=new Map;for(const{source:o,target:i}of n)r.has(o)||r.set(o,[]),r.get(o).push(i),r.has(i)||r.set(i,[]);return t&&(r.has(t.source)||r.set(t.source,[]),r.get(t.source).push(t.target),r.has(t.target)||r.set(t.target,[])),r}function lf(n){const t=new Set,r=new Set;function o(i){if(r.has(i))return!0;if(t.has(i))return!1;t.add(i),r.add(i);for(const a of n.get(i)??[])if(o(a))return!0;return r.delete(i),!1}for(const i of n.keys())if(o(i))return!0;return!1}function cf(n,t){const r=n.config;if(!r)return[];const o=r[t];return Array.isArray(o)?o.filter(i=>typeof i=="string"&&nf(i)):[]}function dB({state:n,groupMapById:t,getNodeById:r,history:o}){const i=e.computed(()=>{const A=new Map;for(const T of n.value.groups)for(const V of T.memberIds)A.set(V,{ownerId:T.ownerId,branch:T.branch});return A}),a=e.computed(()=>{const A=new Map;for(const T of n.value.groups)for(const V of T.memberIds)A.set(V,T);return A}),s=e.computed(()=>{const A=new Map;for(const T of n.value.groups)A.has(T.ownerId)||A.set(T.ownerId,[]),A.get(T.ownerId).push(T);return A}),c=e.computed(()=>Zy(n.value.edges,n.value.groups)),l=e.computed(()=>Pl(c.value));function u(A,T){return A?$a(A.type).includes(T):!1}function p(A,T){if(T===A.id)return!1;const V=r(T);return!(!V||mn(V.type)||V.phase!==A.phase)}function d(A,T){const V=[],R=new Set;for(const X of T)R.has(X)||(R.add(X),p(A,X)&&V.push(X));return V}function f(A,T,V){const R=r(A);return u(R,T)?d(R,V):[]}function m(A,T,V){const R=af(A.id,T),X=t.value.get(R);V.length>0?X?(X.phase!==A.phase&&(X.phase=A.phase),rf(X.memberIds,V)||(X.position=void 0,X.dimensions=void 0,X.memberIds=[...V])):n.value.groups.push(Wy(A.id,T,A.phase,V)):X&&(n.value.groups=n.value.groups.filter(Y=>Y.id!==R))}function h(A,T,V,R={}){const X=r(A);if(!u(X,T))return!1;const Y=d(X,V),ne=cf(X,T);if(rf(ne,Y))return!1;const M=X.config??(X.config={});return Y.length>0?M[T]=[...Y]:(delete M[T],Object.keys(M).length===0&&delete X.config),m(X,T,Y),(R.commit??!0)&&o.commit(R.tag),!0}function y(A,T={}){const V=n.value.groups.filter(R=>R.ownerId!==A);return V.length===n.value.groups.length?!1:(n.value.groups=V,(T.commit??!0)&&o.commit(T.tag),!0)}function b(A,T){const V=t.value.get(af(A,T));if(V)return[...V.memberIds];const R=r(A);return R?cf(R,T):[]}function _(A){return i.value.get(A)}function k(A){const T=[];let V=a.value.get(A);for(;V;)T.push(V.id),V=a.value.get(V.ownerId);return T}function C(A,T){const V=k(T);if(V.length===0)return!1;const R=new Set(k(A));return R.size===0?!0:V.some(X=>!R.has(X))}function N(A,T){if(A===T)return!0;const V=new Set,R=[T];for(;R.length>0;){const X=R.pop();if(V.has(X))continue;if(V.add(X),X===A)return!0;const Y=l.value.get(X);if(Y)for(const ne of Y)V.has(ne)||R.push(ne)}return!1}function E(A,T,V){const R=r(A);return!(!u(R,T)||!p(R,V)||N(A,V))}function w(A,T,V,R={}){const X=r(A);if(!X||!E(A,T,V))return!1;const Y=cf(X,T);if(Y.includes(V))return!1;S(V,{commit:!1});const ne=[...Y,V];return h(A,T,ne,{commit:!1})?((R.commit??!0)&&o.commit(R.tag),!0):!1}function S(A,T={}){const V=_(A);if(!V)return!1;const R=b(V.ownerId,V.branch),X=R.filter(Y=>Y!==A);return X.length===R.length?!1:h(V.ownerId,V.branch,X,T)}function I(A){let T=0;const V=new Set;let R=a.value.get(A);for(;R&&!V.has(R.id);)T+=1,V.add(R.id),R=a.value.get(R.ownerId);return T}function U(A){const T=t.value.get(A);return T?I(T.ownerId):0}function x(A){return A?t.value.has(A):!1}return{memberGroupMap:a,groupsByOwner:s,findMembership:_,getMembers:b,wouldCreateCycle:N,setMembers:h,prepareMembers:f,addMember:w,removeMember:S,clear:y,getNodeDepth:I,getGroupDepth:U,isGroupId:x,isEdgeEnteringGroup:C,canAddMember:E}}function fB(n,t){const{commit:r,undo:o,redo:i,canUndo:a,canRedo:s,clear:c,reset:l,undoStack:u,redoStack:p}=Pt.useManualRefHistory(n,{capacity:t==null?void 0:t.capacity,clone:t==null?void 0:t.clone});let d;function f(C){var N;(N=t==null?void 0:t.onHistoryChange)==null||N.call(t,C,n.value)}function m(C){if(!C){d=void 0,r(),f("commit");return}if(C!=="*"&&d!==C){d=C,r(),f("commit");return}r(),u.value.shift(),f("commit")}function h(){o(),d=void 0,f("undo")}function y(){i(),d=void 0,f("redo")}function b(){c(),d=void 0,f("clear")}function _(){l(),d=void 0,f("reset")}function k(){o(),p.value.shift(),d=void 0,f("revert")}return{canUndo:a,canRedo:s,commit:m,undo:h,redo:y,clear:b,reset:_,revert:k}}function pB(n){var t,r;return((r=(t=n.config)==null?void 0:t.resources)==null?void 0:r.vault)||{}}function mB(n){const{resources:t}=n.config||{};return t!=null&&t.vault?Object.keys(t.vault):[]}function gB(n){const t=Object.entries(n);if(t.length===0)return;const r={};for(const[o,i]of t)r[o]=i;return r}function Qy(n,t){var b,_,k,C,N,E,w;const r=((b=n.config)==null?void 0:b.nodes)??[],o=((_=n.__ui_data)==null?void 0:_.nodes)??[],i=((k=n.__ui_data)==null?void 0:k.groups)??[],a=new Map(o.map(S=>[S.name,S])),s=new Map(i.map(S=>[S.name,S])),c=[],l=[],u=new Map,p=[],d=[],f=new Map,m=S=>{const I=new Set,U=[...S];for(;U.length>0;){const x=U.shift();if(!I.has(x)&&(I.add(x),tf(x)||(u.get(x).phase="request"),!!f.has(x)))for(const A of f.get(x))I.has(A)||U.push(A)}};let h=!1;for(const S of r){const I=a.get(S.name);!I&&!h&&(h=!0);const U=t_({type:S.type,configNode:S,uiNode:I,pluginData:n});c.push(U),u.set(U.name,U)}for(const S of c){const I=$a(S.type);if(!I.length)continue;const U=S.config;if(U)for(const x of I){const A=U[x];if(!Array.isArray(A)){s.has(Bl(S.name,x))&&(h=!0);continue}const T=[];for(const V of A){if(typeof V!="string")continue;const R=u.get(V);R&&!mn(R.type)&&T.push(R.id)}if(T.length){U[x]=T;const V=Bl(S.name,x),R=s.get(V),X=R?{position:Tr(R.position)}:void 0,Y=Wy(S.id,x,S.phase,T,X);p.push(Y),!R&&!h&&(h=!0)}else delete U[x],s.has(Bl(S.name,x))&&(h=!0)}}for(const S of ii)if(!u.has(S)){let I=a.get(S);I||(h||(h=!0),I=RI(S));const U=t_({type:S,uiNode:I,pluginData:n});c.push(U),u.set(U.name,U)}for(const S of r)_B(S,d);for(const S of d){const I=u.get(S.source),U=u.get(S.target);if(!I||!U){I||console.warn(`[initEditorState] skip: source "${S.source}" not found`),U||console.warn(`[initEditorState] skip: target "${S.target}" not found`);continue}f.has(S.source)||f.set(S.source,new Set),f.get(S.source).add(S.target),f.has(S.target)||f.set(S.target,new Set),f.get(S.target).add(S.source),l.push({id:li("edge"),source:I.id,sourceField:(C=Zr(I,"output",S.sourceField))==null?void 0:C.id,target:U.id,targetField:(N=Zr(U,"input",S.targetField))==null?void 0:N.id})}m(["request","service_request"]);let y=null;return(w=(E=n.config)==null?void 0:E.resources)!=null&&w.cache&&(y={...n.config.resources.cache},n.partials&&(y.partial_id=n.partials[0].id)),{nodes:c,edges:l,groups:p,pendingLayout:h?t?"keepHistory":"clearHistory":!1,pendingFitView:!0,...y?{cacheConfig:y}:{}}}function e_(n){const{type:t,name:r,phase:o,position:i,fields:a,config:s}=n,c=qy(t),l=ci(t);return{id:li("node"),type:t,name:r??t,phase:o??"request",position:i??{x:0,y:0},expanded:{},fields:{input:Gy((a==null?void 0:a.input)??c.input),output:Gy((a==null?void 0:a.output)??c.output)},hidden:n.hidden||l.hidden,config:s?Tr(s):{}}}function hB(n){return mn(n)?n==="request"||n==="service_request"?"request":"response":"request"}function t_({type:n,configNode:t,uiNode:r,pluginData:o}){return e_({type:n,name:t==null?void 0:t.name,phase:(r==null?void 0:r.phase)??hB(n),position:r==null?void 0:r.position,fields:bB({type:n,uiNode:r,configNode:t,pluginData:o}),hidden:r==null?void 0:r.hidden,config:wB({type:n,configNode:t,pluginData:o})})}function yB(n){const{type:t,name:r,input:o,inputs:i,output:a,outputs:s,...c}=n;return Tr(c)}function _B(n,t){const r=n.name;if(n.input){const{nodeName:o,fieldName:i}=Il(n.input);o&&t.push({source:o,sourceField:i,target:r})}if(n.inputs)for(const[o,i]of Object.entries(n.inputs)){if(!i)continue;const{nodeName:a,fieldName:s}=Il(i);a&&t.push({source:a,sourceField:s,target:r,targetField:o})}if(n.output){const{nodeName:o,fieldName:i}=Il(n.output);o&&t.push({source:r,target:o,targetField:i})}if(n.outputs)for(const[o,i]of Object.entries(n.outputs)){if(!i)continue;const{nodeName:a,fieldName:s}=Il(i);a&&t.push({source:r,sourceField:o,target:a,targetField:s})}}function bB({type:n,uiNode:t,configNode:r,pluginData:o}){var c,l,u,p;const i=ci(n),a=i==null?void 0:i.io;if(!a)return;const s={};if((c=a.input)!=null&&c.configurable&&(t?s.input=((l=t.fields)==null?void 0:l.input)??[]:r!=null&&r.inputs&&(s.input=Object.keys(r.inputs))),(u=a.output)!=null&&u.configurable){if(t)s.output=((p=t.fields)==null?void 0:p.output)??[];else{const d=new Set;r!=null&&r.outputs&&Object.keys(r.outputs).forEach(f=>d.add(f)),(r==null?void 0:r.type)==="static"&&r.values&&Object.keys(r.values).forEach(f=>d.add(f)),d.size&&(s.output=Array.from(d))}n==="vault"&&(s.output=mB(o))}return Object.keys(s).length?s:void 0}function wB({type:n,configNode:t,pluginData:r}){return n==="vault"?pB(r):t?yB(t):void 0}function kB(n){const t=e.computed(()=>{const d=new Map;return n.value.nodes.forEach(f=>d.set(f.id,f)),d}),r=e.computed(()=>n.value.edges),o=e.computed(()=>n.value.groups),i=e.computed(()=>Zy(r.value,o.value));function a(d){return Pl(i.value,d?{source:d.source,target:d.target}:void 0)}function s(d){const f=t.value.get(d.source),m=t.value.get(d.target);if(!f||!m)return d;const h=Hy(f,d.sourceField)&&!of(f,d.sourceField),y=of(m,d.targetField);return h&&y?{source:d.target,sourceField:d.targetField,target:d.source,targetField:d.sourceField}:d}function c(d){const f=s(d),m=[],h=t.value.get(f.source),y=t.value.get(f.target);if(h||m.push("source node not found"),y||m.push("target node not found"),!h||!y)return{ok:!1,errors:m};of(h,f.sourceField)||m.push("source handle is not an output field"),Hy(y,f.targetField)||m.push("target handle is not an input field"),y.name==="request"&&m.push('cannot target "request"'),h.name==="response"&&m.push('cannot source from "response"');const b=r.value.some(C=>C.target===f.target&&!C.targetField),_=r.value.some(C=>C.target===f.target&&!!C.targetField);(b&&f.targetField||_&&!f.targetField)&&m.push("cannot mix whole-node and field-level inputs on same target"),f.targetField&&r.value.some(C=>C.target===f.target&&C.targetField===f.targetField)&&m.push("target field already connected"),!f.targetField&&r.value.some(C=>C.target===f.target&&!C.targetField)&&m.push("target input already taken"),f.source===f.target&&m.push("self-loop not allowed");const k=a({source:f.source,target:f.target});return lf(k)&&m.push("connection introduces a cycle"),m.length?{ok:!1,errors:m}:{ok:!0}}function l(){const d=[];for(const f of ii)[...t.value.values()].some(m=>m.name===f)||d.push(`missing implicit node "${f}"`);for(const f of r.value){const m=t.value.get(f.source);t.value.get(f.target).name==="request"&&d.push(`edge "${f.id}" targets "request"`),m.name==="response"&&d.push(`edge "${f.id}" sources from "response"`)}return lf(a())&&d.push("graph contains cycle"),d.length?{ok:!1,errors:d}:{ok:!0}}function u(d){return c(d).ok}function p(d){return!d.source||!d.target?!1:u({source:d.source,sourceField:d.sourceHandle,target:d.target,targetField:d.targetHandle})}return{canonicalizeConnection:s,validateConnection:c,validateGraph:l,isValidConnection:u,isValidVueFlowConnection:p,buildAdjacency:Pl}}const[uf,CB]=Pt.createInjectionState(function(t,r={}){const o=e.ref(Qy(t)),i=e.ref(),a=e.ref(),s=e.ref(!1),c=e.ref(!1),l=fB(o,{capacity:200,clone:Tr,onHistoryChange:Q=>{var le,de;Q!=="clear"&&((de=r.onChange)==null||de.call(r,nt(),se(),Re(),(le=o.value.cacheConfig)==null?void 0:le.partial_id))}}),u=e.ref(!1),p=e.ref(new Set);function d(){o.value.pendingLayout=!1,l.commit("*")}function f(Q=!0){o.value.pendingFitView!==Q&&(o.value.pendingFitView=Q,l.commit("*"))}const m=e.computed(()=>{const Q={request:0,response:0};return o.value.nodes.forEach(le=>{mn(le.type)||Q[le.phase]++}),Q}),h=e.computed(()=>new Map(o.value.nodes.map(Q=>[Q.id,Q]))),y=e.computed(()=>new Map(o.value.nodes.map(Q=>[Q.name,Q]))),b=e.computed(()=>{const Q=new Map,le=new Map;for(const de of o.value.edges)Q.set(de.id,de),le.has(de.source)||le.set(de.source,new Set),le.get(de.source).add(de.id),le.has(de.target)||le.set(de.target,new Set),le.get(de.target).add(de.id);return{edgeMapById:Q,edgeIdMapByNodeId:le}}),_=e.computed(()=>b.value.edgeMapById),k=e.computed(()=>b.value.edgeIdMapByNodeId),C=e.computed(()=>new Map(o.value.groups.map(Q=>[Q.id,Q]))),N=e.computed(()=>new Set(o.value.nodes.map(Q=>Q.name))),E=dB({state:o,groupMapById:C,getNodeById:A,history:l}),{canonicalizeConnection:w,validateConnection:S,validateGraph:I,isValidConnection:U,isValidVueFlowConnection:x}=kB(o);function A(Q){return h.value.get(Q)}function T(Q){return y.value.get(Q)}function V(Q){return _.value.get(Q)}function R(Q){if(!k.value.has(Q))return[];const le=[];return k.value.get(Q).forEach(de=>{const _e=V(de);_e&&le.push(_e)}),le}function X(Q){return R(Q).filter(le=>le.target===Q)}function Y(Q){return R(Q).filter(le=>le.source===Q)}const ne=e.computed(()=>i.value?A(i.value):void 0);function M(Q){i.value=Q}function te(Q){a.value=Q}function $(Q){if(mn(Q.type))throw new Error("[createNode] implicit nodes are fixed.");return e_({type:Q.type,name:Q.name||(mn(Q.type)?void 0:zy(Q.type,N.value)),phase:Q.phase,position:Q.position,fields:Q.fields,config:Q.config})}function Z(Q,le=!0){const de=$(Q);if(de)return o.value.nodes.push(de),le&&l.commit(),u.value=!0,de.id}function F(Q,le,de=!0){const _e=A(Q);if(!_e||mn(_e.type))return;const xe={...Tr(_e),id:li("node"),name:zy(_e.name,N.value),position:le??{x:_e.position.x+20,y:_e.position.y+20}},Ne=$a(xe.type);if(Ne.length&&xe.config){for(const g of Ne)delete xe.config[g];Object.keys(xe.config).length===0&&delete xe.config}return o.value.nodes.push(xe),de&&l.commit(),u.value=!0,xe.id}function J(Q,le=!0){if(!A(Q))return;o.value.edges=o.value.edges.filter(xe=>xe.source!==Q&&xe.target!==Q),E.clear(Q,{commit:!1}),E.removeMember(Q,{commit:!1}),o.value.nodes=o.value.nodes.filter(xe=>xe.id!==Q),i.value===Q&&(i.value=void 0);const _e=I();_e.ok||console.warn("[removeNode] topology invalid:",_e.errors.join("; ")),le&&l.commit()}function G(Q,le,de=!0,_e){const xe=A(Q);if(!xe)return;if(tf(xe.name)){console.warn("[renameNode] implicit node name is reserved.");return}xe.name!==le&&(xe.name=le,de&&l.commit(_e))}function v(Q,le,de=!0){const _e=A(Q);_e&&(_e.position={...le},de&&l.commit())}function q(Q,le,de=!0){const _e=C.value.get(Q);if(!_e)return;const xe=_e.position;xe&&xe.x===le.x&&xe.y===le.y||(_e.position={...le},de&&l.commit())}function ie(Q,le,de=!0){const _e=C.value.get(Q);if(!_e)return!1;const xe={...le.position},Ne={...le.dimensions},g=_e.position&&_e.position.x===xe.x&&_e.position.y===xe.y,O=_e.dimensions&&_e.dimensions.width===Ne.width&&_e.dimensions.height===Ne.height;return g&&O?!1:(_e.position=xe,_e.dimensions=Ne,de&&l.commit(),!0)}function oe(Q,le,de,_e=!0,xe){const Ne=A(Q);if(!Ne)return;const g=de??!Ne.expanded[le];g!==!!Ne.expanded[le]&&(Ne.expanded[le]=g,_e&&l.commit(xe??`toggle:${Q}:${le}`))}function ke(Q,le,de=!0,_e){const xe=A(Q);xe&&(xe.config=Tr(le),de&&l.commit(_e))}function ye(Q,le,de,_e=!0){const xe=A(Q);if(!xe)return;const Ne=xe.fields[le];if(Ne.some(g=>g.name===de)){console.warn(`[addField] field "${de}" already exists on ${le}.`);return}Ne.push({id:li("field"),name:de}),le==="input"?xe.fields.input=Ne:xe.fields.output=Ne,_e&&l.commit()}function ce(Q,le,de,_e=!0){const xe=A(Q);if(!xe)return;const Ne=xe.fields.input,g=xe.fields.output,O=Ne.find(j=>j.id===le)??g.find(j=>j.id===le);O&&(O.name=de,_e&&l.commit())}function he(Q,le,de=!0,_e=!0){const xe=A(Q);if(!xe)return;const Ne=xe.fields.input,g=xe.fields.output,O=Ne.findIndex(ae=>ae.id===le);O>=0&&Ne.splice(O,1);const j=g.findIndex(ae=>ae.id===le);j>=0&&g.splice(j,1),xe.fields.input=Ne,xe.fields.output=g,de&&(o.value.edges=o.value.edges.filter(ae=>ae.sourceField!==le&&ae.targetField!==le));const W=I();W.ok||console.warn("[removeField] topology invalid:",W.errors.join("; ")),_e&&l.commit()}function Oe(Q,le=!0){const de=w(Q),_e=S(de);if(!_e.ok){console.warn("[connectEdge] invalid connection:",_e.errors.join("; "));return}const xe={id:li("edge"),...de};o.value.edges.push(xe);const Ne=I();if(!Ne.ok){o.value.edges.pop(),console.warn("[connectEdge] topology invalid:",Ne.errors.join("; "));return}return le&&l.commit(),xe.id}function De(Q,le,de=!0){Be(Q,!1),Oe(le,!1),de&&l.commit()}function Be(Q,le=!0){const de=o.value.edges.findIndex(Ne=>Ne.id===Q);if(de<0)return;const _e=o.value.edges[de];o.value.edges.splice(de,1);const xe=I();if(!xe.ok){o.value.edges.splice(de,0,_e),console.warn("[disconnectEdge] topology invalid:",xe.errors.join("; "));return}le&&l.commit()}function Ge(Q,le=!0){const de=X(Q);for(const _e of de)Be(_e.id,!1);le&&l.commit()}function We(Q,le=!0){const de=Y(Q);for(const _e of de)Be(_e.id,!1);le&&l.commit()}function nt(){var le,de,_e,xe,Ne;const Q=[];for(const g of o.value.nodes){if(mn(g.type))continue;let O;const j={};let W;const ae={};for(const ue of o.value.edges.filter(P=>P.target===g.id)){const P=A(ue.source);if(!P)continue;const z=(le=Qr(P,"output",ue.sourceField))==null?void 0:le.name,D=z?`${P.name}.${z}`:P.name,pe=(de=Qr(g,"input",ue.targetField))==null?void 0:de.name;pe?j[pe]=D:O===void 0&&(O=D)}for(const ue of o.value.edges.filter(P=>P.source===g.id)){const P=A(ue.target);if(!P)continue;const z=P.type;if(!mn(z)||!((_e=Al[z].io)!=null&&_e.input))continue;const D=(xe=Qr(P,"input",ue.targetField))==null?void 0:xe.name,pe=D?`${P.name}.${D}`:P.name,we=(Ne=Qr(g,"output",ue.sourceField))==null?void 0:Ne.name;we?ae[we]=pe:W===void 0&&(W=pe)}const be={...Tr(g.config),name:g.name,type:g.type},L=$a(g.type);if(L.length)for(const ue of L){const P=be[ue];if(!Array.isArray(P))continue;const z=[];for(const D of P){const pe=A(D);pe&&z.push(pe.name)}z.length?be[ue]=Array.from(new Set(z)):delete be[ue]}Object.keys(j).length>0?be.inputs=j:O!==void 0&&(be.input=O),Object.keys(ae).length>0?be.outputs=ae:W!==void 0&&(be.output=W),Q.push(be)}return Q}function lt(){return o.value.nodes.map(Q=>Tr({name:Q.name,phase:Q.phase,position:{...Q.position},expanded:{...Q.expanded},fields:{input:Q.fields.input.map(le=>le.name),output:Q.fields.output.map(le=>le.name)}}))}function Re(){const Q={},le=T("vault");if(le){const de=gB(le.config);de&&Object.keys(de).length>0&&(Q.vault=de)}if(o.value.cacheConfig){const{strategy:de,redis:_e,memory:xe}=o.value.cacheConfig;Q.cache={strategy:de,redis:_e,memory:xe}}if(Object.keys(Q).length!==0)return Q}function Ce(){const Q=[];for(const le of o.value.groups){const de=A(le.ownerId);if(!de)continue;const _e=le.position;_e&&Q.push({name:Bl(de.name,le.branch),position:{..._e}})}return Q}function se(){return{nodes:lt(),groups:Ce()}}function re(Q,le){le&&l.commit(),o.value=Qy(Q,le),le||l.clear()}return{state:o,selection:i,portalSelection:a,modalOpen:s,skipValidation:u,invalidConfigNodeIds:p,propertiesPanelOpen:c,configNodeCounts:m,nodeMapById:h,nodeMapByName:y,edgeMapById:_,edgeIdMapByNodeId:k,groupMapById:C,getNodeById:A,getNodeByName:T,getEdgeById:V,getEdgesByNodeId:R,getInEdgesByNodeId:X,getOutEdgesByNodeId:Y,selectedNode:ne,selectNode:M,selectPortalEdge:te,createNode:$,addNode:Z,duplicateNode:F,removeNode:J,renameNode:G,moveNode:v,moveGroup:q,setGroupLayout:ie,toggleExpanded:oe,replaceConfig:ke,branchGroups:E,addField:ye,renameField:ce,removeField:he,connectEdge:Oe,replaceConnection:De,disconnectEdge:Be,disconnectInEdges:Ge,disconnectOutEdges:We,toConfigNodes:nt,toUINodes:lt,toUIGroups:Ce,toUIData:se,load:re,commit:l.commit,undo:l.undo,redo:l.redo,canUndo:l.canUndo,canRedo:l.canRedo,clear:l.clear,reset:l.reset,revert:l.revert,isValidConnection:U,isValidVueFlowConnection:x,validateGraph:()=>I(),clearPendingLayout:d,setPendingFitView:f}});function $t(){const n=CB();if(!n)throw new Error("Editor state is not provided. Ensure you are using provideEditorStore in a parent component.");return n}function EB(n){const{branchLayout:t,phase:r,layoutOptions:o,nodes:i,edges:a}=n,{findNode:s}=xt.useVueFlow(),{state:c,branchGroups:l,getNodeById:u,moveNode:p,commit:d}=$t(),{getNodeDepth:f,isGroupId:m,groupsByOwner:h}=l,{isBranchEdgeId:y,updateGroupLayout:b,translateGroupTree:_,waitForLayoutFlush:k}=t,{viewport:C,padding:N=Jr.padding,gaps:E=Jr.gaps}=o,{nodes:w=Jr.gaps.nodes,edges:S=Jr.gaps.edges,ranks:I=Jr.gaps.ranks}=E;async function U(T=!0){const V=new Map(i.value.map(v=>[v.id,v.data])),R=new Map,X=new Map,Y=v=>{if(!v)return;let q=X.get(v);return q||(q=s(v),q&&X.set(v,q),q)},ne=new Map,M=v=>{let q=ne.get(v);return q!==void 0||(q=f(v),ne.set(v,q)),q},te=v=>{if(!Va(v.data))return v.parentNode;const q=Y(v.data.ownerId);if(!q)throw new Error(`Cannot find owner node '${v.data.ownerId}' for group node '${v.id}' via findNode`);return q.parentNode};for(const v of a.value){if(y(v.id))continue;const q=v.source,ie=v.target;if(m(q)||m(ie))continue;const oe=Y(q),ke=Y(ie);if(oe){if(!ke)throw new Error(`Cannot find target node '${ie}' for edge '${v.id}' via findNode`)}else throw new Error(`Cannot find source node '${q}' for edge '${v.id}' via findNode`);if(te(oe)===te(ke))continue;let ye=oe,ce=ke,he=M(ye.id),Oe=M(ce.id);for(;he!==Oe;)if(he>Oe){const De=te(ye);if(!De)throw new Error(`Expected node '${ye.id}' to have parent, but it does not`);const Be=Y(De);if(!Be)throw new Error(`Cannot find parent node '${De}' for node '${ye.id}' via findNode`);ye=Be,he--}else if(Oe>he){const De=te(ce);if(!De)throw new Error(`Expected node '${ce.id}' to have parent, but it does not`);const Be=Y(De);if(!Be)throw new Error(`Cannot find parent node '${De}' for node '${ce.id}' via findNode`);ce=Be,Oe--}for(;he>=0;){const De=te(ye),Be=te(ce);if(De===Be){R.has(he)||R.set(he,[]),R.get(he).push({v:ye.id,w:ce.id});break}if(De){if(!Be){const nt=`Expected node '${ce.id}' to have parent, but it does not`;throw console.error(nt,ce),new Error(nt)}}else{const nt=`Expected node '${ye.id}' to have parent, but it does not`;throw console.error(nt,ye),new Error(nt)}const Ge=Y(De),We=Y(Be);if(Ge){if(!We)throw new Error(`Cannot find parent node '${Be}' for node '${ce.id}' via findNode`)}else throw new Error(`Cannot find parent node '${De}' for node '${ye.id}' via findNode`);ye=Ge,ce=We,he--,Oe--}}const $=c.value.groups.toSorted((v,q)=>M(q.ownerId)-M(v.ownerId));for(const v of $)x(v.memberIds.reduce((q,ie)=>{const oe=u(ie);if(!oe)return console.warn(`Cannot find node '${ie}' of group '${v.id}' by getNodeById`),q;if(oe.phase!==r)return q;if(oe.type==="branch"){const ke=h.value.get(oe.id);ke&&q.push(...ke)}return V.delete(oe.id),q.push(oe),q},[]),{virtualEdges:R.get(M(v.ownerId)),cachedFindNode:Y}),await e.nextTick(),b(v.id,!1),await k();const Z=V.values().toArray();for(const v of Z){if(Va(v)||v.type!=="branch")continue;const q=h.value.get(v.id);q&&Z.push(...q)}const{autoNodes:F,leftNode:J,rightNode:G}=A(Z);x(F,{leftNode:J,rightNode:G,virtualEdges:R.get(0),cachedFindNode:Y}),T&&d()}function x(T,V){var ye,ce,he,Oe,De;const{leftNode:R,rightNode:X,virtualEdges:Y,cachedFindNode:ne}=V||{},M=R?(ne??s)(R.id):void 0,te=X?(ne??s)(X.id):void 0;let $;if(T.length>0){$=new Xy.graphlib.Graph({multigraph:!0}),$.setGraph({rankdir:r==="request"?"LR":"RL",nodesep:w,edgesep:S,ranksep:I});const Be=new Set;for(const Ge of T){const We=(ne??s)(Ge.id);if(!We){console.warn(`Cannot find graph node '${Ge.id}' in ${r} phase`);continue}Be.add(Ge.id),Va(Ge)?$.setNode(Ge.id,{...Ge.dimensions??We.dimensions}):$.setNode(Ge.id,{...We.dimensions})}for(const Ge of a.value)!Be.has(Ge.source)||!Be.has(Ge.target)||$.setEdge(Ge.source,Ge.target,{points:[]});Y==null||Y.forEach(Ge=>$.setEdge(Ge,{points:[]})),Xy.layout($)}const Z=[],F=Be=>({x:Be.x-Be.width/2,y:Be.y-Be.height/2,width:Be.width,height:Be.height});if(T.length>0){if(!$)throw new Error("Expected dagreGraph to be initialized");for(const Be of T){const Ge=$.node(Be.id),We=F(Ge);Z.push(We),Va(Be)?_(Be.id,We,We.x+Qo,We.y+Qo):p(Be.id,{x:We.x,y:We.y},!1)}}const J=Z.length>0?Yy(Z):{x:0,y:0,width:0,height:0},G=J.width,v=J.height,q=J.x,ie=J.x+J.width,oe=Math.max(0,Math.min(e.toValue(C==null?void 0:C.width)??Number.POSITIVE_INFINITY,Y1)-G-2*w-(((ye=M==null?void 0:M.dimensions)==null?void 0:ye.width)??0)-(((ce=te==null?void 0:te.dimensions)==null?void 0:ce.width)??0)-2*N),ke=J.y+v/2;R&&p(R.id,{x:q-w-oe/2-(((he=M==null?void 0:M.dimensions)==null?void 0:he.width)??0),y:ke-(((Oe=M==null?void 0:M.dimensions)==null?void 0:Oe.height)??0)/2},!1),X&&p(X.id,{x:ie+w+oe/2,y:ke-(((De=te==null?void 0:te.dimensions)==null?void 0:De.height)??0)/2},!1)}function A(T){let V,R;const X=[];for(const Y of T){if(Va(Y)){X.push(Y);continue}switch(Y.name){case"request":{if(r!=="request")throw new Error(`Unexpected request node in ${r} phase`);if(V)throw new Error("Duplicated request node in request phase");V=Y;break}case"service_request":{if(r!=="request")throw new Error(`Unexpected service_request node in ${r} phase`);if(R)throw new Error("Duplicated service_request node in request phase");R=Y;break}case"service_response":{if(r!=="response")throw new Error(`Unexpected service_response node in ${r} phase`);if(R)throw new Error("Duplicated service_response node in response phase");R=Y;break}case"response":{if(r!=="response")throw new Error(`Unexpected response node in ${r} phase`);if(V)throw new Error("Duplicated response node in response phase");V=Y;break}default:{X.push(Y);break}}}return{autoNodes:X,leftNode:V,rightNode:R}}return{autoLayout:U}}function NB({phase:n,groupMapById:t,getNodeDepth:r,canAddMember:o,draggingId:i}){const a=e.shallowRef(),s=e.shallowRef();function c(d){a.value=d,s.value=void 0}function l(){a.value&&(a.value=void 0,s.value=void 0)}function u(d){let f;const m=i==null?void 0:i.value;return t.value.forEach(h=>{if(h.phase!==n||m&&nf(m)&&!o(h.ownerId,h.branch,m))return;const y=h.position,b=h.dimensions;if(!y||!b||!(d.x>=y.x&&d.x<=y.x+b.width&&d.y>=y.y&&d.y<=y.y+b.height))return;const k=r(h.ownerId);(!f||k>f.depth)&&(f={depth:k,id:h.id})}),f==null?void 0:f.id}function p(d){if(!a.value){s.value=void 0;return}if(!d){s.value=void 0;return}s.value=u(d)}return{activeGroupId:s,start:c,updateActiveGroup:p,end:l}}function SB({phase:n,readonly:t,flowId:r,draggingId:o}){const{findNode:i}=xt.useVueFlow(r),a=$t(),{state:s,groupMapById:c,getNodeById:l,moveNode:u,moveGroup:p,setGroupLayout:d,commit:f,branchGroups:m}=a,{memberGroupMap:h,groupsByOwner:y,getNodeDepth:b,getGroupDepth:_}=m,k=te=>!!te&&te.startsWith("branch:");function C(te){const $=[];for(const Z of te.memberIds){const F=l(Z);F&&$.push(F)}return $}const N=e.computed(()=>{const te=new Map;return h.value.forEach(($,Z)=>{if($.phase!==n||!$.position)return;const F=l(Z);F&&(F.phase!==n||F.hidden||te.set(Z,$))}),te}),E=e.computed(()=>{const te=new Map;return y.value.forEach(($,Z)=>{const F=$.filter(J=>J.phase===n);F.length>0&&te.set(Z,F)}),te}),w=e.computed(()=>{const te=[];for(const $ of s.value.groups){const Z=l($.ownerId);if(!Z||Z.phase!==n)continue;const F=$.position,J=$.dimensions;if(!F||!J)continue;const G=C($).filter(q=>q.phase===n&&!q.hidden),v=_($.id);te.push({id:$.id,type:"group",position:F,width:J.width,height:J.height,data:{...$,memberIds:G.map(q=>q.id)},draggable:!t,selectable:!1,zIndex:v*fl+G1})}return te}),S=e.computed(()=>{let te=0;for(const $ of s.value.groups){if($.phase!==n)continue;const Z=_($.id);Z>te&&(te=Z)}return te}),I=e.computed(()=>{const te=[];for(const $ of s.value.groups){if($.phase!==n||!$.position||!$.dimensions)continue;const Z=l($.ownerId);if(!Z||Z.phase!==n||Z.hidden||!C($).filter(v=>v.phase===n&&!v.hidden).length)continue;const J=Math.max(b(Z.id),_($.id))+S.value+1,G={id:`branch:${$.id}`,source:Z.id,target:$.id,sourceHandle:`branch@${$.branch}`,targetHandle:"input",markerEnd:xt.MarkerType.ArrowClosed,selectable:!1,focusable:!1,updatable:!1,data:{type:"branch",ownerId:Z.id,branch:$.branch,groupId:$.id},zIndex:J*fl+z1};te.push(G)}return te}),U=new Map,x=new Map;let A;function T(te,$=!0){if(te.phase!==n)return;const Z=C(te).filter(q=>q.phase===n&&!q.hidden);if(!Z.length)return;const F=[];for(const q of Z){const ie=i(q.id),oe=ie==null?void 0:ie.dimensions,ke=(oe==null?void 0:oe.width)??0,ye=(oe==null?void 0:oe.height)??0;if(ke<=0||ye<=0)return;F.push({...q.position,width:ke,height:ye});const ce=y.value.get(q.id)??[];for(const he of ce){if(he.phase!==n)continue;const Oe=U.get(he.id),De=(Oe==null?void 0:Oe.position)??he.position,Be=(Oe==null?void 0:Oe.dimensions)??he.dimensions;!De||!Be||F.push({x:De.x,y:De.y,width:Be.width,height:Be.height})}}const J=Yy(F),G=J.width+Qo*2,v=J.height+Qo*2;return{position:{x:Math.round(J.x-Qo),y:Math.round(J.y-Qo)},dimensions:{width:Math.round(G),height:Math.round(v)},commit:$}}function V(){if(U.size===0){A=void 0;return}const te=[];let $=!1;U.forEach((Z,F)=>{const J=d(F,Z,!1);te.push({id:F,changed:J,commit:Z.commit}),Z.commit&&J&&!$&&($=!0)}),U.clear(),A=void 0;for(const{id:Z,changed:F,commit:J}of te){if(!F)continue;const G=c.value.get(Z);if(!G)continue;const v=N.value.get(G.ownerId);v&&x.set(v.id,{commit:J})}if(x.size>0){const Z=Array.from(x);x.clear();for(const[F,{commit:J}]of Z)X(F,J)}$&&f("*")}function R(){U.size!==0&&(A||(A=e.nextTick().then(V)))}function X(te,$=!0){const Z=c.value.get(te);if(!Z)return;const F=T(Z,$);F&&(U.set(te,F),R())}function Y(te,$,Z,F){const J=c.value.get(te);if(!J)return;if(!J.position){p(te,$,!1),X(te);return}if(Z===0&&F===0){p(te,$,!1);return}p(te,$,!1);const G=[te],v=new Set([te]),q=new Set;for(;G.length;){const ie=G.shift(),oe=c.value.get(ie);if(!oe)continue;const ke=C(oe).filter(ye=>ye.phase===n&&!ye.hidden);for(const ye of ke){q.has(ye.id)||(u(ye.id,{x:ye.position.x+Z,y:ye.position.y+F},!1),q.add(ye.id));const ce=E.value.get(ye.id)??[];for(const he of ce){if(v.has(he.id))continue;const Oe=c.value.get(he.id);Oe!=null&&Oe.position&&p(he.id,{x:Oe.position.x+Z,y:Oe.position.y+F},!1),v.add(he.id),G.push(he.id)}}}}function ne(te,$){const Z=o==null?void 0:o.value;if(!Z)return!1;if(Z===te||$.some(F=>Z===F))return!0;for(const F of $){const J=E.value.get(F)??[];if(J!=null&&J.some(G=>G.id===Z))return!0}return!1}const M=new Map;return e.watch(()=>s.value.groups.filter($=>$.phase===n).map($=>{const Z=$.memberIds.map(F=>{var q,ie;const J=i(F),G=Math.round(((q=J==null?void 0:J.dimensions)==null?void 0:q.width)??0),v=Math.round(((ie=J==null?void 0:J.dimensions)==null?void 0:ie.height)??0);return`${F}:${G}x${v}`});return{id:$.id,memberIds:$.memberIds,signature:Z.join(",")}}),te=>{const $=new Set(te.map(Z=>Z.id));for(const Z of M.keys())$.has(Z)||M.delete(Z);for(const Z of te)ne(Z.id,Z.memberIds)||M.get(Z.id)===Z.signature||(M.set(Z.id,Z.signature),X(Z.id))},{deep:!0,flush:"post"}),{groupsByOwner:E,memberGroupMap:N,groupNodes:w,branchEdges:I,isBranchEdgeId:k,updateGroupLayout:X,translateGroupTree:Y,getNodeDepth:b,maxGroupDepth:S,waitForLayoutFlush:()=>A??Promise.resolve()}}function xB(n){e.provide(nh,n)}function n_(){return e.inject(nh,void 0)}function r_(){const n=n_();if(!n)throw new Error("Confirm modal not provided");return n}function AB(n){const{readonly:t,flowId:r}=n,o=xt.useVueFlow(r),{onNodesChange:i,onEdgesChange:a,onPaneClick:s,findEdge:c}=o,{disconnectEdge:l,commit:u,portalSelection:p,selectPortalEdge:d}=$t();i(f=>{f.some(m=>m.type==="select"&&"selected"in m&&m.selected)&&d(void 0)}),a(f=>{const m=f.some(y=>y.type==="select"&&"selected"in y&&y.selected),h=p.value?f.some(y=>y.type==="remove"&&y.id===p.value):!1;(m||h)&&d(void 0)}),s(()=>d(void 0)),Pt.useEventListener("keydown",f=>{if(t||f.key!=="Delete"&&f.key!=="Backspace")return;const m=p.value;!m||c(m)||(f.preventDefault(),l(m,!1),d(void 0),u())})}function o_(n){const t=n.match(/^(input|output)(?:s@(.*))?$/);if(t)return{io:t[1],field:t[2]}}const vB={default:T1,hover:P1,selected:O1};let i_,df;function Vl(n){const t=n.id===i_?"selected":n.id===df?"hover":"default",r=vB[t],{markerEnd:o}=n,i=typeof o=="object"?{...o,color:r}:{type:o,color:r},a=n.zIndex??0,s=t==="selected"?a+2:t==="hover"?a+1:a;return{...n,style:{...n.style,stroke:r,strokeWidth:t==="selected"?1.5:void 0},markerEnd:i,zIndex:s}}const[IB,BB]=Pt.createInjectionState(function(n){const{phase:t,flowId:r,layoutOptions:o,readonly:i}=n,{viewport:a,padding:s=Jr.padding,gaps:c=Jr.gaps}=o,{nodes:l=Jr.gaps.nodes}=c,u=xt.useVueFlow(r),p=$t(),d=n_(),f=Jd(),{i18n:{t:m}}=Qe(),{findNode:h,fitView:y,deleteKeyCode:b,onNodeDrag:_,onNodeDragStop:k,onConnect:C,onNodesChange:N,onEdgesChange:E,onEdgeUpdate:w,onEdgeMouseEnter:S,onEdgeMouseLeave:I,getNodes:U,setNodes:x,setEdges:A,addSelectedNodes:T,screenToFlowCoordinate:V}=u;b.value=["Delete","Backspace"];const{state:R,commit:X,moveNode:Y,selectNode:ne,removeNode:M,getNodeById:te,connectEdge:$,disconnectEdge:Z,getInEdgesByNodeId:F,branchGroups:J,commit:G,reset:v,groupMapById:q}=p,{isGroupId:ie,canAddMember:oe}=J,ke=e.shallowRef(),ye=P=>{ke.value=P},ce=e.readonly(ke);function he(P,z){const D=te(P.source),pe=te(P.target);return!!(D&&pe&&D.phase===z&&pe.phase===z)}const Oe=SB({phase:t,readonly:i,flowId:r,draggingId:ce}),{memberGroupMap:De,groupNodes:Be,branchEdges:Ge,isBranchEdgeId:We,updateGroupLayout:nt,translateGroupTree:lt,getNodeDepth:Re,maxGroupDepth:Ce}=Oe,{activeGroupId:se,start:re,updateActiveGroup:Q,end:le}=NB({phase:t,groupMapById:q,getNodeDepth:Re,canAddMember:oe,draggingId:ce}),de=e.computed(()=>R.value.nodes.filter(P=>P.phase===t&&!P.hidden).map(P=>{const z=De.value.get(P.id),D=z==null?void 0:z.position,pe=z==null?void 0:z.dimensions,we=z&&D&&pe?{x:P.position.x-D.x,y:P.position.y-D.y}:P.position,Se=Re(P.id),Ve=!!(z&&D&&pe),Me=(Ve?Se:0)+Ce.value+1;return{id:P.id,type:"flow",position:we,data:P,deletable:!i&&!vl(P),parentNode:Ve?z.id:void 0,zIndex:Me*fl+W1}})),_e=e.computed(()=>R.value.edges.filter(P=>he(P,t)).filter(P=>!J.isEdgeEnteringGroup(P.source,P.target)).filter(P=>{const z=te(P.source),D=te(P.target);return!(z!=null&&z.hidden)&&!(D!=null&&D.hidden)}).map(P=>{const z=te(P.source),D=te(P.target);if(!z||!D){const we=[];throw z||we.push(`source node "${P.source}"`),D||we.push(`target node "${P.target}"`),new Error(`Missing ${we.join(" and ")} for edge "${P.id}" in phase "${t}"`)}const pe=Math.max(Re(P.source),Re(P.target))+Ce.value+1;return Vl({id:P.id,source:P.source,target:P.target,sourceHandle:P.sourceField?`outputs@${P.sourceField}`:"output",targetHandle:P.targetField?`inputs@${P.targetField}`:"input",markerEnd:xt.MarkerType.ArrowClosed,data:P,updatable:!i,zIndex:pe*fl+H1})})),xe=e.computed(()=>[...Ge.value,..._e.value]),{autoLayout:Ne}=EB({phase:t,layoutOptions:o,branchLayout:Oe,nodes:de,edges:xe});AB({readonly:i,flowId:r}),e.watch([de,Be,xe],([P,z,D])=>{x([...z,...P]),A(D)},{immediate:!0});const g=e.computed(()=>({padding:s/Math.max(e.toValue(a==null?void 0:a.width)??0,e.toValue(a==null?void 0:a.height)??0)}));async function O({source:P,sourceHandle:z,target:D,targetHandle:pe}){if(!z||!pe)return;const we=o_(z),Se=o_(pe);if((we==null?void 0:we.io)==="input"||(Se==null?void 0:Se.io)==="output"||z==="output"&&pe==="output")return;const Ve=F(D);let Me=!1,Ze=!1;const Ye=[],Te=[],Ae=(Se==null?void 0:Se.io)==="input"?Ve.filter(vt=>!vt.targetField):Ve.filter(vt=>!!vt.targetField);Ae.length>0&&(Me=!0,Ae.forEach(vt=>{Te.push(Ra(vt,te)),Z(vt.id,!1)}));const bt=(Se==null?void 0:Se.io)==="input"?Se!=null&&Se.field?Ve.filter(vt=>vt.targetField===Se.field):Ve.filter(vt=>!!vt.targetField):Ve.filter(vt=>!vt.targetField);if(bt.length>0){if(bt.some(en=>en.source===P&&en.target===D&&en.targetField===(Se==null?void 0:Se.field)&&en.sourceField===(we==null?void 0:we.field)))return;Ze=!0,bt.forEach(en=>{Te.push(Ra(en,te)),Z(en.id,!1)})}if(!$({source:P,sourceField:we==null?void 0:we.field,target:D,targetField:Se==null?void 0:Se.field},!1)){v(),f({message:m("plugins.free-form.datakit.flow_editor.error.invalid_connection"),appearance:"danger"});return}if(Ye.push(sf(P,we==null?void 0:we.field,D,Se==null?void 0:Se.field,te)),Me||Ze){if(!d)throw v(),new Error("Expected confirm modal to be provided here when reachable");if(!await d(m(Me?"plugins.free-form.datakit.flow_editor.confirm.message.switch":"plugins.free-form.datakit.flow_editor.confirm.message.override"),Ye,Te)){v();return}}G()}C(O);let j=!1;const W=()=>{j&&(j=!1,G())};N(P=>{P.filter(pe=>pe.type==="select").filter(pe=>!ie(pe.id)).sort((pe,we)=>pe.selected===we.selected?0:pe.selected?1:-1).forEach(pe=>{ne(pe.selected?pe.id:void 0)});let D=!1;P.forEach(pe=>{if(pe.type==="remove"){if(ie(pe.id))return;D=!0,M(pe.id,!1)}}),D&&!j&&(j=!0,queueMicrotask(W))}),_(({node:P,event:z})=>{var Ve,Me,Ze;if(!P)return;if(ie(P.id)){const Ye=P.id;ye(Ye),Q(void 0);const Te=q.value.get(Ye);if(!Te)return;const Ae=Te.position??{...P.position},bt=P.position.x-Ae.x,lr=P.position.y-Ae.y;lt(Ye,P.position,bt,lr);const vt=De.value.get(Te.ownerId);vt&&nt(vt.id,!1);return}const D=P.id;re("canvas"),ye(D);const pe=P.parentNode;let we={...P.position};if(pe&&ie(pe)){const Ye=q.value.get(pe);Ye!=null&&Ye.position&&(we={x:Ye.position.x+P.position.x,y:Ye.position.y+P.position.y})}if(Y(D,we,!1),!vl(te(D))){const Ye={x:we.x,y:we.y,width:((Ve=P.dimensions)==null?void 0:Ve.width)??0,height:((Me=P.dimensions)==null?void 0:Me.height)??0},Te=z&&"clientX"in z?V({x:z.clientX,y:z.clientY}):void 0,Ae={x:Ye.x+Ye.width/2,y:Ye.y+Ye.height/2};Q(Te??Ae)}const Se=pe&&ie(pe)?pe:(Ze=De.value.get(D))==null?void 0:Ze.id;Se&&nt(Se,!1)}),k(({node:P})=>{var Se;if(!P)return;if(ye(void 0),ie(P.id)){X();return}const z=P.id,D=P.parentNode;let pe={...P.position};if(D&&ie(D)){const Ve=q.value.get(D);Ve!=null&&Ve.position&&(pe={x:Ve.position.x+P.position.x,y:Ve.position.y+P.position.y})}Y(z,pe,!1);const we=D&&ie(D)?D:(Se=De.value.get(z))==null?void 0:Se.id;we&&nt(we,!1),Ee(z),le(),X()}),E(P=>{P.filter(pe=>pe.type==="select").sort((pe,we)=>pe.selected===we.selected?0:pe.selected?1:-1).forEach(pe=>{We(pe.id)||(i_=pe.selected?pe.id:void 0,A(we=>we.map(Se=>Se.id!==pe.id||!Se.markerEnd?Se:Vl({...Se,zIndex:pe.selected?1:void 0}))))});let D=!1;P.forEach(pe=>{if(pe.type==="remove"){if(We(pe.id))return;D=!0,Z(pe.id,!1)}}),D&&!j&&(j=!0,queueMicrotask(W))}),S(({edge:P})=>{We(P.id)||(df=P.id,A(z=>z.map(D=>D.id!==P.id?D:Vl(D))))}),I(({edge:P})=>{We(P.id)||(df=void 0,A(z=>z.map(D=>D.id!==P.id?D:Vl(D))))}),w(({edge:P,connection:z})=>{We(P.id)||(Z(P.id,!1),O(z))});function ae(P){y({...g.value,...P})}async function be(P){return ne(P),new Promise(z=>setTimeout(()=>{const D=h(P);T(D?[D]:[]),z()},0))}function L(P){const z=U.value.filter(({type:Ae})=>Ae!=="group"),D=z.find(({id:Ae})=>Ae===P);if(!D)throw new Error(`Node ${P} not found`);const{x:pe,y:we}=D.data.position,{width:Se,height:Ve}=D.dimensions,Me=we,Ze=we+Ve,Ye=z.filter(({id:Ae})=>Ae!==P).filter(({data:{position:{y:Ae}},dimensions:{height:bt}})=>Ae<Ze&&Ae+bt>Me).map(({data:{position:{x:Ae}},dimensions:{width:bt}})=>({left:Ae,right:Ae+bt})).sort((Ae,bt)=>Ae.left-bt.left);let Te=pe+Se+l;for(const{left:Ae,right:bt}of Ye)if(!(bt<=Te)){if(Te+Se<=Ae)return{x:Te,y:Me};Te=Math.max(Te,bt)+l}return{x:Te,y:Me}}function ge(P){if(!P)return;const z=h(P);if(!z)throw new Error(`Node ${P} not found`);const{position:{x:D},dimensions:{width:pe}}=z,we=D+pe,{viewport:Se,dimensions:Ve,setViewport:Me}=u,{x:Ze,y:Ye,zoom:Te}=Se.value,{width:Ae}=Ve.value,bt=D*Te+Ze,lr=we*Te+Ze,vt=Ae-th-l;if(lr<=vt)return;let en=vt-lr;bt+en<0&&(en=-bt),en!==0&&Me({x:Ze+en,y:Ye,zoom:Te},{duration:Z1})}function Ee(P){if(!se.value)return!1;const{nodeId:z,branch:D}=LI(se.value),pe=J.addMember(z,D,P,{commit:!1});return Q(void 0),pe}return{vueFlowStore:u,editorStore:p,readonly:i,nodes:de,edges:xe,selectNode:be,autoLayout:Ne,placeToRight:L,scrollRightToReveal:ge,fitViewParams:g,fitView:ae,groupDrop:{activeGroupId:se,startPanelDrag:()=>re("panel"),endPanelDrag:le,updateActiveGroup:Q,attachNodeToActiveGroup:Ee}}});let ui=null;function TB(){var t;if(ui)return ui;if(typeof navigator>"u")return ui="windows";const n=((t=navigator.userAgentData)==null?void 0:t.platform)||navigator.platform||navigator.userAgent;return/Mac|iPhone|iPad|iPod/i.test(n)?ui="mac":/Linux/i.test(n)&&!/Android/i.test(n)?ui="linux":ui="windows"}const OB={Shift:"⇧",Alt:"⌥",Ctrl:"⌃",Meta:"⌘",Mod:"⌘",Enter:"↩",ArrowUp:"↑",ArrowDown:"↓",ArrowLeft:"←",ArrowRight:"→",Tab:"⇥",Esc:"⎋",Space:"Space",Delete:"⌫"},PB={Shift:"Shift",Alt:"Alt",Ctrl:"Ctrl",Meta:"Win",Mod:"Ctrl",Enter:"Enter",ArrowUp:"Up",ArrowDown:"Down",ArrowLeft:"Left",ArrowRight:"Right",Tab:"Tab",Esc:"Esc",Space:"Spacebar",Delete:"Delete"},VB={Shift:"Shift",Alt:"Alt",Ctrl:"Ctrl",Meta:"Super",Mod:"Ctrl",Enter:"Enter",ArrowUp:"Up",ArrowDown:"Down",ArrowLeft:"Left",ArrowRight:"Right",Tab:"Tab",Esc:"Esc",Space:"Space",Delete:"Delete"};function $B(n,t={}){const r=t.platform??TB(),o=t.joiner??(r==="mac"?"":" + "),i=r==="mac"?OB:r==="linux"?VB:PB;return(Array.isArray(n)?n:n[r]).map(s=>s in i?i[s]:s).join(o)}const RB={key:0,class:"label"},LB={class:"keys"},$l=je(e.defineComponent({__name:"HotkeyLabel",props:{label:{},keys:{},reverse:{type:Boolean}},setup(n){const t=$B(n.keys);return(r,o)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(["dk-hotkey-label",{reverse:n.reverse}])},[n.label?(e.openBlock(),e.createElementBlock("span",RB,e.toDisplayString(n.label),1)):e.createCommentVNode("",!0),e.createElementVNode("kbd",LB,e.toDisplayString(e.unref(t)),1)],2))}}),[["__scopeId","data-v-7ca86b0d"]]),DB=["onClick"],MB={key:0,class:"additional-count"},a_=24,jB=16,Rl=je(e.defineComponent({__name:"NodePortal",props:{expanded:{type:Boolean,default:()=>{}},reversed:{type:Boolean},targets:{}},setup(n){const t=Number.parseFloat(j1)||0,r={target:"body"},{portalSelection:o,selectPortalEdge:i}=$t(),a=e.ref(!1),s=e.computed(()=>{const h=o.value;return h?n.targets.some(y=>y.edgeId===h):!1}),c=e.computed(()=>n.expanded!==void 0?n.expanded||s.value:a.value||s.value),l=()=>a_*n.targets.length+t*(n.targets.length-1),u=e.computed(()=>({width:c.value?`${l()}px`:"fit-content"})),p=h=>{i(h)},d=h=>o.value===h,f=e.computed(()=>n.targets.map((h,y)=>{const b=(a_+t)*y;return{edgeId:h.edgeId,key:`${h.node.id}-${h.fieldName??"node"}-${y}`,icon:Zd(h.node.type).icon,tooltip:h.fieldName?`${h.node.name}.${h.fieldName}`:h.node.name,highlighted:d(h.edgeId),tooltipEl:null,style:y===0?{width:"fit-content",zIndex:n.targets.length}:{position:"absolute",...n.reversed?{left:`${b}px`,transform:c.value?"translateX(0)":`translateX(-${b}px)`}:{right:0,transform:c.value?`translateX(-${b}px)`:"translateX(0)"},zIndex:n.targets.length-y}}})),m=e.computed(()=>Math.max(n.targets.length-1,0));return(h,y)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["dk-node-portal",{expanded:c.value,reversed:n.reversed}]),onClick:y[0]||(y[0]=e.withModifiers(()=>{},["stop"])),onDragstart:y[1]||(y[1]=e.withModifiers(()=>{},["stop"])),onMousedown:y[2]||(y[2]=e.withModifiers(()=>{},["stop"])),onMouseenter:y[3]||(y[3]=b=>a.value=!0),onMouseleave:y[4]||(y[4]=b=>a.value=!1)},[e.createElementVNode("div",{class:"target-boxes",style:e.normalizeStyle(u.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(b,_)=>(e.openBlock(),e.createBlock(e.unref(Fe.KTooltip),{key:b.key,class:"target-box-wrapper","kpop-attributes":r,placement:"top",style:e.normalizeStyle(b.style),text:b.tooltip},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["target-box",{highlighted:b.highlighted}]),onClick:e.withModifiers(k=>p(b.edgeId),["stop"])},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(b.icon),{color:`var(--kui-color-text-neutral, ${e.unref(cr)})`,size:jB},null,8,["color"])),_===0&&m.value>0?(e.openBlock(),e.createElementBlock("span",MB," +"+e.toDisplayString(m.value),1)):e.createCommentVNode("",!0)],10,DB)]),_:2},1032,["style","text"]))),128))],4)],34))}}),[["__scopeId","data-v-45ce7484"]]),Ll=je(e.defineComponent({__name:"HandleTwig",props:{color:{},position:{default:()=>xt.Position.Left},size:{default:()=>Number.parseFloat(Qg)},type:{}},setup(n){e.useCssVars(r=>({v64bbaf90:r.color}));const t=e.computed(()=>({width:`${n.size}px`,minWidth:`${n.size}px`}));return(r,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["handle-twig",[n.type,n.position===e.unref(xt.Position).Left?"left":"right"]]),style:e.normalizeStyle(t.value)},null,6))}}),[["__scopeId","data-v-74b600f2"]]),ff=je(e.defineComponent({__name:"NodeBadge",props:{type:{},size:{},iconOnly:{type:Boolean}},setup(n){e.useCssVars(r=>{var o,i;return{v3b4ea967:(o=t.value.colors)==null?void 0:o.background,v00febd7c:(i=t.value.colors)==null?void 0:i.foreground}});const t=e.computed(()=>Zd(n.type));return(r,o)=>{var a;const i=e.resolveComponent("KBadge");return e.openBlock(),e.createBlock(i,{appearance:"neutral",class:e.normalizeClass(["dk-node-badge",{"icon-only":n.iconOnly,"has-colors":!!t.value.colors}]),size:n.size},e.createSlots({default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(n.type),1)]),_:2},[(a=t.value)!=null&&a.icon?{name:"icon",fn:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value.icon)))]),key:"0"}:void 0]),1032,["class","size"])}}}),[["__scopeId","data-v-409d29e5"]]),FB={class:"body"},UB={class:"name"},KB={class:"handle"},qB={class:"handle-label-wrapper"},GB={class:"handle-label-wrapper"},HB={class:"handle-label text"},zB={class:"handle"},WB={class:"handle-label-wrapper"},YB={class:"handle-label-wrapper"},JB={class:"handle-label text"},XB={key:2,class:"branch-handles"},ZB={class:"handle-label-wrapper"},QB={class:"handle-label text"},s_=je(e.defineComponent({__name:"FlowNode",props:{data:{},error:{type:Boolean},readonly:{type:Boolean}},setup(n){const t=e.useSlots(),{t:r}=jt.createI18n("en-us",Jt),o=BB(),{getInEdgesByNodeId:i,getOutEdgesByNodeId:a,getNodeById:s,toggleExpanded:c,duplicateNode:l,removeNode:u,propertiesPanelOpen:p,branchGroups:d}=$t(),f=e.computed(()=>ci(n.data.type)),m=e.computed(()=>n.data.fields.input.length>0),h=e.computed(()=>n.data.fields.output.length>0),y=e.computed(()=>m.value&&i(n.data.id).every(F=>F.targetField===void 0)),b=e.computed(()=>h.value&&a(n.data.id).every(F=>F.sourceField===void 0)),_=e.computed(()=>n.data.expanded.input??!1),k=e.computed(()=>n.data.expanded.output??!1),C=e.computed(()=>{var F,J,G;return((G=(J=(F=f.value.io)==null?void 0:F.next)==null?void 0:J.branches)==null?void 0:G.map(({name:v})=>v))??[]}),N=e.computed(()=>C.value.length>0),E=e.computed(()=>d.findMembership(n.data.id)),w=e.computed(()=>{var F,J;if(n.data.type==="property"){const G=(F=n.data.config)==null?void 0:F.property;return Wd(G)}return(J=f.value.io)==null?void 0:J.input}),S=e.computed(()=>{var F,J;if(n.data.type==="property"){const G=(F=n.data.config)==null?void 0:F.property;return zd(G)}return(J=f.value.io)==null?void 0:J.output}),I=e.computed(()=>vl(n.data)),U=e.computed(()=>n.data.phase==="response"),x=e.computed(()=>n.data.phase==="request"?xt.Position.Left:xt.Position.Right),A=e.computed(()=>n.data.phase==="request"?xt.Position.Right:xt.Position.Left),T=e.computed(()=>n.data.phase==="request"?xt.Position.Right:xt.Position.Left),V=e.computed(()=>vl(n.data)?r(`plugins.free-form.datakit.flow_editor.node_types.${n.data.type}.name`):n.data.name),R=e.computed(()=>I.value?A1:v1);function X(F){return F==="input"?U.value:!U.value}function Y(F){const J=new Map,G=F==="input"?i(n.data.id):a(n.data.id);for(const v of G){const q=s(F==="input"?v.source:v.target);if(!q)continue;if(F==="input"){const ce=q.type==="vault",he=q.phase!==n.data.phase,Oe=d.isEdgeEnteringGroup(q.id,n.data.id);if(!(ce||he||Oe))continue}else{const ce=q.phase!==n.data.phase,he=d.isEdgeEnteringGroup(n.data.id,q.id);if(!(ce||he))continue}const ie=F==="input"?v.targetField||"input":v.sourceField||"output";let oe;if(F==="input"&&v.sourceField){const ce=q.fields.output.find(he=>he.id===v.sourceField);oe=ce==null?void 0:ce.name}else if(F==="output"&&v.targetField){const ce=q.fields.input.find(he=>he.id===v.targetField);oe=ce==null?void 0:ce.name}const ke={edgeId:v.id,node:q,fieldName:oe},ye=J.get(ie);ye?ye.push(ke):J.set(ie,[ke])}return J}const ne=e.computed(()=>Y("input")),M=e.computed(()=>Y("output"));function te(F){!o||o.readonly||F==="input"&&!y.value||F==="output"&&!b.value||c(n.data.id,F)}async function $(){if(!o||o.readonly)return;const F=l(n.data.id,o.placeToRight(n.data.id));await o.selectNode(F),o.scrollRightToReveal(F),p.value=!0}function Z(){d.removeMember(n.data.id)}return e.watch(y,F=>{F||c(n.data.id,"input",!0,!0,"*")},{immediate:!0}),e.watch(b,F=>{F||c(n.data.id,"output",!0,!0,"*")},{immediate:!0}),e.watch(()=>n.data.fields.input,(F,J)=>{Xt(F,J)||c(n.data.id,"input",F.length>0,!0,"*")},{deep:!0}),e.watch(()=>n.data.fields.output,(F,J)=>{Xt(F,J)||c(n.data.id,"output",F.length>0,!0,"*")},{deep:!0}),(F,J)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["dk-flow-node",{reversed:U.value,implicit:I.value,readonly:n.readonly}])},[e.createElementVNode("div",FB,[I.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(Fe.KTooltip),{key:0,class:"badge",placement:"top",text:n.data.type},{default:e.withCtx(()=>[e.createVNode(ff,{"icon-only":"",size:"small",type:n.data.type},null,8,["type"])]),_:1},8,["text"])),e.createElementVNode("div",UB,e.toDisplayString(V.value),1),n.error?(e.openBlock(),e.createBlock(e.unref($e.WarningIcon),{key:1,class:"error-icon",color:`var(--kui-color-text-danger, ${e.unref(Yg)})`,size:16},null,8,["color"])):e.createCommentVNode("",!0),t.actions?e.renderSlot(F.$slots,"actions",{key:2,data:n.data},void 0,!0):I.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(Fe.KDropdown),{key:3,class:"menu",disabled:n.readonly,"kpop-attributes":{offset:"4px",target:"body",popoverClasses:"dk-flow-node-menu"},width:"160",onClick:J[1]||(J[1]=e.withModifiers(()=>{},["stop"]))},{items:e.withCtx(()=>[e.createVNode(e.unref(Fe.KDropdownItem),{onClick:$},{default:e.withCtx(()=>[e.createVNode($l,{keys:e.unref(pl).duplicate,label:e.unref(r)("plugins.free-form.datakit.flow_editor.actions.duplicate")},null,8,["keys","label"])]),_:1}),E.value?(e.openBlock(),e.createBlock(e.unref(Fe.KDropdownItem),{key:0,onClick:Z},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("plugins.free-form.datakit.flow_editor.actions.remove_from_branch")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(Fe.KDropdownItem),{danger:"",onClick:J[0]||(J[0]=G=>e.unref(u)(n.data.id))},{default:e.withCtx(()=>[e.createVNode($l,{keys:e.unref(pl).delete,label:e.unref(r)("plugins.free-form.datakit.flow_editor.actions.delete")},null,8,["keys","label"])]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(Fe.KButton),{appearance:"tertiary",class:"menu-trigger",icon:"",size:"small"},{default:e.withCtx(()=>[e.createVNode(e.unref($e.MoreIcon),{color:`var(--kui-color-text, ${e.unref(hd)})`},null,8,["color"])]),_:1})]),_:1},8,["disabled"]))]),t["before-handles"]?e.renderSlot(F.$slots,"before-handles",{key:0,data:n.data},void 0,!0):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["handles",{reversed:U.value}])},[w.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["input-handles",{"has-fields":m.value}])},[e.createElementVNode("div",KB,[e.createVNode(e.unref(xt.Handle),{id:"input",position:x.value,type:"target"},null,8,["position"]),ne.value.has("input")?(e.openBlock(),e.createBlock(Rl,{key:0,mode:"input",reversed:X("input"),targets:ne.value.get("input")},null,8,["reversed","targets"])):e.createCommentVNode("",!0),e.createElementVNode("div",qB,[e.createElementVNode("div",{class:e.normalizeClass(["handle-label trigger",{collapsible:y.value}]),onClick:J[2]||(J[2]=e.withModifiers(G=>te("input"),["stop"]))},[J[4]||(J[4]=e.createElementVNode("div",{class:"text"}," inputs ",-1)),m.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[_.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref($e.UnfoldMoreIcon),{key:0,size:`var(--kui-icon-size-20, ${e.unref(dl)})`},null,8,["size"])),_.value?(e.openBlock(),e.createBlock(e.unref($e.UnfoldLessIcon),{key:1,color:y.value?void 0:`var(--kui-color-text-disabled, ${e.unref(Xg)})`,size:`var(--kui-icon-size-20, ${e.unref(dl)})`},null,8,["color","size"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)],2),m.value&&_.value?(e.openBlock(),e.createBlock(Ll,{key:0,color:R.value,position:x.value,type:"bar"},null,8,["color","position"])):e.createCommentVNode("",!0)])]),m.value&&_.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(n.data.fields.input,(G,v)=>(e.openBlock(),e.createElementBlock("div",{key:`inputs-${G.id}`,class:"handle indented"},[e.createVNode(e.unref(xt.Handle),{id:`inputs@${G.id}`,position:x.value,type:"target"},null,8,["id","position"]),ne.value.has(G.id)?(e.openBlock(),e.createBlock(Rl,{key:0,mode:"input",reversed:X("input"),targets:ne.value.get(G.id)},null,8,["reversed","targets"])):e.createCommentVNode("",!0),e.createElementVNode("div",GB,[e.createElementVNode("div",HB,e.toDisplayString(G.name),1),e.createVNode(Ll,{color:R.value,position:x.value,type:v<n.data.fields.input.length-1?"trident":"corner"},null,8,["color","position","type"])])]))),128)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),S.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["output-handles",{"has-fields":h.value}])},[e.createElementVNode("div",zB,[e.createElementVNode("div",WB,[e.createElementVNode("div",{class:e.normalizeClass(["handle-label trigger",{collapsible:b.value}]),onClick:J[3]||(J[3]=e.withModifiers(G=>te("output"),["stop"]))},[J[5]||(J[5]=e.createElementVNode("div",{class:"text"}," outputs ",-1)),h.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[k.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref($e.UnfoldMoreIcon),{key:0,size:`var(--kui-icon-size-20, ${e.unref(dl)})`},null,8,["size"])),k.value?(e.openBlock(),e.createBlock(e.unref($e.UnfoldLessIcon),{key:1,color:b.value?void 0:`var(--kui-color-text-disabled, ${e.unref(Xg)})`,size:`var(--kui-icon-size-20, ${e.unref(dl)})`},null,8,["color","size"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)],2),h.value&&k.value?(e.openBlock(),e.createBlock(Ll,{key:0,color:R.value,position:A.value,type:"bar"},null,8,["color","position"])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(xt.Handle),{id:"output",position:A.value,type:"source"},null,8,["position"]),M.value.has("output")?(e.openBlock(),e.createBlock(Rl,{key:0,mode:"output",reversed:X("output"),targets:M.value.get("output")},null,8,["reversed","targets"])):e.createCommentVNode("",!0)]),h.value&&k.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(n.data.fields.output,(G,v)=>(e.openBlock(),e.createElementBlock("div",{key:`outputs-${G.id}`,class:"handle indented"},[e.createElementVNode("div",YB,[e.createElementVNode("div",JB,e.toDisplayString(G.name),1),e.createVNode(Ll,{color:R.value,position:A.value,type:v<n.data.fields.output.length-1?"trident":"corner"},null,8,["color","position","type"])]),e.createVNode(e.unref(xt.Handle),{id:`outputs@${G.id}`,position:A.value,type:"source"},null,8,["id","position"]),M.value.has(G.id)?(e.openBlock(),e.createBlock(Rl,{key:0,mode:"output",reversed:X("output"),targets:M.value.get(G.id)},null,8,["reversed","targets"])):e.createCommentVNode("",!0)]))),128)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),N.value?(e.openBlock(),e.createElementBlock("div",XB,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,G=>(e.openBlock(),e.createElementBlock("div",{key:`branch-${G}`,class:"handle"},[e.createElementVNode("div",ZB,[e.createElementVNode("div",QB,e.toDisplayString(G),1)]),e.createVNode(e.unref(xt.Handle),{id:`branch@${G}`,connectable:!1,position:T.value,type:"source"},null,8,["id","position"])]))),128))])):e.createCommentVNode("",!0)],2),t["after-handles"]?e.renderSlot(F.$slots,"after-handles",{key:1,data:n.data},void 0,!0):e.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-1de3b7cb"]]),eT=je(e.defineComponent({__name:"GroupNode",props:{data:{},active:{type:Boolean}},setup(n){const t=n,r=e.computed(()=>t.data.phase==="response"),o=e.computed(()=>r.value?xt.Position.Right:xt.Position.Left);return(i,a)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["dk-branch-group-node",{reversed:r.value,"drop-target":n.active}])},[e.createVNode(e.unref(xt.Handle),{id:"input",connectable:!1,position:o.value,type:"target"},null,8,["position"])],2))}}),[["__scopeId","data-v-cf30ffea"]]),pf=je(e.defineComponent({__name:"FlowCanvas",props:{flowId:{},phase:{},mode:{}},emits:["initialized","nodes-change","node-click"],setup(n,{expose:t,emit:r}){const o=e.useSlots(),i=r,a=e.useTemplateRef("flowCanvas"),s=Pt.useElementBounding(a),{i18n:{t:c}}=Qe(),l=e.computed(()=>{const oe=n.mode==="edit"||n.mode==="inspect";return{panOnDrag:oe?void 0:!1,panOnScroll:oe?void 0:!1,zoomOnDoubleClick:oe?void 0:!1,zoomOnPinch:oe?void 0:!1,zoomOnScroll:oe?void 0:!1}}),{vueFlowStore:u,editorStore:p,autoLayout:d,fitViewParams:f,fitView:m,selectNode:h,placeToRight:y,scrollRightToReveal:b,groupDrop:_}=IB({phase:n.phase,flowId:n.flowId,layoutOptions:{viewport:{width:s.width,height:s.height}},readonly:n.mode!=="edit"}),{addNode:k,propertiesPanelOpen:C,invalidConfigNodeIds:N,selectedNode:E,duplicateNode:w,commit:S,selectPortalEdge:I}=p,{screenToFlowCoordinate:U,zoomIn:x,zoomOut:A,viewport:T,maxZoom:V,minZoom:R}=u,{activeGroupId:X,startPanelDrag:Y,endPanelDrag:ne,updateActiveGroup:M,attachNodeToActiveGroup:te}=_;function $(oe){var ye;const ke=(ye=oe.dataTransfer)==null?void 0:ye.types.find(ce=>ce.startsWith(`${ba}/`));if(ke)return ke.replace(`${ba}/`,"")}function Z(oe){var ke,ye;if(n.mode==="inspect"){if(((ke=oe==null?void 0:oe.node)==null?void 0:ke.type)==="group")return;i("node-click",oe.node.data);return}if(n.mode==="edit"){if(((ye=oe==null?void 0:oe.node)==null?void 0:ye.type)==="group"){h(void 0),I(void 0);return}C.value=!0}}function F(oe){n.mode==="edit"&&(oe.preventDefault(),M(U({x:oe.clientX,y:oe.clientY})))}function J(oe){var Ge;if(n.mode!=="edit")return;const ke=(Ge=oe.dataTransfer)==null?void 0:Ge.getData(ba);if(!ke)return;oe.preventDefault();const ye=JSON.parse(ke);if(ye.action!=="create-node")return;const ce=U({x:oe.clientX,y:oe.clientY}),{type:he,anchor:Oe}=ye.data,De={type:he,phase:n.phase,position:{x:ce.x-Oe.offsetX,y:ce.y-Oe.offsetY}},Be=k(De,!1);if(!Be){ne();return}te(Be),S(),h(Be),C.value=!0,ne()}async function G(){i("initialized"),n.mode==="inspect"&&setTimeout(async()=>{await d(!1),setTimeout(()=>m(),0)},0)}async function v(){await d(),setTimeout(()=>m(),0)}const q=e.computed(()=>{if(n.mode==="preview")return[];const oe=[{name:"zoom_in",icon:$e.AddIcon,action:x,disabled:T.value.zoom>=V.value},{name:"zoom_out",icon:$e.RemoveIcon,action:A,disabled:T.value.zoom<=R.value},{name:"fit_view",icon:$e.FullscreenIcon,action:m}];return n.mode==="edit"&&oe.push({name:"auto_layout",icon:$e.AutoLayoutIcon,action:v}),oe});n.mode==="edit"&&(Pt.useEventListener("dragstart",oe=>{$(oe)&&Y()}),Pt.useEventListener("dragend",()=>{ne()}));async function ie(){const oe=E.value;if(n.mode!=="edit"||!oe||oe.phase!==n.phase)return;const ke=w(oe.id,y(oe.id));ke&&(await h(ke),C.value=!0,b(ke))}return Wg({enabled:e.computed(()=>!!E.value&&n.mode==="edit"&&E.value.phase===n.phase),duplicate:ie}),t({autoLayout:d,fitView:m}),(oe,ke)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"flowCanvas",ref:a,class:"dk-flow-canvas"},[e.createVNode(e.unref(xt.VueFlow),e.mergeProps({id:n.flowId,class:["flow",{readonly:n.mode!=="edit",inspect:n.mode==="inspect"}]},l.value,{"connect-on-click":!1,"elements-selectable":n.mode==="edit"||n.mode==="inspect","max-zoom":e.unref(J1),"min-zoom":e.unref(X1),"multi-selection-key-code":null,"nodes-connectable":n.mode==="edit","nodes-draggable":n.mode==="edit",onDragover:F,onDrop:J,onNodeClick:Z,onNodesChange:ke[0]||(ke[0]=ye=>i("nodes-change")),onNodesInitialized:G}),{"node-flow":e.withCtx(({data:ye})=>[e.createVNode(s_,{data:ye,error:e.unref(N).has(ye.id),readonly:n.mode!=="edit"},e.createSlots({_:2},[o["node-before-handles"]?{name:"before-handles",fn:e.withCtx(()=>[e.renderSlot(oe.$slots,"node-before-handles",{data:ye},void 0,!0)]),key:"0"}:void 0,o["node-actions"]?{name:"actions",fn:e.withCtx(()=>[e.renderSlot(oe.$slots,"node-actions",{data:ye},void 0,!0)]),key:"1"}:void 0,o["node-after-handles"]?{name:"after-handles",fn:e.withCtx(()=>[e.renderSlot(oe.$slots,"node-after-handles",{data:ye},void 0,!0)]),key:"2"}:void 0]),1032,["data","error","readonly"])]),"node-group":e.withCtx(({data:ye})=>[e.createVNode(eT,{active:e.unref(X)===ye.id,data:ye},null,8,["active","data"])]),default:e.withCtx(()=>[e.createVNode(e.unref(h1.Background)),e.createVNode(e.unref(Gg.Controls),{"fit-view-params":e.unref(f),position:"bottom-left","show-fit-view":!1,"show-interactive":!1,"show-zoom":!1},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(q.value,ye=>(e.openBlock(),e.createBlock(e.unref(Fe.KTooltip),{key:ye.name,placement:"right",text:e.unref(c)(`plugins.free-form.datakit.flow_editor.actions.${ye.name}`)},{default:e.withCtx(()=>[e.createVNode(e.unref(Gg.ControlButton),{disabled:ye.disabled,onClick:e.withModifiers(ye.action,["stop"])},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(ye.icon),{size:18}))]),_:2},1032,["disabled","onClick"])]),_:2},1032,["text"]))),128))]),_:1},8,["fit-view-params"])]),_:3},16,["id","class","elements-selectable","max-zoom","min-zoom","nodes-connectable","nodes-draggable"])],512))}}),[["__scopeId","data-v-11561a7e"]]);function l_(){const n=["methods","logout_methods"];return{setFieldType:(p,d,f)=>{var m,h,y;if(!(!p||!d||!f))switch(f.type){case"boolean":p[d]={type:Ie.ConfigurationSchemaType.BadgeStatus,...p[d]};break;case"string":f.encrypted?p[d]={type:Ie.ConfigurationSchemaType.Redacted,...p[d]}:p[d]={type:Ie.ConfigurationSchemaType.Text,...p[d]};break;case"set":((m=f.elements)==null?void 0:m.type)==="string"&&(p[d]={type:Ie.ConfigurationSchemaType.BadgeTag,...p[d]});break;case"array":n.includes(d)?p[d]={type:Ie.ConfigurationSchemaType.BadgeMethod,...p[d]}:((h=f.elements)==null?void 0:h.type)==="string"?f.encrypted?p[d]={type:Ie.ConfigurationSchemaType.RedactedArray,...p[d]}:p[d]={type:Ie.ConfigurationSchemaType.BadgeTag,...p[d]}:((y=f.elements)==null?void 0:y.type)==="record"&&(p[d]={type:Ie.ConfigurationSchemaType.Json,...p[d]});break;case"record":p[d]={type:Ie.ConfigurationSchemaType.Json,...p[d]};break;default:p[d]={type:Ie.ConfigurationSchemaType.Text,...p[d]};break}},convertToDotNotation:p=>p.replace(/-/g,"."),unFlattenObject:p=>{const d={};for(const f in p){const m=f.split(".");m.reduce((h,y,b)=>h[y]||(h[y]=isNaN(m[b+1])?m.length-1===b?p[f]:{}:[]),d)}return d},dismissField:(p,d,f="redis",m=!1)=>{const h=new RegExp("(?<=-redis-).*");if(typeof p!="object"||p===null)return p;f==="redis"?Object.keys(p).forEach(y=>{y.match(h)&&delete p[y]}):m?p[f]=null:delete p[f],Object.assign(p,d)},isObjectEmpty:p=>Object.keys(p).length===0,unsetNullForeignKey:(p,d)=>{["service.id","route.id","consumer.id","consumer_group.id"].indexOf(p)>-1&&d[p]===null&&(delete d[p],d[p.replace(".id","")]=null)},formatPluginFieldLabel:p=>p.replace(/_/g," ").split("-").map(d=>d.charAt(0).toUpperCase()+d.slice(1)).join("-"),getTallestPluginCardHeight:p=>{let d=0;if(p.length)for(let f=0;f<p.length;f++){const m=p[f].$el;d=m.offsetHeight>d?m.offsetHeight:d}return d},getToggleVisibility:(p,d)=>{var f,m;if(p&&d){const h=(m=(f=window==null?void 0:window.getComputedStyle(p))==null?void 0:f.getPropertyValue("grid-template-columns"))==null?void 0:m.split(" ").length;return d>h}return!0}}}var Dl=(n=>(n.REDIS_CE="redis-ce",n.REDIS_EE="redis-ee",n))(Dl||{});const Ml=["Featured"],mf=[fe.PluginGroup.AUTHENTICATION,fe.PluginGroup.AI,fe.PluginGroup.SECURITY,fe.PluginGroup.TRAFFIC_CONTROL,fe.PluginGroup.SERVERLESS,fe.PluginGroup.ANALYTICS_AND_MONITORING,fe.PluginGroup.TRANSFORMATIONS,fe.PluginGroup.LOGGING,fe.PluginGroup.DEPLOYMENT,fe.PluginGroup.WEBSOCKET,fe.PluginGroup.MONETIZATION,fe.PluginGroup.CUSTOM_PLUGINS],jl=[fe.PluginGroup.AI,fe.PluginGroup.ANALYTICS_AND_MONITORING,fe.PluginGroup.AUTHENTICATION,fe.PluginGroup.LOGGING,fe.PluginGroup.MONETIZATION,fe.PluginGroup.SECURITY,fe.PluginGroup.SERVERLESS,fe.PluginGroup.TRAFFIC_CONTROL,fe.PluginGroup.TRANSFORMATIONS,fe.PluginGroup.CUSTOM_PLUGINS];var wo=(n=>(n.SERVICE="service_id",n.ROUTE="route_id",n.CONSUMER="consumer_id",n.CONSUMER_GROUP="consumer_group_id",n))(wo||{});const ko=n=>{const t=Object.fromEntries(n.fields.map(r=>Object.entries(r)[0]));return"id"in t||(t.id={}),t},Co={label:"Tags",name:"tags",type:"input",inputType:"text",valueType:"array",valueArrayType:"string",placeholder:"Enter list of tags",help:"An optional set of strings for grouping and filtering, separated by commas.",hint:"e.g. tag1, tag2, tag3"},di={getColumnFields:ko,tags:Co,id:{label:"ID"},enabled:{label:"Enabled",indexed:!0,type:"boolean"},created_at:{label:"Created"},updated_at:{label:"Last updated"},fields:{arrayItems(n){const t=n.inputAttributes||{};return delete n.inputAttributes,{type:"array",itemContainerComponent:"FieldArrayItem",fieldClasses:"kong-form-array-field",fieldItemsClasses:"kong-form-array-field-item",newElementButtonLabelClasses:"kong-form-new-element-button-label",inputAttributes:{class:"form-control",style:{minWidth:"200px"},...t},removeElementButtonLabel:"remove",styleClasses:"kong-form-field-wrapper",inputType:"text",valueType:"array",valueArrayType:"string",...n}}}},c_={fields:[{group:{hint:"The arbitrary group name to associate to the consumer."}},{tags:Co}]},tT={fields:[{id:{uuid:!0,type:"string",auto:!0}},{created_at:{auto:!0,timestamp:!0,type:"integer"}},{consumer:{reference:"consumers",type:"foreign",on_delete:"cascade",required:!0}},{group:{required:!0,type:"string",hint:"The arbitrary group name to associate to the consumer."}},{tags:{elements:{type:"string",required:!0},type:"set"}}]},u_={fields:[{username:{}},{password:{inputType:"password"}},{tags:Co}]},nT={fields:[{id:{uuid:!0,type:"string",auto:!0}},{created_at:{auto:!0,timestamp:!0,type:"integer"}},{consumer:{reference:"consumers",type:"foreign",on_delete:"cascade",required:!0}},{username:{required:!0,type:"string",unique:!0}},{password:{type:"string",required:!0,encrypted:!0}},{tags:{elements:{type:"string",required:!0},type:"set"}}]},d_=e.defineComponent({name:"KeyAuthIdentityRealmsBase",__name:"Base",props:e.mergeModels({realms:{}},{modelValue:{default:[{scope:"cp",id:null,region:null}]},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const t=n,r=e.useModel(n,"modelValue"),{i18n:o}=st.useI18n(),{t:i}=o,a={value:"current-cp",label:i("custom_field.key_auth_identity_realms.cp_label"),group:i("custom_field.key_auth_identity_realms.cp_group_label")},s=e.inject(et.FORMS_CONFIG),{axiosInstance:c}=Ie.useAxios(s==null?void 0:s.axiosRequestConfig),l=()=>{if((s==null?void 0:s.app)==="konnect"){const h=/\b(us|eu|au|me|in|sg)\b/.exec((s==null?void 0:s.apiBaseUrl)||"");if(h)return{region:h[1]}}return{}},u=e.ref(!0),p=e.ref([a]),d=async()=>{if((s==null?void 0:s.app)==="konnect")try{u.value=!0;let h=`${s==null?void 0:s.apiBaseUrl}/v1/realms`;const y=[];do{const b=await c.get(h);b&&b.data&&b.data.data&&y.push(...b.data.data.map(_=>({value:_.id,label:_.name,group:i("custom_field.key_auth_identity_realms.realm_group_label")}))),h=b.data.meta.next?`${s==null?void 0:s.apiBaseUrl}${b.data.meta.next}`:null}while(h);p.value=[a,...y]}catch(h){console.error("Failed to fetch Konnect realms",h)}finally{u.value=!1}},f=e.computed(()=>r.value.map(h=>h.id||"current-cp")),m=h=>{const y=h.includes("current-cp")?[{scope:"cp",id:null,region:null}]:[],b=r.value.filter(({scope:E})=>E!=="cp").map(({id:E})=>E),_=h.filter(E=>E!=="current-cp"),N=(b.length!==_.length||b.some(E=>!_.includes(E))?_.filter(E=>!b.includes(E)):_).map(E=>({...l(),scope:"realm",id:E}));r.value=[...y,...N]};return e.onMounted(()=>{t.realms===void 0&&d()}),e.watch(()=>t.realms,h=>{h&&(p.value=[a,...h.map(y=>({...y,group:i("custom_field.key_auth_identity_realms.realm_group_label")}))],u.value=!1)},{immediate:!0}),(h,y)=>{const b=e.resolveComponent("KMultiselect");return e.openBlock(),e.createBlock(b,{items:p.value,loading:u.value,"model-value":f.value,"onUpdate:modelValue":m},null,8,["items","loading","model-value"])}}}),rT={class:"field-wrapper"},oT=je(e.defineComponent({__name:"VfgAdapter",props:{disabled:{type:Boolean},formOptions:{},model:{},schema:{},vfg:{},errors:{},hint:{}},emits:["modelUpdated"],setup(n,{expose:t,emit:r}){const o=n,i=r,{clearValidationErrors:a,value:s}=et.composables.useAbstractFields({model:e.toRef(()=>o.model),schema:o.schema,formOptions:o.formOptions,emitModelUpdated:c=>{i("modelUpdated",c.value,c.model)}});return t({clearValidationErrors:a}),(c,l)=>(e.openBlock(),e.createElementBlock("div",rT,[e.createVNode(d_,{modelValue:e.unref(s),"onUpdate:modelValue":l[0]||(l[0]=u=>e.isRef(s)?s.value=u:null)},null,8,["modelValue"])]))}}),[["__scopeId","data-v-269e85ed"]]),f_={fields:[{key:{submitWhenNull:!1,hint:`You can optionally set your own unique key to authenticate the
4
4
  client. If missing, it will be generated for you.`,inputType:"password",encrypted:!0}},{tags:Co},{ttl:{help:"Time-to-live (in seconds) value for data"}}]},iT=n=>{var t;return(n==null?void 0:n.app)==="kongManager"?{fieldsToDelete:["config-identity_realms"],shamefullyTransformPayload:({payload:r})=>{(n!=null&&n.credential&&typeof r.ttl!="number"||Number.isNaN(r.ttl))&&(r.ttl=0)}}:{"config-identity_realms":{component:((t=n==null?void 0:n.experimentalRenders)==null?void 0:t.keyAuthIdentityRealms)??!1?e.markRaw(oT):null}}},aT={fields:[{id:{uuid:!0,type:"string",auto:!0}},{created_at:{auto:!0,timestamp:!0,type:"integer"}},{consumer:{reference:"consumers",type:"foreign",on_delete:"cascade",required:!0}},{key:{auto:!0,hint:"If left empty, a key will be generated after saving this form.",required:!1,type:"string",encrypted:!0,unique:!0}},{tags:{elements:{type:"string",required:!0},type:"set"}},{ttl:{between:[0,1e8],description:"Time-to-live (in seconds) value for data",type:"number"}}]},p_={fields:[{username:{hint:"The username to use in the HMAC Signature verification."}},{secret:{inputType:"text",submitWhenNull:!1,hint:`The secret to use in the HMAC Signature verification. Note that
5
5
  if this parameter isn’t provided, Kong will generate a value for you and
6
6
  send it as part of the response body.`}},{tags:Co}]},sT={fields:[{id:{uuid:!0,type:"string",auto:!0}},{created_at:{auto:!0,timestamp:!0,type:"integer"}},{consumer:{reference:"consumers",type:"foreign",on_delete:"cascade",required:!0}},{username:{required:!0,type:"string",unique:!0,hint:"The username to use in the HMAC Signature verification."}},{secret:{auto:!0,type:"string",encrypted:!0,hint:"The secret to use in the HMAC Signature verification. Note that if this parameter isn’t provided, Kong will generate a value for you and send it as part of the response body."}},{tags:{elements:{type:"string",required:!0},type:"set"}}]},lT={fields:[{key:{submitWhenNull:!1,hint:`A unique string identifying the credential. If left out, it will
@@ -23,17 +23,17 @@ ${I}`)}if(N.has(w))return;N.add(w),E.push(w);const S=_.dependencies[w];if(S){con
23
23
  `}return m.replace(/\n$/,"")}t.exports=a}),cn=Tt((n,t)=>{var r=qa(),o=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],i=["scalar","sequence","mapping"];function a(c){const l={};return c!==null&&Object.keys(c).forEach(function(u){c[u].forEach(function(p){l[String(p)]=u})}),l}function s(c,l){if(l=l||{},Object.keys(l).forEach(function(u){if(o.indexOf(u)===-1)throw new r('Unknown option "'+u+'" is met in definition of "'+c+'" YAML type.')}),this.options=l,this.tag=c,this.kind=l.kind||null,this.resolve=l.resolve||function(){return!0},this.construct=l.construct||function(u){return u},this.instanceOf=l.instanceOf||null,this.predicate=l.predicate||null,this.represent=l.represent||null,this.representName=l.representName||null,this.defaultStyle=l.defaultStyle||null,this.multi=l.multi||!1,this.styleAliases=a(l.styleAliases||null),i.indexOf(this.kind)===-1)throw new r('Unknown kind "'+this.kind+'" is specified for "'+c+'" YAML type.')}t.exports=s}),L_=Tt((n,t)=>{var r=qa(),o=cn();function i(c,l){const u=[];return c[l].forEach(function(p){let d=u.length;u.forEach(function(f,m){f.tag===p.tag&&f.kind===p.kind&&f.multi===p.multi&&(d=m)}),u[d]=p}),u}function a(){const c={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function l(u){u.multi?(c.multi[u.kind].push(u),c.multi.fallback.push(u)):c[u.kind][u.tag]=c.fallback[u.tag]=u}for(let u=0,p=arguments.length;u<p;u+=1)arguments[u].forEach(l);return c}function s(c){return this.extend(c)}s.prototype.extend=function(l){let u=[],p=[];if(l instanceof o)p.push(l);else if(Array.isArray(l))p=p.concat(l);else if(l&&(Array.isArray(l.implicit)||Array.isArray(l.explicit)))l.implicit&&(u=u.concat(l.implicit)),l.explicit&&(p=p.concat(l.explicit));else throw new r("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");u.forEach(function(f){if(!(f instanceof o))throw new r("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(f.loadKind&&f.loadKind!=="scalar")throw new r("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(f.multi)throw new r("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),p.forEach(function(f){if(!(f instanceof o))throw new r("Specified list of YAML types (or a single Type object) contains a non-Type object.")});const d=Object.create(s.prototype);return d.implicit=(this.implicit||[]).concat(u),d.explicit=(this.explicit||[]).concat(p),d.compiledImplicit=i(d,"implicit"),d.compiledExplicit=i(d,"explicit"),d.compiledTypeMap=a(d.compiledImplicit,d.compiledExplicit),d},t.exports=s}),D_=Tt((n,t)=>{t.exports=new(cn())("tag:yaml.org,2002:str",{kind:"scalar",construct:function(r){return r!==null?r:""}})}),M_=Tt((n,t)=>{t.exports=new(cn())("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(r){return r!==null?r:[]}})}),j_=Tt((n,t)=>{t.exports=new(cn())("tag:yaml.org,2002:map",{kind:"mapping",construct:function(r){return r!==null?r:{}}})}),F_=Tt((n,t)=>{t.exports=new(L_())({explicit:[D_(),M_(),j_()]})}),U_=Tt((n,t)=>{var r=cn();function o(s){if(s===null)return!0;const c=s.length;return c===1&&s==="~"||c===4&&(s==="null"||s==="Null"||s==="NULL")}function i(){return null}function a(s){return s===null}t.exports=new r("tag:yaml.org,2002:null",{kind:"scalar",resolve:o,construct:i,predicate:a,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"})}),K_=Tt((n,t)=>{var r=cn();function o(s){if(s===null)return!1;const c=s.length;return c===4&&(s==="true"||s==="True"||s==="TRUE")||c===5&&(s==="false"||s==="False"||s==="FALSE")}function i(s){return s==="true"||s==="True"||s==="TRUE"}function a(s){return Object.prototype.toString.call(s)==="[object Boolean]"}t.exports=new r("tag:yaml.org,2002:bool",{kind:"scalar",resolve:o,construct:i,predicate:a,represent:{lowercase:function(s){return s?"true":"false"},uppercase:function(s){return s?"TRUE":"FALSE"},camelcase:function(s){return s?"True":"False"}},defaultStyle:"lowercase"})}),q_=Tt((n,t)=>{var r=Ka(),o=cn();function i(d){return d>=48&&d<=57||d>=65&&d<=70||d>=97&&d<=102}function a(d){return d>=48&&d<=55}function s(d){return d>=48&&d<=57}function c(d){if(d===null)return!1;const f=d.length;let m=0,h=!1;if(!f)return!1;let y=d[m];if((y==="-"||y==="+")&&(y=d[++m]),y==="0"){if(m+1===f)return!0;if(y=d[++m],y==="b"){for(m++;m<f;m++){if(y=d[m],y!=="0"&&y!=="1")return!1;h=!0}return h&&Number.isFinite(l(d))}if(y==="x"){for(m++;m<f;m++){if(!i(d.charCodeAt(m)))return!1;h=!0}return h&&Number.isFinite(l(d))}if(y==="o"){for(m++;m<f;m++){if(!a(d.charCodeAt(m)))return!1;h=!0}return h&&Number.isFinite(l(d))}}for(;m<f;m++){if(!s(d.charCodeAt(m)))return!1;h=!0}return h?Number.isFinite(l(d)):!1}function l(d){let f=d,m=1,h=f[0];if((h==="-"||h==="+")&&(h==="-"&&(m=-1),f=f.slice(1),h=f[0]),f==="0")return 0;if(h==="0"){if(f[1]==="b")return m*parseInt(f.slice(2),2);if(f[1]==="x")return m*parseInt(f.slice(2),16);if(f[1]==="o")return m*parseInt(f.slice(2),8)}return m*parseInt(f,10)}function u(d){return l(d)}function p(d){return Object.prototype.toString.call(d)==="[object Number]"&&d%1===0&&!r.isNegativeZero(d)}t.exports=new o("tag:yaml.org,2002:int",{kind:"scalar",resolve:c,construct:u,predicate:p,represent:{binary:function(d){return d>=0?"0b"+d.toString(2):"-0b"+d.toString(2).slice(1)},octal:function(d){return d>=0?"0o"+d.toString(8):"-0o"+d.toString(8).slice(1)},decimal:function(d){return d.toString(10)},hexadecimal:function(d){return d>=0?"0x"+d.toString(16).toUpperCase():"-0x"+d.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})}),G_=Tt((n,t)=>{var r=Ka(),o=cn(),i=new RegExp("^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),a=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function s(d){return d===null||!i.test(d)?!1:Number.isFinite(parseFloat(d,10))?!0:a.test(d)}function c(d){let f=d.toLowerCase();const m=f[0]==="-"?-1:1;return"+-".indexOf(f[0])>=0&&(f=f.slice(1)),f===".inf"?m===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:f===".nan"?NaN:m*parseFloat(f,10)}var l=/^[-+]?[0-9]+e/;function u(d,f){if(isNaN(d))switch(f){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===d)switch(f){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===d)switch(f){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(r.isNegativeZero(d))return"-0.0";const m=d.toString(10);return l.test(m)?m.replace("e",".e"):m}function p(d){return Object.prototype.toString.call(d)==="[object Number]"&&(d%1!==0||r.isNegativeZero(d))}t.exports=new o("tag:yaml.org,2002:float",{kind:"scalar",resolve:s,construct:c,predicate:p,represent:u,defaultStyle:"lowercase"})}),H_=Tt((n,t)=>{t.exports=F_().extend({implicit:[U_(),K_(),q_(),G_()]})}),z_=Tt((n,t)=>{t.exports=H_()}),W_=Tt((n,t)=>{var r=cn(),o=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),i=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function a(l){return l===null?!1:o.exec(l)!==null||i.exec(l)!==null}function s(l){let u=0,p=null,d=o.exec(l);if(d===null&&(d=i.exec(l)),d===null)throw new Error("Date resolve error");const f=+d[1],m=+d[2]-1,h=+d[3];if(!d[4])return new Date(Date.UTC(f,m,h));const y=+d[4],b=+d[5],_=+d[6];if(d[7]){for(u=d[7].slice(0,3);u.length<3;)u+="0";u=+u}if(d[9]){const C=+d[10],N=+(d[11]||0);p=(C*60+N)*6e4,d[9]==="-"&&(p=-p)}const k=new Date(Date.UTC(f,m,h,y,b,_,u));return p&&k.setTime(k.getTime()-p),k}function c(l){return l.toISOString()}t.exports=new r("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:a,construct:s,instanceOf:Date,represent:c})}),Y_=Tt((n,t)=>{var r=cn();function o(i){return i==="<<"||i===null}t.exports=new r("tag:yaml.org,2002:merge",{kind:"scalar",resolve:o})}),J_=Tt((n,t)=>{var r=cn(),o=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
24
24
  \r`;function i(l){if(l===null)return!1;let u=0;const p=l.length,d=o;for(let f=0;f<p;f++){const m=d.indexOf(l.charAt(f));if(!(m>64)){if(m<0)return!1;u+=6}}return u%8===0}function a(l){const u=l.replace(/[\r\n=]/g,""),p=u.length,d=o;let f=0;const m=[];for(let y=0;y<p;y++)y%4===0&&y&&(m.push(f>>16&255),m.push(f>>8&255),m.push(f&255)),f=f<<6|d.indexOf(u.charAt(y));const h=p%4*6;return h===0?(m.push(f>>16&255),m.push(f>>8&255),m.push(f&255)):h===18?(m.push(f>>10&255),m.push(f>>2&255)):h===12&&m.push(f>>4&255),new Uint8Array(m)}function s(l){let u="",p=0;const d=l.length,f=o;for(let h=0;h<d;h++)h%3===0&&h&&(u+=f[p>>18&63],u+=f[p>>12&63],u+=f[p>>6&63],u+=f[p&63]),p=(p<<8)+l[h];const m=d%3;return m===0?(u+=f[p>>18&63],u+=f[p>>12&63],u+=f[p>>6&63],u+=f[p&63]):m===2?(u+=f[p>>10&63],u+=f[p>>4&63],u+=f[p<<2&63],u+=f[64]):m===1&&(u+=f[p>>2&63],u+=f[p<<4&63],u+=f[64],u+=f[64]),u}function c(l){return Object.prototype.toString.call(l)==="[object Uint8Array]"}t.exports=new r("tag:yaml.org,2002:binary",{kind:"scalar",resolve:i,construct:a,predicate:c,represent:s})}),X_=Tt((n,t)=>{var r=cn(),o=Object.prototype.hasOwnProperty,i=Object.prototype.toString;function a(c){if(c===null)return!0;const l=[],u=c;for(let p=0,d=u.length;p<d;p+=1){const f=u[p];let m=!1;if(i.call(f)!=="[object Object]")return!1;let h;for(h in f)if(o.call(f,h))if(!m)m=!0;else return!1;if(!m)return!1;if(l.indexOf(h)===-1)l.push(h);else return!1}return!0}function s(c){return c!==null?c:[]}t.exports=new r("tag:yaml.org,2002:omap",{kind:"sequence",resolve:a,construct:s})}),Z_=Tt((n,t)=>{var r=cn(),o=Object.prototype.toString;function i(s){if(s===null)return!0;const c=s,l=new Array(c.length);for(let u=0,p=c.length;u<p;u+=1){const d=c[u];if(o.call(d)!=="[object Object]")return!1;const f=Object.keys(d);if(f.length!==1)return!1;l[u]=[f[0],d[f[0]]]}return!0}function a(s){if(s===null)return[];const c=s,l=new Array(c.length);for(let u=0,p=c.length;u<p;u+=1){const d=c[u],f=Object.keys(d);l[u]=[f[0],d[f[0]]]}return l}t.exports=new r("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:i,construct:a})}),Q_=Tt((n,t)=>{var r=cn(),o=Object.prototype.hasOwnProperty;function i(s){if(s===null)return!0;const c=s;for(const l in c)if(o.call(c,l)&&c[l]!==null)return!1;return!0}function a(s){return s!==null?s:{}}t.exports=new r("tag:yaml.org,2002:set",{kind:"mapping",resolve:i,construct:a})}),vf=Tt((n,t)=>{t.exports=z_().extend({implicit:[W_(),Y_()],explicit:[J_(),X_(),Z_(),Q_()]})}),YO=Tt((n,t)=>{var r=Ka(),o=qa(),i=WO(),a=vf(),s=Object.prototype.hasOwnProperty,c=1,l=2,u=3,p=4,d=1,f=2,m=3,h=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,y=/[\x85\u2028\u2029]/,b=/[,\[\]{}]/,_=/^(?:!|!!|![0-9A-Za-z-]+!)$/,k=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function C(g){return Object.prototype.toString.call(g)}function N(g){return g===10||g===13}function E(g){return g===9||g===32}function w(g){return g===9||g===32||g===10||g===13}function S(g){return g===44||g===91||g===93||g===123||g===125}function I(g){if(g>=48&&g<=57)return g-48;const O=g|32;return O>=97&&O<=102?O-97+10:-1}function U(g){return g===120?2:g===117?4:g===85?8:0}function x(g){return g>=48&&g<=57?g-48:-1}function A(g){switch(g){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return`
25
25
  `;case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"…";case 95:return" ";case 76:return"\u2028";case 80:return"\u2029";default:return""}}function T(g){return g<=65535?String.fromCharCode(g):String.fromCharCode((g-65536>>10)+55296,(g-65536&1023)+56320)}function V(g,O,j){O==="__proto__"?Object.defineProperty(g,O,{configurable:!0,enumerable:!0,writable:!0,value:j}):g[O]=j}var R=new Array(256),X=new Array(256);for(let g=0;g<256;g++)R[g]=A(g)?1:0,X[g]=A(g);function Y(g,O){this.input=g,this.filename=O.filename||null,this.schema=O.schema||a,this.onWarning=O.onWarning||null,this.legacy=O.legacy||!1,this.json=O.json||!1,this.listener=O.listener||null,this.maxDepth=typeof O.maxDepth=="number"?O.maxDepth:100,this.maxMergeSeqLength=typeof O.maxMergeSeqLength=="number"?O.maxMergeSeqLength:20,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=g.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function ne(g,O){const j={name:g.filename,buffer:g.input.slice(0,-1),position:g.position,line:g.line,column:g.position-g.lineStart};return j.snippet=i(j),new o(O,j)}function M(g,O){throw ne(g,O)}function te(g,O){g.onWarning&&g.onWarning.call(null,ne(g,O))}function $(g,O,j){const W=g.anchorMapTransactions;if(W.length!==0){const ae=W[W.length-1];s.call(ae,O)||(ae[O]={existed:s.call(g.anchorMap,O),value:g.anchorMap[O]})}g.anchorMap[O]=j}function Z(g){g.anchorMapTransactions.push(Object.create(null))}function F(g){const O=g.anchorMapTransactions.pop(),j=g.anchorMapTransactions;if(j.length===0)return;const W=j[j.length-1],ae=Object.keys(O);for(let be=0,L=ae.length;be<L;be+=1){const ge=ae[be];s.call(W,ge)||(W[ge]=O[ge])}}function J(g){const O=g.anchorMapTransactions.pop(),j=Object.keys(O);for(let W=j.length-1;W>=0;W-=1){const ae=O[j[W]];ae.existed?g.anchorMap[j[W]]=ae.value:delete g.anchorMap[j[W]]}}function G(g){return{position:g.position,line:g.line,lineStart:g.lineStart,lineIndent:g.lineIndent,firstTabInLine:g.firstTabInLine,tag:g.tag,anchor:g.anchor,kind:g.kind,result:g.result}}function v(g,O){g.position=O.position,g.line=O.line,g.lineStart=O.lineStart,g.lineIndent=O.lineIndent,g.firstTabInLine=O.firstTabInLine,g.tag=O.tag,g.anchor=O.anchor,g.kind=O.kind,g.result=O.result}var q={YAML:function(O,j,W){O.version!==null&&M(O,"duplication of %YAML directive"),W.length!==1&&M(O,"YAML directive accepts exactly one argument");const ae=/^([0-9]+)\.([0-9]+)$/.exec(W[0]);ae===null&&M(O,"ill-formed argument of the YAML directive");const be=parseInt(ae[1],10),L=parseInt(ae[2],10);be!==1&&M(O,"unacceptable YAML version of the document"),O.version=W[0],O.checkLineBreaks=L<2,L!==1&&L!==2&&te(O,"unsupported YAML version of the document")},TAG:function(O,j,W){let ae;W.length!==2&&M(O,"TAG directive accepts exactly two arguments");const be=W[0];ae=W[1],_.test(be)||M(O,"ill-formed tag handle (first argument) of the TAG directive"),s.call(O.tagMap,be)&&M(O,'there is a previously declared suffix for "'+be+'" tag handle'),k.test(ae)||M(O,"ill-formed tag prefix (second argument) of the TAG directive");try{ae=decodeURIComponent(ae)}catch{M(O,"tag prefix is malformed: "+ae)}O.tagMap[be]=ae}};function ie(g,O,j,W){if(O<j){const ae=g.input.slice(O,j);if(W)for(let be=0,L=ae.length;be<L;be+=1){const ge=ae.charCodeAt(be);ge===9||ge>=32&&ge<=1114111||M(g,"expected valid JSON character")}else h.test(ae)&&M(g,"the stream contains non-printable characters");g.result+=ae}}function oe(g,O,j,W){r.isObject(j)||M(g,"cannot merge mappings; the provided source object is unacceptable");const ae=Object.keys(j);for(let be=0,L=ae.length;be<L;be+=1){const ge=ae[be];s.call(O,ge)||(V(O,ge,j[ge]),W[ge]=!0)}}function ke(g,O,j,W,ae,be,L,ge,Ee){if(Array.isArray(ae)){ae=Array.prototype.slice.call(ae);for(let ue=0,P=ae.length;ue<P;ue+=1)Array.isArray(ae[ue])&&M(g,"nested arrays are not supported inside keys"),typeof ae=="object"&&C(ae[ue])==="[object Object]"&&(ae[ue]="[object Object]")}if(typeof ae=="object"&&C(ae)==="[object Object]"&&(ae="[object Object]"),ae=String(ae),O===null&&(O={}),W==="tag:yaml.org,2002:merge")if(Array.isArray(be)){be.length>g.maxMergeSeqLength&&M(g,"merge sequence length exceeded maxMergeSeqLength ("+g.maxMergeSeqLength+")");const ue=new Set;for(let P=0,z=be.length;P<z;P+=1){const D=be[P];ue.has(D)||(ue.add(D),oe(g,O,D,j))}}else oe(g,O,be,j);else!g.json&&!s.call(j,ae)&&s.call(O,ae)&&(g.line=L||g.line,g.lineStart=ge||g.lineStart,g.position=Ee||g.position,M(g,"duplicated mapping key")),V(O,ae,be),delete j[ae];return O}function ye(g){const O=g.input.charCodeAt(g.position);O===10?g.position++:O===13?(g.position++,g.input.charCodeAt(g.position)===10&&g.position++):M(g,"a line break is expected"),g.line+=1,g.lineStart=g.position,g.firstTabInLine=-1}function ce(g,O,j){let W=0,ae=g.input.charCodeAt(g.position);for(;ae!==0;){for(;E(ae);)ae===9&&g.firstTabInLine===-1&&(g.firstTabInLine=g.position),ae=g.input.charCodeAt(++g.position);if(O&&ae===35)do ae=g.input.charCodeAt(++g.position);while(ae!==10&&ae!==13&&ae!==0);if(N(ae))for(ye(g),ae=g.input.charCodeAt(g.position),W++,g.lineIndent=0;ae===32;)g.lineIndent++,ae=g.input.charCodeAt(++g.position);else break}return j!==-1&&W!==0&&g.lineIndent<j&&te(g,"deficient indentation"),W}function he(g){let O=g.position,j=g.input.charCodeAt(O);return!!((j===45||j===46)&&j===g.input.charCodeAt(O+1)&&j===g.input.charCodeAt(O+2)&&(O+=3,j=g.input.charCodeAt(O),j===0||w(j)))}function Oe(g,O){O===1?g.result+=" ":O>1&&(g.result+=r.repeat(`
26
- `,O-1))}function De(g,O,j){let W,ae,be,L,ge,Ee;const ue=g.kind,P=g.result;let z=g.input.charCodeAt(g.position);if(w(z)||S(z)||z===35||z===38||z===42||z===33||z===124||z===62||z===39||z===34||z===37||z===64||z===96)return!1;if(z===63||z===45){const D=g.input.charCodeAt(g.position+1);if(w(D)||j&&S(D))return!1}for(g.kind="scalar",g.result="",W=ae=g.position,be=!1;z!==0;){if(z===58){const D=g.input.charCodeAt(g.position+1);if(w(D)||j&&S(D))break}else if(z===35){if(w(g.input.charCodeAt(g.position-1)))break}else{if(g.position===g.lineStart&&he(g)||j&&S(z))break;if(N(z))if(L=g.line,ge=g.lineStart,Ee=g.lineIndent,ce(g,!1,-1),g.lineIndent>=O){be=!0,z=g.input.charCodeAt(g.position);continue}else{g.position=ae,g.line=L,g.lineStart=ge,g.lineIndent=Ee;break}}be&&(ie(g,W,ae,!1),Oe(g,g.line-L),W=ae=g.position,be=!1),E(z)||(ae=g.position+1),z=g.input.charCodeAt(++g.position)}return ie(g,W,ae,!1),g.result?!0:(g.kind=ue,g.result=P,!1)}function Be(g,O){let j,W,ae=g.input.charCodeAt(g.position);if(ae!==39)return!1;for(g.kind="scalar",g.result="",g.position++,j=W=g.position;(ae=g.input.charCodeAt(g.position))!==0;)if(ae===39)if(ie(g,j,g.position,!0),ae=g.input.charCodeAt(++g.position),ae===39)j=g.position,g.position++,W=g.position;else return!0;else N(ae)?(ie(g,j,W,!0),Oe(g,ce(g,!1,O)),j=W=g.position):g.position===g.lineStart&&he(g)?M(g,"unexpected end of the document within a single quoted scalar"):(g.position++,E(ae)||(W=g.position));M(g,"unexpected end of the stream within a single quoted scalar")}function qe(g,O){let j,W,ae,be=g.input.charCodeAt(g.position);if(be!==34)return!1;for(g.kind="scalar",g.result="",g.position++,j=W=g.position;(be=g.input.charCodeAt(g.position))!==0;){if(be===34)return ie(g,j,g.position,!0),g.position++,!0;if(be===92){if(ie(g,j,g.position,!0),be=g.input.charCodeAt(++g.position),N(be))ce(g,!1,O);else if(be<256&&R[be])g.result+=X[be],g.position++;else if((ae=U(be))>0){let L=ae,ge=0;for(;L>0;L--)be=g.input.charCodeAt(++g.position),(ae=I(be))>=0?ge=(ge<<4)+ae:M(g,"expected hexadecimal character");g.result+=T(ge),g.position++}else M(g,"unknown escape sequence");j=W=g.position}else N(be)?(ie(g,j,W,!0),Oe(g,ce(g,!1,O)),j=W=g.position):g.position===g.lineStart&&he(g)?M(g,"unexpected end of the document within a double quoted scalar"):(g.position++,E(be)||(W=g.position))}M(g,"unexpected end of the stream within a double quoted scalar")}function We(g,O){let j=!0,W,ae,be;const L=g.tag;let ge;const Ee=g.anchor;let ue,P,z,D;const pe=Object.create(null);let we,Se,Ve,Me=g.input.charCodeAt(g.position);if(Me===91)ue=93,D=!1,ge=[];else if(Me===123)ue=125,D=!0,ge={};else return!1;for(g.anchor!==null&&$(g,g.anchor,ge),Me=g.input.charCodeAt(++g.position);Me!==0;){if(ce(g,!0,O),Me=g.input.charCodeAt(g.position),Me===ue)return g.position++,g.tag=L,g.anchor=Ee,g.kind=D?"mapping":"sequence",g.result=ge,!0;j?Me===44&&M(g,"expected the node content, but found ','"):M(g,"missed comma between flow collection entries"),Se=we=Ve=null,P=z=!1,Me===63&&w(g.input.charCodeAt(g.position+1))&&(P=z=!0,g.position++,ce(g,!0,O)),W=g.line,ae=g.lineStart,be=g.position,le(g,O,c,!1,!0),Se=g.tag,we=g.result,ce(g,!0,O),Me=g.input.charCodeAt(g.position),(z||g.line===W)&&Me===58&&(P=!0,Me=g.input.charCodeAt(++g.position),ce(g,!0,O),le(g,O,c,!1,!0),Ve=g.result),D?ke(g,ge,pe,Se,we,Ve,W,ae,be):P?ge.push(ke(g,null,pe,Se,we,Ve,W,ae,be)):ge.push(we),ce(g,!0,O),Me=g.input.charCodeAt(g.position),Me===44?(j=!0,Me=g.input.charCodeAt(++g.position)):j=!1}M(g,"unexpected end of the stream within a flow collection")}function nt(g,O){let j,W=d,ae=!1,be=!1,L=O,ge=0,Ee=!1,ue,P=g.input.charCodeAt(g.position);if(P===124)j=!1;else if(P===62)j=!0;else return!1;for(g.kind="scalar",g.result="";P!==0;)if(P=g.input.charCodeAt(++g.position),P===43||P===45)d===W?W=P===43?m:f:M(g,"repeat of a chomping mode identifier");else if((ue=x(P))>=0)ue===0?M(g,"bad explicit indentation width of a block scalar; it cannot be less than one"):be?M(g,"repeat of an indentation width identifier"):(L=O+ue-1,be=!0);else break;if(E(P)){do P=g.input.charCodeAt(++g.position);while(E(P));if(P===35)do P=g.input.charCodeAt(++g.position);while(!N(P)&&P!==0)}for(;P!==0;){for(ye(g),g.lineIndent=0,P=g.input.charCodeAt(g.position);(!be||g.lineIndent<L)&&P===32;)g.lineIndent++,P=g.input.charCodeAt(++g.position);if(!be&&g.lineIndent>L&&(L=g.lineIndent),N(P)){ge++;continue}if(!be&&L===0&&M(g,"missing indentation for block scalar"),g.lineIndent<L){W===m?g.result+=r.repeat(`
26
+ `,O-1))}function De(g,O,j){let W,ae,be,L,ge,Ee;const ue=g.kind,P=g.result;let z=g.input.charCodeAt(g.position);if(w(z)||S(z)||z===35||z===38||z===42||z===33||z===124||z===62||z===39||z===34||z===37||z===64||z===96)return!1;if(z===63||z===45){const D=g.input.charCodeAt(g.position+1);if(w(D)||j&&S(D))return!1}for(g.kind="scalar",g.result="",W=ae=g.position,be=!1;z!==0;){if(z===58){const D=g.input.charCodeAt(g.position+1);if(w(D)||j&&S(D))break}else if(z===35){if(w(g.input.charCodeAt(g.position-1)))break}else{if(g.position===g.lineStart&&he(g)||j&&S(z))break;if(N(z))if(L=g.line,ge=g.lineStart,Ee=g.lineIndent,ce(g,!1,-1),g.lineIndent>=O){be=!0,z=g.input.charCodeAt(g.position);continue}else{g.position=ae,g.line=L,g.lineStart=ge,g.lineIndent=Ee;break}}be&&(ie(g,W,ae,!1),Oe(g,g.line-L),W=ae=g.position,be=!1),E(z)||(ae=g.position+1),z=g.input.charCodeAt(++g.position)}return ie(g,W,ae,!1),g.result?!0:(g.kind=ue,g.result=P,!1)}function Be(g,O){let j,W,ae=g.input.charCodeAt(g.position);if(ae!==39)return!1;for(g.kind="scalar",g.result="",g.position++,j=W=g.position;(ae=g.input.charCodeAt(g.position))!==0;)if(ae===39)if(ie(g,j,g.position,!0),ae=g.input.charCodeAt(++g.position),ae===39)j=g.position,g.position++,W=g.position;else return!0;else N(ae)?(ie(g,j,W,!0),Oe(g,ce(g,!1,O)),j=W=g.position):g.position===g.lineStart&&he(g)?M(g,"unexpected end of the document within a single quoted scalar"):(g.position++,E(ae)||(W=g.position));M(g,"unexpected end of the stream within a single quoted scalar")}function Ge(g,O){let j,W,ae,be=g.input.charCodeAt(g.position);if(be!==34)return!1;for(g.kind="scalar",g.result="",g.position++,j=W=g.position;(be=g.input.charCodeAt(g.position))!==0;){if(be===34)return ie(g,j,g.position,!0),g.position++,!0;if(be===92){if(ie(g,j,g.position,!0),be=g.input.charCodeAt(++g.position),N(be))ce(g,!1,O);else if(be<256&&R[be])g.result+=X[be],g.position++;else if((ae=U(be))>0){let L=ae,ge=0;for(;L>0;L--)be=g.input.charCodeAt(++g.position),(ae=I(be))>=0?ge=(ge<<4)+ae:M(g,"expected hexadecimal character");g.result+=T(ge),g.position++}else M(g,"unknown escape sequence");j=W=g.position}else N(be)?(ie(g,j,W,!0),Oe(g,ce(g,!1,O)),j=W=g.position):g.position===g.lineStart&&he(g)?M(g,"unexpected end of the document within a double quoted scalar"):(g.position++,E(be)||(W=g.position))}M(g,"unexpected end of the stream within a double quoted scalar")}function We(g,O){let j=!0,W,ae,be;const L=g.tag;let ge;const Ee=g.anchor;let ue,P,z,D;const pe=Object.create(null);let we,Se,Ve,Me=g.input.charCodeAt(g.position);if(Me===91)ue=93,D=!1,ge=[];else if(Me===123)ue=125,D=!0,ge={};else return!1;for(g.anchor!==null&&$(g,g.anchor,ge),Me=g.input.charCodeAt(++g.position);Me!==0;){if(ce(g,!0,O),Me=g.input.charCodeAt(g.position),Me===ue)return g.position++,g.tag=L,g.anchor=Ee,g.kind=D?"mapping":"sequence",g.result=ge,!0;j?Me===44&&M(g,"expected the node content, but found ','"):M(g,"missed comma between flow collection entries"),Se=we=Ve=null,P=z=!1,Me===63&&w(g.input.charCodeAt(g.position+1))&&(P=z=!0,g.position++,ce(g,!0,O)),W=g.line,ae=g.lineStart,be=g.position,le(g,O,c,!1,!0),Se=g.tag,we=g.result,ce(g,!0,O),Me=g.input.charCodeAt(g.position),(z||g.line===W)&&Me===58&&(P=!0,Me=g.input.charCodeAt(++g.position),ce(g,!0,O),le(g,O,c,!1,!0),Ve=g.result),D?ke(g,ge,pe,Se,we,Ve,W,ae,be):P?ge.push(ke(g,null,pe,Se,we,Ve,W,ae,be)):ge.push(we),ce(g,!0,O),Me=g.input.charCodeAt(g.position),Me===44?(j=!0,Me=g.input.charCodeAt(++g.position)):j=!1}M(g,"unexpected end of the stream within a flow collection")}function nt(g,O){let j,W=d,ae=!1,be=!1,L=O,ge=0,Ee=!1,ue,P=g.input.charCodeAt(g.position);if(P===124)j=!1;else if(P===62)j=!0;else return!1;for(g.kind="scalar",g.result="";P!==0;)if(P=g.input.charCodeAt(++g.position),P===43||P===45)d===W?W=P===43?m:f:M(g,"repeat of a chomping mode identifier");else if((ue=x(P))>=0)ue===0?M(g,"bad explicit indentation width of a block scalar; it cannot be less than one"):be?M(g,"repeat of an indentation width identifier"):(L=O+ue-1,be=!0);else break;if(E(P)){do P=g.input.charCodeAt(++g.position);while(E(P));if(P===35)do P=g.input.charCodeAt(++g.position);while(!N(P)&&P!==0)}for(;P!==0;){for(ye(g),g.lineIndent=0,P=g.input.charCodeAt(g.position);(!be||g.lineIndent<L)&&P===32;)g.lineIndent++,P=g.input.charCodeAt(++g.position);if(!be&&g.lineIndent>L&&(L=g.lineIndent),N(P)){ge++;continue}if(!be&&L===0&&M(g,"missing indentation for block scalar"),g.lineIndent<L){W===m?g.result+=r.repeat(`
27
27
  `,ae?1+ge:ge):W===d&&ae&&(g.result+=`
28
28
  `);break}j?E(P)?(Ee=!0,g.result+=r.repeat(`
29
29
  `,ae?1+ge:ge)):Ee?(Ee=!1,g.result+=r.repeat(`
30
30
  `,ge+1)):ge===0?ae&&(g.result+=" "):g.result+=r.repeat(`
31
31
  `,ge):g.result+=r.repeat(`
32
- `,ae?1+ge:ge),ae=!0,be=!0,ge=0;const z=g.position;for(;!N(P)&&P!==0;)P=g.input.charCodeAt(++g.position);ie(g,z,g.position,!1)}return!0}function lt(g,O){const j=g.tag,W=g.anchor,ae=[];let be=!1;if(g.firstTabInLine!==-1)return!1;g.anchor!==null&&$(g,g.anchor,ae);let L=g.input.charCodeAt(g.position);for(;L!==0&&(g.firstTabInLine!==-1&&(g.position=g.firstTabInLine,M(g,"tab characters must not be used in indentation")),!(L!==45||!w(g.input.charCodeAt(g.position+1))));){if(be=!0,g.position++,ce(g,!0,-1)&&g.lineIndent<=O){ae.push(null),L=g.input.charCodeAt(g.position);continue}const ge=g.line;if(le(g,O,u,!1,!0),ae.push(g.result),ce(g,!0,-1),L=g.input.charCodeAt(g.position),(g.line===ge||g.lineIndent>O)&&L!==0)M(g,"bad indentation of a sequence entry");else if(g.lineIndent<O)break}return be?(g.tag=j,g.anchor=W,g.kind="sequence",g.result=ae,!0):!1}function Re(g,O,j){let W,ae,be,L;const ge=g.tag,Ee=g.anchor,ue={},P=Object.create(null);let z=null,D=null,pe=null,we=!1,Se=!1;if(g.firstTabInLine!==-1)return!1;g.anchor!==null&&$(g,g.anchor,ue);let Ve=g.input.charCodeAt(g.position);for(;Ve!==0;){!we&&g.firstTabInLine!==-1&&(g.position=g.firstTabInLine,M(g,"tab characters must not be used in indentation"));const Me=g.input.charCodeAt(g.position+1),Ze=g.line;if((Ve===63||Ve===58)&&w(Me))Ve===63?(we&&(ke(g,ue,P,z,D,null,ae,be,L),z=D=pe=null),Se=!0,we=!0,W=!0):we?(we=!1,W=!0):M(g,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),g.position+=1,Ve=Me;else{if(ae=g.line,be=g.lineStart,L=g.position,!le(g,j,l,!1,!0))break;if(g.line===Ze){for(Ve=g.input.charCodeAt(g.position);E(Ve);)Ve=g.input.charCodeAt(++g.position);if(Ve===58)Ve=g.input.charCodeAt(++g.position),w(Ve)||M(g,"a whitespace character is expected after the key-value separator within a block mapping"),we&&(ke(g,ue,P,z,D,null,ae,be,L),z=D=pe=null),Se=!0,we=!1,W=!1,z=g.tag,D=g.result;else if(Se)M(g,"can not read an implicit mapping pair; a colon is missed");else return g.tag=ge,g.anchor=Ee,!0}else if(Se)M(g,"can not read a block mapping entry; a multiline key may not be an implicit key");else return g.tag=ge,g.anchor=Ee,!0}if((g.line===Ze||g.lineIndent>O)&&(we&&(ae=g.line,be=g.lineStart,L=g.position),le(g,O,p,!0,W)&&(we?D=g.result:pe=g.result),we||(ke(g,ue,P,z,D,pe,ae,be,L),z=D=pe=null),ce(g,!0,-1),Ve=g.input.charCodeAt(g.position)),(g.line===Ze||g.lineIndent>O)&&Ve!==0)M(g,"bad indentation of a mapping entry");else if(g.lineIndent<O)break}return we&&ke(g,ue,P,z,D,null,ae,be,L),Se&&(g.tag=ge,g.anchor=Ee,g.kind="mapping",g.result=ue),Se}function Ce(g){let O=!1,j=!1,W,ae,be=g.input.charCodeAt(g.position);if(be!==33)return!1;g.tag!==null&&M(g,"duplication of a tag property"),be=g.input.charCodeAt(++g.position),be===60?(O=!0,be=g.input.charCodeAt(++g.position)):be===33?(j=!0,W="!!",be=g.input.charCodeAt(++g.position)):W="!";let L=g.position;if(O){do be=g.input.charCodeAt(++g.position);while(be!==0&&be!==62);g.position<g.length?(ae=g.input.slice(L,g.position),be=g.input.charCodeAt(++g.position)):M(g,"unexpected end of the stream within a verbatim tag")}else{for(;be!==0&&!w(be);)be===33&&(j?M(g,"tag suffix cannot contain exclamation marks"):(W=g.input.slice(L-1,g.position+1),_.test(W)||M(g,"named tag handle cannot contain such characters"),j=!0,L=g.position+1)),be=g.input.charCodeAt(++g.position);ae=g.input.slice(L,g.position),b.test(ae)&&M(g,"tag suffix cannot contain flow indicator characters")}ae&&!k.test(ae)&&M(g,"tag name cannot contain such characters: "+ae);try{ae=decodeURIComponent(ae)}catch{M(g,"tag name is malformed: "+ae)}return O?g.tag=ae:s.call(g.tagMap,W)?g.tag=g.tagMap[W]+ae:W==="!"?g.tag="!"+ae:W==="!!"?g.tag="tag:yaml.org,2002:"+ae:M(g,'undeclared tag handle "'+W+'"'),!0}function se(g){let O=g.input.charCodeAt(g.position);if(O!==38)return!1;g.anchor!==null&&M(g,"duplication of an anchor property"),O=g.input.charCodeAt(++g.position);const j=g.position;for(;O!==0&&!w(O)&&!S(O);)O=g.input.charCodeAt(++g.position);return g.position===j&&M(g,"name of an anchor node must contain at least one character"),g.anchor=g.input.slice(j,g.position),!0}function re(g){let O=g.input.charCodeAt(g.position);if(O!==42)return!1;O=g.input.charCodeAt(++g.position);const j=g.position;for(;O!==0&&!w(O)&&!S(O);)O=g.input.charCodeAt(++g.position);g.position===j&&M(g,"name of an alias node must contain at least one character");const W=g.input.slice(j,g.position);return s.call(g.anchorMap,W)||M(g,'unidentified alias "'+W+'"'),g.result=g.anchorMap[W],ce(g,!0,-1),!0}function Q(g,O,j,W){const ae=G(g);return Z(g),v(g,O),g.tag=null,g.anchor=null,g.kind=null,g.result=null,Re(g,j,W)&&g.kind==="mapping"?(F(g),!0):(J(g),v(g,ae),!1)}function le(g,O,j,W,ae){let be,L,ge=1,Ee=!1,ue=!1,P=null,z,D,pe;g.depth>=g.maxDepth&&M(g,"nesting exceeded maxDepth ("+g.maxDepth+")"),g.depth+=1,g.listener!==null&&g.listener("open",g),g.tag=null,g.anchor=null,g.kind=null,g.result=null;const we=be=L=p===j||u===j;if(W&&ce(g,!0,-1)&&(Ee=!0,g.lineIndent>O?ge=1:g.lineIndent===O?ge=0:g.lineIndent<O&&(ge=-1)),ge===1)for(;;){const Se=g.input.charCodeAt(g.position),Ve=G(g);if(Ee&&(Se===33&&g.tag!==null||Se===38&&g.anchor!==null)||!Ce(g)&&!se(g))break;P===null&&(P=Ve),ce(g,!0,-1)?(Ee=!0,L=we,g.lineIndent>O?ge=1:g.lineIndent===O?ge=0:g.lineIndent<O&&(ge=-1)):L=!1}if(L&&(L=Ee||ae),ge===1||p===j)if(c===j||l===j?D=O:D=O+1,pe=g.position-g.lineStart,ge===1)if(L&&(lt(g,pe)||Re(g,pe,D))||We(g,D))ue=!0;else{const Se=g.input.charCodeAt(g.position);P!==null&&we&&!L&&Se!==124&&Se!==62&&Q(g,P,P.position-P.lineStart,D)||be&&nt(g,D)||Be(g,D)||qe(g,D)?ue=!0:re(g)?(ue=!0,(g.tag!==null||g.anchor!==null)&&M(g,"alias node should not have any properties")):De(g,D,c===j)&&(ue=!0,g.tag===null&&(g.tag="?")),g.anchor!==null&&$(g,g.anchor,g.result)}else ge===0&&(ue=L&&lt(g,pe));if(g.tag===null)g.anchor!==null&&$(g,g.anchor,g.result);else if(g.tag==="?"){g.result!==null&&g.kind!=="scalar"&&M(g,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+g.kind+'"');for(let Se=0,Ve=g.implicitTypes.length;Se<Ve;Se+=1)if(z=g.implicitTypes[Se],z.resolve(g.result)){g.result=z.construct(g.result),g.tag=z.tag,g.anchor!==null&&$(g,g.anchor,g.result);break}}else if(g.tag!=="!"){if(s.call(g.typeMap[g.kind||"fallback"],g.tag))z=g.typeMap[g.kind||"fallback"][g.tag];else{z=null;const Se=g.typeMap.multi[g.kind||"fallback"];for(let Ve=0,Me=Se.length;Ve<Me;Ve+=1)if(g.tag.slice(0,Se[Ve].tag.length)===Se[Ve].tag){z=Se[Ve];break}}z||M(g,"unknown tag !<"+g.tag+">"),g.result!==null&&z.kind!==g.kind&&M(g,"unacceptable node kind for !<"+g.tag+'> tag; it should be "'+z.kind+'", not "'+g.kind+'"'),z.resolve(g.result,g.tag)?(g.result=z.construct(g.result,g.tag),g.anchor!==null&&$(g,g.anchor,g.result)):M(g,"cannot resolve a node with !<"+g.tag+"> explicit tag")}return g.listener!==null&&g.listener("close",g),g.depth-=1,g.tag!==null||g.anchor!==null||ue}function de(g){const O=g.position;let j=!1,W;for(g.version=null,g.checkLineBreaks=g.legacy,g.tagMap=Object.create(null),g.anchorMap=Object.create(null);(W=g.input.charCodeAt(g.position))!==0&&(ce(g,!0,-1),W=g.input.charCodeAt(g.position),!(g.lineIndent>0||W!==37));){j=!0,W=g.input.charCodeAt(++g.position);let ae=g.position;for(;W!==0&&!w(W);)W=g.input.charCodeAt(++g.position);const be=g.input.slice(ae,g.position),L=[];for(be.length<1&&M(g,"directive name must not be less than one character in length");W!==0;){for(;E(W);)W=g.input.charCodeAt(++g.position);if(W===35){do W=g.input.charCodeAt(++g.position);while(W!==0&&!N(W));break}if(N(W))break;for(ae=g.position;W!==0&&!w(W);)W=g.input.charCodeAt(++g.position);L.push(g.input.slice(ae,g.position))}W!==0&&ye(g),s.call(q,be)?q[be](g,be,L):te(g,'unknown document directive "'+be+'"')}if(ce(g,!0,-1),g.lineIndent===0&&g.input.charCodeAt(g.position)===45&&g.input.charCodeAt(g.position+1)===45&&g.input.charCodeAt(g.position+2)===45?(g.position+=3,ce(g,!0,-1)):j&&M(g,"directives end mark is expected"),le(g,g.lineIndent-1,p,!1,!0),ce(g,!0,-1),g.checkLineBreaks&&y.test(g.input.slice(O,g.position))&&te(g,"non-ASCII line breaks are interpreted as content"),g.documents.push(g.result),g.position===g.lineStart&&he(g)){g.input.charCodeAt(g.position)===46&&(g.position+=3,ce(g,!0,-1));return}g.position<g.length-1&&M(g,"end of the stream or a document separator is expected")}function _e(g,O){g=String(g),O=O||{},g.length!==0&&(g.charCodeAt(g.length-1)!==10&&g.charCodeAt(g.length-1)!==13&&(g+=`
32
+ `,ae?1+ge:ge),ae=!0,be=!0,ge=0;const z=g.position;for(;!N(P)&&P!==0;)P=g.input.charCodeAt(++g.position);ie(g,z,g.position,!1)}return!0}function lt(g,O){const j=g.tag,W=g.anchor,ae=[];let be=!1;if(g.firstTabInLine!==-1)return!1;g.anchor!==null&&$(g,g.anchor,ae);let L=g.input.charCodeAt(g.position);for(;L!==0&&(g.firstTabInLine!==-1&&(g.position=g.firstTabInLine,M(g,"tab characters must not be used in indentation")),!(L!==45||!w(g.input.charCodeAt(g.position+1))));){if(be=!0,g.position++,ce(g,!0,-1)&&g.lineIndent<=O){ae.push(null),L=g.input.charCodeAt(g.position);continue}const ge=g.line;if(le(g,O,u,!1,!0),ae.push(g.result),ce(g,!0,-1),L=g.input.charCodeAt(g.position),(g.line===ge||g.lineIndent>O)&&L!==0)M(g,"bad indentation of a sequence entry");else if(g.lineIndent<O)break}return be?(g.tag=j,g.anchor=W,g.kind="sequence",g.result=ae,!0):!1}function Re(g,O,j){let W,ae,be,L;const ge=g.tag,Ee=g.anchor,ue={},P=Object.create(null);let z=null,D=null,pe=null,we=!1,Se=!1;if(g.firstTabInLine!==-1)return!1;g.anchor!==null&&$(g,g.anchor,ue);let Ve=g.input.charCodeAt(g.position);for(;Ve!==0;){!we&&g.firstTabInLine!==-1&&(g.position=g.firstTabInLine,M(g,"tab characters must not be used in indentation"));const Me=g.input.charCodeAt(g.position+1),Ze=g.line;if((Ve===63||Ve===58)&&w(Me))Ve===63?(we&&(ke(g,ue,P,z,D,null,ae,be,L),z=D=pe=null),Se=!0,we=!0,W=!0):we?(we=!1,W=!0):M(g,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),g.position+=1,Ve=Me;else{if(ae=g.line,be=g.lineStart,L=g.position,!le(g,j,l,!1,!0))break;if(g.line===Ze){for(Ve=g.input.charCodeAt(g.position);E(Ve);)Ve=g.input.charCodeAt(++g.position);if(Ve===58)Ve=g.input.charCodeAt(++g.position),w(Ve)||M(g,"a whitespace character is expected after the key-value separator within a block mapping"),we&&(ke(g,ue,P,z,D,null,ae,be,L),z=D=pe=null),Se=!0,we=!1,W=!1,z=g.tag,D=g.result;else if(Se)M(g,"can not read an implicit mapping pair; a colon is missed");else return g.tag=ge,g.anchor=Ee,!0}else if(Se)M(g,"can not read a block mapping entry; a multiline key may not be an implicit key");else return g.tag=ge,g.anchor=Ee,!0}if((g.line===Ze||g.lineIndent>O)&&(we&&(ae=g.line,be=g.lineStart,L=g.position),le(g,O,p,!0,W)&&(we?D=g.result:pe=g.result),we||(ke(g,ue,P,z,D,pe,ae,be,L),z=D=pe=null),ce(g,!0,-1),Ve=g.input.charCodeAt(g.position)),(g.line===Ze||g.lineIndent>O)&&Ve!==0)M(g,"bad indentation of a mapping entry");else if(g.lineIndent<O)break}return we&&ke(g,ue,P,z,D,null,ae,be,L),Se&&(g.tag=ge,g.anchor=Ee,g.kind="mapping",g.result=ue),Se}function Ce(g){let O=!1,j=!1,W,ae,be=g.input.charCodeAt(g.position);if(be!==33)return!1;g.tag!==null&&M(g,"duplication of a tag property"),be=g.input.charCodeAt(++g.position),be===60?(O=!0,be=g.input.charCodeAt(++g.position)):be===33?(j=!0,W="!!",be=g.input.charCodeAt(++g.position)):W="!";let L=g.position;if(O){do be=g.input.charCodeAt(++g.position);while(be!==0&&be!==62);g.position<g.length?(ae=g.input.slice(L,g.position),be=g.input.charCodeAt(++g.position)):M(g,"unexpected end of the stream within a verbatim tag")}else{for(;be!==0&&!w(be);)be===33&&(j?M(g,"tag suffix cannot contain exclamation marks"):(W=g.input.slice(L-1,g.position+1),_.test(W)||M(g,"named tag handle cannot contain such characters"),j=!0,L=g.position+1)),be=g.input.charCodeAt(++g.position);ae=g.input.slice(L,g.position),b.test(ae)&&M(g,"tag suffix cannot contain flow indicator characters")}ae&&!k.test(ae)&&M(g,"tag name cannot contain such characters: "+ae);try{ae=decodeURIComponent(ae)}catch{M(g,"tag name is malformed: "+ae)}return O?g.tag=ae:s.call(g.tagMap,W)?g.tag=g.tagMap[W]+ae:W==="!"?g.tag="!"+ae:W==="!!"?g.tag="tag:yaml.org,2002:"+ae:M(g,'undeclared tag handle "'+W+'"'),!0}function se(g){let O=g.input.charCodeAt(g.position);if(O!==38)return!1;g.anchor!==null&&M(g,"duplication of an anchor property"),O=g.input.charCodeAt(++g.position);const j=g.position;for(;O!==0&&!w(O)&&!S(O);)O=g.input.charCodeAt(++g.position);return g.position===j&&M(g,"name of an anchor node must contain at least one character"),g.anchor=g.input.slice(j,g.position),!0}function re(g){let O=g.input.charCodeAt(g.position);if(O!==42)return!1;O=g.input.charCodeAt(++g.position);const j=g.position;for(;O!==0&&!w(O)&&!S(O);)O=g.input.charCodeAt(++g.position);g.position===j&&M(g,"name of an alias node must contain at least one character");const W=g.input.slice(j,g.position);return s.call(g.anchorMap,W)||M(g,'unidentified alias "'+W+'"'),g.result=g.anchorMap[W],ce(g,!0,-1),!0}function Q(g,O,j,W){const ae=G(g);return Z(g),v(g,O),g.tag=null,g.anchor=null,g.kind=null,g.result=null,Re(g,j,W)&&g.kind==="mapping"?(F(g),!0):(J(g),v(g,ae),!1)}function le(g,O,j,W,ae){let be,L,ge=1,Ee=!1,ue=!1,P=null,z,D,pe;g.depth>=g.maxDepth&&M(g,"nesting exceeded maxDepth ("+g.maxDepth+")"),g.depth+=1,g.listener!==null&&g.listener("open",g),g.tag=null,g.anchor=null,g.kind=null,g.result=null;const we=be=L=p===j||u===j;if(W&&ce(g,!0,-1)&&(Ee=!0,g.lineIndent>O?ge=1:g.lineIndent===O?ge=0:g.lineIndent<O&&(ge=-1)),ge===1)for(;;){const Se=g.input.charCodeAt(g.position),Ve=G(g);if(Ee&&(Se===33&&g.tag!==null||Se===38&&g.anchor!==null)||!Ce(g)&&!se(g))break;P===null&&(P=Ve),ce(g,!0,-1)?(Ee=!0,L=we,g.lineIndent>O?ge=1:g.lineIndent===O?ge=0:g.lineIndent<O&&(ge=-1)):L=!1}if(L&&(L=Ee||ae),ge===1||p===j)if(c===j||l===j?D=O:D=O+1,pe=g.position-g.lineStart,ge===1)if(L&&(lt(g,pe)||Re(g,pe,D))||We(g,D))ue=!0;else{const Se=g.input.charCodeAt(g.position);P!==null&&we&&!L&&Se!==124&&Se!==62&&Q(g,P,P.position-P.lineStart,D)||be&&nt(g,D)||Be(g,D)||Ge(g,D)?ue=!0:re(g)?(ue=!0,(g.tag!==null||g.anchor!==null)&&M(g,"alias node should not have any properties")):De(g,D,c===j)&&(ue=!0,g.tag===null&&(g.tag="?")),g.anchor!==null&&$(g,g.anchor,g.result)}else ge===0&&(ue=L&&lt(g,pe));if(g.tag===null)g.anchor!==null&&$(g,g.anchor,g.result);else if(g.tag==="?"){g.result!==null&&g.kind!=="scalar"&&M(g,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+g.kind+'"');for(let Se=0,Ve=g.implicitTypes.length;Se<Ve;Se+=1)if(z=g.implicitTypes[Se],z.resolve(g.result)){g.result=z.construct(g.result),g.tag=z.tag,g.anchor!==null&&$(g,g.anchor,g.result);break}}else if(g.tag!=="!"){if(s.call(g.typeMap[g.kind||"fallback"],g.tag))z=g.typeMap[g.kind||"fallback"][g.tag];else{z=null;const Se=g.typeMap.multi[g.kind||"fallback"];for(let Ve=0,Me=Se.length;Ve<Me;Ve+=1)if(g.tag.slice(0,Se[Ve].tag.length)===Se[Ve].tag){z=Se[Ve];break}}z||M(g,"unknown tag !<"+g.tag+">"),g.result!==null&&z.kind!==g.kind&&M(g,"unacceptable node kind for !<"+g.tag+'> tag; it should be "'+z.kind+'", not "'+g.kind+'"'),z.resolve(g.result,g.tag)?(g.result=z.construct(g.result,g.tag),g.anchor!==null&&$(g,g.anchor,g.result)):M(g,"cannot resolve a node with !<"+g.tag+"> explicit tag")}return g.listener!==null&&g.listener("close",g),g.depth-=1,g.tag!==null||g.anchor!==null||ue}function de(g){const O=g.position;let j=!1,W;for(g.version=null,g.checkLineBreaks=g.legacy,g.tagMap=Object.create(null),g.anchorMap=Object.create(null);(W=g.input.charCodeAt(g.position))!==0&&(ce(g,!0,-1),W=g.input.charCodeAt(g.position),!(g.lineIndent>0||W!==37));){j=!0,W=g.input.charCodeAt(++g.position);let ae=g.position;for(;W!==0&&!w(W);)W=g.input.charCodeAt(++g.position);const be=g.input.slice(ae,g.position),L=[];for(be.length<1&&M(g,"directive name must not be less than one character in length");W!==0;){for(;E(W);)W=g.input.charCodeAt(++g.position);if(W===35){do W=g.input.charCodeAt(++g.position);while(W!==0&&!N(W));break}if(N(W))break;for(ae=g.position;W!==0&&!w(W);)W=g.input.charCodeAt(++g.position);L.push(g.input.slice(ae,g.position))}W!==0&&ye(g),s.call(q,be)?q[be](g,be,L):te(g,'unknown document directive "'+be+'"')}if(ce(g,!0,-1),g.lineIndent===0&&g.input.charCodeAt(g.position)===45&&g.input.charCodeAt(g.position+1)===45&&g.input.charCodeAt(g.position+2)===45?(g.position+=3,ce(g,!0,-1)):j&&M(g,"directives end mark is expected"),le(g,g.lineIndent-1,p,!1,!0),ce(g,!0,-1),g.checkLineBreaks&&y.test(g.input.slice(O,g.position))&&te(g,"non-ASCII line breaks are interpreted as content"),g.documents.push(g.result),g.position===g.lineStart&&he(g)){g.input.charCodeAt(g.position)===46&&(g.position+=3,ce(g,!0,-1));return}g.position<g.length-1&&M(g,"end of the stream or a document separator is expected")}function _e(g,O){g=String(g),O=O||{},g.length!==0&&(g.charCodeAt(g.length-1)!==10&&g.charCodeAt(g.length-1)!==13&&(g+=`
33
33
  `),g.charCodeAt(0)===65279&&(g=g.slice(1)));const j=new Y(g,O),W=g.indexOf("\0");for(W!==-1&&(j.position=W,M(j,"null byte is not allowed in input")),j.input+="\0";j.input.charCodeAt(j.position)===32;)j.lineIndent+=1,j.position+=1;for(;j.position<j.length-1;)de(j);return j.documents}function xe(g,O,j){O!==null&&typeof O=="object"&&typeof j>"u"&&(j=O,O=null);const W=_e(g,j);if(typeof O!="function")return W;for(let ae=0,be=W.length;ae<be;ae+=1)O(W[ae])}function Ne(g,O){const j=_e(g,O);if(j.length!==0){if(j.length===1)return j[0];throw new o("expected a single document in the stream, but found more")}}t.exports.loadAll=xe,t.exports.load=Ne}),JO=Tt((n,t)=>{var r=Ka(),o=qa(),i=vf(),a=Object.prototype.toString,s=Object.prototype.hasOwnProperty,c=65279,l=9,u=10,p=13,d=32,f=33,m=34,h=35,y=37,b=38,_=39,k=42,C=44,N=45,E=58,w=61,S=62,I=63,U=64,x=91,A=93,T=96,V=123,R=124,X=125,Y={};Y[0]="\\0",Y[7]="\\a",Y[8]="\\b",Y[9]="\\t",Y[10]="\\n",Y[11]="\\v",Y[12]="\\f",Y[13]="\\r",Y[27]="\\e",Y[34]='\\"',Y[92]="\\\\",Y[133]="\\N",Y[160]="\\_",Y[8232]="\\L",Y[8233]="\\P";var ne=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],M=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function te(L,ge){if(ge===null)return{};const Ee={},ue=Object.keys(ge);for(let P=0,z=ue.length;P<z;P+=1){let D=ue[P],pe=String(ge[D]);D.slice(0,2)==="!!"&&(D="tag:yaml.org,2002:"+D.slice(2));const we=L.compiledTypeMap.fallback[D];we&&s.call(we.styleAliases,pe)&&(pe=we.styleAliases[pe]),Ee[D]=pe}return Ee}function $(L){let ge,Ee;const ue=L.toString(16).toUpperCase();if(L<=255)ge="x",Ee=2;else if(L<=65535)ge="u",Ee=4;else if(L<=4294967295)ge="U",Ee=8;else throw new o("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+ge+r.repeat("0",Ee-ue.length)+ue}var Z=1,F=2;function J(L){this.schema=L.schema||i,this.indent=Math.max(1,L.indent||2),this.noArrayIndent=L.noArrayIndent||!1,this.skipInvalid=L.skipInvalid||!1,this.flowLevel=r.isNothing(L.flowLevel)?-1:L.flowLevel,this.styleMap=te(this.schema,L.styles||null),this.sortKeys=L.sortKeys||!1,this.lineWidth=L.lineWidth||80,this.noRefs=L.noRefs||!1,this.noCompatMode=L.noCompatMode||!1,this.condenseFlow=L.condenseFlow||!1,this.quotingType=L.quotingType==='"'?F:Z,this.forceQuotes=L.forceQuotes||!1,this.replacer=typeof L.replacer=="function"?L.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function G(L,ge){const Ee=r.repeat(" ",ge);let ue=0,P="";const z=L.length;for(;ue<z;){let D;const pe=L.indexOf(`
34
34
  `,ue);pe===-1?(D=L.slice(ue),ue=z):(D=L.slice(ue,pe+1),ue=pe+1),D.length&&D!==`
35
35
  `&&(P+=Ee),P+=D}return P}function v(L,ge){return`
36
- `+r.repeat(" ",L.indent*ge)}function q(L,ge){for(let Ee=0,ue=L.implicitTypes.length;Ee<ue;Ee+=1)if(L.implicitTypes[Ee].resolve(ge))return!0;return!1}function ie(L){return L===d||L===l}function oe(L){return L>=32&&L<=126||L>=161&&L<=55295&&L!==8232&&L!==8233||L>=57344&&L<=65533&&L!==c||L>=65536&&L<=1114111}function ke(L){return oe(L)&&L!==c&&L!==p&&L!==u}function ye(L,ge,Ee){const ue=ke(L),P=ue&&!ie(L);return(Ee?ue:ue&&L!==C&&L!==x&&L!==A&&L!==V&&L!==X)&&L!==h&&!(ge===E&&!P)||ke(ge)&&!ie(ge)&&L===h||ge===E&&P}function ce(L){return oe(L)&&L!==c&&!ie(L)&&L!==N&&L!==I&&L!==E&&L!==C&&L!==x&&L!==A&&L!==V&&L!==X&&L!==h&&L!==b&&L!==k&&L!==f&&L!==R&&L!==w&&L!==S&&L!==_&&L!==m&&L!==y&&L!==U&&L!==T}function he(L){return!ie(L)&&L!==E}function Oe(L,ge){const Ee=L.charCodeAt(ge);let ue;return Ee>=55296&&Ee<=56319&&ge+1<L.length&&(ue=L.charCodeAt(ge+1),ue>=56320&&ue<=57343)?(Ee-55296)*1024+ue-56320+65536:Ee}function De(L){return/^\n* /.test(L)}var Be=1,qe=2,We=3,nt=4,lt=5;function Re(L,ge,Ee,ue,P,z,D,pe){let we,Se=0,Ve=null,Me=!1,Ze=!1;const Ye=ue!==-1;let Te=-1,Ae=ce(Oe(L,0))&&he(Oe(L,L.length-1));if(ge||D)for(we=0;we<L.length;Se>=65536?we+=2:we++){if(Se=Oe(L,we),!oe(Se))return lt;Ae=Ae&&ye(Se,Ve,pe),Ve=Se}else{for(we=0;we<L.length;Se>=65536?we+=2:we++){if(Se=Oe(L,we),Se===u)Me=!0,Ye&&(Ze=Ze||we-Te-1>ue&&L[Te+1]!==" ",Te=we);else if(!oe(Se))return lt;Ae=Ae&&ye(Se,Ve,pe),Ve=Se}Ze=Ze||Ye&&we-Te-1>ue&&L[Te+1]!==" "}return!Me&&!Ze?Ae&&!D&&!P(L)?Be:z===F?lt:qe:Ee>9&&De(L)?lt:D?z===F?lt:qe:Ze?nt:We}function Ce(L,ge,Ee,ue,P){L.dump=function(){if(ge.length===0)return L.quotingType===F?'""':"''";if(!L.noCompatMode&&(ne.indexOf(ge)!==-1||M.test(ge)))return L.quotingType===F?'"'+ge+'"':"'"+ge+"'";const z=L.indent*Math.max(1,Ee),D=L.lineWidth===-1?-1:Math.max(Math.min(L.lineWidth,40),L.lineWidth-z),pe=ue||L.flowLevel>-1&&Ee>=L.flowLevel;function we(Se){return q(L,Se)}switch(Re(ge,pe,L.indent,D,we,L.quotingType,L.forceQuotes&&!ue,P)){case Be:return ge;case qe:return"'"+ge.replace(/'/g,"''")+"'";case We:return"|"+se(ge,L.indent)+re(G(ge,z));case nt:return">"+se(ge,L.indent)+re(G(Q(ge,D),z));case lt:return'"'+de(ge)+'"';default:throw new o("impossible error: invalid scalar style")}}()}function se(L,ge){const Ee=De(L)?String(ge):"",ue=L[L.length-1]===`
36
+ `+r.repeat(" ",L.indent*ge)}function q(L,ge){for(let Ee=0,ue=L.implicitTypes.length;Ee<ue;Ee+=1)if(L.implicitTypes[Ee].resolve(ge))return!0;return!1}function ie(L){return L===d||L===l}function oe(L){return L>=32&&L<=126||L>=161&&L<=55295&&L!==8232&&L!==8233||L>=57344&&L<=65533&&L!==c||L>=65536&&L<=1114111}function ke(L){return oe(L)&&L!==c&&L!==p&&L!==u}function ye(L,ge,Ee){const ue=ke(L),P=ue&&!ie(L);return(Ee?ue:ue&&L!==C&&L!==x&&L!==A&&L!==V&&L!==X)&&L!==h&&!(ge===E&&!P)||ke(ge)&&!ie(ge)&&L===h||ge===E&&P}function ce(L){return oe(L)&&L!==c&&!ie(L)&&L!==N&&L!==I&&L!==E&&L!==C&&L!==x&&L!==A&&L!==V&&L!==X&&L!==h&&L!==b&&L!==k&&L!==f&&L!==R&&L!==w&&L!==S&&L!==_&&L!==m&&L!==y&&L!==U&&L!==T}function he(L){return!ie(L)&&L!==E}function Oe(L,ge){const Ee=L.charCodeAt(ge);let ue;return Ee>=55296&&Ee<=56319&&ge+1<L.length&&(ue=L.charCodeAt(ge+1),ue>=56320&&ue<=57343)?(Ee-55296)*1024+ue-56320+65536:Ee}function De(L){return/^\n* /.test(L)}var Be=1,Ge=2,We=3,nt=4,lt=5;function Re(L,ge,Ee,ue,P,z,D,pe){let we,Se=0,Ve=null,Me=!1,Ze=!1;const Ye=ue!==-1;let Te=-1,Ae=ce(Oe(L,0))&&he(Oe(L,L.length-1));if(ge||D)for(we=0;we<L.length;Se>=65536?we+=2:we++){if(Se=Oe(L,we),!oe(Se))return lt;Ae=Ae&&ye(Se,Ve,pe),Ve=Se}else{for(we=0;we<L.length;Se>=65536?we+=2:we++){if(Se=Oe(L,we),Se===u)Me=!0,Ye&&(Ze=Ze||we-Te-1>ue&&L[Te+1]!==" ",Te=we);else if(!oe(Se))return lt;Ae=Ae&&ye(Se,Ve,pe),Ve=Se}Ze=Ze||Ye&&we-Te-1>ue&&L[Te+1]!==" "}return!Me&&!Ze?Ae&&!D&&!P(L)?Be:z===F?lt:Ge:Ee>9&&De(L)?lt:D?z===F?lt:Ge:Ze?nt:We}function Ce(L,ge,Ee,ue,P){L.dump=function(){if(ge.length===0)return L.quotingType===F?'""':"''";if(!L.noCompatMode&&(ne.indexOf(ge)!==-1||M.test(ge)))return L.quotingType===F?'"'+ge+'"':"'"+ge+"'";const z=L.indent*Math.max(1,Ee),D=L.lineWidth===-1?-1:Math.max(Math.min(L.lineWidth,40),L.lineWidth-z),pe=ue||L.flowLevel>-1&&Ee>=L.flowLevel;function we(Se){return q(L,Se)}switch(Re(ge,pe,L.indent,D,we,L.quotingType,L.forceQuotes&&!ue,P)){case Be:return ge;case Ge:return"'"+ge.replace(/'/g,"''")+"'";case We:return"|"+se(ge,L.indent)+re(G(ge,z));case nt:return">"+se(ge,L.indent)+re(G(Q(ge,D),z));case lt:return'"'+de(ge)+'"';default:throw new o("impossible error: invalid scalar style")}}()}function se(L,ge){const Ee=De(L)?String(ge):"",ue=L[L.length-1]===`
37
37
  `;return Ee+(ue&&(L[L.length-2]===`
38
38
  `||L===`
39
39
  `)?"+":ue?"":"-")+`
@@ -45,7 +45,7 @@ ${I}`)}if(N.has(w))return;N.add(w),E.push(w);const S=_.dependencies[w];if(S){con
45
45
  `+L.slice(P,z),P=z+1),D=pe;return we+=`
46
46
  `,L.length-P>ge&&D>P?we+=L.slice(P,D)+`
47
47
  `+L.slice(D+1):we+=L.slice(P),we.slice(1)}function de(L){let ge="",Ee=0;for(let ue=0;ue<L.length;Ee>=65536?ue+=2:ue++){Ee=Oe(L,ue);const P=Y[Ee];!P&&oe(Ee)?(ge+=L[ue],Ee>=65536&&(ge+=L[ue+1])):ge+=P||$(Ee)}return ge}function _e(L,ge,Ee){let ue="";const P=L.tag;for(let z=0,D=Ee.length;z<D;z+=1){let pe=Ee[z];L.replacer&&(pe=L.replacer.call(Ee,String(z),pe)),(j(L,ge,pe,!1,!1)||typeof pe>"u"&&j(L,ge,null,!1,!1))&&(ue!==""&&(ue+=","+(L.condenseFlow?"":" ")),ue+=L.dump)}L.tag=P,L.dump="["+ue+"]"}function xe(L,ge,Ee,ue){let P="";const z=L.tag;for(let D=0,pe=Ee.length;D<pe;D+=1){let we=Ee[D];L.replacer&&(we=L.replacer.call(Ee,String(D),we)),(j(L,ge+1,we,!0,!0,!1,!0)||typeof we>"u"&&j(L,ge+1,null,!0,!0,!1,!0))&&((!ue||P!=="")&&(P+=v(L,ge)),L.dump&&u===L.dump.charCodeAt(0)?P+="-":P+="- ",P+=L.dump)}L.tag=z,L.dump=P||"[]"}function Ne(L,ge,Ee){let ue="";const P=L.tag,z=Object.keys(Ee);for(let D=0,pe=z.length;D<pe;D+=1){let we="";ue!==""&&(we+=", "),L.condenseFlow&&(we+='"');const Se=z[D];let Ve=Ee[Se];L.replacer&&(Ve=L.replacer.call(Ee,Se,Ve)),j(L,ge,Se,!1,!1)&&(L.dump.length>1024&&(we+="? "),we+=L.dump+(L.condenseFlow?'"':"")+":"+(L.condenseFlow?"":" "),j(L,ge,Ve,!1,!1)&&(we+=L.dump,ue+=we))}L.tag=P,L.dump="{"+ue+"}"}function g(L,ge,Ee,ue){let P="";const z=L.tag,D=Object.keys(Ee);if(L.sortKeys===!0)D.sort();else if(typeof L.sortKeys=="function")D.sort(L.sortKeys);else if(L.sortKeys)throw new o("sortKeys must be a boolean or a function");for(let pe=0,we=D.length;pe<we;pe+=1){let Se="";(!ue||P!=="")&&(Se+=v(L,ge));const Ve=D[pe];let Me=Ee[Ve];if(L.replacer&&(Me=L.replacer.call(Ee,Ve,Me)),!j(L,ge+1,Ve,!0,!0,!0))continue;const Ze=L.tag!==null&&L.tag!=="?"||L.dump&&L.dump.length>1024;Ze&&(L.dump&&u===L.dump.charCodeAt(0)?Se+="?":Se+="? "),Se+=L.dump,Ze&&(Se+=v(L,ge)),j(L,ge+1,Me,!0,Ze)&&(L.dump&&u===L.dump.charCodeAt(0)?Se+=":":Se+=": ",Se+=L.dump,P+=Se)}L.tag=z,L.dump=P||"{}"}function O(L,ge,Ee){const ue=Ee?L.explicitTypes:L.implicitTypes;for(let P=0,z=ue.length;P<z;P+=1){const D=ue[P];if((D.instanceOf||D.predicate)&&(!D.instanceOf||typeof ge=="object"&&ge instanceof D.instanceOf)&&(!D.predicate||D.predicate(ge))){if(Ee?D.multi&&D.representName?L.tag=D.representName(ge):L.tag=D.tag:L.tag="?",D.represent){const pe=L.styleMap[D.tag]||D.defaultStyle;let we;if(a.call(D.represent)==="[object Function]")we=D.represent(ge,pe);else if(s.call(D.represent,pe))we=D.represent[pe](ge,pe);else throw new o("!<"+D.tag+'> tag resolver accepts not "'+pe+'" style');L.dump=we}return!0}}return!1}function j(L,ge,Ee,ue,P,z,D){L.tag=null,L.dump=Ee,O(L,Ee,!1)||O(L,Ee,!0);const pe=a.call(L.dump),we=ue;ue&&(ue=L.flowLevel<0||L.flowLevel>ge);const Se=pe==="[object Object]"||pe==="[object Array]";let Ve,Me;if(Se&&(Ve=L.duplicates.indexOf(Ee),Me=Ve!==-1),(L.tag!==null&&L.tag!=="?"||Me||L.indent!==2&&ge>0)&&(P=!1),Me&&L.usedDuplicates[Ve])L.dump="*ref_"+Ve;else{if(Se&&Me&&!L.usedDuplicates[Ve]&&(L.usedDuplicates[Ve]=!0),pe==="[object Object]")ue&&Object.keys(L.dump).length!==0?(g(L,ge,L.dump,P),Me&&(L.dump="&ref_"+Ve+L.dump)):(Ne(L,ge,L.dump),Me&&(L.dump="&ref_"+Ve+" "+L.dump));else if(pe==="[object Array]")ue&&L.dump.length!==0?(L.noArrayIndent&&!D&&ge>0?xe(L,ge-1,L.dump,P):xe(L,ge,L.dump,P),Me&&(L.dump="&ref_"+Ve+L.dump)):(_e(L,ge,L.dump),Me&&(L.dump="&ref_"+Ve+" "+L.dump));else if(pe==="[object String]")L.tag!=="?"&&Ce(L,L.dump,ge,z,we);else{if(pe==="[object Undefined]")return!1;if(L.skipInvalid)return!1;throw new o("unacceptable kind of an object to dump "+pe)}if(L.tag!==null&&L.tag!=="?"){let Ze=encodeURI(L.tag[0]==="!"?L.tag.slice(1):L.tag).replace(/!/g,"%21");L.tag[0]==="!"?Ze="!"+Ze:Ze.slice(0,18)==="tag:yaml.org,2002:"?Ze="!!"+Ze.slice(18):Ze="!<"+Ze+">",L.dump=Ze+" "+L.dump}}return!0}function W(L,ge){const Ee=[],ue=[];ae(L,Ee,ue);const P=ue.length;for(let z=0;z<P;z+=1)ge.duplicates.push(Ee[ue[z]]);ge.usedDuplicates=new Array(P)}function ae(L,ge,Ee){if(L!==null&&typeof L=="object"){const ue=ge.indexOf(L);if(ue!==-1)Ee.indexOf(ue)===-1&&Ee.push(ue);else if(ge.push(L),Array.isArray(L))for(let P=0,z=L.length;P<z;P+=1)ae(L[P],ge,Ee);else{const P=Object.keys(L);for(let z=0,D=P.length;z<D;z+=1)ae(L[P[z]],ge,Ee)}}}function be(L,ge){ge=ge||{};const Ee=new J(ge);Ee.noRefs||W(L,Ee);let ue=L;return Ee.replacer&&(ue=Ee.replacer.call({"":ue},"",ue)),j(Ee,0,ue,!0,!0)?Ee.dump+`
48
- `:""}t.exports.dump=be}),eb=zO(Tt((n,t)=>{var r=YO(),o=JO();function i(a,s){return function(){throw new Error("Function yaml."+a+" is removed in js-yaml 4. Use yaml."+s+" instead, which is now safe by default.")}}t.exports.Type=cn(),t.exports.Schema=L_(),t.exports.FAILSAFE_SCHEMA=F_(),t.exports.JSON_SCHEMA=H_(),t.exports.CORE_SCHEMA=z_(),t.exports.DEFAULT_SCHEMA=vf(),t.exports.load=r.load,t.exports.loadAll=r.loadAll,t.exports.dump=o.dump,t.exports.YAMLException=qa(),t.exports.types={binary:J_(),float:G_(),map:j_(),null:U_(),pairs:Z_(),set:Q_(),timestamp:W_(),bool:K_(),int:q_(),merge:Y_(),omap:X_(),seq:M_(),str:D_()},t.exports.safeLoad=i("safeLoad","load"),t.exports.safeLoadAll=i("safeLoadAll","loadAll"),t.exports.safeDump=i("safeDump","dump")})()),{Type:Jq,Schema:Xq,FAILSAFE_SCHEMA:Zq,JSON_SCHEMA:xo,CORE_SCHEMA:Qq,DEFAULT_SCHEMA:e3,load:t3,loadAll:n3,dump:r3,YAMLException:o3,types:i3,safeLoad:a3,safeLoadAll:s3,safeDump:l3}=eb.default,Ln=eb.default;const XO=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function Or(){return{lenses:[],dispose:()=>{}}}function ZO(n,t,r){return{range:t,command:{id:r.copyCommandId,title:typeof r.title=="function"?r.title(n):r.title??`$(copy) Copy UUID ${n.substring(0,8)}...`,arguments:[r.formatValue?r.formatValue(n):n]}}}async function QO(n){const t=n.getLanguageId(),r=n.getAlternativeVersionId();switch(t){case"json":{const o=n.getValue(),{parseIntoJSONContext:i}=await Promise.resolve().then(()=>jU);return i(o,r)}case"yaml":{const o=n.getValue(),{parseIntoYAMLContext:i}=await Promise.resolve().then(()=>_V);return i(o,r)}}return{isDefault:!0,language:t,altVersionId:r}}const If=new WeakMap,Bf=new WeakMap,Wl=new WeakMap;function eP(n){return`${n.getLanguageId()}\0${n.getAlternativeVersionId()}`}async function tP(n){let t=If.get(n);t||(t=new Map,If.set(n,t));const r=eP(n);let o=t.get(r);return o||(o=await QO(n),t.set(r,o)),o}async function tb(n){if(Wl.has(n))return Wl.get(n);const t=(async()=>(Bf.has(n)||Bf.set(n,n.onWillDispose(()=>{nP(n)})),tP(n)))().finally(()=>{Wl.delete(n)});return Wl.set(n,t),t}function nP(n){If.delete(n),Bf.delete(n)}const Tf=Symbol.for("yaml.alias"),Of=Symbol.for("yaml.document"),to=Symbol.for("yaml.map"),nb=Symbol.for("yaml.pair"),mr=Symbol.for("yaml.scalar"),yi=Symbol.for("yaml.seq"),Dn=Symbol.for("yaml.node.type"),_i=n=>!!n&&typeof n=="object"&&n[Dn]===Tf,Yl=n=>!!n&&typeof n=="object"&&n[Dn]===Of,bi=n=>!!n&&typeof n=="object"&&n[Dn]===to,Mt=n=>!!n&&typeof n=="object"&&n[Dn]===nb,Et=n=>!!n&&typeof n=="object"&&n[Dn]===mr,wi=n=>!!n&&typeof n=="object"&&n[Dn]===yi;function Kt(n){if(n&&typeof n=="object")switch(n[Dn]){case to:case yi:return!0}return!1}function St(n){if(n&&typeof n=="object")switch(n[Dn]){case Tf:case to:case mr:case yi:return!0}return!1}const rb=n=>(Et(n)||Kt(n))&&!!n.anchor,Ao=Symbol("break visit"),rP=Symbol("skip children"),Ga=Symbol("remove node");function ki(n,t){const r=oP(t);Yl(n)?Ci(null,n.contents,r,Object.freeze([n]))===Ga&&(n.contents=null):Ci(null,n,r,Object.freeze([]))}ki.BREAK=Ao,ki.SKIP=rP,ki.REMOVE=Ga;function Ci(n,t,r,o){const i=iP(n,t,r,o);if(St(i)||Mt(i))return aP(n,o,i),Ci(n,i,r,o);if(typeof i!="symbol"){if(Kt(t)){o=Object.freeze(o.concat(t));for(let a=0;a<t.items.length;++a){const s=Ci(a,t.items[a],r,o);if(typeof s=="number")a=s-1;else{if(s===Ao)return Ao;s===Ga&&(t.items.splice(a,1),a-=1)}}}else if(Mt(t)){o=Object.freeze(o.concat(t));const a=Ci("key",t.key,r,o);if(a===Ao)return Ao;a===Ga&&(t.key=null);const s=Ci("value",t.value,r,o);if(s===Ao)return Ao;s===Ga&&(t.value=null)}}return i}function oP(n){return typeof n=="object"&&(n.Collection||n.Node||n.Value)?Object.assign({Alias:n.Node,Map:n.Node,Scalar:n.Node,Seq:n.Node},n.Value&&{Map:n.Value,Scalar:n.Value,Seq:n.Value},n.Collection&&{Map:n.Collection,Seq:n.Collection},n):n}function iP(n,t,r,o){var i,a,s,c,l;if(typeof r=="function")return r(n,t,o);if(bi(t))return(i=r.Map)==null?void 0:i.call(r,n,t,o);if(wi(t))return(a=r.Seq)==null?void 0:a.call(r,n,t,o);if(Mt(t))return(s=r.Pair)==null?void 0:s.call(r,n,t,o);if(Et(t))return(c=r.Scalar)==null?void 0:c.call(r,n,t,o);if(_i(t))return(l=r.Alias)==null?void 0:l.call(r,n,t,o)}function aP(n,t,r){const o=t[t.length-1];if(Kt(o))o.items[n]=r;else if(Mt(o))n==="key"?o.key=r:o.value=r;else if(Yl(o))o.contents=r;else{const i=_i(o)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}const sP={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},lP=n=>n.replace(/[!,[\]{}]/g,t=>sP[t]);class un{constructor(t,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},un.defaultYaml,t),this.tags=Object.assign({},un.defaultTags,r)}clone(){const t=new un(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new un(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:un.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},un.defaultTags);break}return t}add(t,r){this.atNextDocument&&(this.yaml={explicit:un.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},un.defaultTags),this.atNextDocument=!1);const o=t.trim().split(/[ \t]+/),i=o.shift();switch(i){case"%TAG":{if(o.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),o.length<2))return!1;const[a,s]=o;return this.tags[a]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,o.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;const[a]=o;if(a==="1.1"||a==="1.2")return this.yaml.version=a,!0;{const s=/^\d+\.\d+$/.test(a);return r(6,`Unsupported YAML version ${a}`,s),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(t,r){if(t==="!")return"!";if(t[0]!=="!")return r(`Not a valid tag: ${t}`),null;if(t[1]==="<"){const s=t.slice(2,-1);return s==="!"||s==="!!"?(r(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&r("Verbatim tags must end with a >"),s)}const[,o,i]=t.match(/^(.*!)([^!]*)$/s);i||r(`The ${t} tag has no suffix`);const a=this.tags[o];if(a)try{return a+decodeURIComponent(i)}catch(s){return r(String(s)),null}return o==="!"?t:(r(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[r,o]of Object.entries(this.tags))if(t.startsWith(o))return r+lP(t.substring(o.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],o=Object.entries(this.tags);let i;if(t&&o.length>0&&St(t.contents)){const a={};ki(t.contents,(s,c)=>{St(c)&&c.tag&&(a[c.tag]=!0)}),i=Object.keys(a)}else i=[];for(const[a,s]of o)a==="!!"&&s==="tag:yaml.org,2002:"||(!t||i.some(c=>c.startsWith(s)))&&r.push(`%TAG ${a} ${s}`);return r.join(`
48
+ `:""}t.exports.dump=be}),eb=zO(Tt((n,t)=>{var r=YO(),o=JO();function i(a,s){return function(){throw new Error("Function yaml."+a+" is removed in js-yaml 4. Use yaml."+s+" instead, which is now safe by default.")}}t.exports.Type=cn(),t.exports.Schema=L_(),t.exports.FAILSAFE_SCHEMA=F_(),t.exports.JSON_SCHEMA=H_(),t.exports.CORE_SCHEMA=z_(),t.exports.DEFAULT_SCHEMA=vf(),t.exports.load=r.load,t.exports.loadAll=r.loadAll,t.exports.dump=o.dump,t.exports.YAMLException=qa(),t.exports.types={binary:J_(),float:G_(),map:j_(),null:U_(),pairs:Z_(),set:Q_(),timestamp:W_(),bool:K_(),int:q_(),merge:Y_(),omap:X_(),seq:M_(),str:D_()},t.exports.safeLoad=i("safeLoad","load"),t.exports.safeLoadAll=i("safeLoadAll","loadAll"),t.exports.safeDump=i("safeDump","dump")})()),{Type:t3,Schema:n3,FAILSAFE_SCHEMA:r3,JSON_SCHEMA:xo,CORE_SCHEMA:o3,DEFAULT_SCHEMA:i3,load:a3,loadAll:s3,dump:l3,YAMLException:c3,types:u3,safeLoad:d3,safeLoadAll:f3,safeDump:p3}=eb.default,Ln=eb.default;const XO=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function Or(){return{lenses:[],dispose:()=>{}}}function ZO(n,t,r){return{range:t,command:{id:r.copyCommandId,title:typeof r.title=="function"?r.title(n):r.title??`$(copy) Copy UUID ${n.substring(0,8)}...`,arguments:[r.formatValue?r.formatValue(n):n]}}}async function QO(n){const t=n.getLanguageId(),r=n.getAlternativeVersionId();switch(t){case"json":{const o=n.getValue(),{parseIntoJSONContext:i}=await Promise.resolve().then(()=>GU);return i(o,r)}case"yaml":{const o=n.getValue(),{parseIntoYAMLContext:i}=await Promise.resolve().then(()=>_V);return i(o,r)}}return{isDefault:!0,language:t,altVersionId:r}}const If=new WeakMap,Bf=new WeakMap,Wl=new WeakMap;function eP(n){return`${n.getLanguageId()}\0${n.getAlternativeVersionId()}`}async function tP(n){let t=If.get(n);t||(t=new Map,If.set(n,t));const r=eP(n);let o=t.get(r);return o||(o=await QO(n),t.set(r,o)),o}async function tb(n){if(Wl.has(n))return Wl.get(n);const t=(async()=>(Bf.has(n)||Bf.set(n,n.onWillDispose(()=>{nP(n)})),tP(n)))().finally(()=>{Wl.delete(n)});return Wl.set(n,t),t}function nP(n){If.delete(n),Bf.delete(n)}const Tf=Symbol.for("yaml.alias"),Of=Symbol.for("yaml.document"),to=Symbol.for("yaml.map"),nb=Symbol.for("yaml.pair"),mr=Symbol.for("yaml.scalar"),yi=Symbol.for("yaml.seq"),Dn=Symbol.for("yaml.node.type"),_i=n=>!!n&&typeof n=="object"&&n[Dn]===Tf,Yl=n=>!!n&&typeof n=="object"&&n[Dn]===Of,bi=n=>!!n&&typeof n=="object"&&n[Dn]===to,Mt=n=>!!n&&typeof n=="object"&&n[Dn]===nb,Et=n=>!!n&&typeof n=="object"&&n[Dn]===mr,wi=n=>!!n&&typeof n=="object"&&n[Dn]===yi;function Kt(n){if(n&&typeof n=="object")switch(n[Dn]){case to:case yi:return!0}return!1}function St(n){if(n&&typeof n=="object")switch(n[Dn]){case Tf:case to:case mr:case yi:return!0}return!1}const rb=n=>(Et(n)||Kt(n))&&!!n.anchor,Ao=Symbol("break visit"),rP=Symbol("skip children"),Ga=Symbol("remove node");function ki(n,t){const r=oP(t);Yl(n)?Ci(null,n.contents,r,Object.freeze([n]))===Ga&&(n.contents=null):Ci(null,n,r,Object.freeze([]))}ki.BREAK=Ao,ki.SKIP=rP,ki.REMOVE=Ga;function Ci(n,t,r,o){const i=iP(n,t,r,o);if(St(i)||Mt(i))return aP(n,o,i),Ci(n,i,r,o);if(typeof i!="symbol"){if(Kt(t)){o=Object.freeze(o.concat(t));for(let a=0;a<t.items.length;++a){const s=Ci(a,t.items[a],r,o);if(typeof s=="number")a=s-1;else{if(s===Ao)return Ao;s===Ga&&(t.items.splice(a,1),a-=1)}}}else if(Mt(t)){o=Object.freeze(o.concat(t));const a=Ci("key",t.key,r,o);if(a===Ao)return Ao;a===Ga&&(t.key=null);const s=Ci("value",t.value,r,o);if(s===Ao)return Ao;s===Ga&&(t.value=null)}}return i}function oP(n){return typeof n=="object"&&(n.Collection||n.Node||n.Value)?Object.assign({Alias:n.Node,Map:n.Node,Scalar:n.Node,Seq:n.Node},n.Value&&{Map:n.Value,Scalar:n.Value,Seq:n.Value},n.Collection&&{Map:n.Collection,Seq:n.Collection},n):n}function iP(n,t,r,o){var i,a,s,c,l;if(typeof r=="function")return r(n,t,o);if(bi(t))return(i=r.Map)==null?void 0:i.call(r,n,t,o);if(wi(t))return(a=r.Seq)==null?void 0:a.call(r,n,t,o);if(Mt(t))return(s=r.Pair)==null?void 0:s.call(r,n,t,o);if(Et(t))return(c=r.Scalar)==null?void 0:c.call(r,n,t,o);if(_i(t))return(l=r.Alias)==null?void 0:l.call(r,n,t,o)}function aP(n,t,r){const o=t[t.length-1];if(Kt(o))o.items[n]=r;else if(Mt(o))n==="key"?o.key=r:o.value=r;else if(Yl(o))o.contents=r;else{const i=_i(o)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}const sP={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},lP=n=>n.replace(/[!,[\]{}]/g,t=>sP[t]);class un{constructor(t,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},un.defaultYaml,t),this.tags=Object.assign({},un.defaultTags,r)}clone(){const t=new un(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new un(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:un.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},un.defaultTags);break}return t}add(t,r){this.atNextDocument&&(this.yaml={explicit:un.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},un.defaultTags),this.atNextDocument=!1);const o=t.trim().split(/[ \t]+/),i=o.shift();switch(i){case"%TAG":{if(o.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),o.length<2))return!1;const[a,s]=o;return this.tags[a]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,o.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;const[a]=o;if(a==="1.1"||a==="1.2")return this.yaml.version=a,!0;{const s=/^\d+\.\d+$/.test(a);return r(6,`Unsupported YAML version ${a}`,s),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(t,r){if(t==="!")return"!";if(t[0]!=="!")return r(`Not a valid tag: ${t}`),null;if(t[1]==="<"){const s=t.slice(2,-1);return s==="!"||s==="!!"?(r(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&r("Verbatim tags must end with a >"),s)}const[,o,i]=t.match(/^(.*!)([^!]*)$/s);i||r(`The ${t} tag has no suffix`);const a=this.tags[o];if(a)try{return a+decodeURIComponent(i)}catch(s){return r(String(s)),null}return o==="!"?t:(r(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[r,o]of Object.entries(this.tags))if(t.startsWith(o))return r+lP(t.substring(o.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],o=Object.entries(this.tags);let i;if(t&&o.length>0&&St(t.contents)){const a={};ki(t.contents,(s,c)=>{St(c)&&c.tag&&(a[c.tag]=!0)}),i=Object.keys(a)}else i=[];for(const[a,s]of o)a==="!!"&&s==="tag:yaml.org,2002:"||(!t||i.some(c=>c.startsWith(s)))&&r.push(`%TAG ${a} ${s}`);return r.join(`
49
49
  `)}}un.defaultYaml={explicit:!1,version:"1.2"},un.defaultTags={"!!":"tag:yaml.org,2002:"};function ob(n){if(/[\x00-\x19\s,[\]{}]/.test(n)){const t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(n)}`;throw new Error(t)}return!0}function ib(n){const t=new Set;return ki(n,{Value(r,o){o.anchor&&t.add(o.anchor)}}),t}function ab(n,t){for(let r=1;;++r){const o=`${n}${r}`;if(!t.has(o))return o}}function cP(n,t){const r=[],o=new Map;let i=null;return{onAnchor:a=>{r.push(a),i??(i=ib(n));const s=ab(t,i);return i.add(s),s},setAnchors:()=>{for(const a of r){const s=o.get(a);if(typeof s=="object"&&s.anchor&&(Et(s.node)||Kt(s.node)))s.node.anchor=s.anchor;else{const c=new Error("Failed to resolve repeated object (this should not happen)");throw c.source=a,c}}},sourceObjects:o}}function Ei(n,t,r,o){if(o&&typeof o=="object")if(Array.isArray(o))for(let i=0,a=o.length;i<a;++i){const s=o[i],c=Ei(n,o,String(i),s);c===void 0?delete o[i]:c!==s&&(o[i]=c)}else if(o instanceof Map)for(const i of Array.from(o.keys())){const a=o.get(i),s=Ei(n,o,i,a);s===void 0?o.delete(i):s!==a&&o.set(i,s)}else if(o instanceof Set)for(const i of Array.from(o)){const a=Ei(n,o,i,i);a===void 0?o.delete(i):a!==i&&(o.delete(i),o.add(a))}else for(const[i,a]of Object.entries(o)){const s=Ei(n,o,i,a);s===void 0?delete o[i]:s!==a&&(o[i]=s)}return n.call(t,r,o)}function Mn(n,t,r){if(Array.isArray(n))return n.map((o,i)=>Mn(o,String(i),r));if(n&&typeof n.toJSON=="function"){if(!r||!rb(n))return n.toJSON(t,r);const o={aliasCount:0,count:1,res:void 0};r.anchors.set(n,o),r.onCreate=a=>{o.res=a,delete r.onCreate};const i=n.toJSON(t,r);return r.onCreate&&r.onCreate(i),i}return typeof n=="bigint"&&!(r!=null&&r.keep)?Number(n):n}class Pf{constructor(t){Object.defineProperty(this,Dn,{value:t})}clone(){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:r,maxAliasCount:o,onAnchor:i,reviver:a}={}){if(!Yl(t))throw new TypeError("A document argument is required");const s={anchors:new Map,doc:t,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof o=="number"?o:100},c=Mn(this,"",s);if(typeof i=="function")for(const{count:l,res:u}of s.anchors.values())i(u,l);return typeof a=="function"?Ei(a,{"":c},"",c):c}}class Vf extends Pf{constructor(t){super(Tf),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,r){if((r==null?void 0:r.maxAliasCount)===0)throw new ReferenceError("Alias resolution is disabled");let o;r!=null&&r.aliasResolveCache?o=r.aliasResolveCache:(o=[],ki(t,{Node:(a,s)=>{(_i(s)||rb(s))&&o.push(s)}}),r&&(r.aliasResolveCache=o));let i;for(const a of o){if(a===this)break;a.anchor===this.source&&(i=a)}return i}toJSON(t,r){if(!r)return{source:this.source};const{anchors:o,doc:i,maxAliasCount:a}=r,s=this.resolve(i,r);if(!s){const l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let c=o.get(s);if(c||(Mn(s,null,r),c=o.get(s)),(c==null?void 0:c.res)===void 0){const l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(a>=0&&(c.count+=1,c.aliasCount===0&&(c.aliasCount=Jl(i,s,o)),c.count*c.aliasCount>a)){const l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return c.res}toString(t,r,o){const i=`*${this.source}`;if(t){if(ob(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){const a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(a)}if(t.implicitKey)return`${i} `}return i}}function Jl(n,t,r){if(_i(t)){const o=t.resolve(n),i=r&&o&&r.get(o);return i?i.count*i.aliasCount:0}else if(Kt(t)){let o=0;for(const i of t.items){const a=Jl(n,i,r);a>o&&(o=a)}return o}else if(Mt(t)){const o=Jl(n,t.key,r),i=Jl(n,t.value,r);return Math.max(o,i)}return 1}const sb=n=>!n||typeof n!="function"&&typeof n!="object";class rt extends Pf{constructor(t){super(mr),this.value=t}toJSON(t,r){return r!=null&&r.keep?this.value:Mn(this.value,t,r)}toString(){return String(this.value)}}rt.BLOCK_FOLDED="BLOCK_FOLDED",rt.BLOCK_LITERAL="BLOCK_LITERAL",rt.PLAIN="PLAIN",rt.QUOTE_DOUBLE="QUOTE_DOUBLE",rt.QUOTE_SINGLE="QUOTE_SINGLE";const uP="tag:yaml.org,2002:";function dP(n,t,r){if(t){const o=r.filter(a=>a.tag===t),i=o.find(a=>!a.format)??o[0];if(!i)throw new Error(`Tag ${t} not found`);return i}return r.find(o=>{var i;return((i=o.identify)==null?void 0:i.call(o,n))&&!o.format})}function Ha(n,t,r){var o,i,a;if(Yl(n)&&(n=n.contents),St(n))return n;if(Mt(n)){const h=(i=(o=r.schema[to]).createNode)==null?void 0:i.call(o,r.schema,null,r);return h.items.push(n),h}(n instanceof String||n instanceof Number||n instanceof Boolean||typeof BigInt<"u"&&n instanceof BigInt)&&(n=n.valueOf());const{aliasDuplicateObjects:s,onAnchor:c,onTagObj:l,schema:u,sourceObjects:p}=r;let d;if(s&&n&&typeof n=="object"){if(d=p.get(n),d)return d.anchor??(d.anchor=c(n)),new Vf(d.anchor);d={anchor:null,node:null},p.set(n,d)}t!=null&&t.startsWith("!!")&&(t=uP+t.slice(2));let f=dP(n,t,u.tags);if(!f){if(n&&typeof n.toJSON=="function"&&(n=n.toJSON()),!n||typeof n!="object"){const h=new rt(n);return d&&(d.node=h),h}f=n instanceof Map?u[to]:Symbol.iterator in Object(n)?u[yi]:u[to]}l&&(l(f),delete r.onTagObj);const m=f!=null&&f.createNode?f.createNode(r.schema,n,r):typeof((a=f==null?void 0:f.nodeClass)==null?void 0:a.from)=="function"?f.nodeClass.from(r.schema,n,r):new rt(n);return t?m.tag=t:f.default||(m.tag=f.tag),d&&(d.node=m),m}function Xl(n,t,r){let o=r;for(let i=t.length-1;i>=0;--i){const a=t[i];if(typeof a=="number"&&Number.isInteger(a)&&a>=0){const s=[];s[a]=o,o=s}else o=new Map([[a,o]])}return Ha(o,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:n,sourceObjects:new Map})}const za=n=>n==null||typeof n=="object"&&!!n[Symbol.iterator]().next().done;class lb extends Pf{constructor(t,r){super(t),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(t){const r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(r.schema=t),r.items=r.items.map(o=>St(o)||Mt(o)?o.clone(t):o),this.range&&(r.range=this.range.slice()),r}addIn(t,r){if(za(t))this.add(r);else{const[o,...i]=t,a=this.get(o,!0);if(Kt(a))a.addIn(i,r);else if(a===void 0&&this.schema)this.set(o,Xl(this.schema,i,r));else throw new Error(`Expected YAML collection at ${o}. Remaining path: ${i}`)}}deleteIn(t){const[r,...o]=t;if(o.length===0)return this.delete(r);const i=this.get(r,!0);if(Kt(i))return i.deleteIn(o);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${o}`)}getIn(t,r){const[o,...i]=t,a=this.get(o,!0);return i.length===0?!r&&Et(a)?a.value:a:Kt(a)?a.getIn(i,r):void 0}hasAllNullValues(t){return this.items.every(r=>{if(!Mt(r))return!1;const o=r.value;return o==null||t&&Et(o)&&o.value==null&&!o.commentBefore&&!o.comment&&!o.tag})}hasIn(t){const[r,...o]=t;if(o.length===0)return this.has(r);const i=this.get(r,!0);return Kt(i)?i.hasIn(o):!1}setIn(t,r){const[o,...i]=t;if(i.length===0)this.set(o,r);else{const a=this.get(o,!0);if(Kt(a))a.setIn(i,r);else if(a===void 0&&this.schema)this.set(o,Xl(this.schema,i,r));else throw new Error(`Expected YAML collection at ${o}. Remaining path: ${i}`)}}}const fP=n=>n.replace(/^(?!$)(?: $)?/gm,"#");function Pr(n,t){return/^\n+$/.test(n)?n.substring(1):t?n.replace(/^(?! *$)/gm,t):n}const vo=(n,t,r)=>n.endsWith(`
50
50
  `)?Pr(r,t):r.includes(`
51
51
  `)?`
@@ -175,7 +175,7 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus
175
175
  `)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
176
176
  `,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){var r;const o=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,o.value){const i="end"in o.value?o.value.end:void 0,a=Array.isArray(i)?i[i.length-1]:void 0;(a==null?void 0:a.type)==="comment"?i==null||i.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else o.sep?o.sep.push(this.sourceToken):o.start.push(this.sourceToken);return;case"space":case"comment":if(o.value)t.items.push({start:[this.sourceToken]});else if(o.sep)o.sep.push(this.sourceToken);else{if(this.atIndentedComment(o.start,t.indent)){const i=t.items[t.items.length-2],a=(r=i==null?void 0:i.value)==null?void 0:r.end;if(Array.isArray(a)){gc(a,o.start),a.push(this.sourceToken),t.items.pop();return}}o.start.push(this.sourceToken)}return}if(this.indent>=t.indent){const i=!this.onKeyLine&&this.indent===t.indent,a=i&&(o.sep||o.explicitKey)&&this.type!=="seq-item-ind";let s=[];if(a&&o.sep&&!o.value){const c=[];for(let l=0;l<o.sep.length;++l){const u=o.sep[l];switch(u.type){case"newline":c.push(l);break;case"space":break;case"comment":u.indent>t.indent&&(c.length=0);break;default:c.length=0}}c.length>=2&&(s=o.sep.splice(c[1]))}switch(this.type){case"anchor":case"tag":a||o.value?(s.push(this.sourceToken),t.items.push({start:s}),this.onKeyLine=!0):o.sep?o.sep.push(this.sourceToken):o.start.push(this.sourceToken);return;case"explicit-key-ind":!o.sep&&!o.explicitKey?(o.start.push(this.sourceToken),o.explicitKey=!0):a||o.value?(s.push(this.sourceToken),t.items.push({start:s,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(o.explicitKey)if(o.sep)if(o.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(no(o.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]});else if(Wb(o.key)&&!no(o.sep,"newline")){const c=Oi(o.start),l=o.key,u=o.sep;u.push(this.sourceToken),delete o.key,delete o.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:c,key:l,sep:u}]})}else s.length>0?o.sep=o.sep.concat(s,this.sourceToken):o.sep.push(this.sourceToken);else if(no(o.start,"newline"))Object.assign(o,{key:null,sep:[this.sourceToken]});else{const c=Oi(o.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:c,key:null,sep:[this.sourceToken]}]})}else o.sep?o.value||a?t.items.push({start:s,key:null,sep:[this.sourceToken]}):no(o.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):o.sep.push(this.sourceToken):Object.assign(o,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const c=this.flowScalar(this.type);a||o.value?(t.items.push({start:s,key:c,sep:[]}),this.onKeyLine=!0):o.sep?this.stack.push(c):(Object.assign(o,{key:c,sep:[]}),this.onKeyLine=!0);return}default:{const c=this.startBlockValue(t);if(c){if(c.type==="block-seq"){if(!o.explicitKey&&o.sep&&!no(o.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else i&&t.items.push({start:s});this.stack.push(c);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){var r;const o=t.items[t.items.length-1];switch(this.type){case"newline":if(o.value){const i="end"in o.value?o.value.end:void 0,a=Array.isArray(i)?i[i.length-1]:void 0;(a==null?void 0:a.type)==="comment"?i==null||i.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else o.start.push(this.sourceToken);return;case"space":case"comment":if(o.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(o.start,t.indent)){const i=t.items[t.items.length-2],a=(r=i==null?void 0:i.value)==null?void 0:r.end;if(Array.isArray(a)){gc(a,o.start),a.push(this.sourceToken),t.items.pop();return}}o.start.push(this.sourceToken)}return;case"anchor":case"tag":if(o.value||this.indent<=t.indent)break;o.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;o.value||no(o.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):o.start.push(this.sourceToken);return}if(this.indent>t.indent){const i=this.startBlockValue(t);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){const r=t.items[t.items.length-1];if(this.type==="flow-error-end"){let o;do yield*this.pop(),o=this.peek(1);while((o==null?void 0:o.type)==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?t.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?t.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const i=this.flowScalar(this.type);!r||r.value?t.items.push({start:[],key:i,sep:[]}):r.sep?this.stack.push(i):Object.assign(r,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}const o=this.startBlockValue(t);o?this.stack.push(o):(yield*this.pop(),yield*this.step())}else{const o=this.peek(2);if(o.type==="block-map"&&(this.type==="map-value-ind"&&o.indent===t.indent||this.type==="newline"&&!o.items[o.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&o.type!=="flow-collection"){const i=mc(o),a=Oi(i);Yb(t);const s=t.end.splice(1,t.end.length);s.push(this.sourceToken);const c={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:a,key:t,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=c}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let r=this.source.indexOf(`
177
177
  `)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
178
- `,r)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const r=mc(t),o=Oi(r);return o.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const r=mc(t),o=Oi(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,r){return this.type!=="comment"||this.indent<=r?!1:t.every(o=>o.type==="newline"||o.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function dV(n){const t=n.prettyErrors!==!1;return{lineCounter:n.lineCounter||t&&new cV||null,prettyErrors:t}}function fV(n,t={}){const{lineCounter:r,prettyErrors:o}=dV(t),i=new uV(r==null?void 0:r.addNewLine),a=new oV(t);let s=null;for(const c of a.compose(i.parse(n),!0,n.length))if(!s)s=c;else if(s.options.logLevel!=="silent"){s.errors.push(new Ja(c.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return o&&r&&(s.errors.forEach(Rb(n,r)),s.warnings.forEach(Rb(n,r))),s}function Jb(n,t){const r=n.range;if(!r)return;const o=Math.max(0,r[0]),i=typeof r[1]=="number"?r[1]:typeof r[2]=="number"?r[2]:r[0],a=Math.max(o,i),s=t.getPositionAt(o),c=t.getPositionAt(a);return{startLineNumber:s.lineNumber,startColumn:s.column,endLineNumber:c.lineNumber,endColumn:c.column}}function pV(n){return Et(n)?n.value:n.toJSON()}function mV(n){if(!Et(n))return;const{value:t}=n;return typeof t=="string"||typeof t=="number"?t:void 0}function Xb(n,t){const r=mV(t);return r===void 0?n:[...n,r]}function gV(n,t){const r=[{node:n,keyPath:[]}];for(;r.length>0;){const o=r.pop();if(!o)continue;const{node:i,keyPath:a}=o;if(t(i,a),bi(i)){for(let s=i.items.length-1;s>=0;s--){const c=i.items[s];St(c.value)&&r.push({node:c.value,keyPath:Xb(a,c.key)}),St(c.key)&&r.push({node:c.key,keyPath:a})}continue}if(wi(i))for(let s=i.items.length-1;s>=0;s--){const c=i.items[s],l=[...a,s];if(Mt(c)){St(c.value)&&r.push({node:c.value,keyPath:Xb(l,c.key)}),St(c.key)&&r.push({node:c.key,keyPath:l});continue}St(c)&&r.push({node:c,keyPath:l})}}}function hV(n,t){const r=n.getIn(t,!0);return St(r)?r:void 0}function Zb(n,t){return{provideCodeLenses:async(r,o)=>{if(r.getLanguageId()!=="yaml")return Or();const i=await tb(r);if(i.isDefault||i.language!=="yaml")return Or();const a=i.document,s=a==null?void 0:a.contents;return!a||!s?Or():n(s,r,o)}}}function Qb(n,t){return Zb((r,o,i)=>{const a=[];return gV(r,(s,c)=>{if(i.isCancellationRequested||!Et(s)||typeof s.value!="string"||!XO.test(s.value))return;const l=Jb(s,o);l&&a.push({value:s.value,range:l,context:{keyPath:c,node:s}})}),i.isCancellationRequested?Or():typeof n=="function"?n(a):{lenses:a.map(({value:s,range:c})=>ZO(s,c,n)),dispose:()=>{}}})}function op(n,t,r){return{provideCodeLenses:async(o,i)=>{if(o.getLanguageId()!=="yaml")return Or();const a=await tb(o);if(a.isDefault||a.language!=="yaml"||i.isCancellationRequested)return Or();const s=a.document,c=s==null?void 0:s.contents;if(!s||!c)return Or();const l=hV(s,n);if(!l)return Or();const u=Jb(l,o);return u?t(pV(l),u,{keyPath:n,node:l}):Or()}}}function yV(n,t){const r=fV(n);return{language:"yaml",altVersionId:t,document:r}}const _V=Object.freeze(Object.defineProperty({__proto__:null,createYAMLCodeLensProvider:Zb,createYAMLCopyUUIDCodeLensProvider:Qb,createYAMLValueCodeLensProvider:op,parseIntoYAMLContext:yV},Symbol.toStringTag,{value:"Module"}));let bV="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",wV=(n=21)=>{let t="",r=crypto.getRandomValues(new Uint8Array(n|=0));for(;n--;)t+=bV[r[n]&63];return t};const kV="/v2/control-planes/{controlPlaneId}/core-entities/v1",vn="/v2/control-planes/{controlPlaneId}/core-entities/{workspace}",gr="/v2/control-planes/{controlPlaneId}/core-entities",qt="/{workspace}",tt={list:{konnect:{all:`${vn}/plugins`,forEntity:`${vn}/{entityType}/{entityId}/plugins`},kongManager:{all:`${qt}/plugins`,forEntity:`${qt}/{entityType}/{entityId}/plugins`}},select:{konnect:{availablePlugins:`${kV}/available-plugins`,streamingCustomPlugins:`${gr}/custom-plugins`,clonedPlugins:`${gr}/cloned-plugins`,schemaCustomPluginItem:`${gr}/plugin-schemas/{pluginId}`,streamingCustomPluginItem:`${gr}/custom-plugins/{pluginId}`},kongManager:{availablePlugins:`${qt}/kong`,availablePluginsForOss:"/",streamingCustomPlugins:`${qt}/custom-plugins`,clonedPlugins:`${qt}/cloned-plugins`}},form:{konnect:{create:{all:`${vn}/plugins`,forEntity:`${vn}/{entityType}/{entityId}/plugins`},edit:{all:`${vn}/plugins/{id}`,forEntity:`${vn}/{entityType}/{entityId}/plugins/{id}`},pluginSchema:"/v2/control-planes/{controlPlaneId}/core-entities/schemas/plugins/{plugin}",credential:{create:`${vn}/{resourceEndpoint}`,edit:`${vn}/{resourceEndpoint}/{id}`},credentialSchema:"/v2/control-planes/{controlPlaneId}/core-entities/schemas/{plugin}",entityGetOne:`${vn}/{entity}/{id}`,entityGetAll:`${vn}/{entity}`,entityPeek:`${vn}/{entity}?size={amount}`},kongManager:{create:{all:`${qt}/plugins`,forEntity:`${qt}/{entityType}/{entityId}/plugins`},edit:{all:`${qt}/plugins/{id}`,forEntity:`${qt}/{entityType}/{entityId}/plugins/{id}`},pluginSchema:`${qt}/schemas/plugins/{plugin}`,credential:{create:`${qt}/{resourceEndpoint}`,edit:`${qt}/{resourceEndpoint}/{id}`},credentialSchema:`${qt}/schemas/{plugin}`,entityGetOne:`${qt}/{entity}/{id}`,entityGetAll:`${qt}/{entity}`}},customPlugin:{konnect:{installed:{create:`${gr}/plugin-schemas`,edit:`${gr}/plugin-schemas/{pluginId}`},streamed:{create:`${gr}/custom-plugins`,edit:`${gr}/custom-plugins/{pluginId}`},cloned:{create:`${gr}/cloned-plugins`,edit:`${gr}/cloned-plugins/{pluginId}`}},kongManager:{streamed:{create:`${qt}/custom-plugins`,edit:`${qt}/custom-plugins/{pluginId}`},cloned:{create:`${qt}/cloned-plugins`,edit:`${qt}/cloned-plugins/{pluginId}`}}},item:{konnect:{all:`${vn}/plugins/{id}`,forEntity:`${vn}/{entityType}/{entityId}/plugins/{id}`},kongManager:{all:`${qt}/plugins/{id}`,forEntity:`${qt}/{entityType}/{entityId}/plugins/{id}`}}},ip=new WeakMap,ew=Object.fromEntries(["service","route","consumer","consumer_group","certificate"].map(n=>[`${n}s`,n]));function CV(){const{i18n:{t:n}}=Qe(),t=o=>n(`plugins.free-form.code-lens.entity.${o}`),r=(o,i)=>n("plugins.free-form.code-lens.field.name",{value:o,entity:i});return{service:{title:t("service"),fields:[{id:"field/name",resolve:o=>o.data.name?r(o.data.name,t("service")):void 0}]},route:{title:t("route"),fields:[{id:"field/name",resolve:o=>o.data.name?r(o.data.name,t("route")):void 0}]},consumer_group:{title:t("consumer_group"),fields:[{id:"field/name",resolve:o=>o.data.name?r(o.data.name,t("consumer_group")):void 0}]},consumer:{title:t("consumer"),fields:[{id:"field/username",resolve:o=>o.data.username?n("plugins.free-form.code-lens.field.username",{value:o.data.username}):void 0},{id:"field/customId",resolve:o=>o.data.custom_id?n("plugins.free-form.code-lens.field.custom_id",{value:o.data.custom_id}):void 0}]},certificate:{title:t("certificate"),fields:[{id:"field/subject",resolve:o=>{if(o)return n("plugins.free-form.code-lens.field.subject",{value:o.cert.subject})}},{id:"field/notAfter",resolve:o=>{if(o)return n("plugins.free-form.code-lens.field.expires_after",{value:o.cert.notAfter.toLocaleString("en")})}}],commands:[{id:"cmd/copyCert",resolve:(o,i)=>o.cert?{id:i,title:n("plugins.free-form.code-lens.action.copy_certificate"),arguments:[o.cert]}:void 0}]}}}function EV(n){const t=[];for(const[r,o]of Object.entries(n)){if(o.type!=="foreign")continue;const i=o.reference;Object.prototype.hasOwnProperty.call(ew,i)&&t.push({entity:ew[i],keyPath:r.split(".")})}return t}function NV(n,t,r){let o=`${n.apiBaseUrl}${tt.form[n.app].entityGetOne}`;return n.app==="konnect"&&(o=o.replace(/{controlPlaneId}/gi,n.controlPlaneId||"")),o=o.replace(/\/{workspace}/gi,n.workspace?`/${n.workspace}`:"").replace(/{entity}/gi,t).replace(/{id}/gi,r),o}function SV(n){const t=Number(n);return Number.isFinite(t)&&Math.abs(t)<1e12?t*1e3:t}function tw(n){return op([n],(t,r)=>({lenses:[{range:r,command:{id:"",title:`$(calendar) ${new Date(SV(t)).toLocaleString("en",{dateStyle:"full",timeStyle:"full"})}`}}],dispose:()=>{}}))}function xV(n,t){const r=`kong.entities-plugins.codeEditor.command.${wV()}`,o=`${r}.copy`,i=`${r}.viewEntity`,{axiosInstance:a}=Ie.useAxios(t??n.axiosRequestConfig),s=Ar.useRouter(),{i18n:{t:c}}=Qe(),{getSchemaMap:l}=pt(),u=CV();function p(f,m){const h=new Map,y=new fo.Emitter,b=`${r}.${f}.reloadCodeLensProvider`,_=op(m??[f],async(N,E)=>{const w=N==null?void 0:N.id;if(!w)return ha.emptyCodeLensList();h.has(w)||h.set(w,(async()=>{var A,T;const U=NV(n,`${f}s`,w),x=await a.get(U);if(x.status<200||x.status>=300)throw new Error(x.statusText);if(f==="consumer_group"&&((A=x.data)!=null&&A.consumer_group))return{data:x.data.consumer_group};if(f==="certificate"){const V=(T=x.data)==null?void 0:T.cert;if(!V)throw new Error("Missing certificate");await Promise.resolve().then(()=>FU);const{X509Certificate:R}=await Promise.resolve().then(()=>qK);return{data:x.data,cert:new R(V)}}return{data:x.data}})());const S=u[f];return{lenses:[...S.fields.map(U=>({id:`${w}:${U.id}`,range:E})),{range:E,command:{id:i,title:`${c("plugins.free-form.code-lens.action.view_entity",{title:S.title})} $(link-external)`,arguments:[f,w]}},...(S.commands??[]).map(U=>({id:`${w}:${U.id}`,range:E}))],dispose:()=>{}}}),k={provideCodeLenses:_.provideCodeLenses,resolveCodeLens:async(N,E,w)=>{var A;if(E=(_.resolveCodeLens&&await _.resolveCodeLens(N,E,w))??E,!E.id)return E;const S=E.id.indexOf(":"),I=E.id.indexOf("/"),U=E.id.substring(0,S),x=E.id.substring(S+1,I);try{const T=await h.get(U);if(!T)throw new Error("Expected the cached entity to be non-empty");const V=u[f],R=E.id.substring(S+1);switch(x){case"field":{const X=V.fields.find(ne=>ne.id===R),Y=await(X==null?void 0:X.resolve(T));Y&&(E.command={id:"",title:Y});break}case"cmd":{const X=(A=V.commands)==null?void 0:A.find(ne=>ne.id===R),Y=await(X==null?void 0:X.resolve(T,o));Y&&(E.command=Y);break}}}catch(T){console.error("Error resolving code lens:",T),E.command={id:b,title:`$(warning) ${c("plugins.free-form.code-lens.action.retry_fetch")}`,arguments:[U],tooltip:T instanceof Error?T.message:c("plugins.free-form.code-lens.unknown_error")}}return E},onDidChange:y.event},C=fo.editor.registerCommand(b,(N,E)=>{h.delete(E),y.fire(k)});return{provider:k,dispose:()=>{y.dispose(),C.dispose()}}}function d(f){var _;(_=ip.get(f))==null||_();const m=[fo.languages.registerCodeLensProvider({language:"yaml",scheme:f.uri.scheme,pattern:f.uri.path},ha.collectCodeLensProviders([Qb({copyCommandId:o,title:c("plugins.free-form.code-lens.action.copy_uuid")}),tw("created_at"),tw("updated_at")]))],h=EV(l());for(const{entity:k,keyPath:C}of h){const N=p(k,C);m.push(fo.languages.registerCodeLensProvider({language:"yaml",scheme:f.uri.scheme,pattern:f.uri.path},N.provider),{dispose:N.dispose})}const y={service:n.viewServiceRoute,route:n.viewRouteRoute,consumer:n.viewConsumerRoute,consumer_group:n.viewConsumerGroupRoute,certificate:n.viewCertificateRoute};m.push(fo.editor.registerCommand(o,(k,C)=>{var E;const N=String(C);if(!((E=navigator.clipboard)!=null&&E.writeText)){console.warn("[useCodeLensProviders] Clipboard API is unavailable");return}navigator.clipboard.writeText(N).catch(w=>{console.warn("[useCodeLensProviders] Failed to copy to clipboard:",w)})}),fo.editor.registerCommand(i,(k,C,N)=>{var w;const E=(w=y[C])==null?void 0:w.call(y,N);E&&window.open(s.resolve(E).href,"_blank","noopener")}));const b=()=>{ip.delete(f),m.splice(0,m.length).forEach(k=>{try{k.dispose()}catch(C){console.warn("[useCodeLensProviders] Failed to dispose:",C)}})};return ip.set(f,b),f.onWillDispose(b),b}return{setup:d}}const AV={class:"plugin-code-editor","data-testid":"plugin-code-editor"},vV="YAML Syntax",IV=je(e.defineComponent({__name:"CodeEditor",emits:["change","sourceChange","error"],setup(n,{emit:t}){const r=e.inject(et.FORMS_CONFIG),{formData:o,setValue:i}=pt(),a=t,s=e.shallowRef(null),{setup:c}=xV(r,{validateStatus:m=>m>=200&&m<500});function l(){return Ln.dump(Xr(e.toRaw(o),["__ui_data"]),{schema:xo,noArrayIndent:!0})}const u=e.shallowRef(l()),p={scrollbar:{alwaysConsumeMouseWheel:!1},autoIndent:"keep",editContext:!1};function d(m){const h=m.getModel();h&&(c(h),s.value=m,m.onDidChangeModelContent(()=>{try{const y=Ln.load(m.getValue()||"",{schema:xo,json:!0});if(a("sourceChange",m.getValue()),typeof y!="object"||y===null)return;ul.editor.setModelMarkers(h,vV,[]),i(y),a("change",y)}catch(y){const b=y instanceof Error?y.message:String(y);a("error",b)}}),f())}function f(){const m=s.value,h=m==null?void 0:m.getModel();!m||!h||(m.setPosition(h.getFullModelRange().getEndPosition()),m.focus())}return(m,h)=>(e.openBlock(),e.createElementBlock("div",AV,[e.createVNode(e.unref(ha.MonacoEditor),{ref:"editor",modelValue:u.value,"onUpdate:modelValue":h[0]||(h[0]=y=>u.value=y),class:"editor",language:"yaml",options:p,theme:"light",onReady:d},null,8,["modelValue"])]))}}),[["__scopeId","data-v-a076c960"]]),es={jqlang:"https://jqlang.org/manual/",condition:"https://developer.konghq.com/gateway/routing/expressions/",customPluginSandboxing:"https://developer.konghq.com/gateway/sandboxing/",pluginPriority:"https://developer.konghq.com/gateway/entities/plugin/#plugin-priority"},BV={class:"label-content"},TV=je(e.defineComponent({__name:"ConditionField",setup(n){const t=e.useId(),{i18n:{t:r},i18nT:o}=Qe();return(i,a)=>{const s=e.resolveComponent("KBadge"),c=e.resolveComponent("KLabel"),l=e.resolveComponent("KExternalLink");return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(c,{for:e.unref(t),label:e.unref(r)("plugins.form.fields.condition.label")},{default:e.withCtx(()=>[e.createElementVNode("div",BV,[e.createTextVNode(e.toDisplayString(e.unref(r)("plugins.form.fields.condition.label"))+" ",1),e.createVNode(e.unref(Fe.KTooltip),{class:"label-tooltip"},{content:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("plugins.form.fields.condition.tooltip")),1)]),default:e.withCtx(()=>[e.createVNode(e.unref($e.InfoIcon),{class:"tooltip-trigger-icon",tabindex:"0"})]),_:1}),e.createVNode(s,{appearance:"decorative",size:"small"},{default:e.withCtx(()=>[...a[0]||(a[0]=[e.createTextVNode(" Beta ",-1)])]),_:1})])]),_:1},8,["for","label"]),e.createVNode(Xe,{"input-id":e.unref(t),label:"",name:"condition",placeholder:e.unref(r)("plugins.form.fields.condition.placeholder")},{help:e.withCtx(()=>[e.createVNode(e.unref(o),{keypath:"plugins.form.fields.condition.help.about"},{link:e.withCtx(()=>[e.createVNode(l,{"hide-icon":"",href:e.unref(es).condition},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("plugins.form.fields.condition.help.learn")),1)]),_:1},8,["href"])]),_:1})]),_:1},8,["input-id","placeholder"])])}}}),[["__scopeId","data-v-ebaf84a5"]]),Zt=e.defineComponent({name:"SchemaForm",__name:"Form",props:{tag:{default:"form"},schema:{},data:{},config:{},fieldsOrder:{},renderRules:{}},emits:["change","globalAction"],setup(n,{expose:t,emit:r}){const o=r,i=e.useSlots(),{getSchema:a,formData:s,setValue:c,getValue:l,rootRenderRules:u}=x_({schema:n.schema,propsData:e.computed(()=>n.data),propsConfig:n.config,propsRenderRules:e.toRef(()=>n.renderRules),onChange:d=>o("change",d)}),p=e.computed(()=>{var m;const{fields:d}=a();let f=[...d];return n.fieldsOrder?k_(f,n.fieldsOrder):((m=u.value)!=null&&m.bundles&&(f=C_([...f],u.value.bundles)),f)});return t({getValue:l,getRawValue:()=>e.toRaw(s),setValue:c}),(d,f)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.tag),null,{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(i)[e.unref(So)]))),e.renderSlot(d.$slots,"default",{},()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,m=>(e.openBlock(),e.createBlock(it,{key:Object.keys(m)[0],name:Object.keys(m)[0],onGlobalAction:f[0]||(f[0]=(h,y)=>o("globalAction",h,y))},null,8,["name"]))),128))])]),_:3}))}}),Rt=e.defineComponent({__name:"FieldRenderer",props:{match:{type:Function},priority:{}},setup(n){const t=n,{default:r}=e.useSlots(),{fieldRendererRegistry:o}=pt();return r&&o.set(t.match,r),(i,a)=>null}}),Pi=Symbol("redis-partial-info"),nw=Symbol("free-form-editing"),OV={konnect:{getOne:"/v2/control-planes/{controlPlaneId}/core-entities/partials/{id}",getAll:"/v2/control-planes/{controlPlaneId}/core-entities/partials"},kongManager:{getOne:"/{workspace}/partials/{id}",getAll:"/{workspace}/partials"}},PV={class:"partial-config-card"},VV={class:"config-card-row-label"},$V={class:"label-text"},RV=["data-testid"],LV=["data-testid"],DV={key:1},MV=["data-testid"],jV=["data-testid"],FV=je(e.defineComponent({__name:"RedisConfigCard",props:{configFields:{},pluginRedisFields:{}},setup(n){const{t,formatUnixTimeStamp:r}=jt.createI18n("en-us",Jt),o={id:{order:1},name:{order:1},type:{label:t("redis.config_card.common_fields.type_label"),hidden:!0,type:"hidden"},created_at:{label:t("redis.config_card.common_fields.created_at_label"),formatter:r,order:2},updated_at:{label:t("redis.config_card.common_fields.updated_at_label"),formatter:r,order:3}},i=n,a=d=>d!=null,s=(d,f)=>a(f)&&["password","sentinel_password"].includes(d)?"password":"text",{convertKeyToTitle:c}=Ie.useStringHelpers(),l=e.computed(()=>Object.entries(i.configFields).map(([d,f])=>{var m,h,y,b;return{key:d,label:((m=o[d])==null?void 0:m.label)??c(d),value:(h=o[d])!=null&&h.formatter?o[d].formatter(f):f,type:((y=o[d])==null?void 0:y.type)??s(d,f),order:((b=o[d])==null?void 0:b.order)??100}}).sort((d,f)=>d.order-f.order).filter(d=>d.type!=="hidden")),u=WT(i.configFields,i.pluginRedisFields||[]),p=e.computed(()=>l.value.concat(u));return(d,f)=>{const m=e.resolveComponent("KCopy");return e.openBlock(),e.createElementBlock("div",PV,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,({key:h,label:y,value:b,type:_})=>(e.openBlock(),e.createElementBlock("div",{key:h,class:"partial-config-card-row"},[e.createElementVNode("div",VV,[e.createElementVNode("div",$V,e.toDisplayString(y),1)]),e.createElementVNode("div",{class:"config-card-row-value","data-testid":`${h}-property-value`},[a(b)?(e.openBlock(),e.createElementBlock("div",DV,[_==="password"?(e.openBlock(),e.createElementBlock("div",{key:0,"data-testid":`${h}-copy-password`},[e.createVNode(m,{format:"redacted",text:String(b)},null,8,["text"])],8,MV)):(e.openBlock(),e.createElementBlock("div",{key:1,"data-testid":`${h}-plain-text`},e.toDisplayString(b),9,jV))])):(e.openBlock(),e.createElementBlock("div",{key:0,"data-testid":`${h}-no-value`}," – ",8,LV))],8,RV)]))),128))])}}}),[["__scopeId","data-v-82dcdf99"]]),UV={class:"redis-config-radio-group","data-testid":"redis-config-radio-group"},KV={class:"shared-redis-config"},qV={class:"shared-redis-config-title"},GV={class:"redis-config-select","data-testid":"redis-config-select"},HV={key:1,class:"redis-shared-config-error-message","data-testid":"redis-config-fetch-error"},ap=je(e.defineComponent({__name:"RedisSelector",props:{defaultRedisConfigItem:{},redisType:{},redisPath:{},isKonnectManagedRedisEnabled:{type:Boolean,default:!1}},setup(n){var te;const{t}=jt.createI18n("en-us",Jt),r=["host","port","database","username","password","sentinel_master","sentinel_role","sentinel_nodes","sentinel_username","sentinel_password","cluster_nodes","cluster_max_redirections","ssl","ssl_verify","server_name","keepalive_backlog","keepalive_pool_size","timeout","read_timeout","send_timeout","connect_timeout","connection_is_proxied","redis_proxy_type","cloud_authentication"],o={dependencies:{"cloud_authentication.aws_cache_name":["cloud_authentication.auth_provider","aws"],"cloud_authentication.aws_region":["cloud_authentication.auth_provider","aws"],"cloud_authentication.aws_is_serverless":["cloud_authentication.auth_provider","aws"],"cloud_authentication.aws_access_key_id":["cloud_authentication.auth_provider","aws"],"cloud_authentication.aws_secret_access_key":["cloud_authentication.auth_provider","aws"],"cloud_authentication.aws_assume_role_arn":["cloud_authentication.auth_provider","aws"],"cloud_authentication.aws_role_session_name":["cloud_authentication.auth_provider","aws"],"cloud_authentication.gcp_service_account_json":["cloud_authentication.auth_provider","gcp"],"cloud_authentication.azure_client_id":["cloud_authentication.auth_provider","azure"],"cloud_authentication.azure_client_secret":["cloud_authentication.auth_provider","azure"],"cloud_authentication.azure_tenant_id":["cloud_authentication.auth_provider","azure"]}},i=n,a=Jd(),s=e.inject(Pi),c=(s==null?void 0:s.isEditing)||!1,l=e.computed(()=>{var $;return i.redisPath?i.redisPath:($=s==null?void 0:s.redisPath)!=null&&$.value?"$."+s.redisPath.value:"$.config.redis"}),u=i.redisType||((te=s==null?void 0:s.redisType)==null?void 0:te.value),p=e.computed(()=>{var $;return!!(($=s==null?void 0:s.redisType)!=null&&$.value)}),d=e.ref(null),f=e.ref(!c),{getMessageFromError:m}=Ie.useErrors(),h=e.ref(i.defaultRedisConfigItem),y=e.ref({}),b=e.ref(),{value:_}=Nf("$.partials"),{value:k,hide:C}=Ft(l),N=e.inject(et.FORMS_CONFIG),E=$=>$.app==="konnect"&&!!$.isKonnectManagedRedisEnabled,w=e.computed(()=>i.isKonnectManagedRedisEnabled?t("redis.managed_ui.title"):t("redis.title")),S=e.computed(()=>i.isKonnectManagedRedisEnabled?t("redis.managed_ui.shared_configuration.description"):t("redis.shared_configuration.description")),I=e.computed(()=>i.isKonnectManagedRedisEnabled?t("redis.managed_ui.shared_configuration.label"):t("redis.shared_configuration.label")),U=e.computed(()=>i.isKonnectManagedRedisEnabled?t("redis.managed_ui.dedicated_configuration.description"):t("redis.dedicated_configuration.description")),x=e.computed(()=>i.isKonnectManagedRedisEnabled?t("redis.managed_ui.dedicated_configuration.label"):t("redis.dedicated_configuration.label")),A=e.computed(()=>i.isKonnectManagedRedisEnabled?t("redis.managed_ui.selector.create_new"):void 0),T=e.computed(()=>i.isKonnectManagedRedisEnabled?t("redis.managed_ui.selector.placeholder"):void 0),V=e.ref(null),R=$=>{V.value=$},X=$=>{let Z=`${N.apiBaseUrl}${OV[N.app].getOne}`;return N.app==="konnect"&&(Z=Z.replace(/{controlPlaneId}/gi,(N==null?void 0:N.controlPlaneId)||"")),Z=Z.replace(/\/{workspace}/gi,N!=null&&N.workspace?`/${N.workspace}`:"").replace(/{id}/gi,String($)),Z},{axiosInstance:Y}=Ie.useAxios(N==null?void 0:N.axiosRequestConfig),ne=()=>{f.value?(b.value&&(_.value=b.value,h.value=b.value[0].id,k.value=void 0),k!=null&&k.value&&(y.value=k.value)):(Object.keys(y.value).length&&(k.value=y.value),_!=null&&_.value&&(b.value=_.value),_.value=c?null:void 0)},M=async $=>{if($){h.value=$,_.value=[{id:$}],b.value=[{id:$}],k.value=void 0;try{const Z=await Y.get(X($));if(Z.data.config){const F=Object.assign(Z.data,Z.data.config);delete F.config,d.value=F}}catch(Z){console.error(Z)}}};return e.watch(()=>f.value,()=>{ne()}),e.onBeforeMount(()=>{var $;if(i.defaultRedisConfigItem||_!=null&&_.value){const Z=i.defaultRedisConfigItem||(($=_==null?void 0:_.value)==null?void 0:$[0].id);M(Z),f.value=!0}else k!=null&&k.value&&(y.value=k.value)}),e.watch(()=>C==null?void 0:C.value,$=>{f.value&&($&&_.value?_.value=c?null:void 0:$||b.value&&(_.value=b.value,M(b.value[0].id)))}),($,Z)=>{const F=e.resolveComponent("KBadge"),J=e.resolveComponent("KRadio"),G=e.resolveComponent("KCard");return p.value?e.withDirectives((e.openBlock(),e.createBlock(G,{key:0,class:"redis-config-card","data-testid":"redis-config-card",title:w.value},{default:e.withCtx(()=>[e.createElementVNode("div",UV,[e.createVNode(J,{modelValue:f.value,"onUpdate:modelValue":Z[0]||(Z[0]=v=>f.value=v),card:"","card-orientation":"horizontal","data-testid":"shared-redis-config-radio",description:S.value,label:I.value,"selected-value":!0},{default:e.withCtx(()=>[n.isKonnectManagedRedisEnabled?(e.openBlock(),e.createBlock(F,{key:0,appearance:"success"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("redis.managed_ui.shared_configuration.badge")),1)]),_:1})):e.createCommentVNode("",!0)]),_:1},8,["modelValue","description","label"]),e.createVNode(J,{modelValue:f.value,"onUpdate:modelValue":Z[1]||(Z[1]=v=>f.value=v),card:"","card-orientation":"horizontal","data-testid":"dedicated-redis-config-radio",description:U.value,label:x.value,"selected-value":!1},null,8,["modelValue","description","label"])]),e.withDirectives(e.createElementVNode("div",KV,[e.createElementVNode("div",qV,e.toDisplayString(e.unref(t)("redis.shared_configuration.title")),1),e.createElementVNode("div",GV,[e.createVNode(e.unref(Hg.RedisConfigurationSelector),{"create-button-text":A.value,"data-testid":"redis-config-select-trigger","is-konnect-managed-redis-enabled":n.isKonnectManagedRedisEnabled,"model-value":h.value,placeholder:T.value,"redis-type":e.unref(u),"show-create-button":!E(e.unref(N)),onErrorChange:R,onToast:e.unref(a),"onUpdate:modelValue":M},null,8,["create-button-text","is-konnect-managed-redis-enabled","model-value","placeholder","redis-type","show-create-button","onToast"])]),d.value?(e.openBlock(),e.createBlock(FV,{key:0,"config-fields":d.value},null,8,["config-fields"])):e.createCommentVNode("",!0),V.value?(e.openBlock(),e.createElementBlock("p",HV,e.toDisplayString(e.unref(m)(V.value)),1)):e.createCommentVNode("",!0)],512),[[e.vShow,f.value]]),f.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(Ut,e.mergeProps({key:0},i,{"as-child":"","fields-order":r,name:l.value,"render-rules":o,"reset-label-path":"reset"}),null,16,["name"]))]),_:1},8,["title"])),[[e.vShow,!e.unref(C)]]):e.withDirectives((e.openBlock(),e.createBlock(Ut,e.mergeProps({key:1},i,{"fields-order":r,"hide-required-asterisk":"",name:l.value,"render-rules":o}),null,16,["name"])),[[e.vShow,!e.unref(C)]])}}}),[["__scopeId","data-v-ad3044d7"]]),rw=e.defineComponent({inheritAttrs:!1,__name:"PluginConfigurationForm",props:{controlledFields:{},prepareFormData:{type:Function},schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean}},emits:["change"],setup(n,{expose:t,emit:r}){const o=n,i=r,a=e.useAttrs(),s=e.useId(),c=e.useTemplateRef("form"),l=e.inject(Pi),u=e.computed(()=>o.fieldRenderers??[]),p=e.computed(()=>a["data-testid"]??"ff-plugin-configuration-form"),d=e.computed(()=>{const{"data-testid":y,...b}=a;return b}),f=e.computed(()=>{const y=o.formConfig;return{...y??{},hasValue:(y==null?void 0:y.hasValue)??(b=>!!b&&Object.keys(b).length>0),prepareFormData:b=>{var k,C;const _=((k=y==null?void 0:y.prepareFormData)==null?void 0:k.call(y,b))??b;return((C=o.prepareFormData)==null?void 0:C.call(o,_))??_}}}),m=e.computed(()=>Array.isArray(o.controlledFields)?Gd(o.model,o.controlledFields):o.model);function h(y){i("change",y),o.onFormChange(y,o.controlledFields)}return t({getValue:()=>{var y;return(y=c.value)==null?void 0:y.getValue()},setValue:y=>{var b;return(b=c.value)==null?void 0:b.setValue(y)}}),I_(()=>o.schema,s),(y,b)=>(e.openBlock(),e.createBlock(Zt,e.mergeProps({ref:"form"},d.value,{class:"ff-plugin-configuration-form",config:f.value,data:m.value,"data-instance-id":e.unref(s),"data-plugin-name":n.pluginName,"data-testid":p.value,"render-rules":n.renderRules,schema:n.schema,tag:"div",onChange:h}),e.createSlots({[e.unref(So)]:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(_,k)=>(e.openBlock(),e.createBlock(Rt,{key:`${n.pluginName}-${k}`,match:e.unref(JT)(_.match)},{default:e.withCtx(C=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(_.component),e.mergeProps({ref_for:!0},{...C,...(typeof _.propsOverrides=="function"?_.propsOverrides(C):_.propsOverrides)??{}}),null,16))]),_:2},1032,["match"]))),128)),e.createVNode(Rt,{match:({path:_})=>{var k,C;return _===((C=(k=e.unref(l))==null?void 0:k.redisPath)==null?void 0:C.value)}},{default:e.withCtx(()=>[e.createVNode(ap,{"is-konnect-managed-redis-enabled":o.isKonnectManagedRedisEnabled??!1},null,8,["is-konnect-managed-redis-enabled"])]),_:1},8,["match"]),e.renderSlot(y.$slots,"field-renderers")]),_:2},[y.$slots.default?{name:"default",fn:e.withCtx(()=>[e.renderSlot(y.$slots,"default")]),key:"0"}:void 0]),1040,["config","data","data-instance-id","data-plugin-name","data-testid","render-rules","schema"]))}}),zV={class:"radio-group"},WV={key:0,class:"scope-detail"},YV=je(e.defineComponent({inheritAttrs:!1,__name:"StandardLayout",props:e.mergeModels({formSchema:{},formModel:{},schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},configSections:{},hideEditorModeSwitcher:{type:Boolean,default:!1},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},{editorMode:{},editorModeModifiers:{}}),emits:["update:editorMode"],setup(n){const t=["config","partials","__ui_data","enabled","protocols","instance_name","condition","tags","consumer","consumer_group","route","service"],{i18n:{t:r}}=Qe(),o=e.createPropsRestProxy(n,["hideEditorModeSwitcher"]),i=e.useAttrs(),a=e.inject(fr.KM_2262_CODE_MODE,!1),s=Pt.useLocalStorage("plugin-editor-mode","form"),c=e.useModel(n,"editorMode"),l=e.computed({get:()=>c.value??(a?s.value:"form"),set:F=>{c.value=F}}),u=e.computed(()=>a&&!n.hideEditorModeSwitcher),p=[{label:r("plugins.free-form.editor_mode.visual"),value:"form"},{label:r("plugins.free-form.editor_mode.code"),value:"code"}];function d(F){l.value=F,s.value=F}const f=e.useSlots(),m=e.computed(()=>{var F;return 2+(((F=o.configSections)==null?void 0:F.length)??1)}),h=e.computed(()=>{var F;return(F=b.value)!=null&&F.disabled?{class:"disabled-scope",maxWidth:"300",text:r("plugins.form.scoping.disable_global_radio")}:{class:"scope"}}),y=e.computed(()=>{var F,J;return(F=o.formSchema)!=null&&F.groups?o.formSchema.groups.reduce((G,v)=>{var oe,ke;const q=v.fields,ie=(ke=(oe=v.collapsible)==null?void 0:oe.nestedCollapsible)!=null&&ke.fields?q.concat(v.collapsible.nestedCollapsible.fields):q;return G.concat(ie)},[]):((J=o.formSchema)==null?void 0:J.fields)||[]}),b=e.computed(()=>y.value.find(F=>F.type==="selectionGroup")),_=e.computed(()=>{var F;return(((F=b.value)==null?void 0:F.fields)||[]).map(({label:J,description:G})=>({label:J,description:G}))}),k=e.computed(()=>{var F,J;return(J=(F=b.value)==null?void 0:F.fields)==null?void 0:J[1]}),C=e.computed(()=>{var F;return(((F=k.value)==null?void 0:F.fields)??[]).map(J=>{var G;return{name:J.model.split("-")[0],entity:J.entity,fields:(G=J.inputValues)==null?void 0:G.fields,label:J.label,placeholder:J.placeholder,help:J.help,disabled:J.disabled,disabledTooltip:J.disabledTooltip,labelField:J.labelField}})}),N=["instance_name","protocols","tags","condition"],E=["config"],w=e.computed(()=>{var v;const F={type:"record",fields:o.schema.fields.filter(q=>E.includes(Object.keys(q)[0]))},J=y.value.find(q=>q.model==="enabled");return[...J?[J]:[],...((v=k.value)==null?void 0:v.fields)??[],...y.value.filter(q=>N.includes(q.model))].forEach(q=>{if(q.type==="AutoSuggest")F.fields.push({[q.model.split("-")[0]]:{type:"foreign",reference:q.entity,description:q.help}});else if(q.model==="enabled")F.fields.push({[q.model]:{type:"boolean",default:!0}});else if(q.model==="instance_name"||q.model==="condition")F.fields.push({[q.model]:{type:"string",description:q.help}});else if(q.model==="protocols")F.fields.push({[q.model]:{type:"set",elements:{type:"string",one_of:q.values.map(ie=>ie.value)},default:[...q.default],required:q.required,description:q.help,help:q.default?r("plugins.form.fields.protocols.placeholderWithDefaultValues",{protocols:q.default.join(", ")}):r("plugins.form.fields.protocols.placeholder")}});else if(q.model==="tags")F.fields.push({[q.model]:{type:"set",elements:{type:"string"},description:q.help,default:q.default||[]}});else throw new Error(`Unsupported VFG field type '${q.type}' for model '${q.model}'`)}),F}),S=e.computed(()=>new Set(w.value.fields.map(F=>Object.keys(F)[0]))),I=e.computed(()=>Gd(o.model,t)),U=e.computed(()=>{var F;return((F=k.value)==null?void 0:F.fields.map(J=>J.model))??[]}),x=e.computed(()=>U.value.map(F=>F.split("-")[0])),A=e.ref(o.isEditing?Gd(I.value,x.value):$()),T=e.ref(Object.values(A.value).some(te)),V=e.useTemplateRef("form");let R=!1;function X(F){return o.isEditing?F:{...F,...$()}}function Y(){if(!V.value)return;const{getValue:F,setValue:J}=V.value,v={...F()};T.value?x.value.forEach(q=>{v[q]=A.value[q]??null}):x.value.forEach(q=>{v[q]=null}),R=!0,J(v),e.nextTick(()=>{R=!1})}function ne(F){if(R||M(F),l.value==="code"){const J=x.value.some(G=>te(F[G]));J!==T.value&&(T.value=J)}}function M(F){x.value.forEach(J=>{const G=F[J];El(G,"id")&&G.id!=null?A.value[J]=G:A.value[J]=null})}function te(F){return El(F,"id")&&F.id!=null}function $(){const F={};return U.value.forEach(J=>{if(o.formModel[J]){const G=J.split("-")[0];if(!G)return;F[G]={id:o.formModel[J]}}}),F}const Z=e.ref(!0);return(F,J)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[u.value?(e.openBlock(),e.createBlock(e.Teleport,{key:0,to:"#plugin-form-page-actions"},[e.createVNode(e.unref(Fe.KSegmentedControl),{"data-testid":"plugin-editor-mode-switcher","model-value":l.value,options:p,"onUpdate:modelValue":d},null,8,["model-value"])])):e.createCommentVNode("",!0),e.createVNode(rw,e.mergeProps({ref:"form"},e.unref(i),{class:"ff-standard-layout","controlled-fields":t,"data-testid":"ff-standard-layout-form","field-renderers":n.fieldRenderers,"form-config":n.formConfig,"is-konnect-managed-redis-enabled":n.isKonnectManagedRedisEnabled,model:n.model,"on-form-change":n.onFormChange,"plugin-name":n.pluginName,"prepare-form-data":X,"render-rules":n.renderRules,schema:w.value,onChange:ne}),{"field-renderers":e.withCtx(()=>[e.renderSlot(F.$slots,"field-renderers",{},void 0,!0)]),default:e.withCtx(()=>{var G;return[l.value==="form"?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:0,"data-testid":"form-section-plugin-scope",description:n.generalInfoDescription??e.unref(r)("plugins.form.sections.plugin_scope.description"),step:1,title:n.generalInfoTitle??e.unref(r)("plugins.form.sections.plugin_scope.title")},e.createSlots({default:e.withCtx(()=>{var v;return[(e.openBlock(),e.createBlock(e.resolveDynamicComponent((v=b.value)!=null&&v.disabled?e.unref(Fe.KTooltip):"div"),e.normalizeProps(e.guardReactiveProps(h.value)),{default:e.withCtx(()=>{var q,ie;return[e.createElementVNode("div",zV,[e.createVNode(e.unref(Fe.KRadio),e.mergeProps({modelValue:T.value,"onUpdate:modelValue":J[0]||(J[0]=oe=>T.value=oe),card:"","card-orientation":"horizontal"},_.value[0],{disabled:(q=b.value)==null?void 0:q.disabled,"selected-value":!1,"onUpdate:modelValue":Y}),null,16,["modelValue","disabled"]),_.value[1]?(e.openBlock(),e.createBlock(e.unref(Fe.KRadio),e.mergeProps({key:0,modelValue:T.value,"onUpdate:modelValue":J[1]||(J[1]=oe=>T.value=oe),card:"","card-orientation":"horizontal"},_.value[1],{disabled:(ie=b.value)==null?void 0:ie.disabled,"selected-value":!0,"onUpdate:modelValue":Y}),null,16,["modelValue","disabled"])):e.createCommentVNode("",!0)])]}),_:1},16)),k.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",WV,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,q=>(e.openBlock(),e.createBlock(uO,{key:q.name,developer:n.developer,disabled:q.disabled,"disabled-tooltip":q.disabledTooltip,entity:q.entity,fields:q.fields,help:q.help,label:q.label,"label-field":q.labelField,name:q.name,placeholder:q.placeholder},null,8,["developer","disabled","disabled-tooltip","entity","fields","help","label","label-field","name","placeholder"]))),128))],512)),[[e.vShow,T.value]]):e.createCommentVNode("",!0)]}),_:2},[f["general-info-title"]?{name:"title",fn:e.withCtx(()=>[e.renderSlot(F.$slots,"general-info-title",{},void 0,!0)]),key:"0"}:void 0,f["general-info-description"]?{name:"description",fn:e.withCtx(()=>[e.renderSlot(F.$slots,"general-info-description",{},void 0,!0)]),key:"1"}:void 0,f["general-info-extra"]?{name:"extra",fn:e.withCtx(()=>[e.renderSlot(F.$slots,"general-info-extra",{},void 0,!0)]),key:"2"}:void 0]),1032,["description","title"])):e.createCommentVNode("",!0),l.value==="form"&&((G=n.configSections)!=null&&G.length)?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(n.configSections,(v,q)=>(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:v.name,"data-testid":`form-section-${v.name}`,description:v.description,step:2+q,title:v.title},{default:e.withCtx(()=>[e.renderSlot(F.$slots,`section-${v.name}`,{},void 0,!0)]),_:2},1032,["data-testid","description","step","title"]))),128)):l.value==="form"?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:2,"data-testid":"form-section-plugin-config",description:n.pluginConfigDescription??e.unref(r)("plugins.form.sections.plugin_config.description"),step:2,title:n.pluginConfigTitle??e.unref(r)("plugins.form.sections.plugin_config.title")},e.createSlots({default:e.withCtx(()=>[e.renderSlot(F.$slots,"default",{},void 0,!0)]),_:2},[f["plugin-config-title"]?{name:"title",fn:e.withCtx(()=>[e.renderSlot(F.$slots,"plugin-config-title",{},void 0,!0)]),key:"0"}:void 0,f["plugin-config-description"]?{name:"description",fn:e.withCtx(()=>[e.renderSlot(F.$slots,"plugin-config-description",{},void 0,!0)]),key:"1"}:void 0,f["plugin-config-extra"]?{name:"extra",fn:e.withCtx(()=>[e.renderSlot(F.$slots,"plugin-config-extra",{},void 0,!0)]),key:"2"}:void 0]),1032,["description","title"])):e.createCommentVNode("",!0),l.value==="form"?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:3,"data-testid":"form-section-general-info",description:e.unref(r)("plugins.form.sections.plugin_general_info.description"),step:m.value,title:e.unref(r)("plugins.form.sections.general_info.title")},{default:e.withCtx(()=>[S.value.has("enabled")?(e.openBlock(),e.createBlock(O_,{key:0,"disabled-text":e.unref(r)("plugins.form.fields.plugin_status.text_off"),"enabled-text":e.unref(r)("plugins.form.fields.plugin_status.text_on"),label:e.unref(r)("plugins.form.fields.plugin_status.label"),name:"enabled"},null,8,["disabled-text","enabled-text","label"])):e.createCommentVNode("",!0),S.value.has("instance_name")?(e.openBlock(),e.createBlock(Xe,{key:1,label:e.unref(r)("plugins.form.fields.instance_name.label"),name:"instance_name",placeholder:e.unref(r)("plugins.form.fields.instance_name.placeholder")},null,8,["label","placeholder"])):e.createCommentVNode("",!0),S.value.has("tags")?(e.openBlock(),e.createBlock(hi,{key:2,help:e.unref(r)("plugins.form.fields.tags.help"),name:"tags",placeholder:e.unref(r)("plugins.form.fields.tags.placeholder")},null,8,["help","placeholder"])):e.createCommentVNode("",!0),S.value.has("protocols")?(e.openBlock(),e.createBlock(it,{key:3,name:"protocols"})):e.createCommentVNode("",!0),w.value.fields.find(v=>Object.keys(v)[0]==="condition")?(e.openBlock(),e.createBlock(e.unref(Fe.KCollapse),{key:4,modelValue:Z.value,"onUpdate:modelValue":J[2]||(J[2]=v=>Z.value=v),"data-testid":"view-general-info-additional-settings","trigger-label":Z.value?e.unref(r)("plugins.form.grouping.advanced_parameters.view"):e.unref(r)("plugins.form.grouping.advanced_parameters.hide")},{default:e.withCtx(()=>[e.createVNode(TV)]),_:1},8,["modelValue","trigger-label"])):e.createCommentVNode("",!0)]),_:1},8,["description","step","title"])):e.createCommentVNode("",!0),l.value==="code"?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:4,description:e.unref(r)("plugins.form.sections.code_mode.description"),title:e.unref(r)("plugins.form.sections.code_mode.title")},{default:e.withCtx(()=>[e.renderSlot(F.$slots,"code-editor",{},()=>[e.createVNode(IV)],!0)]),_:3},8,["description","title"])):e.createCommentVNode("",!0)]}),_:3},16,["field-renderers","form-config","is-konnect-managed-redis-enabled","model","on-form-change","plugin-name","render-rules","schema"])],64))}}),[["__scopeId","data-v-e2f4cda4"]]),ow=Symbol.for("kong-ui-public.entities-plugins.free-form-plugin-layout");function JV(n){e.provide(ow,n)}const er=e.defineComponent({inheritAttrs:!1,__name:"DynamicLayout",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},configSections:{},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const t=n,r=e.useAttrs(),o=e.useSlots(),i=e.inject(ow,YV),a=e.computed(()=>({...r,...t}));return(s,c)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(i)),e.normalizeProps(e.guardReactiveProps(a.value)),e.createSlots({_:2},[e.renderList(e.unref(o),(l,u)=>({name:u,fn:e.withCtx(p=>[e.renderSlot(s.$slots,u,e.normalizeProps(e.guardReactiveProps(p??{})))])}))]),1040))}}),XV={class:"ff-acl-mode"},ZV=je(e.defineComponent({__name:"ACLModeCard",setup(n){const{formData:t}=pt(),{i18n:{t:r}}=Qe(),o=e.ref("allow"),i=e.ref(!1),a=e.ref({});e.watch(()=>t.config,c=>{if(i.value||!c)return;const l=c.deny,u=c.allow;Array.isArray(l)&&l.length>0?o.value="deny":Array.isArray(u)&&u.length>0&&(o.value="allow")},{deep:!0,immediate:!0});function s(){i.value=!0,t.config&&(o.value==="allow"?(t.config.deny&&(a.value.deny=[...t.config.deny]),t.config.deny=null,a.value.allow&&(t.config.allow=[...a.value.allow])):(t.config.allow&&(a.value.allow=[...t.config.allow]),t.config.allow=null,a.value.deny&&(t.config.deny=[...a.value.deny])))}return(c,l)=>(e.openBlock(),e.createBlock(e.unref(Fe.KCard),{class:"ff-acl-mode-card"},{default:e.withCtx(()=>[e.createElementVNode("div",XV,[e.createVNode(e.unref(Fe.KRadio),{modelValue:o.value,"onUpdate:modelValue":[l[0]||(l[0]=u=>o.value=u),s],"data-testid":"ff-acl-mode-allow",label:e.unref(r)("plugins.free-form.acl.mode.allow"),"selected-value":"allow"},null,8,["modelValue","label"]),e.createVNode(e.unref(Fe.KRadio),{modelValue:o.value,"onUpdate:modelValue":[l[1]||(l[1]=u=>o.value=u),s],"data-testid":"ff-acl-mode-deny",label:e.unref(r)("plugins.free-form.acl.mode.deny"),"selected-value":"deny"},null,8,["modelValue","label"])]),o.value==="allow"?(e.openBlock(),e.createBlock(it,{key:0,name:"config.allow"})):(e.openBlock(),e.createBlock(it,{key:1,name:"config.deny"}))]),_:1}))}}),[["__scopeId","data-v-fd5c7165"]]),QV=e.defineComponent({__name:"ACLForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},configSections:{},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const t=n,r=e.useSlots();return e.provide(et.AUTOFILL_SLOT,r==null?void 0:r[et.AUTOFILL_SLOT_NAME]),(o,i)=>(e.openBlock(),e.createBlock(er,e.normalizeProps(e.guardReactiveProps(t)),{default:e.withCtx(()=>[e.createVNode(ZV),e.createVNode(Ut,{"as-child":"",name:"config",omit:["allow","deny"],"reset-label-path":"reset"})]),_:1},16))}}),e$={class:"ff-advanced-fields"},ts=je(e.defineComponent({__name:"AdvancedFields",props:{hideGeneralFields:{type:Boolean}},setup(n){const{t}=jt.createI18n("en-us",Jt),{getSchema:r}=pt(),o=e.ref(!0);return(i,a)=>(e.openBlock(),e.createBlock(e.unref(Fe.KCollapse),{modelValue:o.value,"onUpdate:modelValue":a[0]||(a[0]=s=>o.value=s),"data-testid":"view-advanced","trigger-label":o.value?e.unref(t)("plugins.form.grouping.advanced_parameters.view"):e.unref(t)("plugins.form.grouping.advanced_parameters.hide")},{default:e.withCtx(()=>[e.createElementVNode("div",e$,[n.hideGeneralFields?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.unref(r)("instance_name")?(e.openBlock(),e.createBlock(it,{key:0,name:"instance_name"})):e.createCommentVNode("",!0),e.unref(r)("protocols")?(e.openBlock(),e.createBlock(it,{key:1,name:"protocols"})):e.createCommentVNode("",!0),e.unref(r)("tags")?(e.openBlock(),e.createBlock(hi,{key:2,help:"e.g. tag1, tag2, tag3",name:"tags",placeholder:e.unref(t)("plugins.form.fields.tags.placeholder")},null,8,["placeholder"])):e.createCommentVNode("",!0),e.unref(r)("condition")?(e.openBlock(),e.createBlock(Xe,{key:3,name:"condition",placeholder:e.unref(t)("plugins.form.fields.condition.placeholder")},null,8,["placeholder"])):e.createCommentVNode("",!0)],64)),e.renderSlot(i.$slots,"default",{},void 0,!0)])]),_:3},8,["modelValue","trigger-label"]))}}),[["__scopeId","data-v-baa317ec"]]),iw=je(e.defineComponent({__name:"ConfigForm",setup(n){const{getSchema:t,createComputedRenderRules:r}=pt(),o=r("config"),i=e.computed(()=>{var b;const s=[],c=[],l=new Set,p=t().fields.find(_=>Object.keys(_)[0]==="config");if(!p||!("config"in p))return{defaultVisible:s,advanced:c};const d=p.config;d.entity_checks&&d.entity_checks.forEach(_=>{var C,N;let k;"at_least_one_of"in _?k=_.at_least_one_of:"conditional"in _&&((C=t(yt("config",_.conditional.if_field)))!=null&&C.required)&&_.conditional.then_match.required?k=[_.conditional.if_field,_.conditional.then_field]:"conditional_at_least_one_of"in _&&((N=t(yt("config",_.conditional_at_least_one_of.if_field)))!=null&&N.required)&&(k=[_.conditional_at_least_one_of.if_field,..._.conditional_at_least_one_of.then_at_least_one_of]),k==null||k.forEach(E=>l.add(E.split(".")[0]))});const f=((b=o.value)==null?void 0:b.bundles)??[],m=new Map;for(const _ of f)for(let k=1;k<_.length;k++)m.set(_[k],_[k-1]);const h=_=>{const k=m.get(_);return k?h(k):_},y=new Map;for(const _ of d.fields){const k=Object.keys(_)[0];y.set(k,h(k))}for(const _ of d.fields){const k=Object.keys(_)[0];if(y.get(k)!==k)continue;let N;_[k].required||l.has(k)?N=s:N=c,N.push(k)}for(const _ of d.fields){const k=Object.keys(_)[0],C=y.get(k);C!==k&&(s.includes(C)?s:c).push(k)}return{defaultVisible:s,advanced:c}}),a=e.computed(()=>i.value.defaultVisible.length===0);return(s,c)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(Ut,{"as-child":"",class:"ff-default-visible-fields",name:"config",omit:a.value?[]:i.value.advanced,"reset-label-path":"reset"},null,8,["omit"]),a.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(ts,{key:0,class:"ff-advanced-fields-container","data-testid":"ff-advanced-fields-container","hide-general-fields":""},{default:e.withCtx(()=>[e.createVNode(Ut,{"as-child":"",name:"config",omit:i.value.defaultVisible,"reset-label-path":"reset"},null,8,["omit"])]),_:1}))],64))}}),[["__scopeId","data-v-bc82c9e9"]]),sp=e.defineComponent({__name:"CommonForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},configSections:{},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const t=n,r=e.useSlots();return e.provide(et.AUTOFILL_SLOT,r==null?void 0:r[et.AUTOFILL_SLOT_NAME]),(o,i)=>(e.openBlock(),e.createBlock(er,e.normalizeProps(e.guardReactiveProps(t)),{default:e.withCtx(()=>[e.createVNode(iw)]),_:1},16))}});function ze(n={}){return{...n,component:n.component??sp}}const t$=ze({experimental:!0,component:QV}),n$=ze({fieldRenderers:[{match:"config.functions",component:pr,propsOverrides:{appearance:{string:{multiline:!0}}}}]}),r$=ze({component:e.defineComponent({__name:"AIMcpProxyForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},configSections:{},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const t=n,r=e.useSlots();e.provide(et.AUTOFILL_SLOT,r==null?void 0:r[et.AUTOFILL_SLOT_NAME]);const{i18n:{t:o}}=st.useI18n();return(i,a)=>(e.openBlock(),e.createBlock(er,e.normalizeProps(e.guardReactiveProps(t)),{"field-renderers":e.withCtx(()=>[e.createVNode(Rt,{match:({path:s})=>s==="config.default_acl"},{default:e.withCtx(s=>[e.createVNode(zt,e.mergeProps(s,{appearance:"tabs","item-label":(c,l)=>e.unref(o)("plugins.free-form.ai-mcp-proxy.default_acl_item_label",{index:l+1}),"sticky-tabs":""}),null,16,["item-label"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:s})=>s==="config.tools"},{default:e.withCtx(s=>[e.createVNode(zt,e.mergeProps(s,{appearance:"tabs","item-label":(c,l)=>e.unref(o)("plugins.free-form.ai-mcp-proxy.tool_item_label",{index:l+1}),"sticky-tabs":""}),null,16,["item-label"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({genericPath:s})=>s==="config.tools.*.query"||s==="config.tools.*.headers"},{default:e.withCtx(s=>[e.createVNode(pr,e.mergeProps(s,{"one-line":""}),{default:e.withCtx(({keyId:c})=>[e.createVNode(hi,{name:c,placeholder:e.unref(o)("plugins.free-form.tag_helper")},null,8,["name","placeholder"])]),_:1},16)]),_:1},8,["match"])]),default:e.withCtx(()=>[e.createVNode(Ut,{"as-child":"",name:"config","reset-label-path":"reset"})]),_:1},16))}})}),o$=ze({experimental:!0}),i$=ze({experimental:!0}),a$=ze({experimental:!0,fieldRenderers:[{match:"config.templates",component:zt,propsOverrides:{appearance:"tabs",itemLabel:(n,t)=>`#${t+1} Template`}},{match:({genericPath:n})=>n==="config.templates.*.template",component:Xe,propsOverrides:{multiline:!0,rows:4}}]}),s$=ze({experimental:!0,fieldRenderers:[{match:"config.targets",component:zt,propsOverrides:{appearance:"tabs",stickyTabs:!0,itemLabel:(n,t)=>`#${t+1} Target`}},{match:"config.acls.allow",component:zt,propsOverrides:{appearance:"tabs",itemLabel:(n,t)=>`#${t+1} Allow`}},{match:({genericPath:n})=>["config.acls.allow.*.match","config.acls.deny.*.match"].includes(n),component:zt,propsOverrides:{appearance:"tabs",itemLabel:(n,t)=>`#${t+1} Match`}},{match:"config.acls.deny",component:zt,propsOverrides:{appearance:"tabs",stickyTabs:!0,itemLabel:(n,t)=>`#${t+1} Deny`}}]}),l$=ze({experimental:!0}),c$=ze({experimental:!0,renderRules:{bundles:[["config.strategy","config.redis"]],dependencies:{"config.redis":["config.strategy","redis"]}}}),u$=ze({experimental:!0,fieldRenderers:[{match:"config.prompt",component:Xe,propsOverrides:{multiline:!0,rows:4}}]}),d$=ze({experimental:!0,fieldRenderers:[{match:"config.prompt",component:Xe,propsOverrides:{multiline:!0,rows:4}}]}),aw=[{match:"config.vectordb.redis.sentinel_nodes",component:zt,propsOverrides:{appearance:"tabs",itemLabel:(n,t)=>` #${t+1} Sentinel node`}},{match:"config.vectordb.redis.cluster_nodes",component:zt,propsOverrides:{appearance:"tabs",itemLabel:(n,t)=>` #${t+1} Cluster node`}}],sw={bundles:[["config.vectordb.strategy","config.vectordb.redis","config.vectordb.pgvector"]],dependencies:{"config.vectordb.redis":["config.vectordb.strategy","redis"],"config.vectordb.pgvector":["config.vectordb.strategy","pgvector"],"config.vectordb.redis.cloud_authentication.aws_cache_name":["config.vectordb.redis.cloud_authentication.auth_provider","aws"],"config.vectordb.redis.cloud_authentication.aws_region":["config.vectordb.redis.cloud_authentication.auth_provider","aws"],"config.vectordb.redis.cloud_authentication.aws_is_serverless":["config.vectordb.redis.cloud_authentication.auth_provider","aws"],"config.vectordb.redis.cloud_authentication.aws_access_key_id":["config.vectordb.redis.cloud_authentication.auth_provider","aws"],"config.vectordb.redis.cloud_authentication.aws_secret_access_key":["config.vectordb.redis.cloud_authentication.auth_provider","aws"],"config.vectordb.redis.cloud_authentication.aws_assume_role_arn":["config.vectordb.redis.cloud_authentication.auth_provider","aws"],"config.vectordb.redis.cloud_authentication.aws_role_session_name":["config.vectordb.redis.cloud_authentication.auth_provider","aws"],"config.vectordb.redis.cloud_authentication.gcp_service_account_json":["config.vectordb.redis.cloud_authentication.auth_provider","gcp"],"config.vectordb.redis.cloud_authentication.azure_client_id":["config.vectordb.redis.cloud_authentication.auth_provider","azure"],"config.vectordb.redis.cloud_authentication.azure_client_secret":["config.vectordb.redis.cloud_authentication.auth_provider","azure"],"config.vectordb.redis.cloud_authentication.azure_tenant_id":["config.vectordb.redis.cloud_authentication.auth_provider","azure"]}},f$=ze({experimental:!0,fieldRenderers:aw,renderRules:sw}),p$=ze({experimental:!0,fieldRenderers:aw,renderRules:sw}),m$=ze({experimental:!0}),g$={class:"kong-identity-field","data-testid":"ff-kong-identity-field"},h$={class:"kong-identity-description"},y$={class:"kong-identity-learn-more",href:"https://developer.konghq.com/kong-identity/",rel:"noopener noreferrer",target:"_blank"},_$={class:"kong-identity-options"},b$=je(e.defineComponent({name:"KongIdentityField",__name:"KongIdentityField",props:e.mergeModels({identityRealmsInSchema:{type:Boolean},loadingRealms:{type:Boolean}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const t=n,{i18n:r}=st.useI18n(),{t:o}=r,{formData:i,getSchema:a,getEmptyOrDefault:s}=pt(),c=e.computed(()=>t.identityRealmsInSchema!==void 0?t.identityRealmsInSchema:!!a("$.config.identity_realms")),l=e.computed(()=>c.value),u=e.computed(()=>c.value?o("custom_field.kong_identity.description_with_realms"):o("custom_field.kong_identity.description_without_realms")),p=e.computed(()=>c.value?o("custom_field.kong_identity.consumers_description_key_auth"):o("custom_field.kong_identity.consumers_description_basic_auth")),d=e.computed(()=>c.value?o("custom_field.kong_identity.kong_identity_description_key_auth"):o("custom_field.kong_identity.kong_identity_description_basic_auth")),f=e.useModel(n,"modelValue"),m=e.ref(f.value??"consumers");function h(y){var b,_,k;if(i.config&&y!==m.value)switch(m.value=y,f.value=y,y){case"kong-identity":{i.config.principals={...s("$.config.principals"),enabled:!0,directory:"default"},c.value&&(i.config.identity_realms=[]),(b=a("$.config.realm"))!=null&&b.required||(i.config.realm=null);break}case"consumers":{const C=!!((_=a("$.config.principals"))!=null&&_.required);i.config.principals=C?s("$.config.principals"):null,c.value&&(i.config.identity_realms=[]);break}case"centrally-managed":{const C=!!((k=a("$.config.principals"))!=null&&k.required);i.config.principals=C?s("$.config.principals"):null,i.config.identity_realms=[{scope:"cp",id:null,region:null}];break}}}return(y,b)=>(e.openBlock(),e.createElementBlock("div",g$,[e.createVNode(e.unref(Fe.KLabel),{"data-testid":"ff-kong-identity-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("custom_field.kong_identity.title")),1)]),_:1}),e.createElementVNode("p",h$,[e.createTextVNode(e.toDisplayString(u.value)+" ",1),e.createElementVNode("a",y$,e.toDisplayString(e.unref(o)("custom_field.kong_identity.learn_more")),1)]),e.createElementVNode("div",_$,[n.loadingRealms?(e.openBlock(),e.createBlock(e.unref(Fe.KSkeletonBox),{key:0,class:"kong-identity-options-skeleton"})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(e.unref(Fe.KRadio),{card:"","card-orientation":"horizontal","data-testid":"kong-identity-mode-consumers",description:p.value,label:e.unref(o)("custom_field.kong_identity.consumers_label"),"model-value":m.value,"selected-value":"consumers","onUpdate:modelValue":h},{default:e.withCtx(()=>[e.createVNode(e.unref($e.TeamIcon),{size:`var(--kui-icon-size-50, ${e.unref(yd)})`},null,8,["size"])]),_:1},8,["description","label","model-value"]),l.value?(e.openBlock(),e.createBlock(e.unref(Fe.KRadio),{key:0,card:"","card-orientation":"horizontal","data-testid":"kong-identity-mode-centrally-managed",description:e.unref(o)("custom_field.kong_identity.centrally_managed_description"),label:e.unref(o)("custom_field.kong_identity.centrally_managed_label"),"model-value":m.value,"selected-value":"centrally-managed","onUpdate:modelValue":h},{default:e.withCtx(()=>[e.createVNode(e.unref($e.AccountTreeIcon),{size:`var(--kui-icon-size-50, ${e.unref(yd)})`},null,8,["size"])]),_:1},8,["description","label","model-value"])):e.createCommentVNode("",!0),e.createVNode(e.unref(Fe.KRadio),{card:"","card-orientation":"horizontal","data-testid":"kong-identity-mode-kong-identity",description:d.value,label:e.unref(o)("custom_field.kong_identity.kong_identity_label"),"model-value":m.value,"selected-value":"kong-identity","onUpdate:modelValue":h},{default:e.withCtx(()=>[e.createVNode(e.unref($e.KeyIcon),{size:`var(--kui-icon-size-50, ${e.unref(yd)})`},null,8,["size"])]),_:1},8,["description","label","model-value"])],64))])]))}}),[["__scopeId","data-v-75509002"]]),lw=Symbol("fetched-realms"),w$={"data-testid":"ff-identity-realms-field"},k$=["innerHTML"],cw=e.defineComponent({__name:"IdentityRealmsField",props:{name:{},label:{},labelAttributes:{},required:{type:Boolean},placeholder:{},resetLabelPath:{}},setup(n){const t=n,{error:r,value:o,path:i}=Ft(e.toRef(t,"name"));if(r)throw r;const a=ln(i,t),s=e.inject(lw,void 0);return(c,l)=>{var p;const u=e.resolveComponent("KLabel");return e.openBlock(),e.createElementBlock("div",w$,[e.createVNode(u,e.mergeProps({class:"ff-array-field-label"},e.unref(a),{"data-testid":`ff-label-${e.unref(i)}`,"tooltip-attributes":e.unref(a).labelAttributes.tooltipAttributes}),e.createSlots({default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a).label)+" ",1)]),_:2},[(p=e.unref(a).labelAttributes)!=null&&p.info?{name:"tooltip",fn:e.withCtx(()=>[e.renderSlot(c.$slots,"tooltip",{},()=>[e.createElementVNode("div",{innerHTML:e.unref(a).labelAttributes.info},null,8,k$)])]),key:"0"}:void 0]),1040,["data-testid","tooltip-attributes"]),e.createVNode(d_,{modelValue:e.unref(o),"onUpdate:modelValue":l[0]||(l[0]=d=>e.isRef(o)?o.value=d:null),realms:e.unref(s)},null,8,["modelValue","realms"])])}}}),C$=je(e.defineComponent({name:"PrincipalsCreationGuide",__name:"PrincipalsCreationGuide",props:{loading:{type:Boolean},showPanel:{type:Boolean},dataPlaneIncompatible:{type:Boolean}},emits:["click:learn-more","click:create-entity"],setup(n,{emit:t}){const r=t,{i18n:o}=st.useI18n(),{t:i}=o,a=e.ref(!1),s=()=>{a.value=!1,r("click:create-entity",{type:"principal"})};return(c,l)=>{const u=e.resolveComponent("KSkeleton");return e.openBlock(),e.createElementBlock(e.Fragment,null,[n.loading?(e.openBlock(),e.createBlock(u,{key:0,class:"kong-identity-principals-skeleton","data-testid":"kong-identity-principals-loading"})):n.showPanel?(e.openBlock(),e.createBlock(e.unref(Fe.KEmptyState),{key:1,class:"kong-identity-principals","data-testid":"kong-identity-principals-panel",message:e.unref(i)("custom_field.kong_identity.configure_description"),title:e.unref(i)("custom_field.kong_identity.configure_title")},{icon:e.withCtx(()=>[...l[3]||(l[3]=[])]),action:e.withCtx(()=>[e.createVNode(e.unref(Fe.KButton),{appearance:"primary","data-testid":"kong-identity-create-principal",onClick:l[0]||(l[0]=p=>a.value=!0)},{default:e.withCtx(()=>[e.createVNode(e.unref($e.AddIcon),{decorative:""}),e.createTextVNode(" "+e.toDisplayString(e.unref(i)("custom_field.kong_identity.create_principal")),1)]),_:1}),e.createVNode(e.unref(Fe.KButton),{appearance:"secondary",class:"open-learning-hub","data-testid":"kong-identity-principals-learn-more",onClick:l[1]||(l[1]=p=>r("click:learn-more","kong-identity"))},{default:e.withCtx(()=>[e.createVNode(e.unref($e.BookIcon),{decorative:""}),e.createTextVNode(" "+e.toDisplayString(e.unref(i)("custom_field.kong_identity.configure_learn_more")),1)]),_:1})]),_:1},8,["message","title"])):n.dataPlaneIncompatible?(e.openBlock(),e.createBlock(e.unref(Fe.KAlert),{key:2,appearance:"warning",class:"kong-identity-dp-version-alert","data-testid":"kong-identity-dp-version-alert",message:e.unref(i)("custom_field.kong_identity.incompatible_data_plane_alert"),"show-icon":""},null,8,["message"])):e.createCommentVNode("",!0),e.createVNode(e.unref(Fe.KPrompt),{"action-button-text":e.unref(i)("custom_field.kong_identity.leave_prompt_action"),"data-testid":"kong-identity-create-principal-prompt",message:e.unref(i)("custom_field.kong_identity.leave_prompt_message"),title:e.unref(i)("custom_field.kong_identity.leave_prompt_title"),visible:a.value,onCancel:l[2]||(l[2]=p=>a.value=!1),onProceed:s},null,8,["action-button-text","message","title","visible"])],64)}}}),[["__scopeId","data-v-d86101ef"]]),uw=Symbol("before-save"),E$={key:0,class:"identity-realms-error","data-testid":"identity-realms-validation-error"},N$={key:0,class:"kong-identity-error-on-miss"},S$=je(e.defineComponent({__name:"ConfigFormContent",emits:["click:learn-more","click:create-entity"],setup(n,{emit:t}){const r=t,o={major:3,minor:15};function i(J){const[G,v]=J.split(".").map(Number);return Number.isNaN(G)||Number.isNaN(v)?!1:G!==o.major?G<o.major:v<o.minor}const a=e.inject(uw),s=e.inject(nw),{i18n:c}=st.useI18n(),l=e.inject(et.FORMS_CONFIG),u=e.computed(()=>(l==null?void 0:l.app)==="konnect"),{axiosInstance:p}=Ie.useAxios(l==null?void 0:l.axiosRequestConfig),{formData:d,getSchema:f}=pt(),m=e.computed(()=>!!f("$.config.principals.error_on_miss")),h=e.computed(()=>l==null?void 0:l.principalsCreationGuideVisible),y=e.computed(()=>h.value===!0),b=e.computed(()=>h.value===void 0),_=e.computed(()=>{var J,G;return((G=(J=d.config)==null?void 0:J.principals)==null?void 0:G.error_on_miss)??!0});function k(J){var G;(G=d.config)!=null&&G.principals&&(d.config.principals.error_on_miss=J)}const C=e.ref([]),N=e.ref(!1),E=async()=>{var J;if(!((l==null?void 0:l.app)!=="konnect"||!w.value))try{N.value=!0;let G=`${l.apiBaseUrl}/v1/realms`;const v=[];do{const q=await p.get(G);(J=q==null?void 0:q.data)!=null&&J.data&&v.push(...q.data.data.map(ie=>({value:ie.id,label:ie.name}))),G=q.data.meta.next?`${l.apiBaseUrl}${q.data.meta.next}`:null}while(G);C.value=v}catch{C.value=[]}finally{N.value=!1}};e.onMounted(E),e.provide(lw,C);const w=e.computed(()=>!!f("$.config.identity_realms")),S=e.inject(fr.KHCP_20393_IDENTITY_PRINCIPALS_UI,!1),I=e.computed(()=>S&&!!f("$.config.principals")),U=e.computed(()=>((l==null?void 0:l.dataPlaneVersions)??[]).some(i));function x(){var J,G,v,q;if((G=(J=d.config)==null?void 0:J.principals)!=null&&G.enabled)return"kong-identity";if(u.value){if(A((v=d.config)==null?void 0:v.identity_realms))return"centrally-managed"}else if(Array.isArray((q=d.config)==null?void 0:q.identity_realms)&&d.config.identity_realms.length>0)return"centrally-managed";return"consumers"}function A(J){return!Array.isArray(J)||J.length===0?!1:J.some(G=>G.scope!=="cp"&&G.id!=null)}const T=e.ref(x());e.watch(()=>l==null?void 0:l.principalsDirectoryName,J=>{var G;s!=null&&s.value||T.value!=="kong-identity"||J==null||(G=d.config)!=null&&G.principals&&(d.config.principals.directory=J)},{immediate:!0}),e.watch(T,J=>{var v;if(J!=="kong-identity")return;const G=l==null?void 0:l.principalsDirectoryName;G==null||!((v=d.config)!=null&&v.principals)||(d.config.principals.directory=G)});const V=e.computed(()=>{var J;return u.value&&T.value==="centrally-managed"&&!A((J=d.config)==null?void 0:J.identity_realms)}),R=e.ref(!1),X=e.ref(!1);let Y=!1;e.watch(T,async J=>{J==="centrally-managed"&&(R.value=!1,X.value=!1,Y=!1,await e.nextTick(),Y=!0)}),e.onMounted(()=>{T.value==="centrally-managed"&&(Y=!0)}),e.watch(()=>{var J;return(J=d.config)==null?void 0:J.identity_realms},()=>{T.value==="centrally-managed"&&Y&&(R.value=!0)},{deep:!0});function ne(){Y&&(R.value=!0)}const M=e.computed(()=>(R.value||X.value)&&V.value),te=a==null?void 0:a(()=>V.value?(X.value=!0,!1):!0);e.onUnmounted(()=>te==null?void 0:te());const $=e.computed(()=>{var J;return!!((J=f("$.config.realm"))!=null&&J.required)}),Z=e.computed(()=>{const J=["anonymous","principals","identity_realms"];return $.value||J.push("realm"),J}),F=e.computed(()=>{var q;const J=f("$.config"),G=((q=J==null?void 0:J.fields)==null?void 0:q.map(ie=>Object.keys(ie)[0]))??[],v=new Set(["anonymous"]);return!$.value&&T.value!=="kong-identity"&&v.add("realm"),u.value&&w.value&&!I.value&&v.add("identity_realms"),G.filter(ie=>!v.has(ie))});return(J,G)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(Ut,{"as-child":"",class:"ff-default-visible-fields",name:"config",omit:Z.value,"reset-label-path":"reset"},null,8,["omit"]),u.value&&I.value?(e.openBlock(),e.createBlock(b$,{key:0,modelValue:T.value,"onUpdate:modelValue":G[0]||(G[0]=v=>T.value=v),class:"kong-identity-section","identity-realms-in-schema":w.value,"loading-realms":N.value},null,8,["modelValue","identity-realms-in-schema","loading-realms"])):e.createCommentVNode("",!0),u.value&&w.value&&T.value==="centrally-managed"?(e.openBlock(),e.createElementBlock("div",{key:1,class:"identity-realms-section","data-testid":"identity-realms-section",onClick:ne},[e.createVNode(cw,{name:"$.config.identity_realms",required:!0}),M.value?(e.openBlock(),e.createElementBlock("p",E$,e.toDisplayString(e.unref(c).t("custom_field.kong_identity.identity_realms_required")),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),u.value&&I.value&&T.value==="kong-identity"?(e.openBlock(),e.createBlock(C$,{key:2,class:"kong-identity-principals-section","data-plane-incompatible":U.value,loading:b.value,"show-panel":y.value,"onClick:createEntity":G[1]||(G[1]=v=>r("click:create-entity",v)),"onClick:learnMore":G[2]||(G[2]=v=>r("click:learn-more",v))},null,8,["data-plane-incompatible","loading","show-panel"])):e.createCommentVNode("",!0),e.createVNode(ts,{class:"ff-advanced-fields-container","data-testid":"ff-advanced-fields-container","hide-general-fields":""},{default:e.withCtx(()=>[u.value&&I.value&&T.value==="kong-identity"&&m.value?(e.openBlock(),e.createElementBlock("div",N$,[e.createVNode(e.unref(Fe.KLabel),{"data-testid":"ff-principals-error-on-miss-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c).t("custom_field.kong_identity.error_on_miss_label")),1)]),_:1}),e.createVNode(e.unref(Fe.KRadio),{"data-testid":"principals-error-on-miss-true",description:e.unref(c).t("custom_field.kong_identity.error_on_miss_reject_description"),label:e.unref(c).t("custom_field.kong_identity.error_on_miss_reject_label"),"model-value":_.value,"selected-value":!0,"onUpdate:modelValue":k},null,8,["description","label","model-value"]),e.createVNode(e.unref(Fe.KRadio),{"data-testid":"principals-error-on-miss-false",description:e.unref(c).t("custom_field.kong_identity.error_on_miss_continue_description"),label:e.unref(c).t("custom_field.kong_identity.error_on_miss_continue_label"),"model-value":_.value,"selected-value":!1,"onUpdate:modelValue":k},null,8,["description","label","model-value"])])):e.createCommentVNode("",!0),e.createVNode(Ut,{"as-child":"",name:"config",omit:F.value,"reset-label-path":"reset"},null,8,["omit"])]),_:1})],64))}}),[["__scopeId","data-v-7dc8344d"]]),dw=e.defineComponent({__name:"ConfigFormWithIdentity",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},configSections:{},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},emits:["click:learn-more","click:create-entity"],setup(n,{emit:t}){const r=n,o=t,i=e.useSlots();return e.provide(et.AUTOFILL_SLOT,i==null?void 0:i[et.AUTOFILL_SLOT_NAME]),e.provide(nw,e.computed(()=>r.isEditing)),(a,s)=>(e.openBlock(),e.createBlock(er,e.normalizeProps(e.guardReactiveProps(r)),{default:e.withCtx(()=>[e.createVNode(S$,{"onClick:createEntity":s[0]||(s[0]=c=>o("click:create-entity",c)),"onClick:learnMore":s[1]||(s[1]=c=>o("click:learn-more",c))})]),_:1},16))}}),x$=ze({experimental:!0,component:dw,renderRules:{dependencies:{"config.brute_force_protection.redis":["config.brute_force_protection.strategy","redis"]}},fieldRenderers:[{match:"config.anonymous",component:Xe,propsOverrides:{placeholder:"e.g., 00000000-0000-0000-0000-000000000001"}}]}),A$=ze({experimental:!0}),v$=ze({experimental:!0}),I$=ze({experimental:!0,fieldRenderers:[{match:"config.message_by_lua_functions.*",component:Xe,propsOverrides:{multiline:!0,rows:3}}]}),B$=ze({experimental:!0,fieldRenderers:[{match:"config.message_by_lua_functions.*",component:Xe,propsOverrides:{multiline:!0,rows:3}}]}),T$=ze({experimental:!0}),O$=ze({experimental:!0,fieldRenderers:[{match:({path:n})=>n==="config.methods"||n==="config.request_method",component:Dt,propsOverrides:{multiple:!0}}]}),fw=Object.entries(Object.assign({"./authenticate-third-party-with-dynamic-url.yaml":`nodes:
178
+ `,r)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const r=mc(t),o=Oi(r);return o.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const r=mc(t),o=Oi(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,r){return this.type!=="comment"||this.indent<=r?!1:t.every(o=>o.type==="newline"||o.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function dV(n){const t=n.prettyErrors!==!1;return{lineCounter:n.lineCounter||t&&new cV||null,prettyErrors:t}}function fV(n,t={}){const{lineCounter:r,prettyErrors:o}=dV(t),i=new uV(r==null?void 0:r.addNewLine),a=new oV(t);let s=null;for(const c of a.compose(i.parse(n),!0,n.length))if(!s)s=c;else if(s.options.logLevel!=="silent"){s.errors.push(new Ja(c.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return o&&r&&(s.errors.forEach(Rb(n,r)),s.warnings.forEach(Rb(n,r))),s}function Jb(n,t){const r=n.range;if(!r)return;const o=Math.max(0,r[0]),i=typeof r[1]=="number"?r[1]:typeof r[2]=="number"?r[2]:r[0],a=Math.max(o,i),s=t.getPositionAt(o),c=t.getPositionAt(a);return{startLineNumber:s.lineNumber,startColumn:s.column,endLineNumber:c.lineNumber,endColumn:c.column}}function pV(n){return Et(n)?n.value:n.toJSON()}function mV(n){if(!Et(n))return;const{value:t}=n;return typeof t=="string"||typeof t=="number"?t:void 0}function Xb(n,t){const r=mV(t);return r===void 0?n:[...n,r]}function gV(n,t){const r=[{node:n,keyPath:[]}];for(;r.length>0;){const o=r.pop();if(!o)continue;const{node:i,keyPath:a}=o;if(t(i,a),bi(i)){for(let s=i.items.length-1;s>=0;s--){const c=i.items[s];St(c.value)&&r.push({node:c.value,keyPath:Xb(a,c.key)}),St(c.key)&&r.push({node:c.key,keyPath:a})}continue}if(wi(i))for(let s=i.items.length-1;s>=0;s--){const c=i.items[s],l=[...a,s];if(Mt(c)){St(c.value)&&r.push({node:c.value,keyPath:Xb(l,c.key)}),St(c.key)&&r.push({node:c.key,keyPath:l});continue}St(c)&&r.push({node:c,keyPath:l})}}}function hV(n,t){const r=n.getIn(t,!0);return St(r)?r:void 0}function Zb(n,t){return{provideCodeLenses:async(r,o)=>{if(r.getLanguageId()!=="yaml")return Or();const i=await tb(r);if(i.isDefault||i.language!=="yaml")return Or();const a=i.document,s=a==null?void 0:a.contents;return!a||!s?Or():n(s,r,o)}}}function Qb(n,t){return Zb((r,o,i)=>{const a=[];return gV(r,(s,c)=>{if(i.isCancellationRequested||!Et(s)||typeof s.value!="string"||!XO.test(s.value))return;const l=Jb(s,o);l&&a.push({value:s.value,range:l,context:{keyPath:c,node:s}})}),i.isCancellationRequested?Or():typeof n=="function"?n(a):{lenses:a.map(({value:s,range:c})=>ZO(s,c,n)),dispose:()=>{}}})}function op(n,t,r){return{provideCodeLenses:async(o,i)=>{if(o.getLanguageId()!=="yaml")return Or();const a=await tb(o);if(a.isDefault||a.language!=="yaml"||i.isCancellationRequested)return Or();const s=a.document,c=s==null?void 0:s.contents;if(!s||!c)return Or();const l=hV(s,n);if(!l)return Or();const u=Jb(l,o);return u?t(pV(l),u,{keyPath:n,node:l}):Or()}}}function yV(n,t){const r=fV(n);return{language:"yaml",altVersionId:t,document:r}}const _V=Object.freeze(Object.defineProperty({__proto__:null,createYAMLCodeLensProvider:Zb,createYAMLCopyUUIDCodeLensProvider:Qb,createYAMLValueCodeLensProvider:op,parseIntoYAMLContext:yV},Symbol.toStringTag,{value:"Module"}));let bV="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",wV=(n=21)=>{let t="",r=crypto.getRandomValues(new Uint8Array(n|=0));for(;n--;)t+=bV[r[n]&63];return t};const kV="/v2/control-planes/{controlPlaneId}/core-entities/v1",vn="/v2/control-planes/{controlPlaneId}/core-entities/{workspace}",gr="/v2/control-planes/{controlPlaneId}/core-entities",qt="/{workspace}",tt={list:{konnect:{all:`${vn}/plugins`,forEntity:`${vn}/{entityType}/{entityId}/plugins`},kongManager:{all:`${qt}/plugins`,forEntity:`${qt}/{entityType}/{entityId}/plugins`}},select:{konnect:{availablePlugins:`${kV}/available-plugins`,streamingCustomPlugins:`${gr}/custom-plugins`,clonedPlugins:`${gr}/cloned-plugins`,schemaCustomPluginItem:`${gr}/plugin-schemas/{pluginId}`,streamingCustomPluginItem:`${gr}/custom-plugins/{pluginId}`},kongManager:{availablePlugins:`${qt}/kong`,availablePluginsForOss:"/",streamingCustomPlugins:`${qt}/custom-plugins`,clonedPlugins:`${qt}/cloned-plugins`}},form:{konnect:{create:{all:`${vn}/plugins`,forEntity:`${vn}/{entityType}/{entityId}/plugins`},edit:{all:`${vn}/plugins/{id}`,forEntity:`${vn}/{entityType}/{entityId}/plugins/{id}`},pluginSchema:"/v2/control-planes/{controlPlaneId}/core-entities/schemas/plugins/{plugin}",credential:{create:`${vn}/{resourceEndpoint}`,edit:`${vn}/{resourceEndpoint}/{id}`},credentialSchema:"/v2/control-planes/{controlPlaneId}/core-entities/schemas/{plugin}",entityGetOne:`${vn}/{entity}/{id}`,entityGetAll:`${vn}/{entity}`,entityPeek:`${vn}/{entity}?size={amount}`},kongManager:{create:{all:`${qt}/plugins`,forEntity:`${qt}/{entityType}/{entityId}/plugins`},edit:{all:`${qt}/plugins/{id}`,forEntity:`${qt}/{entityType}/{entityId}/plugins/{id}`},pluginSchema:`${qt}/schemas/plugins/{plugin}`,credential:{create:`${qt}/{resourceEndpoint}`,edit:`${qt}/{resourceEndpoint}/{id}`},credentialSchema:`${qt}/schemas/{plugin}`,entityGetOne:`${qt}/{entity}/{id}`,entityGetAll:`${qt}/{entity}`}},customPlugin:{konnect:{installed:{create:`${gr}/plugin-schemas`,edit:`${gr}/plugin-schemas/{pluginId}`},streamed:{create:`${gr}/custom-plugins`,edit:`${gr}/custom-plugins/{pluginId}`},cloned:{create:`${gr}/cloned-plugins`,edit:`${gr}/cloned-plugins/{pluginId}`}},kongManager:{streamed:{create:`${qt}/custom-plugins`,edit:`${qt}/custom-plugins/{pluginId}`},cloned:{create:`${qt}/cloned-plugins`,edit:`${qt}/cloned-plugins/{pluginId}`}}},item:{konnect:{all:`${vn}/plugins/{id}`,forEntity:`${vn}/{entityType}/{entityId}/plugins/{id}`},kongManager:{all:`${qt}/plugins/{id}`,forEntity:`${qt}/{entityType}/{entityId}/plugins/{id}`}}},ip=new WeakMap,ew=Object.fromEntries(["service","route","consumer","consumer_group","certificate"].map(n=>[`${n}s`,n]));function CV(){const{i18n:{t:n}}=Qe(),t=o=>n(`plugins.free-form.code-lens.entity.${o}`),r=(o,i)=>n("plugins.free-form.code-lens.field.name",{value:o,entity:i});return{service:{title:t("service"),fields:[{id:"field/name",resolve:o=>o.data.name?r(o.data.name,t("service")):void 0}]},route:{title:t("route"),fields:[{id:"field/name",resolve:o=>o.data.name?r(o.data.name,t("route")):void 0}]},consumer_group:{title:t("consumer_group"),fields:[{id:"field/name",resolve:o=>o.data.name?r(o.data.name,t("consumer_group")):void 0}]},consumer:{title:t("consumer"),fields:[{id:"field/username",resolve:o=>o.data.username?n("plugins.free-form.code-lens.field.username",{value:o.data.username}):void 0},{id:"field/customId",resolve:o=>o.data.custom_id?n("plugins.free-form.code-lens.field.custom_id",{value:o.data.custom_id}):void 0}]},certificate:{title:t("certificate"),fields:[{id:"field/subject",resolve:o=>{if(o)return n("plugins.free-form.code-lens.field.subject",{value:o.cert.subject})}},{id:"field/notAfter",resolve:o=>{if(o)return n("plugins.free-form.code-lens.field.expires_after",{value:o.cert.notAfter.toLocaleString("en")})}}],commands:[{id:"cmd/copyCert",resolve:(o,i)=>o.cert?{id:i,title:n("plugins.free-form.code-lens.action.copy_certificate"),arguments:[o.cert]}:void 0}]}}}function EV(n){const t=[];for(const[r,o]of Object.entries(n)){if(o.type!=="foreign")continue;const i=o.reference;Object.prototype.hasOwnProperty.call(ew,i)&&t.push({entity:ew[i],keyPath:r.split(".")})}return t}function NV(n,t,r){let o=`${n.apiBaseUrl}${tt.form[n.app].entityGetOne}`;return n.app==="konnect"&&(o=o.replace(/{controlPlaneId}/gi,n.controlPlaneId||"")),o=o.replace(/\/{workspace}/gi,n.workspace?`/${n.workspace}`:"").replace(/{entity}/gi,t).replace(/{id}/gi,r),o}function SV(n){const t=Number(n);return Number.isFinite(t)&&Math.abs(t)<1e12?t*1e3:t}function tw(n){return op([n],(t,r)=>({lenses:[{range:r,command:{id:"",title:`$(calendar) ${new Date(SV(t)).toLocaleString("en",{dateStyle:"full",timeStyle:"full"})}`}}],dispose:()=>{}}))}function xV(n,t){const r=`kong.entities-plugins.codeEditor.command.${wV()}`,o=`${r}.copy`,i=`${r}.viewEntity`,{axiosInstance:a}=Ie.useAxios(t??n.axiosRequestConfig),s=Ar.useRouter(),{i18n:{t:c}}=Qe(),{getSchemaMap:l}=pt(),u=CV();function p(f,m){const h=new Map,y=new fo.Emitter,b=`${r}.${f}.reloadCodeLensProvider`,_=op(m??[f],async(N,E)=>{const w=N==null?void 0:N.id;if(!w)return ha.emptyCodeLensList();h.has(w)||h.set(w,(async()=>{var A,T;const U=NV(n,`${f}s`,w),x=await a.get(U);if(x.status<200||x.status>=300)throw new Error(x.statusText);if(f==="consumer_group"&&((A=x.data)!=null&&A.consumer_group))return{data:x.data.consumer_group};if(f==="certificate"){const V=(T=x.data)==null?void 0:T.cert;if(!V)throw new Error("Missing certificate");await Promise.resolve().then(()=>HU);const{X509Certificate:R}=await Promise.resolve().then(()=>YK);return{data:x.data,cert:new R(V)}}return{data:x.data}})());const S=u[f];return{lenses:[...S.fields.map(U=>({id:`${w}:${U.id}`,range:E})),{range:E,command:{id:i,title:`${c("plugins.free-form.code-lens.action.view_entity",{title:S.title})} $(link-external)`,arguments:[f,w]}},...(S.commands??[]).map(U=>({id:`${w}:${U.id}`,range:E}))],dispose:()=>{}}}),k={provideCodeLenses:_.provideCodeLenses,resolveCodeLens:async(N,E,w)=>{var A;if(E=(_.resolveCodeLens&&await _.resolveCodeLens(N,E,w))??E,!E.id)return E;const S=E.id.indexOf(":"),I=E.id.indexOf("/"),U=E.id.substring(0,S),x=E.id.substring(S+1,I);try{const T=await h.get(U);if(!T)throw new Error("Expected the cached entity to be non-empty");const V=u[f],R=E.id.substring(S+1);switch(x){case"field":{const X=V.fields.find(ne=>ne.id===R),Y=await(X==null?void 0:X.resolve(T));Y&&(E.command={id:"",title:Y});break}case"cmd":{const X=(A=V.commands)==null?void 0:A.find(ne=>ne.id===R),Y=await(X==null?void 0:X.resolve(T,o));Y&&(E.command=Y);break}}}catch(T){console.error("Error resolving code lens:",T),E.command={id:b,title:`$(warning) ${c("plugins.free-form.code-lens.action.retry_fetch")}`,arguments:[U],tooltip:T instanceof Error?T.message:c("plugins.free-form.code-lens.unknown_error")}}return E},onDidChange:y.event},C=fo.editor.registerCommand(b,(N,E)=>{h.delete(E),y.fire(k)});return{provider:k,dispose:()=>{y.dispose(),C.dispose()}}}function d(f){var _;(_=ip.get(f))==null||_();const m=[fo.languages.registerCodeLensProvider({language:"yaml",scheme:f.uri.scheme,pattern:f.uri.path},ha.collectCodeLensProviders([Qb({copyCommandId:o,title:c("plugins.free-form.code-lens.action.copy_uuid")}),tw("created_at"),tw("updated_at")]))],h=EV(l());for(const{entity:k,keyPath:C}of h){const N=p(k,C);m.push(fo.languages.registerCodeLensProvider({language:"yaml",scheme:f.uri.scheme,pattern:f.uri.path},N.provider),{dispose:N.dispose})}const y={service:n.viewServiceRoute,route:n.viewRouteRoute,consumer:n.viewConsumerRoute,consumer_group:n.viewConsumerGroupRoute,certificate:n.viewCertificateRoute};m.push(fo.editor.registerCommand(o,(k,C)=>{var E;const N=String(C);if(!((E=navigator.clipboard)!=null&&E.writeText)){console.warn("[useCodeLensProviders] Clipboard API is unavailable");return}navigator.clipboard.writeText(N).catch(w=>{console.warn("[useCodeLensProviders] Failed to copy to clipboard:",w)})}),fo.editor.registerCommand(i,(k,C,N)=>{var w;const E=(w=y[C])==null?void 0:w.call(y,N);E&&window.open(s.resolve(E).href,"_blank","noopener")}));const b=()=>{ip.delete(f),m.splice(0,m.length).forEach(k=>{try{k.dispose()}catch(C){console.warn("[useCodeLensProviders] Failed to dispose:",C)}})};return ip.set(f,b),f.onWillDispose(b),b}return{setup:d}}const AV={class:"plugin-code-editor","data-testid":"plugin-code-editor"},vV="YAML Syntax",IV=je(e.defineComponent({__name:"CodeEditor",emits:["change","sourceChange","error"],setup(n,{emit:t}){const r=e.inject(et.FORMS_CONFIG),{formData:o,setValue:i}=pt(),a=t,s=e.shallowRef(null),{setup:c}=xV(r,{validateStatus:m=>m>=200&&m<500});function l(){return Ln.dump(Xr(e.toRaw(o),["__ui_data"]),{schema:xo,noArrayIndent:!0})}const u=e.shallowRef(l()),p={scrollbar:{alwaysConsumeMouseWheel:!1},autoIndent:"keep",editContext:!1};function d(m){const h=m.getModel();h&&(c(h),s.value=m,m.onDidChangeModelContent(()=>{try{const y=Ln.load(m.getValue()||"",{schema:xo,json:!0});if(a("sourceChange",m.getValue()),typeof y!="object"||y===null)return;ul.editor.setModelMarkers(h,vV,[]),i(y),a("change",y)}catch(y){const b=y instanceof Error?y.message:String(y);a("error",b)}}),f())}function f(){const m=s.value,h=m==null?void 0:m.getModel();!m||!h||(m.setPosition(h.getFullModelRange().getEndPosition()),m.focus())}return(m,h)=>(e.openBlock(),e.createElementBlock("div",AV,[e.createVNode(e.unref(ha.MonacoEditor),{ref:"editor",modelValue:u.value,"onUpdate:modelValue":h[0]||(h[0]=y=>u.value=y),class:"editor",language:"yaml",options:p,theme:"light",onReady:d},null,8,["modelValue"])]))}}),[["__scopeId","data-v-a076c960"]]),es={jqlang:"https://jqlang.org/manual/",condition:"https://developer.konghq.com/gateway/routing/expressions/",customPluginSandboxing:"https://developer.konghq.com/gateway/sandboxing/",pluginPriority:"https://developer.konghq.com/gateway/entities/plugin/#plugin-priority"},BV={class:"label-content"},TV=je(e.defineComponent({__name:"ConditionField",setup(n){const t=e.useId(),{i18n:{t:r},i18nT:o}=Qe();return(i,a)=>{const s=e.resolveComponent("KBadge"),c=e.resolveComponent("KLabel"),l=e.resolveComponent("KExternalLink");return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(c,{for:e.unref(t),label:e.unref(r)("plugins.form.fields.condition.label")},{default:e.withCtx(()=>[e.createElementVNode("div",BV,[e.createTextVNode(e.toDisplayString(e.unref(r)("plugins.form.fields.condition.label"))+" ",1),e.createVNode(e.unref(Fe.KTooltip),{class:"label-tooltip"},{content:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("plugins.form.fields.condition.tooltip")),1)]),default:e.withCtx(()=>[e.createVNode(e.unref($e.InfoIcon),{class:"tooltip-trigger-icon",tabindex:"0"})]),_:1}),e.createVNode(s,{appearance:"decorative",size:"small"},{default:e.withCtx(()=>[...a[0]||(a[0]=[e.createTextVNode(" Beta ",-1)])]),_:1})])]),_:1},8,["for","label"]),e.createVNode(Xe,{"input-id":e.unref(t),label:"",name:"condition",placeholder:e.unref(r)("plugins.form.fields.condition.placeholder")},{help:e.withCtx(()=>[e.createVNode(e.unref(o),{keypath:"plugins.form.fields.condition.help.about"},{link:e.withCtx(()=>[e.createVNode(l,{"hide-icon":"",href:e.unref(es).condition},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("plugins.form.fields.condition.help.learn")),1)]),_:1},8,["href"])]),_:1})]),_:1},8,["input-id","placeholder"])])}}}),[["__scopeId","data-v-ebaf84a5"]]),Zt=e.defineComponent({name:"SchemaForm",__name:"Form",props:{tag:{default:"form"},schema:{},data:{},config:{},fieldsOrder:{},renderRules:{}},emits:["change","globalAction"],setup(n,{expose:t,emit:r}){const o=r,i=e.useSlots(),{getSchema:a,formData:s,setValue:c,getValue:l,rootRenderRules:u}=x_({schema:n.schema,propsData:e.computed(()=>n.data),propsConfig:n.config,propsRenderRules:e.toRef(()=>n.renderRules),onChange:d=>o("change",d)}),p=e.computed(()=>{var m;const{fields:d}=a();let f=[...d];return n.fieldsOrder?k_(f,n.fieldsOrder):((m=u.value)!=null&&m.bundles&&(f=C_([...f],u.value.bundles)),f)});return t({getValue:l,getRawValue:()=>e.toRaw(s),setValue:c}),(d,f)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.tag),null,{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(i)[e.unref(So)]))),e.renderSlot(d.$slots,"default",{},()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,m=>(e.openBlock(),e.createBlock(it,{key:Object.keys(m)[0],name:Object.keys(m)[0],onGlobalAction:f[0]||(f[0]=(h,y)=>o("globalAction",h,y))},null,8,["name"]))),128))])]),_:3}))}}),Rt=e.defineComponent({__name:"FieldRenderer",props:{match:{type:Function},priority:{}},setup(n){const t=n,{default:r}=e.useSlots(),{fieldRendererRegistry:o}=pt();return r&&o.set(t.match,r),(i,a)=>null}}),Pi=Symbol("redis-partial-info"),nw=Symbol("free-form-editing"),OV={konnect:{getOne:"/v2/control-planes/{controlPlaneId}/core-entities/partials/{id}",getAll:"/v2/control-planes/{controlPlaneId}/core-entities/partials"},kongManager:{getOne:"/{workspace}/partials/{id}",getAll:"/{workspace}/partials"}},PV={class:"partial-config-card"},VV={class:"config-card-row-label"},$V={class:"label-text"},RV=["data-testid"],LV=["data-testid"],DV={key:1},MV=["data-testid"],jV=["data-testid"],FV=je(e.defineComponent({__name:"RedisConfigCard",props:{configFields:{},pluginRedisFields:{}},setup(n){const{t,formatUnixTimeStamp:r}=jt.createI18n("en-us",Jt),o={id:{order:1},name:{order:1},type:{label:t("redis.config_card.common_fields.type_label"),hidden:!0,type:"hidden"},created_at:{label:t("redis.config_card.common_fields.created_at_label"),formatter:r,order:2},updated_at:{label:t("redis.config_card.common_fields.updated_at_label"),formatter:r,order:3}},i=n,a=d=>d!=null,s=(d,f)=>a(f)&&["password","sentinel_password"].includes(d)?"password":"text",{convertKeyToTitle:c}=Ie.useStringHelpers(),l=e.computed(()=>Object.entries(i.configFields).map(([d,f])=>{var m,h,y,b;return{key:d,label:((m=o[d])==null?void 0:m.label)??c(d),value:(h=o[d])!=null&&h.formatter?o[d].formatter(f):f,type:((y=o[d])==null?void 0:y.type)??s(d,f),order:((b=o[d])==null?void 0:b.order)??100}}).sort((d,f)=>d.order-f.order).filter(d=>d.type!=="hidden")),u=WT(i.configFields,i.pluginRedisFields||[]),p=e.computed(()=>l.value.concat(u));return(d,f)=>{const m=e.resolveComponent("KCopy");return e.openBlock(),e.createElementBlock("div",PV,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,({key:h,label:y,value:b,type:_})=>(e.openBlock(),e.createElementBlock("div",{key:h,class:"partial-config-card-row"},[e.createElementVNode("div",VV,[e.createElementVNode("div",$V,e.toDisplayString(y),1)]),e.createElementVNode("div",{class:"config-card-row-value","data-testid":`${h}-property-value`},[a(b)?(e.openBlock(),e.createElementBlock("div",DV,[_==="password"?(e.openBlock(),e.createElementBlock("div",{key:0,"data-testid":`${h}-copy-password`},[e.createVNode(m,{format:"redacted",text:String(b)},null,8,["text"])],8,MV)):(e.openBlock(),e.createElementBlock("div",{key:1,"data-testid":`${h}-plain-text`},e.toDisplayString(b),9,jV))])):(e.openBlock(),e.createElementBlock("div",{key:0,"data-testid":`${h}-no-value`}," – ",8,LV))],8,RV)]))),128))])}}}),[["__scopeId","data-v-82dcdf99"]]),UV={class:"redis-config-radio-group","data-testid":"redis-config-radio-group"},KV={class:"shared-redis-config"},qV={class:"shared-redis-config-title"},GV={class:"redis-config-select","data-testid":"redis-config-select"},HV={key:1,class:"redis-shared-config-error-message","data-testid":"redis-config-fetch-error"},ap=je(e.defineComponent({__name:"RedisSelector",props:{defaultRedisConfigItem:{},redisType:{},redisPath:{},isKonnectManagedRedisEnabled:{type:Boolean,default:!1}},setup(n){var te;const{t}=jt.createI18n("en-us",Jt),r=["host","port","database","username","password","sentinel_master","sentinel_role","sentinel_nodes","sentinel_username","sentinel_password","cluster_nodes","cluster_max_redirections","ssl","ssl_verify","server_name","keepalive_backlog","keepalive_pool_size","timeout","read_timeout","send_timeout","connect_timeout","connection_is_proxied","redis_proxy_type","cloud_authentication"],o={dependencies:{"cloud_authentication.aws_cache_name":["cloud_authentication.auth_provider","aws"],"cloud_authentication.aws_region":["cloud_authentication.auth_provider","aws"],"cloud_authentication.aws_is_serverless":["cloud_authentication.auth_provider","aws"],"cloud_authentication.aws_access_key_id":["cloud_authentication.auth_provider","aws"],"cloud_authentication.aws_secret_access_key":["cloud_authentication.auth_provider","aws"],"cloud_authentication.aws_assume_role_arn":["cloud_authentication.auth_provider","aws"],"cloud_authentication.aws_role_session_name":["cloud_authentication.auth_provider","aws"],"cloud_authentication.gcp_service_account_json":["cloud_authentication.auth_provider","gcp"],"cloud_authentication.azure_client_id":["cloud_authentication.auth_provider","azure"],"cloud_authentication.azure_client_secret":["cloud_authentication.auth_provider","azure"],"cloud_authentication.azure_tenant_id":["cloud_authentication.auth_provider","azure"]}},i=n,a=Jd(),s=e.inject(Pi),c=(s==null?void 0:s.isEditing)||!1,l=e.computed(()=>{var $;return i.redisPath?i.redisPath:($=s==null?void 0:s.redisPath)!=null&&$.value?"$."+s.redisPath.value:"$.config.redis"}),u=i.redisType||((te=s==null?void 0:s.redisType)==null?void 0:te.value),p=e.computed(()=>{var $;return!!(($=s==null?void 0:s.redisType)!=null&&$.value)}),d=e.ref(null),f=e.ref(!c),{getMessageFromError:m}=Ie.useErrors(),h=e.ref(i.defaultRedisConfigItem),y=e.ref({}),b=e.ref(),{value:_}=Nf("$.partials"),{value:k,hide:C}=Ft(l),N=e.inject(et.FORMS_CONFIG),E=$=>$.app==="konnect"&&!!$.isKonnectManagedRedisEnabled,w=e.computed(()=>i.isKonnectManagedRedisEnabled?t("redis.managed_ui.title"):t("redis.title")),S=e.computed(()=>i.isKonnectManagedRedisEnabled?t("redis.managed_ui.shared_configuration.description"):t("redis.shared_configuration.description")),I=e.computed(()=>i.isKonnectManagedRedisEnabled?t("redis.managed_ui.shared_configuration.label"):t("redis.shared_configuration.label")),U=e.computed(()=>i.isKonnectManagedRedisEnabled?t("redis.managed_ui.dedicated_configuration.description"):t("redis.dedicated_configuration.description")),x=e.computed(()=>i.isKonnectManagedRedisEnabled?t("redis.managed_ui.dedicated_configuration.label"):t("redis.dedicated_configuration.label")),A=e.computed(()=>i.isKonnectManagedRedisEnabled?t("redis.managed_ui.selector.create_new"):void 0),T=e.computed(()=>i.isKonnectManagedRedisEnabled?t("redis.managed_ui.selector.placeholder"):void 0),V=e.ref(null),R=$=>{V.value=$},X=$=>{let Z=`${N.apiBaseUrl}${OV[N.app].getOne}`;return N.app==="konnect"&&(Z=Z.replace(/{controlPlaneId}/gi,(N==null?void 0:N.controlPlaneId)||"")),Z=Z.replace(/\/{workspace}/gi,N!=null&&N.workspace?`/${N.workspace}`:"").replace(/{id}/gi,String($)),Z},{axiosInstance:Y}=Ie.useAxios(N==null?void 0:N.axiosRequestConfig),ne=()=>{f.value?(b.value&&(_.value=b.value,h.value=b.value[0].id,k.value=void 0),k!=null&&k.value&&(y.value=k.value)):(Object.keys(y.value).length&&(k.value=y.value),_!=null&&_.value&&(b.value=_.value),_.value=c?null:void 0)},M=async $=>{if($){h.value=$,_.value=[{id:$}],b.value=[{id:$}],k.value=void 0;try{const Z=await Y.get(X($));if(Z.data.config){const F=Object.assign(Z.data,Z.data.config);delete F.config,d.value=F}}catch(Z){console.error(Z)}}};return e.watch(()=>f.value,()=>{ne()}),e.onBeforeMount(()=>{var $;if(i.defaultRedisConfigItem||_!=null&&_.value){const Z=i.defaultRedisConfigItem||(($=_==null?void 0:_.value)==null?void 0:$[0].id);M(Z),f.value=!0}else k!=null&&k.value&&(y.value=k.value)}),e.watch(()=>C==null?void 0:C.value,$=>{f.value&&($&&_.value?_.value=c?null:void 0:$||b.value&&(_.value=b.value,M(b.value[0].id)))}),($,Z)=>{const F=e.resolveComponent("KBadge"),J=e.resolveComponent("KRadio"),G=e.resolveComponent("KCard");return p.value?e.withDirectives((e.openBlock(),e.createBlock(G,{key:0,class:"redis-config-card","data-testid":"redis-config-card",title:w.value},{default:e.withCtx(()=>[e.createElementVNode("div",UV,[e.createVNode(J,{modelValue:f.value,"onUpdate:modelValue":Z[0]||(Z[0]=v=>f.value=v),card:"","card-orientation":"horizontal","data-testid":"shared-redis-config-radio",description:S.value,label:I.value,"selected-value":!0},{default:e.withCtx(()=>[n.isKonnectManagedRedisEnabled?(e.openBlock(),e.createBlock(F,{key:0,appearance:"success"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("redis.managed_ui.shared_configuration.badge")),1)]),_:1})):e.createCommentVNode("",!0)]),_:1},8,["modelValue","description","label"]),e.createVNode(J,{modelValue:f.value,"onUpdate:modelValue":Z[1]||(Z[1]=v=>f.value=v),card:"","card-orientation":"horizontal","data-testid":"dedicated-redis-config-radio",description:U.value,label:x.value,"selected-value":!1},null,8,["modelValue","description","label"])]),e.withDirectives(e.createElementVNode("div",KV,[e.createElementVNode("div",qV,e.toDisplayString(e.unref(t)("redis.shared_configuration.title")),1),e.createElementVNode("div",GV,[e.createVNode(e.unref(Hg.RedisConfigurationSelector),{"create-button-text":A.value,"data-testid":"redis-config-select-trigger","is-konnect-managed-redis-enabled":n.isKonnectManagedRedisEnabled,"model-value":h.value,placeholder:T.value,"redis-type":e.unref(u),"show-create-button":!E(e.unref(N)),onErrorChange:R,onToast:e.unref(a),"onUpdate:modelValue":M},null,8,["create-button-text","is-konnect-managed-redis-enabled","model-value","placeholder","redis-type","show-create-button","onToast"])]),d.value?(e.openBlock(),e.createBlock(FV,{key:0,"config-fields":d.value},null,8,["config-fields"])):e.createCommentVNode("",!0),V.value?(e.openBlock(),e.createElementBlock("p",HV,e.toDisplayString(e.unref(m)(V.value)),1)):e.createCommentVNode("",!0)],512),[[e.vShow,f.value]]),f.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(Ut,e.mergeProps({key:0},i,{"as-child":"","fields-order":r,name:l.value,"render-rules":o,"reset-label-path":"reset"}),null,16,["name"]))]),_:1},8,["title"])),[[e.vShow,!e.unref(C)]]):e.withDirectives((e.openBlock(),e.createBlock(Ut,e.mergeProps({key:1},i,{"fields-order":r,"hide-required-asterisk":"",name:l.value,"render-rules":o}),null,16,["name"])),[[e.vShow,!e.unref(C)]])}}}),[["__scopeId","data-v-ad3044d7"]]),rw=e.defineComponent({inheritAttrs:!1,__name:"PluginConfigurationForm",props:{controlledFields:{},prepareFormData:{type:Function},schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean}},emits:["change"],setup(n,{expose:t,emit:r}){const o=n,i=r,a=e.useAttrs(),s=e.useId(),c=e.useTemplateRef("form"),l=e.inject(Pi),u=e.computed(()=>o.fieldRenderers??[]),p=e.computed(()=>a["data-testid"]??"ff-plugin-configuration-form"),d=e.computed(()=>{const{"data-testid":y,...b}=a;return b}),f=e.computed(()=>{const y=o.formConfig;return{...y??{},hasValue:(y==null?void 0:y.hasValue)??(b=>!!b&&Object.keys(b).length>0),prepareFormData:b=>{var k,C;const _=((k=y==null?void 0:y.prepareFormData)==null?void 0:k.call(y,b))??b;return((C=o.prepareFormData)==null?void 0:C.call(o,_))??_}}}),m=e.computed(()=>Array.isArray(o.controlledFields)?Gd(o.model,o.controlledFields):o.model);function h(y){i("change",y),o.onFormChange(y,o.controlledFields)}return t({getValue:()=>{var y;return(y=c.value)==null?void 0:y.getValue()},setValue:y=>{var b;return(b=c.value)==null?void 0:b.setValue(y)}}),I_(()=>o.schema,s),(y,b)=>(e.openBlock(),e.createBlock(Zt,e.mergeProps({ref:"form"},d.value,{class:"ff-plugin-configuration-form",config:f.value,data:m.value,"data-instance-id":e.unref(s),"data-plugin-name":n.pluginName,"data-testid":p.value,"render-rules":n.renderRules,schema:n.schema,tag:"div",onChange:h}),e.createSlots({[e.unref(So)]:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(_,k)=>(e.openBlock(),e.createBlock(Rt,{key:`${n.pluginName}-${k}`,match:e.unref(JT)(_.match)},{default:e.withCtx(C=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(_.component),e.mergeProps({ref_for:!0},{...C,...(typeof _.propsOverrides=="function"?_.propsOverrides(C):_.propsOverrides)??{}}),null,16))]),_:2},1032,["match"]))),128)),e.createVNode(Rt,{match:({path:_})=>{var k,C;return _===((C=(k=e.unref(l))==null?void 0:k.redisPath)==null?void 0:C.value)}},{default:e.withCtx(()=>[e.createVNode(ap,{"is-konnect-managed-redis-enabled":o.isKonnectManagedRedisEnabled??!1},null,8,["is-konnect-managed-redis-enabled"])]),_:1},8,["match"]),e.renderSlot(y.$slots,"field-renderers")]),_:2},[y.$slots.default?{name:"default",fn:e.withCtx(()=>[e.renderSlot(y.$slots,"default")]),key:"0"}:void 0]),1040,["config","data","data-instance-id","data-plugin-name","data-testid","render-rules","schema"]))}}),zV={class:"radio-group"},WV={key:0,class:"scope-detail"},YV=je(e.defineComponent({inheritAttrs:!1,__name:"StandardLayout",props:e.mergeModels({formSchema:{},formModel:{},schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},configSections:{},hideEditorModeSwitcher:{type:Boolean,default:!1},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},{editorMode:{},editorModeModifiers:{}}),emits:["update:editorMode"],setup(n){const t=["config","partials","__ui_data","enabled","protocols","instance_name","condition","tags","consumer","consumer_group","route","service"],{i18n:{t:r}}=Qe(),o=e.createPropsRestProxy(n,["hideEditorModeSwitcher"]),i=e.useAttrs(),a=e.inject(fr.KM_2262_CODE_MODE,!1),s=Pt.useLocalStorage("plugin-editor-mode","form"),c=e.useModel(n,"editorMode"),l=e.computed({get:()=>c.value??(a?s.value:"form"),set:F=>{c.value=F}}),u=e.computed(()=>a&&!n.hideEditorModeSwitcher),p=[{label:r("plugins.free-form.editor_mode.visual"),value:"form"},{label:r("plugins.free-form.editor_mode.code"),value:"code"}];function d(F){l.value=F,s.value=F}const f=e.useSlots(),m=e.computed(()=>{var F;return 2+(((F=o.configSections)==null?void 0:F.length)??1)}),h=e.computed(()=>{var F;return(F=b.value)!=null&&F.disabled?{class:"disabled-scope",maxWidth:"300",text:r("plugins.form.scoping.disable_global_radio")}:{class:"scope"}}),y=e.computed(()=>{var F,J;return(F=o.formSchema)!=null&&F.groups?o.formSchema.groups.reduce((G,v)=>{var oe,ke;const q=v.fields,ie=(ke=(oe=v.collapsible)==null?void 0:oe.nestedCollapsible)!=null&&ke.fields?q.concat(v.collapsible.nestedCollapsible.fields):q;return G.concat(ie)},[]):((J=o.formSchema)==null?void 0:J.fields)||[]}),b=e.computed(()=>y.value.find(F=>F.type==="selectionGroup")),_=e.computed(()=>{var F;return(((F=b.value)==null?void 0:F.fields)||[]).map(({label:J,description:G})=>({label:J,description:G}))}),k=e.computed(()=>{var F,J;return(J=(F=b.value)==null?void 0:F.fields)==null?void 0:J[1]}),C=e.computed(()=>{var F;return(((F=k.value)==null?void 0:F.fields)??[]).map(J=>{var G;return{name:J.model.split("-")[0],entity:J.entity,fields:(G=J.inputValues)==null?void 0:G.fields,label:J.label,placeholder:J.placeholder,help:J.help,disabled:J.disabled,disabledTooltip:J.disabledTooltip,labelField:J.labelField}})}),N=["instance_name","protocols","tags","condition"],E=["config"],w=e.computed(()=>{var v;const F={type:"record",fields:o.schema.fields.filter(q=>E.includes(Object.keys(q)[0]))},J=y.value.find(q=>q.model==="enabled");return[...J?[J]:[],...((v=k.value)==null?void 0:v.fields)??[],...y.value.filter(q=>N.includes(q.model))].forEach(q=>{if(q.type==="AutoSuggest")F.fields.push({[q.model.split("-")[0]]:{type:"foreign",reference:q.entity,description:q.help}});else if(q.model==="enabled")F.fields.push({[q.model]:{type:"boolean",default:!0}});else if(q.model==="instance_name"||q.model==="condition")F.fields.push({[q.model]:{type:"string",description:q.help}});else if(q.model==="protocols")F.fields.push({[q.model]:{type:"set",elements:{type:"string",one_of:q.values.map(ie=>ie.value)},default:[...q.default],required:q.required,description:q.help,help:q.default?r("plugins.form.fields.protocols.placeholderWithDefaultValues",{protocols:q.default.join(", ")}):r("plugins.form.fields.protocols.placeholder")}});else if(q.model==="tags")F.fields.push({[q.model]:{type:"set",elements:{type:"string"},description:q.help,default:q.default||[]}});else throw new Error(`Unsupported VFG field type '${q.type}' for model '${q.model}'`)}),F}),S=e.computed(()=>new Set(w.value.fields.map(F=>Object.keys(F)[0]))),I=e.computed(()=>Gd(o.model,t)),U=e.computed(()=>{var F;return((F=k.value)==null?void 0:F.fields.map(J=>J.model))??[]}),x=e.computed(()=>U.value.map(F=>F.split("-")[0])),A=e.ref(o.isEditing?Gd(I.value,x.value):$()),T=e.ref(Object.values(A.value).some(te)),V=e.useTemplateRef("form");let R=!1;function X(F){return o.isEditing?F:{...F,...$()}}function Y(){if(!V.value)return;const{getValue:F,setValue:J}=V.value,v={...F()};T.value?x.value.forEach(q=>{v[q]=A.value[q]??null}):x.value.forEach(q=>{v[q]=null}),R=!0,J(v),e.nextTick(()=>{R=!1})}function ne(F){if(R||M(F),l.value==="code"){const J=x.value.some(G=>te(F[G]));J!==T.value&&(T.value=J)}}function M(F){x.value.forEach(J=>{const G=F[J];El(G,"id")&&G.id!=null?A.value[J]=G:A.value[J]=null})}function te(F){return El(F,"id")&&F.id!=null}function $(){const F={};return U.value.forEach(J=>{if(o.formModel[J]){const G=J.split("-")[0];if(!G)return;F[G]={id:o.formModel[J]}}}),F}const Z=e.ref(!0);return(F,J)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[u.value?(e.openBlock(),e.createBlock(e.Teleport,{key:0,to:"#plugin-form-page-actions"},[e.createVNode(e.unref(Fe.KSegmentedControl),{"data-testid":"plugin-editor-mode-switcher","model-value":l.value,options:p,"onUpdate:modelValue":d},null,8,["model-value"])])):e.createCommentVNode("",!0),e.createVNode(rw,e.mergeProps({ref:"form"},e.unref(i),{class:"ff-standard-layout","controlled-fields":t,"data-testid":"ff-standard-layout-form","field-renderers":n.fieldRenderers,"form-config":n.formConfig,"is-konnect-managed-redis-enabled":n.isKonnectManagedRedisEnabled,model:n.model,"on-form-change":n.onFormChange,"plugin-name":n.pluginName,"prepare-form-data":X,"render-rules":n.renderRules,schema:w.value,onChange:ne}),{"field-renderers":e.withCtx(()=>[e.renderSlot(F.$slots,"field-renderers",{},void 0,!0)]),default:e.withCtx(()=>{var G;return[l.value==="form"?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:0,"data-testid":"form-section-plugin-scope",description:n.generalInfoDescription??e.unref(r)("plugins.form.sections.plugin_scope.description"),step:1,title:n.generalInfoTitle??e.unref(r)("plugins.form.sections.plugin_scope.title")},e.createSlots({default:e.withCtx(()=>{var v;return[(e.openBlock(),e.createBlock(e.resolveDynamicComponent((v=b.value)!=null&&v.disabled?e.unref(Fe.KTooltip):"div"),e.normalizeProps(e.guardReactiveProps(h.value)),{default:e.withCtx(()=>{var q,ie;return[e.createElementVNode("div",zV,[e.createVNode(e.unref(Fe.KRadio),e.mergeProps({modelValue:T.value,"onUpdate:modelValue":J[0]||(J[0]=oe=>T.value=oe),card:"","card-orientation":"horizontal"},_.value[0],{disabled:(q=b.value)==null?void 0:q.disabled,"selected-value":!1,"onUpdate:modelValue":Y}),null,16,["modelValue","disabled"]),_.value[1]?(e.openBlock(),e.createBlock(e.unref(Fe.KRadio),e.mergeProps({key:0,modelValue:T.value,"onUpdate:modelValue":J[1]||(J[1]=oe=>T.value=oe),card:"","card-orientation":"horizontal"},_.value[1],{disabled:(ie=b.value)==null?void 0:ie.disabled,"selected-value":!0,"onUpdate:modelValue":Y}),null,16,["modelValue","disabled"])):e.createCommentVNode("",!0)])]}),_:1},16)),k.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",WV,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,q=>(e.openBlock(),e.createBlock(uO,{key:q.name,developer:n.developer,disabled:q.disabled,"disabled-tooltip":q.disabledTooltip,entity:q.entity,fields:q.fields,help:q.help,label:q.label,"label-field":q.labelField,name:q.name,placeholder:q.placeholder},null,8,["developer","disabled","disabled-tooltip","entity","fields","help","label","label-field","name","placeholder"]))),128))],512)),[[e.vShow,T.value]]):e.createCommentVNode("",!0)]}),_:2},[f["general-info-title"]?{name:"title",fn:e.withCtx(()=>[e.renderSlot(F.$slots,"general-info-title",{},void 0,!0)]),key:"0"}:void 0,f["general-info-description"]?{name:"description",fn:e.withCtx(()=>[e.renderSlot(F.$slots,"general-info-description",{},void 0,!0)]),key:"1"}:void 0,f["general-info-extra"]?{name:"extra",fn:e.withCtx(()=>[e.renderSlot(F.$slots,"general-info-extra",{},void 0,!0)]),key:"2"}:void 0]),1032,["description","title"])):e.createCommentVNode("",!0),l.value==="form"&&((G=n.configSections)!=null&&G.length)?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(n.configSections,(v,q)=>(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:v.name,"data-testid":`form-section-${v.name}`,description:v.description,step:2+q,title:v.title},{default:e.withCtx(()=>[e.renderSlot(F.$slots,`section-${v.name}`,{},void 0,!0)]),_:2},1032,["data-testid","description","step","title"]))),128)):l.value==="form"?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:2,"data-testid":"form-section-plugin-config",description:n.pluginConfigDescription??e.unref(r)("plugins.form.sections.plugin_config.description"),step:2,title:n.pluginConfigTitle??e.unref(r)("plugins.form.sections.plugin_config.title")},e.createSlots({default:e.withCtx(()=>[e.renderSlot(F.$slots,"default",{},void 0,!0)]),_:2},[f["plugin-config-title"]?{name:"title",fn:e.withCtx(()=>[e.renderSlot(F.$slots,"plugin-config-title",{},void 0,!0)]),key:"0"}:void 0,f["plugin-config-description"]?{name:"description",fn:e.withCtx(()=>[e.renderSlot(F.$slots,"plugin-config-description",{},void 0,!0)]),key:"1"}:void 0,f["plugin-config-extra"]?{name:"extra",fn:e.withCtx(()=>[e.renderSlot(F.$slots,"plugin-config-extra",{},void 0,!0)]),key:"2"}:void 0]),1032,["description","title"])):e.createCommentVNode("",!0),l.value==="form"?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:3,"data-testid":"form-section-general-info",description:e.unref(r)("plugins.form.sections.plugin_general_info.description"),step:m.value,title:e.unref(r)("plugins.form.sections.general_info.title")},{default:e.withCtx(()=>[S.value.has("enabled")?(e.openBlock(),e.createBlock(O_,{key:0,"disabled-text":e.unref(r)("plugins.form.fields.plugin_status.text_off"),"enabled-text":e.unref(r)("plugins.form.fields.plugin_status.text_on"),label:e.unref(r)("plugins.form.fields.plugin_status.label"),name:"enabled"},null,8,["disabled-text","enabled-text","label"])):e.createCommentVNode("",!0),S.value.has("instance_name")?(e.openBlock(),e.createBlock(Xe,{key:1,label:e.unref(r)("plugins.form.fields.instance_name.label"),name:"instance_name",placeholder:e.unref(r)("plugins.form.fields.instance_name.placeholder")},null,8,["label","placeholder"])):e.createCommentVNode("",!0),S.value.has("tags")?(e.openBlock(),e.createBlock(hi,{key:2,help:e.unref(r)("plugins.form.fields.tags.help"),name:"tags",placeholder:e.unref(r)("plugins.form.fields.tags.placeholder")},null,8,["help","placeholder"])):e.createCommentVNode("",!0),S.value.has("protocols")?(e.openBlock(),e.createBlock(it,{key:3,name:"protocols"})):e.createCommentVNode("",!0),w.value.fields.find(v=>Object.keys(v)[0]==="condition")?(e.openBlock(),e.createBlock(e.unref(Fe.KCollapse),{key:4,modelValue:Z.value,"onUpdate:modelValue":J[2]||(J[2]=v=>Z.value=v),"data-testid":"view-general-info-additional-settings","trigger-label":Z.value?e.unref(r)("plugins.form.grouping.advanced_parameters.view"):e.unref(r)("plugins.form.grouping.advanced_parameters.hide")},{default:e.withCtx(()=>[e.createVNode(TV)]),_:1},8,["modelValue","trigger-label"])):e.createCommentVNode("",!0)]),_:1},8,["description","step","title"])):e.createCommentVNode("",!0),l.value==="code"?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:4,description:e.unref(r)("plugins.form.sections.code_mode.description"),title:e.unref(r)("plugins.form.sections.code_mode.title")},{default:e.withCtx(()=>[e.renderSlot(F.$slots,"code-editor",{},()=>[e.createVNode(IV)],!0)]),_:3},8,["description","title"])):e.createCommentVNode("",!0)]}),_:3},16,["field-renderers","form-config","is-konnect-managed-redis-enabled","model","on-form-change","plugin-name","render-rules","schema"])],64))}}),[["__scopeId","data-v-e2f4cda4"]]),ow=Symbol.for("kong-ui-public.entities-plugins.free-form-plugin-layout");function JV(n){e.provide(ow,n)}const er=e.defineComponent({inheritAttrs:!1,__name:"DynamicLayout",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},configSections:{},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const t=n,r=e.useAttrs(),o=e.useSlots(),i=e.inject(ow,YV),a=e.computed(()=>({...r,...t}));return(s,c)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(i)),e.normalizeProps(e.guardReactiveProps(a.value)),e.createSlots({_:2},[e.renderList(e.unref(o),(l,u)=>({name:u,fn:e.withCtx(p=>[e.renderSlot(s.$slots,u,e.normalizeProps(e.guardReactiveProps(p??{})))])}))]),1040))}}),XV={class:"ff-acl-mode"},ZV=je(e.defineComponent({__name:"ACLModeCard",setup(n){const{formData:t}=pt(),{i18n:{t:r}}=Qe(),o=e.ref("allow"),i=e.ref(!1),a=e.ref({});e.watch(()=>t.config,c=>{if(i.value||!c)return;const l=c.deny,u=c.allow;Array.isArray(l)&&l.length>0?o.value="deny":Array.isArray(u)&&u.length>0&&(o.value="allow")},{deep:!0,immediate:!0});function s(){i.value=!0,t.config&&(o.value==="allow"?(t.config.deny&&(a.value.deny=[...t.config.deny]),t.config.deny=null,a.value.allow&&(t.config.allow=[...a.value.allow])):(t.config.allow&&(a.value.allow=[...t.config.allow]),t.config.allow=null,a.value.deny&&(t.config.deny=[...a.value.deny])))}return(c,l)=>(e.openBlock(),e.createBlock(e.unref(Fe.KCard),{class:"ff-acl-mode-card"},{default:e.withCtx(()=>[e.createElementVNode("div",XV,[e.createVNode(e.unref(Fe.KRadio),{modelValue:o.value,"onUpdate:modelValue":[l[0]||(l[0]=u=>o.value=u),s],"data-testid":"ff-acl-mode-allow",label:e.unref(r)("plugins.free-form.acl.mode.allow"),"selected-value":"allow"},null,8,["modelValue","label"]),e.createVNode(e.unref(Fe.KRadio),{modelValue:o.value,"onUpdate:modelValue":[l[1]||(l[1]=u=>o.value=u),s],"data-testid":"ff-acl-mode-deny",label:e.unref(r)("plugins.free-form.acl.mode.deny"),"selected-value":"deny"},null,8,["modelValue","label"])]),o.value==="allow"?(e.openBlock(),e.createBlock(it,{key:0,name:"config.allow"})):(e.openBlock(),e.createBlock(it,{key:1,name:"config.deny"}))]),_:1}))}}),[["__scopeId","data-v-fd5c7165"]]),QV=e.defineComponent({__name:"ACLForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},configSections:{},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const t=n,r=e.useSlots();return e.provide(et.AUTOFILL_SLOT,r==null?void 0:r[et.AUTOFILL_SLOT_NAME]),(o,i)=>(e.openBlock(),e.createBlock(er,e.normalizeProps(e.guardReactiveProps(t)),{default:e.withCtx(()=>[e.createVNode(ZV),e.createVNode(Ut,{"as-child":"",name:"config",omit:["allow","deny"],"reset-label-path":"reset"})]),_:1},16))}}),e$={class:"ff-advanced-fields"},ts=je(e.defineComponent({__name:"AdvancedFields",props:{hideGeneralFields:{type:Boolean}},setup(n){const{t}=jt.createI18n("en-us",Jt),{getSchema:r}=pt(),o=e.ref(!0);return(i,a)=>(e.openBlock(),e.createBlock(e.unref(Fe.KCollapse),{modelValue:o.value,"onUpdate:modelValue":a[0]||(a[0]=s=>o.value=s),"data-testid":"view-advanced","trigger-label":o.value?e.unref(t)("plugins.form.grouping.advanced_parameters.view"):e.unref(t)("plugins.form.grouping.advanced_parameters.hide")},{default:e.withCtx(()=>[e.createElementVNode("div",e$,[n.hideGeneralFields?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.unref(r)("instance_name")?(e.openBlock(),e.createBlock(it,{key:0,name:"instance_name"})):e.createCommentVNode("",!0),e.unref(r)("protocols")?(e.openBlock(),e.createBlock(it,{key:1,name:"protocols"})):e.createCommentVNode("",!0),e.unref(r)("tags")?(e.openBlock(),e.createBlock(hi,{key:2,help:"e.g. tag1, tag2, tag3",name:"tags",placeholder:e.unref(t)("plugins.form.fields.tags.placeholder")},null,8,["placeholder"])):e.createCommentVNode("",!0),e.unref(r)("condition")?(e.openBlock(),e.createBlock(Xe,{key:3,name:"condition",placeholder:e.unref(t)("plugins.form.fields.condition.placeholder")},null,8,["placeholder"])):e.createCommentVNode("",!0)],64)),e.renderSlot(i.$slots,"default",{},void 0,!0)])]),_:3},8,["modelValue","trigger-label"]))}}),[["__scopeId","data-v-baa317ec"]]),iw=je(e.defineComponent({__name:"ConfigForm",setup(n){const{getSchema:t,createComputedRenderRules:r}=pt(),o=r("config"),i=e.computed(()=>{var b;const s=[],c=[],l=new Set,p=t().fields.find(_=>Object.keys(_)[0]==="config");if(!p||!("config"in p))return{defaultVisible:s,advanced:c};const d=p.config;d.entity_checks&&d.entity_checks.forEach(_=>{var C,N;let k;"at_least_one_of"in _?k=_.at_least_one_of:"conditional"in _&&((C=t(yt("config",_.conditional.if_field)))!=null&&C.required)&&_.conditional.then_match.required?k=[_.conditional.if_field,_.conditional.then_field]:"conditional_at_least_one_of"in _&&((N=t(yt("config",_.conditional_at_least_one_of.if_field)))!=null&&N.required)&&(k=[_.conditional_at_least_one_of.if_field,..._.conditional_at_least_one_of.then_at_least_one_of]),k==null||k.forEach(E=>l.add(E.split(".")[0]))});const f=((b=o.value)==null?void 0:b.bundles)??[],m=new Map;for(const _ of f)for(let k=1;k<_.length;k++)m.set(_[k],_[k-1]);const h=_=>{const k=m.get(_);return k?h(k):_},y=new Map;for(const _ of d.fields){const k=Object.keys(_)[0];y.set(k,h(k))}for(const _ of d.fields){const k=Object.keys(_)[0];if(y.get(k)!==k)continue;let N;_[k].required||l.has(k)?N=s:N=c,N.push(k)}for(const _ of d.fields){const k=Object.keys(_)[0],C=y.get(k);C!==k&&(s.includes(C)?s:c).push(k)}return{defaultVisible:s,advanced:c}}),a=e.computed(()=>i.value.defaultVisible.length===0);return(s,c)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(Ut,{"as-child":"",class:"ff-default-visible-fields",name:"config",omit:a.value?[]:i.value.advanced,"reset-label-path":"reset"},null,8,["omit"]),a.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(ts,{key:0,class:"ff-advanced-fields-container","data-testid":"ff-advanced-fields-container","hide-general-fields":""},{default:e.withCtx(()=>[e.createVNode(Ut,{"as-child":"",name:"config",omit:i.value.defaultVisible,"reset-label-path":"reset"},null,8,["omit"])]),_:1}))],64))}}),[["__scopeId","data-v-bc82c9e9"]]),sp=e.defineComponent({__name:"CommonForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},configSections:{},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const t=n,r=e.useSlots();return e.provide(et.AUTOFILL_SLOT,r==null?void 0:r[et.AUTOFILL_SLOT_NAME]),(o,i)=>(e.openBlock(),e.createBlock(er,e.normalizeProps(e.guardReactiveProps(t)),{default:e.withCtx(()=>[e.createVNode(iw)]),_:1},16))}});function Ke(n={}){return{...n,component:n.component??sp}}const t$=Ke({experimental:!0,component:QV}),n$=Ke({fieldRenderers:[{match:"config.functions",component:pr,propsOverrides:{appearance:{string:{multiline:!0}}}}]}),r$=Ke({component:e.defineComponent({__name:"AIMcpProxyForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},configSections:{},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const t=n,r=e.useSlots();e.provide(et.AUTOFILL_SLOT,r==null?void 0:r[et.AUTOFILL_SLOT_NAME]);const{i18n:{t:o}}=st.useI18n();return(i,a)=>(e.openBlock(),e.createBlock(er,e.normalizeProps(e.guardReactiveProps(t)),{"field-renderers":e.withCtx(()=>[e.createVNode(Rt,{match:({path:s})=>s==="config.default_acl"},{default:e.withCtx(s=>[e.createVNode(zt,e.mergeProps(s,{appearance:"tabs","item-label":(c,l)=>e.unref(o)("plugins.free-form.ai-mcp-proxy.default_acl_item_label",{index:l+1}),"sticky-tabs":""}),null,16,["item-label"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:s})=>s==="config.tools"},{default:e.withCtx(s=>[e.createVNode(zt,e.mergeProps(s,{appearance:"tabs","item-label":(c,l)=>e.unref(o)("plugins.free-form.ai-mcp-proxy.tool_item_label",{index:l+1}),"sticky-tabs":""}),null,16,["item-label"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({genericPath:s})=>s==="config.tools.*.query"||s==="config.tools.*.headers"},{default:e.withCtx(s=>[e.createVNode(pr,e.mergeProps(s,{"one-line":""}),{default:e.withCtx(({keyId:c})=>[e.createVNode(hi,{name:c,placeholder:e.unref(o)("plugins.free-form.tag_helper")},null,8,["name","placeholder"])]),_:1},16)]),_:1},8,["match"])]),default:e.withCtx(()=>[e.createVNode(Ut,{"as-child":"",name:"config","reset-label-path":"reset"})]),_:1},16))}})}),o$=Ke({experimental:!0}),i$=Ke({experimental:!0}),a$=Ke({experimental:!0,fieldRenderers:[{match:"config.templates",component:zt,propsOverrides:{appearance:"tabs",itemLabel:(n,t)=>`#${t+1} Template`}},{match:({genericPath:n})=>n==="config.templates.*.template",component:Xe,propsOverrides:{multiline:!0,rows:4}}]}),s$=Ke({experimental:!0,fieldRenderers:[{match:"config.targets",component:zt,propsOverrides:{appearance:"tabs",stickyTabs:!0,itemLabel:(n,t)=>`#${t+1} Target`}},{match:"config.acls.allow",component:zt,propsOverrides:{appearance:"tabs",itemLabel:(n,t)=>`#${t+1} Allow`}},{match:({genericPath:n})=>["config.acls.allow.*.match","config.acls.deny.*.match"].includes(n),component:zt,propsOverrides:{appearance:"tabs",itemLabel:(n,t)=>`#${t+1} Match`}},{match:"config.acls.deny",component:zt,propsOverrides:{appearance:"tabs",stickyTabs:!0,itemLabel:(n,t)=>`#${t+1} Deny`}}]}),l$=Ke({experimental:!0}),c$=Ke({experimental:!0,renderRules:{bundles:[["config.strategy","config.redis"]],dependencies:{"config.redis":["config.strategy","redis"]}}}),u$=Ke({experimental:!0,fieldRenderers:[{match:"config.prompt",component:Xe,propsOverrides:{multiline:!0,rows:4}}]}),d$=Ke({experimental:!0,fieldRenderers:[{match:"config.prompt",component:Xe,propsOverrides:{multiline:!0,rows:4}}]}),aw=[{match:"config.vectordb.redis.sentinel_nodes",component:zt,propsOverrides:{appearance:"tabs",itemLabel:(n,t)=>` #${t+1} Sentinel node`}},{match:"config.vectordb.redis.cluster_nodes",component:zt,propsOverrides:{appearance:"tabs",itemLabel:(n,t)=>` #${t+1} Cluster node`}}],sw={bundles:[["config.vectordb.strategy","config.vectordb.redis","config.vectordb.pgvector"]],dependencies:{"config.vectordb.redis":["config.vectordb.strategy","redis"],"config.vectordb.pgvector":["config.vectordb.strategy","pgvector"],"config.vectordb.redis.cloud_authentication.aws_cache_name":["config.vectordb.redis.cloud_authentication.auth_provider","aws"],"config.vectordb.redis.cloud_authentication.aws_region":["config.vectordb.redis.cloud_authentication.auth_provider","aws"],"config.vectordb.redis.cloud_authentication.aws_is_serverless":["config.vectordb.redis.cloud_authentication.auth_provider","aws"],"config.vectordb.redis.cloud_authentication.aws_access_key_id":["config.vectordb.redis.cloud_authentication.auth_provider","aws"],"config.vectordb.redis.cloud_authentication.aws_secret_access_key":["config.vectordb.redis.cloud_authentication.auth_provider","aws"],"config.vectordb.redis.cloud_authentication.aws_assume_role_arn":["config.vectordb.redis.cloud_authentication.auth_provider","aws"],"config.vectordb.redis.cloud_authentication.aws_role_session_name":["config.vectordb.redis.cloud_authentication.auth_provider","aws"],"config.vectordb.redis.cloud_authentication.gcp_service_account_json":["config.vectordb.redis.cloud_authentication.auth_provider","gcp"],"config.vectordb.redis.cloud_authentication.azure_client_id":["config.vectordb.redis.cloud_authentication.auth_provider","azure"],"config.vectordb.redis.cloud_authentication.azure_client_secret":["config.vectordb.redis.cloud_authentication.auth_provider","azure"],"config.vectordb.redis.cloud_authentication.azure_tenant_id":["config.vectordb.redis.cloud_authentication.auth_provider","azure"]}},f$=Ke({experimental:!0,fieldRenderers:aw,renderRules:sw}),p$=Ke({experimental:!0,fieldRenderers:aw,renderRules:sw}),m$=Ke({experimental:!0}),g$={class:"kong-identity-field","data-testid":"ff-kong-identity-field"},h$={class:"kong-identity-description"},y$={class:"kong-identity-learn-more",href:"https://developer.konghq.com/kong-identity/",rel:"noopener noreferrer",target:"_blank"},_$={class:"kong-identity-options"},b$=je(e.defineComponent({name:"KongIdentityField",__name:"KongIdentityField",props:e.mergeModels({identityRealmsInSchema:{type:Boolean},loadingRealms:{type:Boolean}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const t=n,{i18n:r}=st.useI18n(),{t:o}=r,{formData:i,getSchema:a,getEmptyOrDefault:s}=pt(),c=e.computed(()=>t.identityRealmsInSchema!==void 0?t.identityRealmsInSchema:!!a("$.config.identity_realms")),l=e.computed(()=>c.value),u=e.computed(()=>c.value?o("custom_field.kong_identity.description_with_realms"):o("custom_field.kong_identity.description_without_realms")),p=e.computed(()=>c.value?o("custom_field.kong_identity.consumers_description_key_auth"):o("custom_field.kong_identity.consumers_description_basic_auth")),d=e.computed(()=>c.value?o("custom_field.kong_identity.kong_identity_description_key_auth"):o("custom_field.kong_identity.kong_identity_description_basic_auth")),f=e.useModel(n,"modelValue"),m=e.ref(f.value??"consumers");function h(y){var b,_,k;if(i.config&&y!==m.value)switch(m.value=y,f.value=y,y){case"kong-identity":{i.config.principals={...s("$.config.principals"),enabled:!0,directory:"default"},c.value&&(i.config.identity_realms=[]),(b=a("$.config.realm"))!=null&&b.required||(i.config.realm=null);break}case"consumers":{const C=!!((_=a("$.config.principals"))!=null&&_.required);i.config.principals=C?s("$.config.principals"):null,c.value&&(i.config.identity_realms=[]);break}case"centrally-managed":{const C=!!((k=a("$.config.principals"))!=null&&k.required);i.config.principals=C?s("$.config.principals"):null,i.config.identity_realms=[{scope:"cp",id:null,region:null}];break}}}return(y,b)=>(e.openBlock(),e.createElementBlock("div",g$,[e.createVNode(e.unref(Fe.KLabel),{"data-testid":"ff-kong-identity-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("custom_field.kong_identity.title")),1)]),_:1}),e.createElementVNode("p",h$,[e.createTextVNode(e.toDisplayString(u.value)+" ",1),e.createElementVNode("a",y$,e.toDisplayString(e.unref(o)("custom_field.kong_identity.learn_more")),1)]),e.createElementVNode("div",_$,[n.loadingRealms?(e.openBlock(),e.createBlock(e.unref(Fe.KSkeletonBox),{key:0,class:"kong-identity-options-skeleton"})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(e.unref(Fe.KRadio),{card:"","card-orientation":"horizontal","data-testid":"kong-identity-mode-consumers",description:p.value,label:e.unref(o)("custom_field.kong_identity.consumers_label"),"model-value":m.value,"selected-value":"consumers","onUpdate:modelValue":h},{default:e.withCtx(()=>[e.createVNode(e.unref($e.TeamIcon),{size:`var(--kui-icon-size-50, ${e.unref(yd)})`},null,8,["size"])]),_:1},8,["description","label","model-value"]),l.value?(e.openBlock(),e.createBlock(e.unref(Fe.KRadio),{key:0,card:"","card-orientation":"horizontal","data-testid":"kong-identity-mode-centrally-managed",description:e.unref(o)("custom_field.kong_identity.centrally_managed_description"),label:e.unref(o)("custom_field.kong_identity.centrally_managed_label"),"model-value":m.value,"selected-value":"centrally-managed","onUpdate:modelValue":h},{default:e.withCtx(()=>[e.createVNode(e.unref($e.AccountTreeIcon),{size:`var(--kui-icon-size-50, ${e.unref(yd)})`},null,8,["size"])]),_:1},8,["description","label","model-value"])):e.createCommentVNode("",!0),e.createVNode(e.unref(Fe.KRadio),{card:"","card-orientation":"horizontal","data-testid":"kong-identity-mode-kong-identity",description:d.value,label:e.unref(o)("custom_field.kong_identity.kong_identity_label"),"model-value":m.value,"selected-value":"kong-identity","onUpdate:modelValue":h},{default:e.withCtx(()=>[e.createVNode(e.unref($e.KeyIcon),{size:`var(--kui-icon-size-50, ${e.unref(yd)})`},null,8,["size"])]),_:1},8,["description","label","model-value"])],64))])]))}}),[["__scopeId","data-v-75509002"]]),lw=Symbol("fetched-realms"),w$={"data-testid":"ff-identity-realms-field"},k$=["innerHTML"],cw=e.defineComponent({__name:"IdentityRealmsField",props:{name:{},label:{},labelAttributes:{},required:{type:Boolean},placeholder:{},resetLabelPath:{}},setup(n){const t=n,{error:r,value:o,path:i}=Ft(e.toRef(t,"name"));if(r)throw r;const a=ln(i,t),s=e.inject(lw,void 0);return(c,l)=>{var p;const u=e.resolveComponent("KLabel");return e.openBlock(),e.createElementBlock("div",w$,[e.createVNode(u,e.mergeProps({class:"ff-array-field-label"},e.unref(a),{"data-testid":`ff-label-${e.unref(i)}`,"tooltip-attributes":e.unref(a).labelAttributes.tooltipAttributes}),e.createSlots({default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a).label)+" ",1)]),_:2},[(p=e.unref(a).labelAttributes)!=null&&p.info?{name:"tooltip",fn:e.withCtx(()=>[e.renderSlot(c.$slots,"tooltip",{},()=>[e.createElementVNode("div",{innerHTML:e.unref(a).labelAttributes.info},null,8,k$)])]),key:"0"}:void 0]),1040,["data-testid","tooltip-attributes"]),e.createVNode(d_,{modelValue:e.unref(o),"onUpdate:modelValue":l[0]||(l[0]=d=>e.isRef(o)?o.value=d:null),realms:e.unref(s)},null,8,["modelValue","realms"])])}}}),C$=je(e.defineComponent({name:"PrincipalsCreationGuide",__name:"PrincipalsCreationGuide",props:{loading:{type:Boolean},showPanel:{type:Boolean},dataPlaneIncompatible:{type:Boolean}},emits:["click:learn-more","click:create-entity"],setup(n,{emit:t}){const r=t,{i18n:o}=st.useI18n(),{t:i}=o,a=e.ref(!1),s=()=>{a.value=!1,r("click:create-entity",{type:"principal"})};return(c,l)=>{const u=e.resolveComponent("KSkeleton");return e.openBlock(),e.createElementBlock(e.Fragment,null,[n.loading?(e.openBlock(),e.createBlock(u,{key:0,class:"kong-identity-principals-skeleton","data-testid":"kong-identity-principals-loading"})):n.showPanel?(e.openBlock(),e.createBlock(e.unref(Fe.KEmptyState),{key:1,class:"kong-identity-principals","data-testid":"kong-identity-principals-panel",message:e.unref(i)("custom_field.kong_identity.configure_description"),title:e.unref(i)("custom_field.kong_identity.configure_title")},{icon:e.withCtx(()=>[...l[3]||(l[3]=[])]),action:e.withCtx(()=>[e.createVNode(e.unref(Fe.KButton),{appearance:"primary","data-testid":"kong-identity-create-principal",onClick:l[0]||(l[0]=p=>a.value=!0)},{default:e.withCtx(()=>[e.createVNode(e.unref($e.AddIcon),{decorative:""}),e.createTextVNode(" "+e.toDisplayString(e.unref(i)("custom_field.kong_identity.create_principal")),1)]),_:1}),e.createVNode(e.unref(Fe.KButton),{appearance:"secondary",class:"open-learning-hub","data-testid":"kong-identity-principals-learn-more",onClick:l[1]||(l[1]=p=>r("click:learn-more","kong-identity"))},{default:e.withCtx(()=>[e.createVNode(e.unref($e.BookIcon),{decorative:""}),e.createTextVNode(" "+e.toDisplayString(e.unref(i)("custom_field.kong_identity.configure_learn_more")),1)]),_:1})]),_:1},8,["message","title"])):n.dataPlaneIncompatible?(e.openBlock(),e.createBlock(e.unref(Fe.KAlert),{key:2,appearance:"warning",class:"kong-identity-dp-version-alert","data-testid":"kong-identity-dp-version-alert",message:e.unref(i)("custom_field.kong_identity.incompatible_data_plane_alert"),"show-icon":""},null,8,["message"])):e.createCommentVNode("",!0),e.createVNode(e.unref(Fe.KPrompt),{"action-button-text":e.unref(i)("custom_field.kong_identity.leave_prompt_action"),"data-testid":"kong-identity-create-principal-prompt",message:e.unref(i)("custom_field.kong_identity.leave_prompt_message"),title:e.unref(i)("custom_field.kong_identity.leave_prompt_title"),visible:a.value,onCancel:l[2]||(l[2]=p=>a.value=!1),onProceed:s},null,8,["action-button-text","message","title","visible"])],64)}}}),[["__scopeId","data-v-d86101ef"]]),uw=Symbol("before-save"),E$={key:0,class:"identity-realms-error","data-testid":"identity-realms-validation-error"},N$={key:0,class:"kong-identity-error-on-miss"},S$=je(e.defineComponent({__name:"ConfigFormContent",emits:["click:learn-more","click:create-entity"],setup(n,{emit:t}){const r=t,o={major:3,minor:15};function i(J){const[G,v]=J.split(".").map(Number);return Number.isNaN(G)||Number.isNaN(v)?!1:G!==o.major?G<o.major:v<o.minor}const a=e.inject(uw),s=e.inject(nw),{i18n:c}=st.useI18n(),l=e.inject(et.FORMS_CONFIG),u=e.computed(()=>(l==null?void 0:l.app)==="konnect"),{axiosInstance:p}=Ie.useAxios(l==null?void 0:l.axiosRequestConfig),{formData:d,getSchema:f}=pt(),m=e.computed(()=>!!f("$.config.principals.error_on_miss")),h=e.computed(()=>l==null?void 0:l.principalsCreationGuideVisible),y=e.computed(()=>h.value===!0),b=e.computed(()=>h.value===void 0),_=e.computed(()=>{var J,G;return((G=(J=d.config)==null?void 0:J.principals)==null?void 0:G.error_on_miss)??!0});function k(J){var G;(G=d.config)!=null&&G.principals&&(d.config.principals.error_on_miss=J)}const C=e.ref([]),N=e.ref(!1),E=async()=>{var J;if(!((l==null?void 0:l.app)!=="konnect"||!w.value))try{N.value=!0;let G=`${l.apiBaseUrl}/v1/realms`;const v=[];do{const q=await p.get(G);(J=q==null?void 0:q.data)!=null&&J.data&&v.push(...q.data.data.map(ie=>({value:ie.id,label:ie.name}))),G=q.data.meta.next?`${l.apiBaseUrl}${q.data.meta.next}`:null}while(G);C.value=v}catch{C.value=[]}finally{N.value=!1}};e.onMounted(E),e.provide(lw,C);const w=e.computed(()=>!!f("$.config.identity_realms")),S=e.inject(fr.KHCP_20393_IDENTITY_PRINCIPALS_UI,!1),I=e.computed(()=>S&&!!f("$.config.principals")),U=e.computed(()=>((l==null?void 0:l.dataPlaneVersions)??[]).some(i));function x(){var J,G,v,q;if((G=(J=d.config)==null?void 0:J.principals)!=null&&G.enabled)return"kong-identity";if(u.value){if(A((v=d.config)==null?void 0:v.identity_realms))return"centrally-managed"}else if(Array.isArray((q=d.config)==null?void 0:q.identity_realms)&&d.config.identity_realms.length>0)return"centrally-managed";return"consumers"}function A(J){return!Array.isArray(J)||J.length===0?!1:J.some(G=>G.scope!=="cp"&&G.id!=null)}const T=e.ref(x());e.watch(()=>l==null?void 0:l.principalsDirectoryName,J=>{var G;s!=null&&s.value||T.value!=="kong-identity"||J==null||(G=d.config)!=null&&G.principals&&(d.config.principals.directory=J)},{immediate:!0}),e.watch(T,J=>{var v;if(J!=="kong-identity")return;const G=l==null?void 0:l.principalsDirectoryName;G==null||!((v=d.config)!=null&&v.principals)||(d.config.principals.directory=G)});const V=e.computed(()=>{var J;return u.value&&T.value==="centrally-managed"&&!A((J=d.config)==null?void 0:J.identity_realms)}),R=e.ref(!1),X=e.ref(!1);let Y=!1;e.watch(T,async J=>{J==="centrally-managed"&&(R.value=!1,X.value=!1,Y=!1,await e.nextTick(),Y=!0)}),e.onMounted(()=>{T.value==="centrally-managed"&&(Y=!0)}),e.watch(()=>{var J;return(J=d.config)==null?void 0:J.identity_realms},()=>{T.value==="centrally-managed"&&Y&&(R.value=!0)},{deep:!0});function ne(){Y&&(R.value=!0)}const M=e.computed(()=>(R.value||X.value)&&V.value),te=a==null?void 0:a(()=>V.value?(X.value=!0,!1):!0);e.onUnmounted(()=>te==null?void 0:te());const $=e.computed(()=>{var J;return!!((J=f("$.config.realm"))!=null&&J.required)}),Z=e.computed(()=>{const J=["anonymous","principals","identity_realms"];return $.value||J.push("realm"),J}),F=e.computed(()=>{var q;const J=f("$.config"),G=((q=J==null?void 0:J.fields)==null?void 0:q.map(ie=>Object.keys(ie)[0]))??[],v=new Set(["anonymous"]);return!$.value&&T.value!=="kong-identity"&&v.add("realm"),u.value&&w.value&&!I.value&&v.add("identity_realms"),G.filter(ie=>!v.has(ie))});return(J,G)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(Ut,{"as-child":"",class:"ff-default-visible-fields",name:"config",omit:Z.value,"reset-label-path":"reset"},null,8,["omit"]),u.value&&I.value?(e.openBlock(),e.createBlock(b$,{key:0,modelValue:T.value,"onUpdate:modelValue":G[0]||(G[0]=v=>T.value=v),class:"kong-identity-section","identity-realms-in-schema":w.value,"loading-realms":N.value},null,8,["modelValue","identity-realms-in-schema","loading-realms"])):e.createCommentVNode("",!0),u.value&&w.value&&T.value==="centrally-managed"?(e.openBlock(),e.createElementBlock("div",{key:1,class:"identity-realms-section","data-testid":"identity-realms-section",onClick:ne},[e.createVNode(cw,{name:"$.config.identity_realms",required:!0}),M.value?(e.openBlock(),e.createElementBlock("p",E$,e.toDisplayString(e.unref(c).t("custom_field.kong_identity.identity_realms_required")),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),u.value&&I.value&&T.value==="kong-identity"?(e.openBlock(),e.createBlock(C$,{key:2,class:"kong-identity-principals-section","data-plane-incompatible":U.value,loading:b.value,"show-panel":y.value,"onClick:createEntity":G[1]||(G[1]=v=>r("click:create-entity",v)),"onClick:learnMore":G[2]||(G[2]=v=>r("click:learn-more",v))},null,8,["data-plane-incompatible","loading","show-panel"])):e.createCommentVNode("",!0),e.createVNode(ts,{class:"ff-advanced-fields-container","data-testid":"ff-advanced-fields-container","hide-general-fields":""},{default:e.withCtx(()=>[u.value&&I.value&&T.value==="kong-identity"&&m.value?(e.openBlock(),e.createElementBlock("div",N$,[e.createVNode(e.unref(Fe.KLabel),{"data-testid":"ff-principals-error-on-miss-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c).t("custom_field.kong_identity.error_on_miss_label")),1)]),_:1}),e.createVNode(e.unref(Fe.KRadio),{"data-testid":"principals-error-on-miss-true",description:e.unref(c).t("custom_field.kong_identity.error_on_miss_reject_description"),label:e.unref(c).t("custom_field.kong_identity.error_on_miss_reject_label"),"model-value":_.value,"selected-value":!0,"onUpdate:modelValue":k},null,8,["description","label","model-value"]),e.createVNode(e.unref(Fe.KRadio),{"data-testid":"principals-error-on-miss-false",description:e.unref(c).t("custom_field.kong_identity.error_on_miss_continue_description"),label:e.unref(c).t("custom_field.kong_identity.error_on_miss_continue_label"),"model-value":_.value,"selected-value":!1,"onUpdate:modelValue":k},null,8,["description","label","model-value"])])):e.createCommentVNode("",!0),e.createVNode(Ut,{"as-child":"",name:"config",omit:F.value,"reset-label-path":"reset"},null,8,["omit"])]),_:1})],64))}}),[["__scopeId","data-v-7dc8344d"]]),dw=e.defineComponent({__name:"ConfigFormWithIdentity",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},configSections:{},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},emits:["click:learn-more","click:create-entity"],setup(n,{emit:t}){const r=n,o=t,i=e.useSlots();return e.provide(et.AUTOFILL_SLOT,i==null?void 0:i[et.AUTOFILL_SLOT_NAME]),e.provide(nw,e.computed(()=>r.isEditing)),(a,s)=>(e.openBlock(),e.createBlock(er,e.normalizeProps(e.guardReactiveProps(r)),{default:e.withCtx(()=>[e.createVNode(S$,{"onClick:createEntity":s[0]||(s[0]=c=>o("click:create-entity",c)),"onClick:learnMore":s[1]||(s[1]=c=>o("click:learn-more",c))})]),_:1},16))}}),x$=Ke({experimental:!0,component:dw,renderRules:{dependencies:{"config.brute_force_protection.redis":["config.brute_force_protection.strategy","redis"]}},fieldRenderers:[{match:"config.anonymous",component:Xe,propsOverrides:{placeholder:"e.g., 00000000-0000-0000-0000-000000000001"}}]}),A$=Ke({experimental:!0}),v$=Ke({experimental:!0}),I$=Ke({experimental:!0,fieldRenderers:[{match:"config.message_by_lua_functions.*",component:Xe,propsOverrides:{multiline:!0,rows:3}}]}),B$=Ke({experimental:!0,fieldRenderers:[{match:"config.message_by_lua_functions.*",component:Xe,propsOverrides:{multiline:!0,rows:3}}]}),T$=Ke({experimental:!0}),O$=Ke({experimental:!0,fieldRenderers:[{match:({path:n})=>n==="config.methods"||n==="config.request_method",component:Dt,propsOverrides:{multiple:!0}}]}),fw=Object.entries(Object.assign({"./authenticate-third-party-with-dynamic-url.yaml":`nodes:
179
179
  - name: STATIC_INPUTS
180
180
  type: static
181
181
  values:
@@ -435,14 +435,14 @@ nodes:
435
435
  input: API
436
436
  status: 200
437
437
  `})).sort(([n],[t])=>n.localeCompare(t)).map(([n,t])=>{const r=n.replace(/^\.\//,"").replace(/\.yaml$/,"");return{id:r,i18nKey:Lx(r),code:t}});function ns(n){return typeof n=="object"&&!Array.isArray(n)&&n!==null}const P$=[{name:"decK",extract(n){try{const t=Ln.load(n);return ns(t)&&Array.isArray(t.plugins)&&t.plugins.find(o=>ns(o)&&o.name==="datakit")||null}catch{return null}}},{name:"KIC",extract(n){let t=n;const r=n.match(/echo\s+(?:"([\s\S]*?)"|'([\s\S]*?)')\s*\|\s*kubectl/);r&&(t=r[1]||r[2]);try{const o=Ln.load(t);if(!ns(o))return null;const i=ns(o.metadata)?o.metadata:{},a=o.plugin||i.name;return(o.kind==="KongPlugin"||o.kind==="KongClusterPlugin")&&a==="datakit"&&o||null}catch{return null}}},{name:"cURL",extract(n){if(!n.trim().startsWith("curl"))return null;const t=n.match(/(?:--data|-d)\s+(?:'((?:[^'\\]|\\[\s\S])*)'|"((?:[^"\\]|\\[\s\S])*)")/);if(!t)return null;let r=t[1]||t[2];t[2]&&(r=r.replace(/\\(["\\])/g,"$1"));try{const o=JSON.parse(r);return ns(o)&&o.name==="datakit"&&o||null}catch{return null}}}],V$={class:"dk-code-editor"},$$={class:"examples-content"},lp="YAML Syntax",R$=je(e.defineComponent({__name:"CodeEditor",props:{editing:{type:Boolean}},emits:["change","error"],setup(n,{expose:t,emit:r}){const{t:o}=jt.createI18n("en-us",Jt),{formData:i,setValue:a}=pt(),s=r,{getMessageFromError:c}=Ie.useErrors(),l=e.shallowRef(null);function u(w){return Ln.dump(e.toRaw(w),{schema:xo,noArrayIndent:!0})}function p(){return u(Xr(i,["__ui_data"]))}const d=e.shallowRef(p()),f={scrollbar:{alwaysConsumeMouseWheel:!1},autoIndent:"keep",editContext:!1};function m(w){const S=w.getModel();S&&(l.value=w,w.onDidChangeModelContent(()=>{try{const I=Ln.load(w.getValue()||"",{schema:xo,json:!0});if(typeof I!="object"||I===null)return;ul.editor.setModelMarkers(S,lp,[]),a(I),s("change",I)}catch(I){const{message:U,mark:x}=I,{line:A,column:T}=x||{line:0,column:0},V=U.split(`
438
- `)[0],R=[{startLineNumber:A+1,startColumn:T+1,endLineNumber:A+1,endColumn:T+2,message:V,severity:ul.MarkerSeverity.Error,source:lp}];ul.editor.setModelMarkers(S,lp,R),s("error",V)}}),w.onDidPaste(I=>{const U=w.getModel();if(!U)return;const x=U.getValueInRange(I.range);for(const A of P$){const T=A.extract(x);if(T){y.value=T,b.value=A.name,h.value=!0;return}}}),E())}const h=e.shallowRef(!1),y=e.shallowRef(null),b=e.shallowRef("");function _(){h.value=!1,y.value=null,b.value=""}function k(){y.value&&(d.value=u(y.value),_())}function C(w){return o(`plugins.free-form.datakit.examples.${w}`)}function N(w){const S=w.code;try{const I=Ln.load(d.value,{schema:xo,json:!0}),U=Ln.load(S,{schema:xo,json:!0});if(typeof I=="object"&&I!==null&&Xt(I.config,U))return;const x=Xr({...i,config:{...U}},["__ui_data"]);d.value=u(x)}catch(I){s("error",c(I))}E()}function E(){const w=l.value,S=w==null?void 0:w.getModel();!w||!S||(w.setPosition(S.getFullModelRange().getEndPosition()),w.focus())}return t({setExampleCode:N}),(w,S)=>(e.openBlock(),e.createElementBlock("div",V$,[e.createVNode(e.unref(Fe.KAlert),{class:"examples"},{icon:e.withCtx(()=>[e.createVNode(e.unref($e.SparklesIcon))]),default:e.withCtx(()=>[e.createElementVNode("div",$$,[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.datakit.description_example"))+" ",1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(fw),I=>(e.openBlock(),e.createBlock(e.unref(Fe.KButton),{key:I.id,appearance:"secondary",size:"small",onClick:U=>N(I)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(C(I.i18nKey)),1)]),_:2},1032,["onClick"]))),128))])]),_:1}),e.createVNode(e.unref(ha.MonacoEditor),{ref:"editor",modelValue:d.value,"onUpdate:modelValue":S[0]||(S[0]=I=>d.value=I),appearance:"standalone",class:"editor",language:"yaml",options:f,theme:"light",onReady:m},null,8,["modelValue"]),e.createVNode(e.unref(Fe.KModal),{"action-button-text":e.unref(o)("plugins.free-form.datakit.detected_config_format_confirm"),title:e.unref(o)("plugins.free-form.datakit.detected_config_format_title"),visible:h.value,onCancel:_,onProceed:k},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.datakit.detected_config_format",{format:b.value})),1)]),_:1},8,["action-button-text","title","visible"])]))}}),[["__scopeId","data-v-20217c6a"]]),{t:L$}=jt.createI18n("en-us",Jt),hc=Pt.createGlobalState(()=>{const n=Pt.useLocalStorage("datakit-editor-mode","flow"),t=Pt.useLocalStorage("datakit-editor-sidebar-expanded",!0),r=Pt.useLocalStorage("datakit-editor-response-panel-collapsed",!1);return{editorMode:n,sidePanelExpanded:t,responsePanelCollapsed:r}});function D$({enabled:n,confirm:t}){Ar.onBeforeRouteLeave(()=>e.toValue(n)?t?t():window.confirm(L$("plugins.free-form.datakit.flow_editor.leave_confirm")):!0);const r=o=>{e.toValue(n)&&o.preventDefault()};Pt.useEventListener("beforeunload",r)}const M$={class:"label-content"},j$={class:"count"},F$={class:"label-content"},U$={class:"count"},pw=.5,cp=.03,K$=30,up=je(e.defineComponent({__name:"FlowPanels",props:{inactive:{type:Boolean},mode:{},resizable:{type:Boolean}},setup(n){const{t}=jt.createI18n("en-us",Jt),r=e.ref(!1),o=e.ref(!1),{responsePanelCollapsed:i}=hc(),{state:a,configNodeCounts:s,clearPendingLayout:c,setPendingFitView:l,commit:u,clear:p,portalSelection:d}=$t(),f=e.useId(),m=`${f}-request`,h=`${f}-response`,y=xt.useVueFlow(m),b=xt.useVueFlow(h);function _(ce,he){const{onPaneClick:Oe,onNodesChange:De,onEdgesChange:Be,getSelectedNodes:qe,getSelectedEdges:We}=ce,{removeSelectedElements:nt}=he;function lt(Re){if(!Re){nt();return}Re.some(Ce=>Ce.type==="select")&&qe.value.length+We.value.length>0&&nt()}De(lt),Be(lt),Oe(()=>lt())}_(y,b),_(b,y),e.watch(d,ce=>{ce&&(y.removeSelectedElements(),b.removeSelectedElements())});const k=e.useTemplateRef("flowPanels"),C=e.useTemplateRef("requestLabel"),N=e.useTemplateRef("requestCanvasContainer"),E=e.useTemplateRef("requestFlow"),w=e.useTemplateRef("resizeHandle"),S=e.useTemplateRef("responseLabel"),I=e.useTemplateRef("responseCanvasContainer"),U=e.useTemplateRef("responseFlow"),x=Pt.useElementBounding(k),A=Pt.useElementBounding(C),T=Pt.useElementBounding(N),V=Pt.useElementBounding(w),R=Pt.useElementBounding(S),X=Pt.useElementBounding(I),Y=e.computed(()=>Math.max(K$,x.height.value*cp)),ne=e.computed(()=>x.height.value-A.height.value-V.height.value-R.height.value),M=e.computed(()=>{const ce=ne.value;return ce?Math.max(cp,Y.value/ce):cp}),te=e.ref(pw),$=e.computed(()=>`${te.value*100}%`),Z=e.computed(()=>`${(1-te.value)*100}%`),F=e.computed(()=>te.value<=M.value),J=e.computed(()=>1-te.value<=M.value);function G(ce,{persist:he=!0}={}){const Oe=Math.min(1,Math.max(0,ce));te.value=Oe,he&&n.mode==="edit"&&(i.value=J.value)}function v(ce,he=!0){G(ce?1:pw,{persist:he})}function q(ce=!0){G(0,{persist:ce})}if(n.mode==="edit"){const ce=s.value.response===0,he=i.value;v(ce||he,!1)}else e.watch(()=>s.value.response,ce=>{v(ce===0,!1)},{immediate:!0});const ie=()=>{n.resizable&&(F.value?v(!1):q())},oe=()=>{n.resizable&&v(!J.value)},{isDragging:ke}=Pt.useDraggable(w,{onMove(ce){if(!n.resizable)return;const he=Math.max(0,ce.y-T.top.value),Oe=Math.min(1,Math.max(0,he/ne.value));G(Oe,{persist:!1})},onEnd(){n.resizable&&(T.height.value<Y.value?q():X.height.value<Y.value?v(!0):G(te.value))}});function ye(){e.nextTick(()=>{var ce,he;(ce=E.value)==null||ce.fitView(),(he=U.value)==null||he.fitView()})}return e.watch([r,o,()=>a.value.pendingLayout,()=>a.value.pendingFitView],([ce,he,Oe,De])=>{n.inactive||!ce||!he||!Oe&&!De||(Oe&&c(),De&&l(!1),setTimeout(async()=>{var Be,qe;Oe&&(await((Be=E.value)==null?void 0:Be.autoLayout(!1)),await((qe=U.value)==null?void 0:qe.autoLayout(!1)),u("*"),Oe==="clearHistory"&&p()),De&&setTimeout(()=>ye(),0)},0))}),(ce,he)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"flowPanels",ref:k,class:"flow-panels"},[e.createElementVNode("div",{ref_key:"requestLabel",ref:C,class:e.normalizeClass(["label request",{resizable:n.resizable}]),onClick:ie},[n.resizable?(e.openBlock(),e.createBlock(e.unref($e.ChevronDownIcon),{key:0,class:e.normalizeClass(["icon",{collapsed:F.value}])},null,8,["class"])):e.createCommentVNode("",!0),e.createElementVNode("div",M$,[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.canvas_panel.request"))+" ",1),e.createElementVNode("span",j$,[e.unref(s).request===1?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(" ("+e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.canvas_panel.node_count_singular"))+") ",1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(" ("+e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.canvas_panel.node_count_plural",{count:e.unref(s).request}))+") ",1)],64))])])],2),e.createElementVNode("div",{ref_key:"requestCanvasContainer",ref:N,class:e.normalizeClass(["canvas",{dragging:e.unref(ke)}]),style:e.normalizeStyle({flexBasis:$.value})},[e.createVNode(pf,{ref_key:"requestFlow",ref:E,"flow-id":m,mode:n.mode,phase:"request",onInitialized:he[0]||(he[0]=Oe=>r.value=!0),onNodesChange:he[1]||(he[1]=Oe=>r.value=!1)},null,8,["mode"])],6),e.createElementVNode("div",{ref_key:"resizeHandle",ref:w,class:e.normalizeClass(["resize-handle",{resizable:n.resizable}])},null,2),e.createElementVNode("div",{ref_key:"responseLabel",ref:S,class:e.normalizeClass(["label response",{dragging:e.unref(ke),resizable:n.resizable}]),onClick:oe},[n.resizable?(e.openBlock(),e.createBlock(e.unref($e.ChevronDownIcon),{key:0,class:e.normalizeClass(["icon",{collapsed:J.value}])},null,8,["class"])):e.createCommentVNode("",!0),e.createElementVNode("div",F$,[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.canvas_panel.response"))+" ",1),e.createElementVNode("span",U$,[e.unref(s).response===1?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(" ("+e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.canvas_panel.node_count_singular"))+") ",1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(" ("+e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.canvas_panel.node_count_plural",{count:e.unref(s).response}))+") ",1)],64))])])],2),e.createElementVNode("div",{ref_key:"responseCanvasContainer",ref:I,class:e.normalizeClass(["canvas response",{dragging:e.unref(ke)}]),style:e.normalizeStyle({flexBasis:Z.value})},[e.createVNode(pf,{ref_key:"responseFlow",ref:U,"flow-id":h,mode:n.mode,phase:"response",onInitialized:he[2]||(he[2]=Oe=>o.value=!0),onNodesChange:he[3]||(he[3]=Oe=>o.value=!1)},null,8,["mode"])],6)],512))}}),[["__scopeId","data-v-5a4fec80"]]),q$={class:"dk-confirm-modal-body"},G$={class:"connections"},H$=je(e.defineComponent({__name:"ConflictModal",props:{title:{},message:{},addedConnections:{},removedConnections:{}},emits:["cancel","confirm"],setup(n,{expose:t,emit:r}){const{i18n:{t:o}}=Qe(),i=r,a=e.ref(!1),s=e.ref(n.message),c=e.ref(n.addedConnections??[]),l=e.ref(n.removedConnections??[]);let u=null;function p(){a.value=!1,i("cancel"),u==null||u(!1)}function d(){a.value=!1,i("confirm"),u==null||u(!0)}async function f(m,h,y){return s.value=m,c.value=h??[],l.value=y??[],a.value=!0,await new Promise(b=>{u=b})}return t({open:f}),(m,h)=>{const y=e.resolveComponent("KModal");return e.openBlock(),e.createBlock(y,{"action-button-text":e.unref(o)("plugins.free-form.datakit.flow_editor.confirm.proceed"),"close-on-backdrop-click":"","max-width":"660px",title:n.title??e.unref(o)("plugins.free-form.datakit.flow_editor.confirm.title"),visible:a.value,"z-index":9999,onCancel:p,onProceed:d},{default:e.withCtx(()=>[e.createElementVNode("div",q$,[e.createElementVNode("p",null,e.toDisplayString(s.value),1),e.createElementVNode("p",null,e.toDisplayString(e.unref(o)("plugins.free-form.datakit.flow_editor.confirm.message.confirm")),1),e.createElementVNode("div",G$,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value??[],([b,_])=>(e.openBlock(),e.createElementBlock("div",{key:`${b}-${_}`,class:"connection"},[e.createVNode(e.unref($e.AddIcon),{color:`var(--kui-color-background-success, ${e.unref(I1)})`},null,8,["color"]),e.createTextVNode(" "+e.toDisplayString(b)+" → "+e.toDisplayString(_),1)]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value??[],([b,_])=>(e.openBlock(),e.createElementBlock("div",{key:`${b}-${_}`,class:"connection"},[e.createVNode(e.unref($e.RemoveIcon),{color:`var(--kui-color-text-danger, ${e.unref(Yg)})`},null,8,["color"]),e.createTextVNode(" "+e.toDisplayString(b)+" → "+e.toDisplayString(_),1)]))),128))])])]),_:1},8,["action-button-text","title","visible"])}}}),[["__scopeId","data-v-e6df03c2"]]),z$={class:"dk-editor-nav"},W$={class:"top"},Y$={class:"bottom"},J$=je(e.defineComponent({__name:"EditorNav",emits:["back"],setup(n,{emit:t}){const{t:r}=jt.createI18n("en-us",Jt),o=t,i=[{label:r("plugins.free-form.datakit.flow_editor.return_to_config"),icon:$e.ArrowLeftIcon,onClick:()=>o("back")}],{sidePanelExpanded:a}=hc(),s=e.computed(()=>a.value?r("plugins.free-form.datakit.flow_editor.collapse_panel"):r("plugins.free-form.datakit.flow_editor.expand_panel")),c=e.ref(!1);function l(){a.value=!a.value}return(u,p)=>(e.openBlock(),e.createElementBlock("nav",z$,[e.createElementVNode("div",W$,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(i,({label:d,to:f,icon:m,onClick:h})=>e.createVNode(e.unref(Fe.KTooltip),{key:d,"kpop-attributes":{offset:"10px"},label:d,placement:"right"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(Fe.KButton),{key:d,appearance:"none",class:"nav-item",icon:"",to:f,onClick:h},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m),{decorative:"",size:`var(--kui-icon-size-40, ${e.unref(_a)})`},null,8,["size"]))]),_:2},1032,["to","onClick"]))]),_:2},1032,["label"])),64))]),e.createElementVNode("div",Y$,[e.createElementVNode("div",{class:e.normalizeClass(["side-panel-toggle",{expanded:e.unref(a)}]),onTransitionend:p[0]||(p[0]=e.withModifiers(d=>c.value=!1,["self"])),onTransitionstart:p[1]||(p[1]=e.withModifiers(d=>c.value=!0,["self"]))},[e.createVNode(e.unref(Fe.KTooltip),{label:c.value?void 0:s.value,placement:e.unref(a)?"left":"right"},{default:e.withCtx(()=>[e.createVNode(e.unref(Fe.KButton),{appearance:"none",class:"nav-item nav-item-toggle",icon:"",size:"large",onClick:l},{default:e.withCtx(()=>[e.unref(a)?(e.openBlock(),e.createBlock(e.unref($e.ChevronDoubleLeftIcon),{key:0,decorative:"",size:`var(--kui-icon-size-40, ${e.unref(_a)})`},null,8,["size"])):(e.openBlock(),e.createBlock(e.unref($e.ChevronDoubleRightIcon),{key:1,decorative:"",size:`var(--kui-icon-size-40, ${e.unref(_a)})`},null,8,["size"]))]),_:1})]),_:1},8,["label","placement"])],34)])]))}}),[["__scopeId","data-v-0dcd2605"]]),X$={class:"dk-editor-main"},Z$={class:"header"},Q$={class:"actions"},eR={class:"settings"},tR={ref:"canvasContainer",class:"body"},nR=je(e.defineComponent({__name:"EditorMain",setup(n){const{t}=jt.createI18n("en-us",Jt),{modalOpen:r,undo:o,redo:i,canUndo:a,canRedo:s,load:c}=$t();function l(f){return t(`plugins.free-form.datakit.examples.${f}`)}function u(f){const m=Ln.load(f.code,{schema:xo,json:!0});if(typeof m!="object"||m===null)return;const h=m,y={config:{...h,nodes:h.nodes??[]}};c(y,!0)}function p(){r.value=!1}Wg({enabled:r,undo:o,redo:i});const d={maxWidth:"300px",zIndex:1e4};return(f,m)=>(e.openBlock(),e.createElementBlock("div",X$,[e.createElementVNode("header",Z$,[e.createElementVNode("div",Q$,[e.createVNode(e.unref(Fe.KTooltip),{"z-index":1e4},{content:e.withCtx(()=>[e.createVNode($l,{keys:e.unref(pl).undo,label:e.unref(t)("plugins.free-form.datakit.flow_editor.actions.undo"),reverse:""},null,8,["keys","label"])]),default:e.withCtx(()=>[e.createVNode(e.unref(Fe.KButton),{appearance:"tertiary",disabled:!e.unref(a),icon:"",onClick:e.unref(o)},{default:e.withCtx(()=>[e.createVNode(e.unref($e.UndoIcon))]),_:1},8,["disabled","onClick"])]),_:1}),e.createVNode(e.unref(Fe.KTooltip),{"z-index":1e4},{content:e.withCtx(()=>[e.createVNode($l,{keys:e.unref(pl).redo,label:e.unref(t)("plugins.free-form.datakit.flow_editor.actions.redo"),reverse:""},null,8,["keys","label"])]),default:e.withCtx(()=>[e.createVNode(e.unref(Fe.KButton),{appearance:"tertiary",disabled:!e.unref(s),icon:"",onClick:e.unref(i)},{default:e.withCtx(()=>[e.createVNode(e.unref($e.RedoIcon))]),_:1},8,["disabled","onClick"])]),_:1}),m[0]||(m[0]=e.createElementVNode("div",{class:"divider"},null,-1)),e.createElementVNode("div",eR,[e.createVNode(hn,{label:e.unref(t)("plugins.free-form.datakit.flow_editor.debug.label"),"label-attributes":{info:e.unref(t)("plugins.free-form.datakit.flow_editor.debug.description"),tooltipAttributes:d},name:"config.debug"},null,8,["label","label-attributes"])]),m[1]||(m[1]=e.createElementVNode("div",{class:"divider"},null,-1)),e.createVNode(e.unref(Fe.KDropdown),{appearance:"tertiary","kpop-attributes":{placement:"bottom-end",target:"body"},"show-caret":"","trigger-text":e.unref(t)("plugins.free-form.datakit.flow_editor.examples"),width:240},{items:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(fw),h=>(e.openBlock(),e.createBlock(e.unref(Fe.KDropdownItem),{key:h.id,onClick:y=>u(h)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l(h.i18nKey)),1)]),_:2},1032,["onClick"]))),128))]),_:1},8,["trigger-text"]),e.createVNode(e.unref(Fe.KButton),{appearance:"tertiary",target:"_blank",to:"https://developer.konghq.com/plugins/datakit/"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.actions.view_docs"))+" ",1),e.createVNode(e.unref($e.ExternalLinkIcon))]),_:1}),e.createVNode(e.unref(Fe.KButton),{onClick:p},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.actions.done")),1)]),_:1})])]),e.createElementVNode("div",tR,[e.createVNode(up,{mode:"edit",resizable:""})],512)]))}}),[["__scopeId","data-v-1cf532ff"]]),rR=["draggable"],oR={class:"icon"},iR={class:"content"},aR={class:"title"},sR={class:"description"},lR=je(e.defineComponent({__name:"NodePanelItem",props:{type:{},unsupported:{type:Boolean}},emits:["dragstart"],setup(n,{emit:t}){e.useCssVars(l=>({f502bd0e:e.unref(a),v4b2eb58e:e.unref(s)}));const r=t,{summary:o,icon:i}=xl[n.type],{colors:{background:a,foreground:s}}=VI(xl[n.type].group);function c(l){r("dragstart",l,n.type)}return(l,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["dk-node-panel-item",{[`node-type-${n.type}`]:!0,unsupported:n.unsupported}]),draggable:!n.unsupported,onDragstart:c},[e.createElementVNode("div",oR,[e.createVNode(e.unref(i),{size:16})]),e.createElementVNode("div",iR,[e.createElementVNode("div",aR,e.toDisplayString(n.type),1),e.createElementVNode("div",sR,e.toDisplayString(e.unref(o)),1)])],42,rR))}}),[["__scopeId","data-v-829422ff"]]),cR={class:"dk-node-panel"},uR={key:0,class:"title"},dR={class:"node-list"},fR={class:"group-title"},pR={class:"group-items"},mR={"aria-hidden":"true",class:"preview",inert:""},gR=je(e.defineComponent({__name:"NodePanel",props:{hideTitle:{type:Boolean}},setup(n){const{t}=jt.createI18n("en-us",Jt),{createNode:r}=$t(),o=e.inject(fr.KM_2446_DATAKIT_JWT_NODES,!1),i=e.computed(()=>o?Uy:Uy.filter(({id:u})=>u!=="authentication")),a=`dk-drag-preview-${e.useId()}`,s=e.shallowRef(),c=e.computed(()=>s.value?[{id:"preview",type:"flow",data:s.value,position:{x:0,y:0}}]:[]),l=async(u,p)=>{var x,A,T;const d=u.currentTarget,{left:f,top:m,width:h,height:y}=d.getBoundingClientRect(),b=u.clientX-f,_=u.clientY-m;s.value=r({type:p}),await e.nextTick();const k=document.querySelector(`#${a}`)||d,C=k.cloneNode(!0);C.classList.add("dk-drag-snapshot");const{offsetWidth:N,offsetHeight:E}=k;Object.assign(C.style,{position:"absolute",top:"-9999px",left:"-9999px",width:`${N}px`,height:`${E}px`}),document.body.appendChild(C);const w=b/h,S=_/y,I={ratioX:w,ratioY:S,offsetX:N*w,offsetY:E*S},U={action:"create-node",data:{type:p,anchor:I}};(x=u.dataTransfer)==null||x.setData(ba,JSON.stringify(U)),(A=u.dataTransfer)==null||A.setData(`${ba}/${p}`,p),(T=u.dataTransfer)==null||T.setDragImage(C,I.offsetX,I.offsetY),requestAnimationFrame(()=>{C.remove(),s.value=void 0})};return(u,p)=>{const d=e.resolveComponent("KLabel");return e.openBlock(),e.createElementBlock("div",cR,[n.hideTitle?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("h3",uR,[e.createVNode(d,{class:"label",info:e.unref(t)("plugins.free-form.datakit.flow_editor.node_panel.description")},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.node_panel.title")),1)]),_:1},8,["info"])])),e.createElementVNode("div",dR,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,f=>(e.openBlock(),e.createElementBlock("section",{key:f.id,class:"node-group"},[e.createElementVNode("h4",fR,e.toDisplayString(f.title),1),e.createElementVNode("div",pR,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.nodes,m=>(e.openBlock(),e.createBlock(lR,{key:m.type,type:m.type,onDragstart:l},null,8,["type"]))),128))])]))),128))]),e.createElementVNode("div",mR,[e.createVNode(e.unref(xt.VueFlow),{nodes:c.value},{"node-flow":e.withCtx(f=>[e.createVNode(s_,{id:a,data:f.data},null,8,["data"])]),_:1},8,["nodes"])])])}}}),[["__scopeId","data-v-f2040974"]]);function hR(){const{addField:n,getNodeByName:t,removeField:r,replaceConfig:o,renameField:i,disconnectOutEdges:a,nodeMapByName:s}=$t(),c=t("vault");if(!c)throw new Error("no vault node");const l=e.computed(()=>{var h;return((h=s.value.get("vault"))==null?void 0:h.config)||{}});return{formData:e.computed(()=>({vault:{...l.value}})),addVault:(h,y)=>{n(c.id,"output",h,!1);const b={...c.config,[h]:y};o(c.id,b)},removeVault:h=>{const y=Zr(c,"output",h);if(!y)return;const b=c.fields.output.length===1;r(c.id,y.id,!0,!1);const _=Xr(c.config,h);o(c.id,_,!b),b&&a(c.id)},updateVault:(h,y,b=!0)=>{const _={...c.config,[h]:y};o(c.id,_,b)},renameVault:(h,y,b=!0)=>{var N;const _=Zr(c,"output",h);if(!_)return;i(c.id,_.id,y,!1);const k=((N=c.config)==null?void 0:N[h])??"",C={...Xr(c.config,h),[y]:k};o(c.id,C,b)}}}const yR=e.defineComponent({__name:"VaultSecretPicker",props:{secretRef:{type:[String,Boolean]},secretName:{},validateName:{type:Function,default:()=>{}},isEditing:{type:Boolean,default:!1}},emits:["proceed","cancel"],setup(n,{emit:t}){const r=t,{i18n:{t:o}}=st.useI18n(),i=e.inject(et.FORMS_CONFIG),a=e.ref(n.secretName||""),s=e.ref(""),c=e.computed(()=>a.value.trim()?n.validateName(a.value.trim(),n.isEditing)===void 0:!1),l=e.computed(()=>!c.value),u=()=>{const m=a.value.trim(),h=n.validateName(m,n.isEditing);return s.value=h||"",h===void 0},p=()=>{s.value="",u()},d=m=>{u()&&r("proceed",{secretRef:m,secretName:a.value.trim()})},f=()=>{a.value="",s.value="",r("cancel")};return e.watch(()=>n.secretName,m=>{a.value=m||"",s.value=""}),(m,h)=>{const y=e.resolveComponent("KInput"),b=e.resolveComponent("KEmptyState");return e.unref(i)?(e.openBlock(),e.createBlock(e.unref(ya.VaultSecretPicker),{key:0,"additional-disabled":l.value,config:e.unref(i),"proceed-button-text":e.unref(o)("plugins.free-form.datakit.flow_editor.vault_secret_picker.proceed_button_text"),setup:n.secretRef,title:e.unref(o)("plugins.free-form.datakit.flow_editor.vault_secret_picker.title"),onCancel:f,onProceed:d},{"form-prefix":e.withCtx(()=>[e.createVNode(y,{"model-value":a.value,"onUpdate:modelValue":[h[0]||(h[0]=_=>a.value=_),p],"data-testid":"vault-secret-picker-secret-name-input",error:!!s.value,"error-message":s.value,label:e.unref(o)("plugins.free-form.datakit.flow_editor.vault_secret_picker.secret_name.label"),"label-attributes":{info:e.unref(o)("plugins.free-form.datakit.flow_editor.vault_secret_picker.secret_name.help")},placeholder:e.unref(o)("plugins.free-form.datakit.flow_editor.vault_secret_picker.secret_name.placeholder"),required:""},null,8,["model-value","error","error-message","label","label-attributes","placeholder"])]),_:1},8,["additional-disabled","config","proceed-button-text","setup","title"])):(e.openBlock(),e.createBlock(b,{key:1,"icon-variant":"error",message:e.unref(o)("plugins.free-form.vault_picker.component_error")},null,8,["message"]))}}}),_R={class:"dk-vault-panel"},bR={class:"title"},wR={class:"vault-list"},kR={key:0,class:"vault-list-item"},CR={class:"vault-list-item-key"},ER={class:"vault-list-item-key-text"},NR=je(e.defineComponent({__name:"VaultField",props:{autofocus:{type:Boolean},name:{},labelAttributes:{}},emits:["update","add","remove"],setup(n,{emit:t}){const r=n,o=t,{keys:i,addKey:a,removeKey:s,updateKey:c,getKeyName:l}=Hl(e.toRef(r,"name")),u=Ft(e.toRef(r,"name")),p=e.ref(null),d=e.ref(null),f=e.computed(()=>{if(!p.value)return null;const E=l(p.value),w=u.value?u.value.value[p.value]:void 0;return E===void 0||w===void 0?null:{id:p.value,key:E,value:w}}),{i18n:{t:m}}=st.useI18n(),h=e.computed(()=>new Set(i.value.map(([,E])=>E))),y=()=>{if(!u.value)return;const w=a();d.value=w,p.value=w},b=()=>{p.value=null,d.value&&(s(d.value),d.value=null)},_=E=>{if(!f.value)throw new Error("no selected entry");const w=f.value.key,S=w!==E.secretName,I=f.value.value!==E.secretRef,U=S||I;f.value.value=E.secretRef,f.value.key=E.secretName,I&&(u.value.value[f.value.id]=E.secretRef),S&&c(f.value.id,E.secretName),d.value?o("add",E.secretName,E.secretRef):U&&o("update",E.secretName,E.secretRef,S?w:void 0),d.value=null,b()},k=E=>{p.value=E},C=E=>{const w=l(E);s(E),o("remove",w)},N=(E,w)=>{var S;if(!E)return m("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.name_required_error");if(h.value.has(E)&&!(w&&E===((S=f.value)==null?void 0:S.key)))return m("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.name_exists_error")};return(E,w)=>{var x,A;const S=e.resolveComponent("KButton"),I=e.resolveComponent("KDropdownItem"),U=e.resolveComponent("KDropdown");return e.openBlock(),e.createElementBlock("div",_R,[e.createElementVNode("h3",bR,e.toDisplayString(e.unref(m)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.title")),1),e.createVNode(S,{appearance:"tertiary",class:"add-button",size:"small",onClick:y},{default:e.withCtx(()=>[e.createVNode(e.unref($e.AddIcon)),e.createTextVNode(" "+e.toDisplayString(e.unref(m)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.add_button")),1)]),_:1}),e.createElementVNode("div",wR,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(i),([T,V])=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:T},[V?(e.openBlock(),e.createElementBlock("div",kR,[e.createElementVNode("div",CR,[e.createVNode(e.unref($e.KeyIcon),{color:`var(--kui-color-text-neutral, ${e.unref(cr)})`,size:16},null,8,["color"]),e.createElementVNode("div",ER,e.toDisplayString(V),1)]),e.createVNode(U,null,{items:e.withCtx(()=>[e.createVNode(I,{onClick:R=>k(T)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(m)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.edit")),1)]),_:1},8,["onClick"]),e.createVNode(I,{danger:"",onClick:R=>C(T)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(m)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.delete")),1)]),_:1},8,["onClick"])]),default:e.withCtx(()=>[e.createVNode(S,{appearance:"tertiary",icon:""},{default:e.withCtx(()=>[e.createVNode(e.unref($e.MoreIcon),{color:`var(--kui-color-text, ${e.unref(hd)})`},null,8,["color"])]),_:1})]),_:2},1024)])):e.createCommentVNode("",!0)],64))),128))]),e.createVNode(yR,{"is-editing":!!p.value&&!d.value,"secret-name":(x=f.value)==null?void 0:x.key,"secret-ref":(A=f.value)==null?void 0:A.value,"validate-name":N,onCancel:b,onProceed:_},null,8,["is-editing","secret-name","secret-ref"])])}}}),[["__scopeId","data-v-a7726f48"]]);function SR(){const{getSchema:n}=pt();return e.computed(()=>{const t=n("config.resources");if(!t)throw new Error("Failed to get resource schema");const r=Tr(t);return r.fields.forEach(o=>{const i=Object.keys(o)[0];if(i==="cache"){const a=o[i];o[i]={...a,fields:[...a.fields,{partial_id:{type:"string"}}]},a.fields.forEach(s=>{const c=Object.keys(s)[0];if(c==="redis"){const l=s[c];s[c]={...l},delete s[c].required}})}}),r})}const xR={key:1},AR=["innerHTML"],vR={class:"horizontal-container"},dp=je(e.defineComponent({__name:"RadioField",props:{labelAttributes:{},multiple:{type:Boolean},items:{},label:{},autofocus:{type:Boolean},name:{}},emits:["update:modelValue"],setup(n,{emit:t}){const r=t,o=e.createPropsRestProxy(n,["name","items"]),{getSelectItems:i}=pt(),a=Ft(e.toRef(()=>n.name)),s=ln(a.path,o),c=e.computed(()=>n.items?n.items:a.path?i(a.path.value):[]),l=u=>{a.value&&(a.value.value=u),r("update:modelValue",u)};return(u,p)=>{var m;const d=e.resolveComponent("KAlert"),f=e.resolveComponent("KLabel");return e.unref(a).error?(e.openBlock(),e.createBlock(d,{key:0,appearance:"danger",message:e.unref(a).error.message},null,8,["message"])):e.withDirectives((e.openBlock(),e.createElementBlock("div",xR,[e.createVNode(f,e.normalizeProps(e.guardReactiveProps(e.unref(s).labelAttributes)),e.createSlots({default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s).label)+" ",1)]),_:2},[(m=e.unref(s).labelAttributes)!=null&&m.info?{name:"tooltip",fn:e.withCtx(()=>[e.createElementVNode("div",{innerHTML:e.unref(s).labelAttributes.info},null,8,AR)]),key:"0"}:void 0]),1040),e.createElementVNode("div",vR,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,h=>(e.openBlock(),e.createBlock(e.unref(Fe.KRadio),{key:h.value,"model-value":e.unref(a).value.value,"onUpdate:modelValue":[p[0]||(p[0]=y=>e.unref(a).value.value=y),l],"card-orientation":"horizontal",label:h.label,"selected-value":h.value},null,8,["model-value","label","selected-value"]))),128))])],512)),[[e.vShow,!e.unref(a).hide.value]])}}}),[["__scopeId","data-v-7c0483f3"]]),IR={class:"dk-cache-panel"},BR={class:"title"},TR={key:0,class:"cache-item"},OR={class:"cache-item-key"},PR={class:"cache-item-key-text"},VR={class:"dk-resource-cache-form"},$R={key:1},RR={key:2,class:"dk-cache-inline-redis"},LR={key:3,class:"dk-cache-redis-editor"},DR={key:0,class:"redis-editor-error"},MR=je(e.defineComponent({__name:"CacheField",props:{strategy:{}},emits:["update","remove","cancel"],setup(n,{emit:t}){const r=Ln.dump({host:"127.0.0.1",port:6379},{indent:2}),o=t,{getDefault:i,formData:a}=pt(),s=Ft("cache");if(s.error)throw new Error("No cache schema");const c=e.inject(Pi),l=e.computed(()=>!!c),u=e.shallowRef(""),p=e.ref(""),d=e.ref(!1),{i18n:{t:f}}=st.useI18n(),m=e.computed(()=>{var S,I,U;return h.value==="redis"?l.value?!!((S=a.cache)!=null&&S.partial_id||(I=a.cache)!=null&&I.redis):!!((U=a.cache)!=null&&U.redis)&&!p.value:!0}),h=e.computed(()=>{var S;return(S=s.value.value)==null?void 0:S.strategy}),y=e.computed(()=>{var S;return(S=s.value.value)!=null&&S.redis?Ln.dump(s.value.value.redis,{indent:2,noRefs:!0}):""});e.watch([d,h],([S,I])=>{S&&I==="redis"&&!l.value&&(u.value=y.value||r,p.value="")}),e.watch(u,S=>{var I;if(!l.value&&h.value==="redis")try{const U=Ln.load(S,{json:!0});U&&typeof U=="object"&&(a.cache.redis=U,p.value="")}catch(U){p.value=((I=U.message)==null?void 0:I.split(`
439
- `)[0])||"Invalid YAML"}});const b=()=>{d.value=!0},_=()=>{d.value=!1,o("cancel")},k=()=>{o("remove")},C=()=>{b(),s.value.value||(s.value.value=i("cache"),s.value.value.strategy="memory")},N=()=>{d.value=!1,o("update",a)},E=()=>{var S,I;h.value==="memory"&&((S=a.cache)!=null&&S.partial_id)&&((I=a.cache)==null||delete I.partial_id)};async function w({codeElement:S,language:I,code:U}){S.innerHTML=await _1.codeToHtml(U,{lang:I,theme:"material-theme-darker",structure:"inline"})}return(S,I)=>{const U=e.resolveComponent("KButton"),x=e.resolveComponent("KDropdownItem"),A=e.resolveComponent("KDropdown"),T=e.resolveComponent("KLabel"),V=e.resolveComponent("KCodeBlock"),R=e.resolveComponent("KModal");return e.openBlock(),e.createElementBlock("div",IR,[e.createElementVNode("h3",BR,e.toDisplayString(e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.title")),1),n.strategy?(e.openBlock(),e.createElementBlock("div",TR,[e.createElementVNode("div",OR,[e.createVNode(e.unref($e.DatabaseIcon),{color:`var(--kui-color-text-neutral, ${e.unref(cr)})`,size:`var(--kui-icon-size-30, ${e.unref(Yn)})`},null,8,["color","size"]),e.createElementVNode("div",PR,e.toDisplayString(n.strategy),1)]),e.createVNode(A,null,{items:e.withCtx(()=>[e.createVNode(x,{onClick:b},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.edit")),1)]),_:1}),e.createVNode(x,{danger:"",onClick:k},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.delete")),1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(U,{appearance:"tertiary",icon:""},{default:e.withCtx(()=>[e.createVNode(e.unref($e.MoreIcon),{color:`var(--kui-color-text, ${e.unref(hd)})`},null,8,["color"])]),_:1})]),_:1})])):(e.openBlock(),e.createBlock(U,{key:1,appearance:"tertiary",class:"add-button",size:"small",onClick:C},{default:e.withCtx(()=>[e.createVNode(e.unref($e.AddIcon)),e.createTextVNode(" "+e.toDisplayString(e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.add_button")),1)]),_:1})),e.createVNode(R,{"action-button-disabled":!m.value,"action-button-text":e.unref(f)("actions.save"),"max-width":"640px",title:e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.title"),visible:d.value,onCancel:_,onProceed:N},{default:e.withCtx(()=>{var X,Y;return[e.createElementVNode("div",VR,[e.createVNode(dp,{items:[{label:e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.strategy_options.memory"),value:"memory"},{label:e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.strategy_options.redis"),value:"redis"}],name:"strategy","onUpdate:modelValue":E},null,8,["items"]),h.value==="memory"?(e.openBlock(),e.createBlock(it,{key:0,name:"memory.dictionary_name"})):e.createCommentVNode("",!0),h.value==="redis"&&l.value?(e.openBlock(),e.createElementBlock("div",$R,[e.createVNode(T,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.select_redis_configuration")),1)]),_:1}),e.createVNode(e.unref(Hg.RedisConfigurationSelector),{"model-value":(X=e.unref(a).cache)==null?void 0:X.partial_id,"redis-type":"redis-ee","onUpdate:modelValue":I[0]||(I[0]=ne=>e.unref(a).cache.partial_id=ne)},null,8,["model-value"])])):e.createCommentVNode("",!0),h.value==="redis"&&l.value&&!((Y=e.unref(a).cache)!=null&&Y.partial_id)&&y.value?(e.openBlock(),e.createElementBlock("div",RR,[e.createElementVNode("div",null,e.toDisplayString(e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.inline_config_preview")),1),e.createVNode(V,{id:"dk-cache-redis-configuration",code:y.value,language:"yaml",theme:"dark",onCodeBlockRender:w},null,8,["code"])])):e.createCommentVNode("",!0),h.value==="redis"&&!l.value?(e.openBlock(),e.createElementBlock("div",LR,[e.createVNode(T,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.inline_config")),1)]),_:1}),e.createVNode(e.unref(ha.MonacoEditor),{modelValue:u.value,"onUpdate:modelValue":I[1]||(I[1]=ne=>u.value=ne),appearance:"standalone",class:"redis-editor",language:"yaml",theme:"light"},null,8,["modelValue"]),p.value?(e.openBlock(),e.createElementBlock("p",DR,e.toDisplayString(p.value),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)])]}),_:1},8,["action-button-disabled","action-button-text","title","visible"])])}}}),[["__scopeId","data-v-4ffd057c"]]),jR={class:"dk-resources-panel"},FR=je(e.defineComponent({__name:"ResourcesPanel",setup(n){const t=SR(),r=e.ref(0),{addVault:o,removeVault:i,updateVault:a,renameVault:s,formData:c}=hR();function l(y,b,_){_&&_!==y&&s(_,y,!1),a(y,b)}const{state:u,commit:p}=$t(),d=e.computed(()=>({cache:u.value.cacheConfig}));function f(y){u.value.cacheConfig=y.cache,p()}function m(){u.value.cacheConfig=void 0,p()}function h(){r.value++}return(y,b)=>(e.openBlock(),e.createElementBlock("div",jR,[e.createVNode(Zt,{data:e.unref(c),schema:e.unref(t)},{default:e.withCtx(()=>[e.createVNode(NR,{name:"vault",onAdd:e.unref(o),onRemove:e.unref(i),onUpdate:l},null,8,["onAdd","onRemove"])]),_:1},8,["data","schema"]),b[0]||(b[0]=e.createElementVNode("hr",{class:"dk-resources-divider"},null,-1)),(e.openBlock(),e.createBlock(Zt,{key:`${r.value}`,data:d.value,schema:e.unref(t)},{default:e.withCtx(()=>{var _;return[e.createVNode(MR,{strategy:(_=d.value.cache)==null?void 0:_.strategy,onCancel:h,onRemove:m,onUpdate:f},null,8,["strategy"])]}),_:1},8,["data","schema"]))]))}}),[["__scopeId","data-v-9093c001"]]),UR={class:"header"},KR={class:"title"},qR={class:"body"},GR={class:"panel"},HR=je(e.defineComponent({__name:"SidePanel",setup(n){const{t}=jt.createI18n("en-us",Jt),{sidePanelExpanded:r}=hc(),{propertiesPanelOpen:o,selectedNode:i}=$t(),a=e.ref("nodes");function s(){o.value=!1}e.watch(i,l=>{l||s()});const c=e.ref(!1);return e.onMounted(()=>{c.value=!0}),(l,u)=>{const p=e.resolveComponent("KSegmentedControl");return e.openBlock(),e.createElementBlock("aside",{class:e.normalizeClass(["side-panel",{expanded:e.unref(r),inited:c.value}])},[e.createElementVNode("header",UR,[e.createElementVNode("h2",KR,e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.name")),1)]),e.createElementVNode("div",qR,[e.createElementVNode("div",GR,[e.createVNode(p,{modelValue:a.value,"onUpdate:modelValue":u[0]||(u[0]=d=>a.value=d),options:[{label:e.unref(t)("plugins.free-form.datakit.flow_editor.panel_segments.nodes"),value:"nodes"},{label:e.unref(t)("plugins.free-form.datakit.flow_editor.panel_segments.resources.title"),value:"resources"}]},null,8,["modelValue","options"]),a.value==="nodes"?(e.openBlock(),e.createBlock(gR,{key:0,class:"node-panel","hide-title":""})):e.createCommentVNode("",!0),a.value==="resources"?(e.openBlock(),e.createBlock(FR,{key:1})):e.createCommentVNode("",!0)])])],2)}}}),[["__scopeId","data-v-9e854e60"]]),zR=e.defineComponent({__name:"HttpMethodField",props:{name:{}},setup(n){return(t,r)=>(e.openBlock(),e.createBlock(Dt,{items:e.unref(gf)([...e.unref(jy)]),name:n.name},null,8,["items","name"]))}});function WR(n,t){const r=[],o=(i,a)=>{typeof a=="string"&&r.push({nodeName:n.name,path:["nodes",t,...i],value:a})};if("input"in n&&n.input!=null&&o(["input"],n.input),"inputs"in n&&n.inputs&&typeof n.inputs=="object")for(const[i,a]of Object.entries(n.inputs))a!=null&&o(["inputs",i],a);if("output"in n&&n.output!=null&&o(["output"],n.output),"outputs"in n&&n.outputs&&typeof n.outputs=="object")for(const[i,a]of Object.entries(n.outputs))a!=null&&o(["outputs",i],a);return r}function YR(n){const t=n.path[2];return t==="output"||t==="outputs"}function mw(n){if(!n)return!1;for(const t of Object.values(n))if(t!=null)return!0;return!1}function gw(n,t){const r=n.input!==void 0&&n.input!==null,o=mw(n.inputs);r&&o&&t.addIssue({code:"custom",message:'A node cannot use both "input" and "inputs". Use one or the other.',path:["inputs"]});const i=n.output!==void 0&&n.output!==null,a=mw(n.outputs);i&&a&&t.addIssue({code:"custom",message:'A node cannot use both "output" and "outputs". Use one or the other.',path:["outputs"]})}function hw(n,t,r){if(!n.nodes)return;const o=n.nodes.map(l=>l.name),i=new Set;o.forEach((l,u)=>{i.has(l)&&r.addIssue({code:"custom",message:`Duplicate node name: "${l}"`,path:["nodes",u,"name"]}),i.add(l)});const a=new Set([...t,...o]),s=new Map,c=new Map;n.nodes.forEach((l,u)=>{for(const p of WR(l,u)){const d=p.value.split(".",1)[0];if(a.has(d)||r.addIssue({code:"custom",message:`Unknown node "${d}" in connection "${p.value}"`,path:p.path}),YR(p)){const f=`${p.nodeName}->${d}`;c.has(f)?r.addIssue({code:"custom",message:`Connection specified on both sides: "${p.nodeName}" outputs to "${d}" and "${d}" inputs from "${p.nodeName}". Specify it on one side only.`,path:p.path}):s.set(f,s.get(f)??p.path)}else{const f=`${d}->${p.nodeName}`;s.has(f)?r.addIssue({code:"custom",message:`Connection specified on both sides: "${d}" outputs to "${p.nodeName}" and "${p.nodeName}" inputs from "${d}". Specify it on one side only.`,path:p.path}):c.set(f,c.get(f)??p.path)}}})}const JR=ee.z.enum(Dy),XR=ee.z.enum(ii),yw=n=>ii.includes(n),fp=ee.z.enum(My),_w=fp.options;ee.z.union([fp,JR]);const ZR=/^[A-Za-z_][A-Za-z0-9_-]{0,254}$/,yc=ee.z.string().min(1).max(255).regex(ZR,"Invalid node name (snake_case / kebab-case only)").refine(n=>!yw(n),"Name clashes with reserved implicit node").brand(),bw=ee.z.union([XR,yc]),QR=ee.z.string().min(1).brand(),e2=["then","else"];ee.z.enum(e2);const ut=ee.z.string().min(1).max(255).refine(n=>{if(bw.safeParse(n).success)return!0;const t=n.match(/^([^.]+)\.([^.]+)$/);if(!t)return!1;const[,r,o]=t;return bw.safeParse(r).success&&QR.safeParse(o).success},'Invalid connection, expected "NODE" or "NODE.FIELD"').nullish(),t2=ee.z.object({body:ut,headers:ut,http_proxy:ut,https_proxy:ut,proxy_auth_password:ut,proxy_auth_username:ut,query:ut,url:ut}).partial().strict(),n2=ee.z.object({headers:ut,body:ut}).partial().strict(),r2=ee.z.object({data:ut,key:ut,ttl:ut}).partial().strict(),o2=ee.z.object({claims:ut,key:ut}).partial().strict(),i2=ee.z.object({key:ut,token:ut}).partial().strict(),ww=ee.z.enum(jy),kw=ee.z.enum(Xd),Fn=ee.z.object({type:ee.z.string(),name:yc,input:ut,inputs:ee.z.record(ee.z.string().min(1).max(255),ut).nullish(),output:ut,outputs:ee.z.record(ee.z.string().min(1).max(255),ut).nullish()}).loose().superRefine((n,t)=>{gw(n,t)}),a2=ee.z.object({type:ee.z.string(),name:ee.z.string()}).loose().superRefine((n,t)=>{const r=n.type,o=n.name;(typeof o!="string"||o.length===0||o.includes("."))&&t.addIssue({code:"custom",path:["name"],message:"invalid node name",fatal:!1}),_w.includes(r)||t.addIssue({code:"custom",path:["type"],message:`unknown node type "${r}", expected one of: ${_w.join(", ")}`})}),s2=Fn.safeExtend({type:ee.z.literal("call"),method:ww.default("GET").nullish(),ssl_server_name:ee.z.string().nullish(),ssl_verify:ee.z.boolean().default(!0).nullish(),timeout:ee.z.number().int().min(0).max(2147483646).nullish(),url:ee.z.url().nullish(),inputs:t2.nullish(),outputs:ee.z.object({body:ut,headers:ut,raw_body:ut,status:ut}).partial().nullish()}).strict(),l2=Fn.safeExtend({type:ee.z.literal("exit"),status:ee.z.number().int().min(200).max(599).default(200).nullish(),warn_headers_sent:ee.z.boolean().nullish(),inputs:n2.nullish(),output:ee.z.never().nullish(),outputs:ee.z.never().nullish()}).strict(),c2=Fn.safeExtend({type:ee.z.literal("jq"),jq:ee.z.string().min(1).max(10240),outputs:ee.z.never().nullish()}).strict(),u2=Fn.safeExtend({type:ee.z.literal("xml_to_json"),recognize_type:ee.z.boolean().nullish().default(!0),attributes_block_name:ee.z.string().min(1).max(32).nullish(),attributes_name_prefix:ee.z.string().min(1).max(32).nullish(),text_block_name:ee.z.string().min(1).max(32).nullish().default("#text"),text_as_property:ee.z.boolean().nullish().default(!1),xpath:ee.z.string().min(1).max(256).nullish(),inputs:ee.z.never().nullish(),outputs:ee.z.never().nullish()}).strict().superRefine((n,t)=>{!n.attributes_block_name&&!n.attributes_name_prefix&&(t.addIssue({code:"custom",path:["attributes_block_name"],message:"At least one of attributes_block_name or attributes_name_prefix is required"}),t.addIssue({code:"custom",path:["attributes_name_prefix"],message:"At least one of attributes_block_name or attributes_name_prefix is required"}))}),d2=Fn.safeExtend({type:ee.z.literal("json_to_xml"),attributes_block_name:ee.z.string().min(1).max(32).nullish(),attributes_name_prefix:ee.z.string().min(1).max(32).nullish(),root_element_name:ee.z.string().min(1).max(64).nullish(),text_block_name:ee.z.string().min(1).max(32).nullish().default("#text"),inputs:ee.z.record(ee.z.string().min(1).max(255),ut).nullish(),outputs:ee.z.never().nullish()}).strict().superRefine((n,t)=>{!n.attributes_block_name&&!n.attributes_name_prefix&&(t.addIssue({code:"custom",path:["attributes_block_name"],message:"At least one of attributes_block_name or attributes_name_prefix is required"}),t.addIssue({code:"custom",path:["attributes_name_prefix"],message:"At least one of attributes_block_name or attributes_name_prefix is required"}))}),f2=Fn.safeExtend({type:ee.z.literal("jwt_decode"),inputs:ee.z.never().nullish(),outputs:ee.z.object({header:ut,payload:ut,signature:ut}).partial().nullish()}).strict(),p2=Fn.safeExtend({type:ee.z.literal("jwt_sign"),algorithm:kw,expires_in:ee.z.number().int().min(1).default(300).nullish(),inputs:o2.nullish(),kid:ee.z.string().nullish(),not_before:ee.z.number().int().min(0).default(0).nullish(),outputs:ee.z.object({claims:ut,header:ut,token:ut}).partial().nullish(),static_claims:ee.z.record(ee.z.string(),ee.z.string()).default({}).nullish(),typ:ee.z.string().default("JWT").nullish()}).strict(),m2=Fn.safeExtend({type:ee.z.literal("jwt_verify"),allowed_algorithms:ee.z.array(kw).default([]).nullish(),audiences:ee.z.array(ee.z.string()).default([]).nullish(),inputs:i2.nullish(),issuers:ee.z.array(ee.z.string()).default([]).nullish(),leeway:ee.z.number().int().min(0).default(0).nullish(),outputs:ee.z.object({claims:ut,header:ut}).partial().nullish(),required_claims:ee.z.array(ee.z.string()).default([]).nullish(),validate_exp:ee.z.boolean().default(!0).nullish(),validate_nbf:ee.z.boolean().default(!0).nullish()}).strict(),g2=Fn.safeExtend({type:ee.z.literal("property"),content_type:ee.z.enum(["application/json","text/plain","application/octet-stream"]).nullish(),property:ee.z.string().min(1).max(255),non_nil:ee.z.boolean().default(!1).nullish(),inputs:ee.z.never().nullish(),outputs:ee.z.never().nullish()}).strict(),h2=Fn.safeExtend({type:ee.z.literal("static"),values:ee.z.record(ee.z.string(),ee.z.unknown()),input:ee.z.never().nullish(),inputs:ee.z.never().nullish()}).strict(),y2=Fn.safeExtend({type:ee.z.literal("cache"),bypass_on_error:ee.z.boolean().nullish(),inputs:r2.nullish(),outputs:ee.z.object({data:ut,hit:ut,miss:ut,stored:ut}).partial().nullish(),ttl:ee.z.number().int().gt(0).nullish()}).strict(),_2=Fn.safeExtend({type:ee.z.literal("branch"),then:ee.z.array(yc).min(1).max(64).nullish(),else:ee.z.array(yc).min(1).max(64).nullish()}).strict(),b2=a2.pipe(ee.z.discriminatedUnion("type",[s2,l2,c2,u2,d2,f2,p2,m2,g2,h2,y2,_2])),w2=ee.z.record(ee.z.string().regex(/^[A-Za-z_][A-Za-z0-9_-]*$/).min(1).max(255),ee.z.string().min(1).max(4095)),k2=ee.z.object({dictionary_name:ee.z.string().nullish().default("kong_db_cache")}),C2=ee.z.object({host:ee.z.string().default("127.0.0.1"),port:ee.z.number().int().min(0).max(65535).default(6379)}),E2=ee.z.object({ip:ee.z.string().default("127.0.0.1"),port:ee.z.number().int().min(0).max(65535).default(6379)}),N2=ee.z.object({host:ee.z.string().nullish().default("127.0.0.1"),port:ee.z.number().int().min(0).max(65535).nullish().default(6379),connect_timeout:ee.z.number().int().min(0).max(2147483646).nullish().default(2e3),send_timeout:ee.z.number().int().min(0).max(2147483646).nullish().default(2e3),read_timeout:ee.z.number().int().min(0).max(2147483646).nullish().default(2e3),username:ee.z.string().nullish(),password:ee.z.string().nullish(),sentinel_username:ee.z.string().nullish(),sentinel_password:ee.z.string().nullish(),database:ee.z.number().int().nullish().default(0),keepalive_pool_size:ee.z.number().int().min(1).max(2147483646).nullish().default(256),keepalive_backlog:ee.z.number().int().min(0).max(2147483646).nullish(),sentinel_master:ee.z.string().nullish(),sentinel_role:ee.z.enum(["master","slave","any"]).nullish(),sentinel_nodes:ee.z.array(C2).min(1,{message:"sentinel_nodes must contain at least 1 item"}).nullish(),cluster_nodes:ee.z.array(E2).min(1,{message:"cluster_nodes must contain at least 1 item"}).nullish(),ssl:ee.z.boolean().default(!1).nullish(),ssl_verify:ee.z.boolean().default(!0).nullish(),server_name:ee.z.string().nullish(),cluster_max_redirections:ee.z.number().int().default(5).nullish(),connection_is_proxied:ee.z.boolean().default(!1).nullish(),cloud_authentication:ee.z.object({auth_provider:ee.z.enum(["aws","azure","gcp"]).nullish(),aws_access_key_id:ee.z.string().nullish(),aws_assume_role_arn:ee.z.string().nullish(),aws_cache_name:ee.z.string().nullish(),aws_is_serverless:ee.z.boolean().default(!0).nullish(),aws_region:ee.z.string().nullish(),aws_role_session_name:ee.z.string().nullish(),aws_secret_access_key:ee.z.string().nullish(),azure_client_id:ee.z.string().nullish(),azure_client_secret:ee.z.string().nullish(),azure_tenant_id:ee.z.string().nullish(),gcp_service_account_json:ee.z.string().nullish()}).nullish(),timeout:ee.z.number().int().nullish(),sentinel_addresses:ee.z.array(ee.z.string()).min(1).nullish(),cluster_addresses:ee.z.array(ee.z.string()).min(1).nullish()}).superRefine((n,t)=>{var l;const r=n.host!==void 0&&n.host!==null,o=n.port!==void 0&&n.port!==null;(r&&!o||!r&&o)&&t.addIssue({code:"custom",message:"host and port must be specified together",path:r?["port"]:["host"]});const i=!!n.sentinel_master,a=!!n.sentinel_role,s=!!((l=n.sentinel_nodes)!=null&&l.length),c=[i,a,s].filter(Boolean).length;c>0&&c<3&&t.addIssue({code:"custom",message:"sentinel_master, sentinel_role and sentinel_nodes must be provided together"}),n.connection_is_proxied===!0&&!r&&t.addIssue({code:"custom",message:"host is required when connection_is_proxied is true (host/port should point to the proxy)",path:["host"]})}),S2=ee.z.object({strategy:ee.z.enum(["memory","redis"]).nullish(),memory:k2,redis:N2}),x2=ee.z.object({vault:w2.nullish(),cache:S2.nullish()});ee.z.array(ee.z.object({id:ee.z.string()})),ee.z.object({nodes:ee.z.array(b2).min(1,"At least one node is required").max(64),debug:ee.z.boolean().default(!1).nullish(),resources:x2.nullish()}).strict().superRefine((n,t)=>{hw(n,ii,t)});const Cw=fp.options,pp=ee.z.string().min(1).refine(n=>!n.includes("."),"Invalid node name").refine(n=>!yw(n),"Node name conflicts with reserved implicit node"),_t=ee.z.string().refine(n=>{if(!n||/\s/.test(n))return!1;const t=n.indexOf(".");if(t===-1)return!0;const r=n.slice(0,t),o=n.slice(t+1);return r.length>0&&o.length>0},"Invalid connection"),Ew=ee.z.object({body:_t.nullish(),headers:_t.nullish(),query:_t.nullish()}).partial().strict(),Nw=ee.z.object({headers:_t.nullish(),body:_t.nullish()}).partial().strict(),Sw=ee.z.object({data:_t.nullish(),key:_t.nullish(),ttl:_t.nullish()}).partial().strict(),xw=ee.z.object({claims:_t.nullish(),key:_t.nullish()}).partial().strict(),Aw=ee.z.object({key:_t.nullish(),token:_t.nullish()}).partial().strict(),A2={call:Ew,exit:Nw,cache:Sw,jwt_sign:xw,jwt_verify:Aw};function v2(n){const t=A2[n];return t?Object.keys(t.shape):null}const Un=ee.z.object({type:ee.z.string(),name:pp,input:_t.nullish(),inputs:ee.z.record(ee.z.string(),_t.nullish()).nullish(),output:_t.nullish(),outputs:ee.z.record(ee.z.string(),_t.nullish()).nullish()}).loose().superRefine((n,t)=>{gw(n,t)}),I2=ee.z.object({type:ee.z.string(),name:ee.z.string()}).loose().superRefine((n,t)=>{const r=n.type,o=n.name;(typeof o!="string"||o.length===0||o.includes("."))&&t.addIssue({code:"custom",path:["name"],message:"Invalid node name",fatal:!1}),Cw.includes(r)||t.addIssue({code:"custom",path:["type"],message:`unknown node type "${r}", expected one of: ${Cw.join(", ")}`})}),B2=Un.safeExtend({type:ee.z.literal("call"),method:ww.nullish(),ssl_server_name:ee.z.string().nullish(),ssl_verify:ee.z.boolean().nullish(),timeout:ee.z.union([ee.z.number(),ee.z.string()]).nullish(),url:ee.z.string().nullish(),inputs:Ew.nullish(),outputs:ee.z.object({body:_t.nullish(),headers:_t.nullish(),status:_t.nullish()}).partial().nullish()}).strict(),T2=Un.safeExtend({type:ee.z.literal("exit"),status:ee.z.union([ee.z.number(),ee.z.string()]).nullish(),warn_headers_sent:ee.z.boolean().nullish(),inputs:Nw.nullish(),output:ee.z.never().nullish(),outputs:ee.z.never().nullish()}).strict(),O2=Un.safeExtend({type:ee.z.literal("jq"),jq:ee.z.string().nullish(),outputs:ee.z.never().nullish()}).strict(),P2=Un.safeExtend({type:ee.z.literal("xml_to_json"),recognize_type:ee.z.boolean().nullish(),attributes_block_name:ee.z.string().nullish(),attributes_name_prefix:ee.z.string().nullish(),text_block_name:ee.z.string().nullish(),text_as_property:ee.z.boolean().nullish(),xpath:ee.z.string().nullish(),inputs:ee.z.never().nullish(),outputs:ee.z.never().nullish()}).strict(),V2=Un.safeExtend({type:ee.z.literal("json_to_xml"),attributes_block_name:ee.z.string().nullish(),attributes_name_prefix:ee.z.string().nullish(),root_element_name:ee.z.string().nullish(),text_block_name:ee.z.string().nullish(),inputs:ee.z.record(ee.z.string(),_t.nullish()).nullish(),outputs:ee.z.never().nullish()}).strict(),$2=Un.safeExtend({type:ee.z.literal("property"),content_type:ee.z.string().nullish(),non_nil:ee.z.boolean().nullish(),property:ee.z.string().nullish(),inputs:ee.z.never().nullish(),outputs:ee.z.never().nullish()}).strict(),R2=Un.safeExtend({type:ee.z.literal("static"),values:ee.z.record(ee.z.string(),ee.z.unknown()).nullish(),input:ee.z.never().nullish(),inputs:ee.z.never().nullish()}).strict(),L2=Un.safeExtend({type:ee.z.literal("cache"),bypass_on_error:ee.z.boolean().nullish(),inputs:Sw.nullish(),outputs:ee.z.object({data:_t.nullish(),hit:_t.nullish(),miss:_t.nullish(),stored:_t.nullish()}).partial().nullish(),ttl:ee.z.union([ee.z.number(),ee.z.string()]).nullish()}).strict(),D2=Un.safeExtend({type:ee.z.literal("jwt_decode"),inputs:ee.z.never().nullish(),outputs:ee.z.object({header:_t.nullish(),payload:_t.nullish(),signature:_t.nullish()}).partial().nullish()}).strict(),M2=Un.safeExtend({type:ee.z.literal("jwt_sign"),algorithm:ee.z.enum(Xd).nullish(),expires_in:ee.z.union([ee.z.number(),ee.z.string()]).nullish(),inputs:xw.nullish(),kid:ee.z.string().nullish(),not_before:ee.z.union([ee.z.number(),ee.z.string()]).nullish(),outputs:ee.z.object({claims:_t.nullish(),header:_t.nullish(),token:_t.nullish()}).partial().nullish(),static_claims:ee.z.record(ee.z.string(),ee.z.string()).nullish(),typ:ee.z.string().nullish()}).strict(),j2=Un.safeExtend({type:ee.z.literal("jwt_verify"),allowed_algorithms:ee.z.array(ee.z.enum(Xd)).nullish(),audiences:ee.z.array(ee.z.string()).nullish(),inputs:Aw.nullish(),issuers:ee.z.array(ee.z.string()).nullish(),leeway:ee.z.union([ee.z.number(),ee.z.string()]).nullish(),outputs:ee.z.object({claims:_t.nullish(),header:_t.nullish()}).partial().nullish(),required_claims:ee.z.array(ee.z.string()).nullish(),validate_exp:ee.z.boolean().nullish(),validate_nbf:ee.z.boolean().nullish()}).strict(),F2=Un.safeExtend({type:ee.z.literal("branch"),then:ee.z.array(pp).nullish(),else:ee.z.array(pp).nullish()}).strict(),U2=I2.pipe(ee.z.discriminatedUnion("type",[B2,T2,O2,P2,V2,D2,M2,j2,$2,R2,L2,F2])),K2=ee.z.record(ee.z.string(),ee.z.string()),q2=ee.z.object({dictionary_name:ee.z.string().nullish()}),G2=ee.z.object(),H2=ee.z.object({strategy:ee.z.enum(["memory","redis"]).nullish(),memory:q2.nullish(),redis:G2.nullish()}),z2=ee.z.object({vault:K2.nullish(),cache:H2.nullish()}),vw=ee.z.object({nodes:ee.z.array(U2).nullish(),debug:ee.z.boolean().nullish(),resources:z2.nullish()}).strict().superRefine((n,t)=>{!n||!Array.isArray(n.nodes)||hw(n,ii,t)}).nullish(),Iw=e.defineComponent({__name:"InputsRecordField",props:{name:{},items:{},nodeType:{}},emits:["change:inputs"],setup(n){const{getSchema:t}=pt(),{i18n:r}=Qe(),o=e.computed(()=>{const i=t("inputs");if(!i)return[];const a=i.fields.map(c=>Object.keys(c)[0]);if(mn(n.nodeType))return a;const s=v2(n.nodeType);return s===null?a:s.length===0?[]:oI(a,s)});return(i,a)=>(e.openBlock(),e.createBlock(Ut,{"as-child":"",name:n.name,"reset-label-path":"isolate"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,s=>(e.openBlock(),e.createBlock(Dt,{key:s,clearable:"","enable-filtering":"",items:n.items,name:s,placeholder:e.unref(r).t("plugins.free-form.datakit.flow_editor.node_properties.input.placeholder"),onChange:c=>i.$emit("change:inputs",s,c?c.value:null)},e.createSlots({_:2},[i.$slots["item-label"]?{name:"item-label",fn:e.withCtx(c=>[e.renderSlot(i.$slots,"item-label",e.mergeProps({ref_for:!0},c))]),key:"0"}:void 0]),1032,["items","name","placeholder","onChange"]))),128))]),_:3},8,["name"]))}}),W2=["data-testid"],Y2={class:"dk-inputs-map-field-entry-body"},J2={class:"dk-inputs-map-field-entry-content"},X2=je(e.defineComponent({__name:"InputsMapField",props:{name:{},items:{},fieldNameValidator:{},keyOrder:{}},emits:["change:inputs","add:field","remove:field","rename:field"],setup(n,{emit:t}){const r=n,o=t,{keys:i,addKey:a,removeKey:s,updateKey:c,getKeyName:l,field:u}=Hl(e.toRef(r,"name")),{value:p}=Ft(e.toRef(r,"name")),{i18n:{t:d}}=Qe(),f=e.useTemplateRef("root"),m=e.ref(null),h=e.ref({}),y=e.ref({});let b;const _=e.computed(()=>{var A;return(A=r.keyOrder)!=null&&A.length?[...i.value].sort((T,V)=>{const R=r.keyOrder.indexOf(T[1]),X=r.keyOrder.indexOf(V[1]);return(R===-1?1/0:R)-(X===-1?1/0:X)}):i.value});async function k(A,T="key"){var V;f.value&&(await e.nextTick(),(V=f.value.querySelector(`[data-${T}-input="${A}"]`))==null||V.focus())}function C(){const A=a();if(!A)return;y.value[A]="";const T=_.value.findIndex(([,V])=>!V);k(T===-1?_.value.length-1:T),m.value=A}function N(A,T){s(A),delete y.value[A],delete h.value[A],A===m.value&&(m.value=null),T.trim()!==""&&o("remove:field",T)}function E(A){b=y.value[A]??l(A)??""}function w(A,T){const V=T.trim();y.value[A]=V,I(A,V)}function S(A){var V;const T=y.value[A]??l(A)??"";if(I(A,T)){y.value[A]=b,c(A,b),delete h.value[A];return}if(A===m.value){if(T.trim()==="")return;c(A,T),o("add:field",T,((V=p==null?void 0:p.value)==null?void 0:V[A])??null),m.value=null}else c(A,T),o("rename:field",b,T);delete h.value[A],b=T}function I(A,T){delete h.value[A];const V=r.fieldNameValidator("input",b,T);if(V)return h.value[A]=V,V}function U(A){I(A,y.value[A]??l(A)??"")}function x(A,T){if(p!=null&&p.value&&(p.value[A]=T),A===m.value)return;const V=l(A);V&&o("change:inputs",V,T)}return e.watch(i,A=>{const T=new Set(A.map(([V])=>V));Object.keys(y.value).forEach(V=>{T.has(V)?y.value[V]=y.value[V]??l(V)??"":(delete y.value[V],delete h.value[V])}),A.forEach(([V,R])=>{y.value[V]=y.value[V]??R}),m.value&&!T.has(m.value)&&(m.value=null)},{immediate:!0}),e.watch(()=>r.keyOrder,()=>{if(!m.value)return;const A=_.value.findIndex(([T])=>T===m.value);A!==-1&&k(A)}),(A,T)=>{const V=e.resolveComponent("KAlert"),R=e.resolveComponent("KLabel"),X=e.resolveComponent("KInput"),Y=e.resolveComponent("KSelect"),ne=e.resolveComponent("KButton");return e.unref(u).error?(e.openBlock(),e.createBlock(V,{key:0,appearance:"danger",message:e.unref(u).error.message},null,8,["message"])):(e.openBlock(),e.createElementBlock("div",{key:1,ref_key:"root",ref:f,class:"dk-inputs-map-field"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value,([M,te],$)=>{var Z;return e.openBlock(),e.createElementBlock("div",{key:M,class:"dk-inputs-map-field-entry","data-testid":`ff-kv-container-${e.unref(u).path.value}.${$}`},[e.createVNode(R,{for:`ff-kv-entry-key-${e.unref(u).path.value}.${$}`},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(d)("plugins.free-form.datakit.flow_editor.node_properties.input_name.label")),1)]),_:1},8,["for"]),e.createElementVNode("div",Y2,[e.createElementVNode("div",J2,[e.createVNode(X,{id:`ff-kv-entry-key-${e.unref(u).path.value}.${$}`,class:"ff-kv-field-entry-key","data-key-input":$,"data-testid":`ff-key-${e.unref(u).path.value}.${$}`,error:!!h.value[M],"error-message":h.value[M],"model-value":y.value[M]??te,placeholder:e.unref(d)("plugins.free-form.datakit.flow_editor.node_properties.input_name.placeholder"),onBlur:F=>U(M),onChange:F=>S(M),onFocus:F=>E(M),"onUpdate:modelValue":F=>w(M,F)},null,8,["id","data-key-input","data-testid","error","error-message","model-value","placeholder","onBlur","onChange","onFocus","onUpdate:modelValue"]),e.createVNode(Y,{class:"ff-kv-field-entry-value",clearable:"","data-testid":`ff-value-${e.unref(u).path.value}.${$}`,"enable-filtering":"",items:n.items,label:e.unref(d)("plugins.free-form.datakit.flow_editor.node_properties.input.source"),"model-value":(Z=e.unref(p))==null?void 0:Z[M],placeholder:e.unref(d)("plugins.free-form.datakit.flow_editor.node_properties.input.placeholder"),onChange:F=>x(M,(F==null?void 0:F.value)??null)},e.createSlots({_:2},[A.$slots["item-label"]?{name:"item-template",fn:e.withCtx(({item:F})=>[e.renderSlot(A.$slots,"item-label",e.mergeProps({ref_for:!0},F),void 0,!0)]),key:"0"}:void 0]),1032,["data-testid","items","label","model-value","placeholder","onChange"])]),e.createVNode(ne,{appearance:"tertiary",class:"dk-inputs-map-field-remove-btn","data-testid":`ff-kv-remove-btn-${e.unref(u).path.value}.${$}`,icon:"",onClick:F=>N(M,te)},{default:e.withCtx(()=>[e.createVNode(e.unref($e.CloseIcon))]),_:1},8,["data-testid","onClick"])])],8,W2)}),128)),e.createVNode(ne,{appearance:"tertiary","data-testid":`ff-kv-add-btn-${e.unref(u).path.value}`,disabled:!!m.value,onClick:C},{default:e.withCtx(()=>[e.createVNode(e.unref($e.AddIcon)),e.createTextVNode(" "+e.toDisplayString(e.unref(d)("plugins.free-form.datakit.flow_editor.node_properties.input.add_button")),1)]),_:1},8,["data-testid","disabled"])],512))}}}),[["__scopeId","data-v-43dcb370"]]),Z2={class:"dk-source-item"},_c=je(e.defineComponent({__name:"SourceItem",props:{item:{}},setup(n){return(t,r)=>(e.openBlock(),e.createElementBlock("span",Z2,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Zd)(n.item.type).icon),{color:`var(--kui-color-text-neutral, ${e.unref(cr)})`,size:`var(--kui-icon-size-40, ${e.unref(_a)})`},null,8,["color","size"])),e.createTextVNode(" "+e.toDisplayString(n.item.label),1)]))}}),[["__scopeId","data-v-d9aa16eb"]]),Q2={key:1,class:"dk-inputs-field-or"},In=je(e.defineComponent({__name:"InputsField",props:{items:{},fieldNames:{},fieldNameValidator:{},nodeType:{}},emits:["change:input","change:inputs","add:field","remove:field","rename:field"],setup(n,{emit:t}){const r=t,{getSchema:o}=pt(),{i18n:{t:i}}=Qe(),a=e.computed(()=>o("inputs")),s=e.computed(()=>a.value?a.value.type==="record"?Iw:X2:null);function c(f){r("change:input",f?f.value:null)}function l(f,m){r("add:field",f,m)}function u(f,m){r("change:inputs",f,m)}function p(f){r("remove:field",f)}function d(f,m){r("rename:field",f,m)}return(f,m)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(Fe.KLabel),{class:"dk-inputs-field-h1",info:e.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.tooltip")},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.label")),1)]),_:1},8,["info"]),e.unref(o)("input")?(e.openBlock(),e.createBlock(Dt,{key:0,class:"dk-inputs-field-h2",clearable:"","enable-filtering":"",items:n.items,label:e.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.input"),"label-attributes":{info:void 0},name:"input",placeholder:e.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.placeholder"),onChange:c},{"item-label":e.withCtx(h=>[e.renderSlot(f.$slots,"item-label",e.normalizeProps(e.guardReactiveProps(h)),()=>[e.createVNode(_c,{item:h},null,8,["item"])],!0)]),_:3},8,["items","label","placeholder"])):e.createCommentVNode("",!0),s.value?(e.openBlock(),e.createElementBlock("div",Q2,[e.createElementVNode("span",null,e.toDisplayString(e.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.or")),1)])):e.createCommentVNode("",!0),s.value?(e.openBlock(),e.createBlock(e.unref(Fe.KLabel),{key:2,class:"dk-inputs-field-h2 dk-margin-0"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.fields")),1)]),_:1})):e.createCommentVNode("",!0),s.value?(e.openBlock(),e.createBlock(e.unref(s),e.mergeProps({key:3,items:n.items,"key-order":n.fieldNames,name:"inputs"},s.value===Iw?{nodeType:n.nodeType}:{fieldNameValidator:n.fieldNameValidator},{"onAdd:field":l,"onChange:inputs":u,"onRemove:field":p,"onRename:field":d}),{"item-label":e.withCtx(h=>[e.createVNode(_c,{item:h},null,8,["item"])]),_:1},16,["items","key-order"])):e.createCommentVNode("",!0)],64))}}),[["__scopeId","data-v-4f1ce4e7"]]),eL={},tL={class:"dk-node-form-divider"};function nL(n,t){return e.openBlock(),e.createElementBlock("hr",tL)}const tr=je(eL,[["render",nL],["__scopeId","data-v-35ed58be"]]),rL={fields:[{input:{description:"filter input(s)",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{inputs:{description:"call node inputs",fields:[{body:{description:"HTTP request body",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{headers:{description:"HTTP request headers",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{query:{description:"HTTP request query",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}}],required:!1,type:"record"}}],type:"record"},oL={fields:[{input:{description:"filter input(s)",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{inputs:{description:"call node inputs",fields:[{body:{description:"HTTP request body",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{headers:{description:"HTTP request headers",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}}],required:!1,type:"record"}}],type:"record"};function iL(n){const t=Number(n);return!isNaN(t)&&isFinite(t)}function yn(...n){return function(r){for(const o of n){const i=o(r);if(i)return i}}}function To(n){const{i18n:{t}}=Qe(),r=()=>n?typeof n=="string"?n:t("plugins.free-form.datakit.flow_editor.node_properties.errors.not_empty",n):"Field is required";return function(i){if(i==null||typeof i=="string"&&i.trim()==="")return r()}}function Bw(n,t){const{i18n:{t:r}}=Qe();return function(i){if(i!=null)switch(n){case"identifier":{const a=()=>t?typeof t=="string"?t:r("plugins.free-form.datakit.flow_editor.node_properties.errors.invalid_identifier_format",t):"Invalid identifier format";return/^[A-Za-z_][A-Za-z0-9_-]*$/.test(i)?void 0:a()}case"url":{const a=()=>t?typeof t=="string"?t:r("plugins.free-form.datakit.flow_editor.node_properties.errors.invalid_url_format"):"Invalid URL format";try{new URL(i);return}catch{return a()}}default:return}}}function $r(n=0,t=1/0,r){const{i18n:{t:o}}=Qe();return function(a){if(a!=null&&typeof a=="string"&&(a.length<n||a.length>t))return r?typeof r=="string"?r:o("plugins.free-form.datakit.flow_editor.node_properties.errors.string_len_range",{fieldName:r.fieldName,minLength:n,maxLength:t}):`Value must be between ${n} and ${t} characters`}}function Tw(n){const{i18n:{t}}=Qe();return function(o){if(!iL(o))return n?typeof n=="string"?n:t("plugins.free-form.datakit.flow_editor.node_properties.errors.not_number",n):"Value must be a number"}}function Vi(n,t){const{i18n:{t:r}}=Qe();return function(i){if(i==null)return;const a=Tw(t)(i);if(a)return a;const s=Number(i);switch(n){case"float":{const c=()=>t?typeof t=="string"?t:r("plugins.free-form.datakit.flow_editor.node_properties.errors.not_float",t):"Invalid float format";return Number.isFinite(s)?void 0:c()}case"integer":{const c=()=>t?typeof t=="string"?t:r("plugins.free-form.datakit.flow_editor.node_properties.errors.not_integer",t):"Invalid integer format";return Number.isInteger(s)?void 0:c()}default:return}}}function $i(n=-1/0,t=1/0,r){const{i18n:{t:o}}=Qe();return function(a){if(a==null)return;const s=Tw(r)(a);if(s)return s;const c=Number(a);if(c<n||c>t)return r?typeof r=="string"?r:o("plugins.free-form.datakit.flow_editor.node_properties.errors.number_range",{fieldName:r.fieldName,min:n,max:t}):`Value must be between ${n} and ${t}`}}function aL(n,t){const{state:r}=$t(),{i18n:{t:o}}=Qe();return function(a){if(r.value.nodes.some(s=>s.name===a&&s.id!==n))return t?typeof t=="string"?t:o("plugins.free-form.datakit.flow_editor.node_properties.errors.not_unique",t):"Name must be unique."}}function sL(n,t,r){const{i18n:{t:o}}=Qe();return function(a){if(!t)return;if(r?t.fields[n].some(c=>c.name===a&&c.id!==r):t.fields[n].some(c=>c.name===a)){const c=o(n==="input"?"plugins.free-form.datakit.flow_editor.node_properties.input_name.label":"plugins.free-form.datakit.flow_editor.node_properties.output_value.value_name");return o("plugins.free-form.datakit.flow_editor.node_properties.errors.not_unique",{fieldName:c})}}}function lL(){const{i18n:{t:n}}=Qe();return function(r){if(tf(r))return n("plugins.free-form.datakit.flow_editor.node_properties.errors.reserved_node_name",{nodeName:r})}}function Ow(n){const{i18n:{t}}=Qe(),r={fieldName:t("plugins.free-form.datakit.flow_editor.node_properties.name")};return yn(To(r),Bw("identifier",r),lL(),aL(n,r))}function cL(n){const{i18n:{t}}=Qe(),{getNodeById:r}=$t();return function(i,a,s){const c={fieldName:t(i==="input"?"plugins.free-form.datakit.flow_editor.node_properties.input_name.label":"plugins.free-form.datakit.flow_editor.node_properties.output_value.value_name")};return yn(To(c),sL(i,r(n),s))(a)}}function uL(n){const t=e.ref({}),r=e.computed(()=>Object.values(t.value).every(s=>!s)),o={};Object.keys(n).forEach(s=>{const c=n[s],l=d=>{const f=typeof d=="function"?d():d,m=c(f);return t.value[s]=m,m},u=()=>{t.value[s]=void 0},p=d=>(u(),l(d));o[s]={handleChange:p,handleBlur:p,validate:p,isValid:e.computed(()=>t.value[s]===void 0),error:e.computed(()=>t.value[s])}});function i(){t.value={}}function a(s){var c;for(const l of Object.keys(n)){const u=s[l],p=typeof u=="function"?u():u;(c=o[l])==null||c.validate(p)}return t.value}return{isValid:r,errorMap:t,fields:o,clearErrors:i,validate:a}}function Rr(n){const{validationConfig:t,getValidationData:r,toggleNodeValid:o}=n,{skipValidation:i}=$t(),a=e.computed(()=>typeof t=="function"?t():t),s=e.computed(()=>uL(a.value)),c=e.computed(()=>s.value.fields),l=e.computed(()=>s.value.isValid.value);function u(){const d=r(),f=s.value.validate(d),m={};for(const h in a.value)m[h]=f[h];return m}function p(d,f){const m=()=>{const y=r(),b=c.value[d];b&&b.handleBlur(y[d])},h=()=>{f==null||f();const y=r(),b=c.value[d];b&&b.handleChange(y[d])};return e.computed(()=>{const y=c.value[d];return{validate:m,update:h,error:y?!y.isValid.value:!1,errorMessage:y?y.error.value??"":""}})}return e.onMounted(()=>{i.value?i.value=!1:u()}),e.onBeforeUnmount(async()=>{try{const d=u(),f=Object.values(d).filter(Boolean).length>0;o(!f)}catch{}}),e.watch(()=>l.value,o,{immediate:!0}),{fields:c.value,isValid:l,validateAll:u,createFieldHandler:p}}function _n(n,t){const{state:r,renameNode:o,getNodeById:i,addField:a,renameField:s,removeField:c,replaceConfig:l,disconnectEdge:u,connectEdge:p,invalidConfigNodeIds:d,commit:f,revert:m}=$t(),{i18n:{t:h}}=Qe(),y=r_(),b=e.computed(()=>{const M=i(n);if(!M)throw new Error("Node not existed");return M}),_=e.computed(()=>{const te=r.value.edges.filter($=>$.target===n).reduce(($,Z)=>{var q,ie;const F=i(Z.source),J=(q=Qr(F,"output",Z.sourceField))==null?void 0:q.id,G=(ie=Qr(b.value,"input",Z.targetField))==null?void 0:ie.name,v=F.id+(J?`.${J}`:"");return G?$.inputs={...$.inputs,[G]:v}:$.input=v,$},{});return b.value.fields.input.forEach($=>{te.inputs||(te.inputs={}),te.inputs[$.name]||(te.inputs[$.name]=null)}),{...b.value.config,...te,name:b.value.name}}),k=M=>{o(n,M??"",!0,`${n}:rename`)},C=(M,te=!0)=>{if(!t)throw new Error("getFormValue is not defined");const $=Xr(t(),["name","input","inputs"]),Z=M?`update:${n}:${M}`:void 0;l(n,$,te,Z)},N=(M,te)=>{const $=Zr(b.value,M,te);if(!$)throw new Error(`Field with name "${te}" not found in node "${b.value.name}"`);return $},E=(M,te,$)=>{const Z=!!$;a(n,M,te,!Z),Z&&x(te,$)},w=(M,te,$)=>{const Z=N(M,te).id;s(n,Z,$)},S=(M,te)=>{const $=N(M,te).id;c(n,$)},I=e.computed(()=>r.value.edges.filter(M=>M.target===n&&!M.targetField)[0]),U=e.computed(()=>r.value.edges.filter(M=>M.target===n&&M.targetField)),x=async(M,te)=>{const $=te==null,Z=N("input",M).id;if($){const ye=U.value.find(ce=>ce.targetField===Z);ye&&u(ye.id);return}const{nodeId:F,fieldId:J}=Ky(te),G=N("input",M).id,v=[];I.value&&(v.push(Ra(I.value,i)),u(I.value.id,!1));const q=U.value.find(ye=>ye.targetField===Z);q&&(v.push(Ra(q,i)),u(q.id,!1)),p({source:F,sourceField:J,target:n,targetField:G},!1);const ie=sf(F,J,n,G,i),oe=v[0]&&ie?v[0][1]===ie[1]:!1;if(f(),oe||v.length===0)return;await y(h("plugins.free-form.datakit.flow_editor.confirm.message.switch"),[ie],v)||m()},A=async M=>{if(M==null){I.value&&u(I.value.id);return}const $=[];for(const v of U.value)$.push(Ra(v,i)),u(v.id,!1);I.value&&u(I.value.id,!1);const{nodeId:Z,fieldId:F}=Ky(M);p({source:Z,sourceField:F,target:n,targetField:void 0},!1);const J=sf(Z,F,n,void 0,i);if(f(),$.length===0)return;await y(h("plugins.free-form.datakit.flow_editor.confirm.message.switch"),[J],$)||m()},T=M=>{const te=[...r.value.edges,{source:M,target:n}];return lf(Pl(te))},V=e.computed(()=>{var te,$;const M=[];for(const Z of r.value.nodes)if((te=ci(Z.type).io)!=null&&te.output&&Z.fields.output&&Z.id!==n&&!(Z.type==="property"&&!zd(($=Z.config)==null?void 0:$.property))&&!T(Z.id)&&!(b.value.phase==="request"&&Z.phase==="response")&&!(Z.type==="vault"&&Z.fields.output.length===0)){M.push({value:Z.id,label:Z.name,type:Z.type});for(const J of Z.fields.output)M.push({value:`${Z.id}.${J.id}`,label:`${Z.name}.${J.name}`,type:Z.type})}return M}),R=e.computed(()=>b.value.fields.input.map(M=>M.name)||[]);function X(M){d.value.delete(n),M||d.value.add(n)}const Y=cL(n);function ne(M,te,$){const Z=i(n);if(!Z)throw new Error("Node not found when validating field name");const F=Zr(Z,M,te);return Y(M,$,F==null?void 0:F.id)}return{formData:_,inputOptions:V,inputEdge:I,inputsEdges:U,inputsFieldNames:R,currentNode:b,setName:k,setConfig:C,addField:E,renameFieldByName:w,removeFieldByName:S,setInputs:x,setInput:A,nameValidator:Ow(n),fieldNameValidator:ne,toggleNodeValid:X}}function bn(n){const{getSchema:t}=pt();return e.computed(()=>{if(mn(n))switch(n){case"response":return oL;case"service_request":return rL}try{const o=t().fields.find(u=>El(u,"config"));if(!o)throw new Error("Config field not found in schema.");const a=o.config.fields.find(u=>El(u,"nodes"));if(!a)throw new Error("Nodes field not found in config schema.");const l=a.nodes.elements.subschema_definitions[n];if(!l)throw new Error(`Subschema "${n}" not found in the schema.`);return l}catch(r){throw new Error(`Failed to get subschema "${n}": ${r.message}`)}})}const Kn=e.defineComponent({__name:"NameField",props:{name:{},validate:{type:Function}},emits:["update"],setup(n,{emit:t}){const r=n,o=t,{i18n:{t:i}}=Qe(),a=e.ref(r.name),s=e.computed(()=>{const p=r.validate(a.value.trim());return p===void 0?"":p});let c=a.value.trim();function l(){if(s.value){a.value=c;return}o("update",a.value.trim())}function u(){c=a.value.trim()}return e.watch(()=>r.name,p=>{p!==a.value&&(a.value=p)}),(p,d)=>{const f=e.resolveComponent("KInput");return e.openBlock(),e.createBlock(f,{"model-value":a.value,"onUpdate:modelValue":d[0]||(d[0]=m=>a.value=m),"data-1p-ignore":"",error:!!s.value,"error-message":s.value,label:e.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.name"),required:"",onChange:l,onFocus:u},null,8,["model-value","error","error-message","label"])}}}),dL=e.defineComponent({__name:"NodeFormCall",props:{nodeId:{}},setup(n){const{i18n:{t}}=Qe(),r=e.useTemplateRef("form"),o=bn("call"),{formData:i,setName:a,setConfig:s,inputOptions:c,setInputs:l,setInput:u,inputsFieldNames:p,nameValidator:d,toggleNodeValid:f,fieldNameValidator:m}=_n(n.nodeId,()=>r.value.getValue()),{createFieldHandler:h}=Rr({validationConfig:{url:yn(To({fieldName:"URL"}),Bw("url",{fieldName:"URL"})),timeout:yn(Vi("integer"),$i(0,2147483646))},getValidationData:()=>({url:i.value.url,timeout:i.value.timeout}),toggleNodeValid:f}),y=h("url",()=>s("url")),b=h("timeout",()=>s("timeout"));return(_,k)=>{const C=e.resolveComponent("KLabel");return e.openBlock(),e.createBlock(Zt,{ref:"form",data:e.unref(i),schema:e.unref(o)},{default:e.withCtx(()=>[e.createVNode(Kn,{name:e.unref(i).name,validate:e.unref(d),onUpdate:e.unref(a)},null,8,["name","validate","onUpdate"]),e.createVNode(C,{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(Xe,{error:e.unref(y).error,"error-message":e.unref(y).errorMessage,name:"url",onBlur:e.unref(y).validate,"onUpdate:modelValue":e.unref(y).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(zR,{name:"method",onUpdate:k[0]||(k[0]=N=>e.unref(s)())}),e.createVNode(Ht,{error:e.unref(b).error,"error-message":e.unref(b).errorMessage,name:"timeout",onBlur:e.unref(b).validate,"onUpdate:modelValue":e.unref(b).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(Xe,{name:"ssl_server_name","onUpdate:modelValue":k[1]||(k[1]=N=>e.unref(s)("ssl_server_name"))}),e.createVNode(hn,{name:"ssl_verify","onUpdate:modelValue":k[2]||(k[2]=N=>e.unref(s)("ssl_verify"))}),e.createVNode(tr),e.createVNode(In,{"field-name-validator":e.unref(m),"field-names":e.unref(p),items:e.unref(c),"node-type":"call","onChange:input":e.unref(u),"onChange:inputs":e.unref(l)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"])}}}),fL=e.defineComponent({__name:"NodeFormServiceRequest",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=bn("service_request"),{formData:o,inputOptions:i,setInputs:a,setInput:s,inputsFieldNames:c,fieldNameValidator:l}=_n(n.nodeId,()=>t.value.getValue());return(u,p)=>(e.openBlock(),e.createBlock(Zt,{ref:"form",data:e.unref(o),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(In,{"field-name-validator":e.unref(l),"field-names":e.unref(c),items:e.unref(i),"node-type":"service_request","onChange:input":e.unref(s),"onChange:inputs":e.unref(a)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),pL=e.defineComponent({__name:"NodeFormResponse",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=bn("response"),{formData:o,inputOptions:i,setInputs:a,setInput:s,inputsFieldNames:c,fieldNameValidator:l}=_n(n.nodeId,()=>t.value.getValue());return(u,p)=>(e.openBlock(),e.createBlock(Zt,{ref:"form",data:e.unref(o),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(In,{"field-name-validator":e.unref(l),"field-names":e.unref(c),items:e.unref(i),"node-type":"response","onChange:input":e.unref(s),"onChange:inputs":e.unref(a)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),mL=e.defineComponent({__name:"NodeFormJq",props:{nodeId:{}},setup(n){const{i18n:{t},i18nT:r}=Qe(),o=e.useTemplateRef("form"),i=bn("jq"),{formData:a,setName:s,setConfig:c,inputOptions:l,setInputs:u,setInput:p,addField:d,removeFieldByName:f,renameFieldByName:m,inputsFieldNames:h,nameValidator:y,toggleNodeValid:b,fieldNameValidator:_}=_n(n.nodeId,()=>o.value.getValue());function k(I,U){d("input",I,U)}function C(I){f("input",I)}function N(I,U){m("input",I,U)}const E=t("plugins.free-form.datakit.flow_editor.node_properties.jq.label"),{createFieldHandler:w}=Rr({validationConfig:{jq:yn(To({fieldName:E}),$r(1,10240,{fieldName:E}))},getValidationData:()=>({jq:a.value.jq}),toggleNodeValid:b}),S=w("jq",()=>c("jq"));return(I,U)=>{const x=e.resolveComponent("KLabel"),A=e.resolveComponent("KExternalLink");return e.openBlock(),e.createBlock(Zt,{ref:"form",data:e.unref(a),schema:e.unref(i)},{default:e.withCtx(()=>[e.createVNode(Kn,{name:e.unref(a).name,validate:e.unref(y),onUpdate:e.unref(s)},null,8,["name","validate","onUpdate"]),e.createVNode(x,{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(Xe,{autosize:"",error:e.unref(S).error,"error-message":e.unref(S).errorMessage,label:e.unref(E),"label-attributes":{},multiline:"",name:"jq",resizable:"",onBlur:e.unref(S).validate,"onUpdate:modelValue":e.unref(S).update},{help:e.withCtx(()=>[e.createVNode(e.unref(r),{keypath:"plugins.free-form.datakit.flow_editor.node_properties.jq.help"},{link:e.withCtx(()=>[e.createVNode(A,{"hide-icon":"",href:e.unref(es).jqlang},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(es).jqlang),1)]),_:1},8,["href"])]),_:1})]),_:1},8,["error","error-message","label","onBlur","onUpdate:modelValue"]),e.createVNode(tr),e.createVNode(In,{"field-name-validator":e.unref(_),"field-names":e.unref(h),items:e.unref(l),"node-type":"jq","onAdd:field":k,"onChange:input":e.unref(p),"onChange:inputs":e.unref(u),"onRemove:field":C,"onRename:field":N},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"])}}}),gL=je(e.defineComponent({__name:"OutputValueField",props:{fieldNameValidator:{},keyOrder:{}},emits:["change:value","add:field","rename:field","remove:field"],setup(n,{emit:t}){const r=n,o=t,i=e.ref({}),{value:a,...s}=Ft("values"),{i18n:c}=Qe(),l=e.useTemplateRef("root"),u=e.ref([]),p=e.ref(null);let d="",f=a==null?void 0:a.value;function m(){return Nl("ff-kv-field-")}function h(x,A,T){const V=T.indexOf(x),R=T.indexOf(A);return V===-1&&R===-1?0:V===-1?1:R===-1?-1:V-R}function y(x,A){if(!x)return[];const T=Object.entries(x).map(([V,R])=>({id:m(),key:V,value:R}));return A!=null&&A.length&&T.sort((V,R)=>h(V.key,R.key,A)),T}function b(){const x={id:m(),key:"",value:""};return u.value.push(x),x}function _(x){const A=u.value.findIndex(T=>T.id===x);A!==-1&&u.value.splice(A,1)}u.value=y(a==null?void 0:a.value,r.keyOrder);async function k(x,A="key"){var T;l.value&&(await e.nextTick(),(T=l.value.querySelector(`[data-${A}-input="${x}"]`))==null||T.focus())}function C(){const x=b(),A=u.value.findIndex(({key:T})=>!T);k(A===-1?u.value.length-1:A),p.value=x}function N(x){var A;x.id===((A=p.value)==null?void 0:A.id)&&(p.value=null),_(x.id),x.key.trim()!==""&&o("remove:field",x.key)}function E(x){d=x.key}function w(x){var A;if(I(x)){x.key=d,delete i.value[x.id];return}if(x.id===((A=p.value)==null?void 0:A.id)){if(x.key.trim()==="")return;p.value=null,o("add:field",x.key,x.value)}else o("rename:field",d,x.key);d=x.key}function S(x,A){var V;if(A.id===((V=p.value)==null?void 0:V.id))return;const T=x.target.value.trim();o("change:value",A.key,T)}function I(x){delete i.value[x.id];const A=r.fieldNameValidator("output",d,x.key);if(A)return i.value[x.id]=A,A}function U(x){I(x)}return e.watch(()=>a==null?void 0:a.value,x=>{var Y;if(Xt(x,f))return;f=x;const A=p.value,T=new Map(u.value.filter(ne=>ne.key).map(ne=>[ne.key,ne])),V=[],R=x??{};((Y=r.keyOrder)!=null&&Y.length?Object.keys(R).sort((ne,M)=>h(ne,M,r.keyOrder)):Object.keys(R)).forEach(ne=>{const M=T.get(ne);if(M){M.value=R[ne],V.push(M);return}V.push({id:m(),key:ne,value:R[ne]})}),A&&!V.some(ne=>ne.id===A.id)&&V.push(A),u.value=V},{deep:!0}),(x,A)=>{const T=e.resolveComponent("KAlert"),V=e.resolveComponent("KLabel"),R=e.resolveComponent("KButton"),X=e.resolveComponent("KInput"),Y=e.resolveComponent("KCard");return s.error?(e.openBlock(),e.createBlock(T,{key:0,appearance:"danger",message:s.error.message},null,8,["message"])):(e.openBlock(),e.createElementBlock("div",{key:1,ref_key:"root",ref:l,class:"dk-output-value-field"},[e.createVNode(V,{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c).t("plugins.free-form.datakit.flow_editor.node_properties.output_value.label")),1)]),_:1}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(ne,M)=>(e.openBlock(),e.createBlock(Y,{key:ne.id,class:"dk-output-value-field-entry","data-testid":`ff-kv-container-${s.path.value}.${M}`},{actions:e.withCtx(()=>[e.createVNode(R,{appearance:"none","data-testid":`ff-kv-remove-btn-${s.path.value}.${M}`,icon:"",onClick:te=>N(ne)},{default:e.withCtx(()=>[e.createVNode(e.unref($e.CloseIcon))]),_:1},8,["data-testid","onClick"])]),default:e.withCtx(()=>[e.createVNode(X,{id:`ff-kv-entry-key-${s.path.value}.${M}`,modelValue:ne.key,"onUpdate:modelValue":[te=>ne.key=te,te=>I(ne)],modelModifiers:{trim:!0},class:"ff-kv-field-entry-key","data-key-input":M,"data-testid":`ff-key-${s.path.value}.${M}`,error:!!i.value[ne.id],"error-message":i.value[ne.id],label:e.unref(c).t("plugins.free-form.datakit.flow_editor.node_properties.output_value.value_name"),required:"",onBlur:te=>U(ne),onChange:te=>w(ne),onFocus:te=>E(ne)},null,8,["id","modelValue","onUpdate:modelValue","data-key-input","data-testid","error","error-message","label","onBlur","onChange","onFocus"]),e.createVNode(X,{modelValue:ne.value,"onUpdate:modelValue":te=>ne.value=te,modelModifiers:{trim:!0},class:"ff-kv-field-entry-value","data-testid":`ff-value-${s.path.value}.${M}`,label:e.unref(c).t("plugins.free-form.datakit.flow_editor.node_properties.output_value.value"),onChange:te=>S(te,ne)},null,8,["modelValue","onUpdate:modelValue","data-testid","label","onChange"])]),_:2},1032,["data-testid"]))),128)),e.createVNode(R,{appearance:"tertiary","data-testid":`ff-kv-add-btn-${s.path.value}`,disabled:!!p.value,onClick:C},{default:e.withCtx(()=>[e.createVNode(e.unref($e.AddIcon)),e.createTextVNode(" "+e.toDisplayString(e.unref(c).t("plugins.free-form.datakit.flow_editor.node_properties.output_value.add_button")),1)]),_:1},8,["data-testid","disabled"])],512))}}}),[["__scopeId","data-v-3970c2c0"]]);function hL(n){const t={};for(const[r,o]of Object.entries(n))typeof o=="object"&&o!==null?t[r]=JSON.stringify(o):t[r]=String(o);return t}function bc(n){const t={};for(const[r,o]of Object.entries(n))if(o!=null){t[r]=o;try{o==="null"?t[r]=null:(o==="true"||o==="false"||/^-?\d+(\.\d+)?$/.test(o)||o.startsWith("{")&&o.endsWith("}")||o.startsWith("[")&&o.endsWith("]"))&&(t[r]=JSON.parse(o))}catch{}}return t}function yL(n,t,r){const o={};for(const i of Object.keys(n))i===t?o[r]=n[t]:o[i]=n[i];return o}const _L=e.defineComponent({__name:"NodeFormStatic",props:{nodeId:{}},setup(n){const{renameNode:t,getOutEdgesByNodeId:r,addField:o,renameField:i,removeField:a,replaceConfig:s,getNodeById:c}=$t(),{fieldNameValidator:l}=_n(n.nodeId),u=bn("static"),p=Ow(n.nodeId),d=e.computed(()=>c(n.nodeId)),f=e.computed(()=>{var C;return((C=d.value)==null?void 0:C.fields.output.map(N=>N.name))||[]});function m(C){if(!d.value)throw new Error("No current node");t(d.value.id,C??"")}const h=e.computed(()=>{var U;if(!d.value)return{};const C=((U=d.value.config)==null?void 0:U.values)??{},N={},E=r(d.value.id).map(x=>x.sourceField).filter(Boolean).map(x=>Qr(d.value,"output",x)).map(x=>x==null?void 0:x.name).filter(Boolean),w=d.value.fields.output.map(x=>x.name),S=Object.keys(C);return new Set([...S,...E,...w]).forEach(x=>{if(x in C){N[x]=C[x];return}N[x]=""}),{name:d.value.name,values:hL(N)}});function y(C,N){if(!d.value)throw new Error("No selected node");const E=N!==void 0;if(o(n.nodeId,"output",C,!E),E){const w={values:bc({...h.value.values,[C]:N})};s(n.nodeId,w)}}function b(C,N){if(!d.value)throw new Error("No selected node");const E=Zr(d.value,"output",C);if(!E)throw new Error("No field found to rename");const w={values:bc(yL(h.value.values??{},C,N))};s(n.nodeId,w,!1),i(n.nodeId,E.id,N)}function _(C){var w;if(!d.value)throw new Error("No selected node");const N=Zr(d.value,"output",C);if(!N)throw new Error("No field found to delete");a((w=d.value)==null?void 0:w.id,N.id,!0,!1);const E={values:bc({...h.value.values})};delete E.values[C],s(n.nodeId,E)}function k(C,N){if(!d.value)throw new Error("No selected node");const E={...h.value.values};E[C]=N;const w={values:bc(E)};s(n.nodeId,w)}return(C,N)=>(e.openBlock(),e.createBlock(Zt,{ref:"form",data:h.value,schema:e.unref(u)},{default:e.withCtx(()=>{var E;return[e.createVNode(Kn,{name:((E=d.value)==null?void 0:E.name)??"",validate:e.unref(p),onUpdate:m},null,8,["name","validate"]),e.createVNode(gL,{"field-name-validator":e.unref(l),"key-order":f.value,"onAdd:field":y,"onChange:value":k,"onRemove:field":_,"onRename:field":b},null,8,["field-name-validator","key-order"])]}),_:1},8,["data","schema"]))}}),bL={class:"dk-kong-property-item"},wL={class:"property-type"},kL={class:"property-badges"},CL=je(e.defineComponent({__name:"PropertiesField",props:{validators:{}},emits:["update:model-value","update:property-key"],setup(n,{emit:t}){const{i18n:{t:r}}=Qe(),o=n,i=t,{formData:a}=pt(),s=e.ref(Ta(a.property)),c=e.computed(()=>Oa(a.property)),l=e.ref(Hd(a.property)),u=e.computed(()=>a.property??""),p=e.computed(()=>Object.entries(bo).map(([m])=>{var b;const h=Oa(m)?(b=a.property)==null?void 0:b.startsWith(m.replace(ri,"")):a.property===m;return{label:h&&l.value?m.replace(ri,l.value):m,value:m,selected:h}}));function d(m){const h=Sl.find(y=>{var b;return(b=a.property)==null?void 0:b.startsWith(y)});h&&(a.property=h+m,o.validators.key.handleChange(a.property),i("update:property-key",a.property))}function f(m){s.value!==Ta(m==null?void 0:m.value)&&(a.property=(m==null?void 0:m.value)||null,s.value=Ta(a.property),o.validators.property.handleBlur(()=>a.property),i("update:model-value",a.property))}return e.watch(()=>a.property,m=>{l.value=Hd(m),s.value=Ta(m)}),(m,h)=>{const y=e.resolveComponent("KBadge"),b=e.resolveComponent("KSelect"),_=e.resolveComponent("KInput");return e.openBlock(),e.createElementBlock(e.Fragment,null,[(e.openBlock(),e.createBlock(b,{key:u.value,"enable-filtering":"",error:!n.validators.property.isValid.value,help:n.validators.property.error.value,items:p.value,label:"Property","label-attributes":{maxWidth:"300px",placement:"top",info:"The property name to get/set"},required:"",onBlur:h[0]||(h[0]=k=>n.validators.property.handleBlur(()=>e.unref(a).property)),onChange:f},{"item-template":e.withCtx(({item:k})=>[e.createElementVNode("div",bL,[e.createElementVNode("div",null,[e.createElementVNode("div",null,e.toDisplayString(k.label),1),e.createElementVNode("div",wL,e.toDisplayString(e.unref(bo)[k.value].dataType),1)]),e.createElementVNode("div",kL,[e.unref(bo)[k.value].readable?(e.openBlock(),e.createBlock(y,{key:0,appearance:"info"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("plugins.free-form.datakit.flow_editor.node_properties.property.get")),1)]),_:1})):e.createCommentVNode("",!0),e.unref(bo)[k.value].writable?(e.openBlock(),e.createBlock(y,{key:1,appearance:"warning"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("plugins.free-form.datakit.flow_editor.node_properties.property.set")),1)]),_:1})):e.createCommentVNode("",!0)])])]),_:1},8,["error","help","items"])),c.value?(e.openBlock(),e.createBlock(_,{key:0,"model-value":l.value,"onUpdate:modelValue":[h[1]||(h[1]=k=>l.value=k),d],error:!n.validators.key.isValid.value,"error-message":n.validators.key.error.value,label:"key",required:"",onBlur:h[2]||(h[2]=k=>n.validators.key.handleBlur(()=>e.unref(a).property))},null,8,["model-value","error","error-message"])):e.createCommentVNode("",!0)],64)}}}),[["__scopeId","data-v-3e7fee25"]]),EL=e.defineComponent({__name:"NodeFormProperty",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),{selectedNode:r,disconnectInEdges:o,disconnectOutEdges:i}=$t(),a=bn("property"),{formData:s,setName:c,setConfig:l,inputOptions:u,setInputs:p,setInput:d,inputsFieldNames:f,nameValidator:m,toggleNodeValid:h,fieldNameValidator:y}=_n(n.nodeId,()=>t.value.getValue()),b=e.computed(()=>Wd(s.value.property));function _(C){var E;const N=(E=r.value)==null?void 0:E.id;if(!N)throw new Error("Expected selectedNode to be defined");zd(C)||i(N,!1),Wd(C)||o(N,!1),l()}const{fields:k}=Rr({validationConfig:()=>({property:To({fieldName:"Property"}),key:Oa(s.value.property)?To({fieldName:"Key"}):()=>{}}),getValidationData:()=>({property:s.value.property,key:Hd(s.value.property)}),toggleNodeValid:h});return(C,N)=>(e.openBlock(),e.createBlock(Zt,{ref:"form",data:e.unref(s),schema:e.unref(a)},{default:e.withCtx(()=>[e.createVNode(Kn,{name:e.unref(s).name,validate:e.unref(m),onUpdate:e.unref(c)},null,8,["name","validate","onUpdate"]),e.createVNode(Dt,{name:"content_type",onUpdate:N[0]||(N[0]=E=>e.unref(l)())}),e.createVNode(CL,{validators:e.unref(k),"onUpdate:modelValue":_,"onUpdate:propertyKey":N[1]||(N[1]=E=>e.unref(l)("property-key"))},null,8,["validators"]),e.createVNode(hn,{name:"non_nil","onUpdate:modelValue":N[2]||(N[2]=E=>e.unref(l)("non_nil"))}),b.value?(e.openBlock(),e.createBlock(tr,{key:0})):e.createCommentVNode("",!0),b.value?(e.openBlock(),e.createBlock(In,{key:1,"field-name-validator":e.unref(y),"field-names":e.unref(f),items:e.unref(u),"node-type":"property","onChange:input":e.unref(d),"onChange:inputs":e.unref(p)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])):e.createCommentVNode("",!0)]),_:1},8,["data","schema"]))}}),NL=e.defineComponent({__name:"NodeFormExit",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=bn("exit"),{formData:o,setName:i,setConfig:a,inputOptions:s,setInputs:c,setInput:l,inputsFieldNames:u,nameValidator:p,toggleNodeValid:d,fieldNameValidator:f}=_n(n.nodeId,()=>t.value.getValue()),{createFieldHandler:m}=Rr({validationConfig:{status:yn(Vi("integer",{fieldName:"Status"}),$i(200,599,{fieldName:"Status"}))},getValidationData:()=>({status:o.value.status}),toggleNodeValid:d}),h=m("status",()=>a("status"));return(y,b)=>(e.openBlock(),e.createBlock(Zt,{ref:"form",data:e.unref(o),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Kn,{name:e.unref(o).name,validate:e.unref(p),onUpdate:e.unref(i)},null,8,["name","validate","onUpdate"]),e.createVNode(Ht,{error:e.unref(h).error,"error-message":e.unref(h).errorMessage,name:"status",onBlur:e.unref(h).validate,"onUpdate:modelValue":e.unref(h).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(hn,{name:"warn_headers_sent","onUpdate:modelValue":b[0]||(b[0]=_=>e.unref(a)())}),e.createVNode(tr),e.createVNode(In,{"field-name-validator":e.unref(f),"field-names":e.unref(u),items:e.unref(s),"node-type":"exit","onChange:input":e.unref(l),"onChange:inputs":e.unref(c)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}});function SL(n){const t=_n(n),{state:r,getNodeById:o,branchGroups:i,commit:a}=$t(),{i18n:{t:s}}=Qe(),c=r_(),l=Jd(),u=e.computed(()=>{var C;const _={...t.formData.value},k=$a(((C=t.currentNode.value)==null?void 0:C.type)||"branch");for(const N of k)(!(N in _)||_[N]==null)&&(_[N]=[]);return _});function p(_,k,C){const N=o(_),E=o(C),w=N?`${N.name}.${k}`:`${_}.${k}`,S=E?E.name:C;return[w,S]}function d(_){return(_==null?[]:Array.isArray(_)?_:[_]).filter(k=>nf(k))}function f(_,k){return i.wouldCreateCycle(_,k)?(l({message:s("plugins.free-form.datakit.flow_editor.error.branch_cycle"),appearance:"danger"}),!0):!1}function m(_,k,C){const N=[],E=[],w=[];for(const S of C){const I=i.findMembership(S);if(!I||I.ownerId===_&&I.branch===k)continue;const U=i.getMembers(I.ownerId,I.branch).filter(x=>x!==S);w.push({ownerId:I.ownerId,branch:I.branch,members:U}),N.push(p(_,k,S)),E.push(p(I.ownerId,I.branch,S))}return{conflictUpdates:w,addedAssignments:N,removedAssignments:E}}function h(_,k,C,N){let E=!1;for(const w of N)E=i.setMembers(w.ownerId,w.branch,w.members,{commit:!1})||E;return E=i.setMembers(_,k,C,{commit:!1})||E,E}async function y(_,k){const C=t.currentNode.value,N=d(k),E=i.prepareMembers(C.id,_,N),w=i.getMembers(C.id,_);if(rf(w,E))return!0;const S=E.filter(T=>!w.includes(T));for(const T of S)if(f(C.id,T))return!1;const{conflictUpdates:I,addedAssignments:U,removedAssignments:x}=m(C.id,_,S);return I.length>0&&!await c(s("plugins.free-form.datakit.flow_editor.confirm.message.branch_replace"),U,x)?!1:(h(C.id,_,E,I)&&a(),!0)}const b=e.computed(()=>{const _=t.currentNode.value;return!_||!i?[]:r.value.nodes.filter(k=>k.id!==n&&!mn(k.type)&&k.phase===_.phase&&!i.wouldCreateCycle(_.id,k.id)).map(k=>({value:k.id,label:k.name,type:k.type}))});return{...t,formData:u,branchOptions:b,updateBranchMembers:y}}const xL=e.defineComponent({__name:"NodeFormBranch",props:{nodeId:{}},setup(n){const{i18n:{t}}=Qe(),r=bn("branch"),o=e.ref(0),{formData:i,setName:a,inputOptions:s,branchOptions:c,nameValidator:l,setInput:u,setInputs:p,inputsFieldNames:d,fieldNameValidator:f,updateBranchMembers:m}=SL(n.nodeId);async function h(y,b){await m(y,b)||(o.value+=1)}return(y,b)=>(e.openBlock(),e.createBlock(Zt,{key:o.value,data:e.unref(i),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Kn,{name:e.unref(i).name,validate:e.unref(l),onUpdate:e.unref(a)},null,8,["name","validate","onUpdate"]),e.createVNode(e.unref(Fe.KLabel),{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(Dt,{"enable-filtering":"",items:e.unref(c),multiple:"",name:"then",onUpdate:b[0]||(b[0]=_=>h("then",_))},{"item-label":e.withCtx(_=>[e.createVNode(_c,{item:_},null,8,["item"])]),_:1},8,["items"]),e.createVNode(Dt,{"enable-filtering":"",items:e.unref(c),multiple:"",name:"else",onUpdate:b[1]||(b[1]=_=>h("else",_))},{"item-label":e.withCtx(_=>[e.createVNode(_c,{item:_},null,8,["item"])]),_:1},8,["items"]),e.createVNode(tr),e.createVNode(In,{"field-name-validator":e.unref(f),"field-names":e.unref(d),items:e.unref(s),"node-type":"branch","onChange:input":e.unref(u),"onChange:inputs":e.unref(p)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),AL=e.defineComponent({__name:"NodeFormCache",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=bn("cache"),{i18n:{t:o}}=Qe(),{formData:i,setName:a,setConfig:s,inputOptions:c,setInputs:l,setInput:u,inputsFieldNames:p,nameValidator:d,toggleNodeValid:f,fieldNameValidator:m}=_n(n.nodeId,()=>t.value.getValue()),{createFieldHandler:h}=Rr({validationConfig:()=>({ttl:yn(Vi("integer",{fieldName:"TTL"}),$i(1,1/0,{fieldName:"TTL"}))}),getValidationData:()=>({ttl:i.value.ttl}),toggleNodeValid:f}),y=h("ttl",()=>s("ttl"));return(b,_)=>(e.openBlock(),e.createBlock(Zt,{ref:"form",data:e.unref(i),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Kn,{name:e.unref(i).name,validate:e.unref(d),onUpdate:e.unref(a)},null,8,["name","validate","onUpdate"]),e.createVNode(e.unref(Fe.KLabel),{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(hn,{name:"bypass_on_error","onUpdate:modelValue":_[0]||(_[0]=k=>e.unref(s)("bypass_on_error"))}),e.createVNode(Ht,{error:e.unref(y).error,"error-message":e.unref(y).errorMessage,name:"ttl",onBlur:e.unref(y).validate,"onUpdate:modelValue":e.unref(y).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(tr),e.createVNode(In,{"field-name-validator":e.unref(m),"field-names":e.unref(p),items:e.unref(c),"node-type":"cache","onChange:input":e.unref(u),"onChange:inputs":e.unref(l)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),vL=e.defineComponent({__name:"NodeFormXmlToJson",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=bn("xml_to_json"),{i18n:{t:o}}=Qe(),{formData:i,setName:a,setConfig:s,inputOptions:c,setInputs:l,setInput:u,inputsFieldNames:p,nameValidator:d,toggleNodeValid:f,fieldNameValidator:m}=_n(n.nodeId,()=>t.value.getValue()),h=o("plugins.free-form.datakit.flow_editor.node_properties.errors.attributes_required"),y=()=>!!(i.value.attributes_block_name||i.value.attributes_name_prefix),{createFieldHandler:b}=Rr({validationConfig:()=>({attributes_block_name:yn(()=>y()?void 0:h,I=>{if(I)return $r(1,32,{fieldName:"Attributes block name"})(I)}),attributes_name_prefix:yn(()=>y()?void 0:h,I=>{if(I)return $r(1,32,{fieldName:"Attributes name prefix"})(I)}),text_block_name:$r(1,32,{fieldName:"Text block name"}),xpath:$r(1,256,{fieldName:"XPath"})}),getValidationData:()=>({attributes_block_name:i.value.attributes_block_name,attributes_name_prefix:i.value.attributes_name_prefix,text_block_name:i.value.text_block_name,xpath:i.value.xpath}),toggleNodeValid:f}),_=b("attributes_block_name",()=>s("attributes_block_name")),k=b("attributes_name_prefix",()=>s("attributes_name_prefix")),C=b("text_block_name",()=>s("text_block_name")),N=b("xpath",()=>s("xpath")),E=()=>{_.value.validate(),k.value.validate()},w=()=>{_.value.update(),k.value.validate()},S=()=>{k.value.update(),_.value.validate()};return(I,U)=>(e.openBlock(),e.createBlock(Zt,{ref:"form",data:e.unref(i),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Kn,{name:e.unref(i).name,validate:e.unref(d),onUpdate:e.unref(a)},null,8,["name","validate","onUpdate"]),e.createVNode(e.unref(Fe.KLabel),{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(hn,{name:"recognize_type","onUpdate:modelValue":U[0]||(U[0]=x=>e.unref(s)("recognize_type"))}),e.createVNode(Xe,{error:e.unref(_).error,"error-message":e.unref(_).errorMessage,name:"attributes_block_name",onBlur:E,"onUpdate:modelValue":w},null,8,["error","error-message"]),e.createVNode(Xe,{error:e.unref(k).error,"error-message":e.unref(k).errorMessage,name:"attributes_name_prefix",onBlur:E,"onUpdate:modelValue":S},null,8,["error","error-message"]),e.createVNode(Xe,{error:e.unref(C).error,"error-message":e.unref(C).errorMessage,name:"text_block_name",onBlur:e.unref(C).validate,"onUpdate:modelValue":e.unref(C).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(hn,{name:"text_as_property","onUpdate:modelValue":U[1]||(U[1]=x=>e.unref(s)("text_as_property"))}),e.createVNode(Xe,{error:e.unref(N).error,"error-message":e.unref(N).errorMessage,name:"xpath",onBlur:e.unref(N).validate,"onUpdate:modelValue":e.unref(N).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(tr),e.createVNode(In,{"field-name-validator":e.unref(m),"field-names":e.unref(p),items:e.unref(c),"node-type":"xml_to_json","onChange:input":e.unref(u),"onChange:inputs":e.unref(l)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),IL=e.defineComponent({__name:"NodeFormJsonToXml",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=bn("json_to_xml"),{i18n:{t:o}}=Qe(),{formData:i,setName:a,setConfig:s,inputOptions:c,setInputs:l,setInput:u,addField:p,removeFieldByName:d,renameFieldByName:f,inputsFieldNames:m,nameValidator:h,toggleNodeValid:y,fieldNameValidator:b}=_n(n.nodeId,()=>t.value.getValue()),_=o("plugins.free-form.datakit.flow_editor.node_properties.errors.attributes_required"),k=()=>!!(i.value.attributes_block_name||i.value.attributes_name_prefix),{createFieldHandler:C}=Rr({validationConfig:{attributes_block_name:yn(()=>k()?void 0:_,$r(1,32,{fieldName:"Attributes block name"})),attributes_name_prefix:yn(()=>k()?void 0:_,$r(1,32,{fieldName:"Attributes name prefix"})),root_element_name:$r(1,64,{fieldName:"Root element name"}),text_block_name:$r(1,32,{fieldName:"Text block name"})},getValidationData:()=>({attributes_block_name:i.value.attributes_block_name,attributes_name_prefix:i.value.attributes_name_prefix,root_element_name:i.value.root_element_name,text_block_name:i.value.text_block_name}),toggleNodeValid:y}),N=C("attributes_block_name",()=>s("attributes_block_name")),E=C("attributes_name_prefix",()=>s("attributes_name_prefix")),w=C("root_element_name",()=>s("root_element_name")),S=C("text_block_name",()=>s("text_block_name"));function I(){N.value.validate(),E.value.validate()}function U(){N.value.update(),E.value.validate()}function x(){E.value.update(),N.value.validate()}function A(R,X){p("input",R,X)}function T(R){d("input",R)}function V(R,X){f("input",R,X)}return(R,X)=>(e.openBlock(),e.createBlock(Zt,{ref:"form",data:e.unref(i),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Kn,{name:e.unref(i).name,validate:e.unref(h),onUpdate:e.unref(a)},null,8,["name","validate","onUpdate"]),e.createVNode(e.unref(Fe.KLabel),{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(Xe,{error:e.unref(N).error,"error-message":e.unref(N).errorMessage,name:"attributes_block_name",onBlur:I,"onUpdate:modelValue":U},null,8,["error","error-message"]),e.createVNode(Xe,{error:e.unref(E).error,"error-message":e.unref(E).errorMessage,name:"attributes_name_prefix",onBlur:I,"onUpdate:modelValue":x},null,8,["error","error-message"]),e.createVNode(Xe,{error:e.unref(w).error,"error-message":e.unref(w).errorMessage,name:"root_element_name",onBlur:e.unref(w).validate,"onUpdate:modelValue":e.unref(w).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(Xe,{error:e.unref(S).error,"error-message":e.unref(S).errorMessage,name:"text_block_name",onBlur:e.unref(S).validate,"onUpdate:modelValue":e.unref(S).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(tr),e.createVNode(In,{"field-name-validator":e.unref(b),"field-names":e.unref(m),items:e.unref(c),"node-type":"json_to_xml","onAdd:field":A,"onChange:input":e.unref(u),"onChange:inputs":e.unref(l),"onRemove:field":T,"onRename:field":V},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),BL=e.defineComponent({__name:"NodeFormJwtDecode",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=bn("jwt_decode"),{formData:o,setName:i,inputOptions:a,setInputs:s,setInput:c,inputsFieldNames:l,nameValidator:u,fieldNameValidator:p}=_n(n.nodeId,()=>t.value.getValue());return(d,f)=>(e.openBlock(),e.createBlock(Zt,{ref:"form",data:e.unref(o),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Kn,{name:e.unref(o).name,validate:e.unref(u),onUpdate:e.unref(i)},null,8,["name","validate","onUpdate"]),e.createVNode(tr),e.createVNode(In,{"field-name-validator":e.unref(p),"field-names":e.unref(l),items:e.unref(a),"node-type":"jwt_decode","onChange:input":e.unref(c),"onChange:inputs":e.unref(s)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),TL=e.defineComponent({__name:"NodeFormJwtSign",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=bn("jwt_sign"),{i18n:{t:o}}=Qe(),{formData:i,setName:a,setConfig:s,inputOptions:c,setInputs:l,setInput:u,inputsFieldNames:p,nameValidator:d,toggleNodeValid:f,fieldNameValidator:m}=_n(n.nodeId,()=>{const k={...t.value.getValue()};return(!k.static_claims||Object.keys(k.static_claims).length===0)&&delete k.static_claims,k}),{createFieldHandler:h}=Rr({validationConfig:{algorithm:To({fieldName:"Algorithm"}),expires_in:yn(Vi("integer",{fieldName:"Expires in"}),$i(1,1/0,{fieldName:"Expires in"})),not_before:yn(Vi("integer",{fieldName:"Not before"}),$i(0,1/0,{fieldName:"Not before"}))},getValidationData:()=>({algorithm:i.value.algorithm,expires_in:i.value.expires_in,not_before:i.value.not_before}),toggleNodeValid:f}),y=h("algorithm",()=>s("algorithm")),b=h("expires_in",()=>s("expires_in")),_=h("not_before",()=>s("not_before"));return(k,C)=>(e.openBlock(),e.createBlock(Zt,{ref:"form",data:e.unref(i),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Kn,{name:e.unref(i).name,validate:e.unref(d),onUpdate:e.unref(a)},null,8,["name","validate","onUpdate"]),e.createVNode(e.unref(Fe.KLabel),{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(Dt,{"enable-filtering":"",name:"algorithm",onUpdate:e.unref(y).update},null,8,["onUpdate"]),e.createVNode(Ht,{error:e.unref(b).error,"error-message":e.unref(b).errorMessage,name:"expires_in",onBlur:e.unref(b).validate,"onUpdate:modelValue":e.unref(b).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(Ht,{error:e.unref(_).error,"error-message":e.unref(_).errorMessage,name:"not_before",onBlur:e.unref(_).validate,"onUpdate:modelValue":e.unref(_).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(Xe,{name:"kid","onUpdate:modelValue":C[0]||(C[0]=N=>e.unref(s)("kid"))}),e.createVNode(Xe,{name:"typ","onUpdate:modelValue":C[1]||(C[1]=N=>e.unref(s)("typ"))}),e.createVNode(pr,{label:e.unref(o)("plugins.free-form.datakit.flow_editor.node_properties.jwt.static_claims.label"),name:"static_claims",onLegacyValueChange:C[2]||(C[2]=N=>e.unref(s)("static_claims"))},null,8,["label"]),e.createVNode(tr),e.createVNode(In,{"field-name-validator":e.unref(m),"field-names":e.unref(p),items:e.unref(c),"node-type":"jwt_sign","onChange:input":e.unref(u),"onChange:inputs":e.unref(l)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),OL=e.defineComponent({__name:"NodeFormJwtVerify",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=bn("jwt_verify"),{i18n:{t:o}}=Qe(),{formData:i,setName:a,setConfig:s,inputOptions:c,setInputs:l,setInput:u,inputsFieldNames:p,nameValidator:d,toggleNodeValid:f,fieldNameValidator:m}=_n(n.nodeId,()=>t.value.getValue()),{createFieldHandler:h}=Rr({validationConfig:{leeway:yn(Vi("integer",{fieldName:"Leeway"}),$i(0,1/0,{fieldName:"Leeway"}))},getValidationData:()=>({leeway:i.value.leeway}),toggleNodeValid:f}),y=h("leeway",()=>s("leeway"));return(b,_)=>(e.openBlock(),e.createBlock(Zt,{ref:"form",data:e.unref(i),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Kn,{name:e.unref(i).name,validate:e.unref(d),onUpdate:e.unref(a)},null,8,["name","validate","onUpdate"]),e.createVNode(e.unref(Fe.KLabel),{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(Dt,{"enable-filtering":"",multiple:"",name:"allowed_algorithms",onUpdate:_[0]||(_[0]=k=>e.unref(s)("allowed_algorithms"))}),e.createVNode(zt,{name:"issuers",onAdd:_[2]||(_[2]=k=>e.unref(s)("issuers")),onRemove:_[3]||(_[3]=k=>e.unref(s)("issuers"))},{item:e.withCtx(({fieldName:k,autofocus:C})=>[e.createVNode(Xe,{autofocus:C,name:k,"onUpdate:modelValue":_[1]||(_[1]=N=>e.unref(s)("issuers"))},null,8,["autofocus","name"])]),_:1}),e.createVNode(zt,{name:"audiences",onAdd:_[5]||(_[5]=k=>e.unref(s)("audiences")),onRemove:_[6]||(_[6]=k=>e.unref(s)("audiences"))},{item:e.withCtx(({fieldName:k,autofocus:C})=>[e.createVNode(Xe,{autofocus:C,name:k,"onUpdate:modelValue":_[4]||(_[4]=N=>e.unref(s)("audiences"))},null,8,["autofocus","name"])]),_:1}),e.createVNode(zt,{name:"required_claims",onAdd:_[8]||(_[8]=k=>e.unref(s)("required_claims")),onRemove:_[9]||(_[9]=k=>e.unref(s)("required_claims"))},{item:e.withCtx(({fieldName:k,autofocus:C})=>[e.createVNode(Xe,{autofocus:C,name:k,"onUpdate:modelValue":_[7]||(_[7]=N=>e.unref(s)("required_claims"))},null,8,["autofocus","name"])]),_:1}),e.createVNode(Ht,{error:e.unref(y).error,"error-message":e.unref(y).errorMessage,name:"leeway",onBlur:e.unref(y).validate,"onUpdate:modelValue":e.unref(y).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(hn,{name:"validate_exp","onUpdate:modelValue":_[10]||(_[10]=k=>e.unref(s)("validate_exp"))}),e.createVNode(hn,{name:"validate_nbf","onUpdate:modelValue":_[11]||(_[11]=k=>e.unref(s)("validate_nbf"))}),e.createVNode(tr),e.createVNode(In,{"field-name-validator":e.unref(m),"field-names":e.unref(p),items:e.unref(c),"node-type":"jwt_verify","onChange:input":e.unref(u),"onChange:inputs":e.unref(l)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),PL=["innerHTML"],VL={key:1,class:"branch-note"},$L={class:"branch-label"},RL={class:"branch-text"},LL=e.defineComponent({__name:"NodePropertiesPanel",props:{maxWidth:{default:`${th}px`},offsetTop:{default:`${q1}px`},visible:{type:Boolean},nodeId:{}},emits:["close"],setup(n){const{t}=jt.createI18n("en-us",Jt),{getNodeById:r,branchGroups:o}=$t(),i=e.computed(()=>n.nodeId&&r(n.nodeId)),a=e.computed(()=>{if(n.nodeId)return o.findMembership(n.nodeId)}),s=e.computed(()=>{if(!a.value)return"";const u=r(a.value.ownerId);return u?`${u.name}.${a.value.branch}`:""});function c(){n.nodeId&&o.removeMember(n.nodeId)}const l=e.computed(()=>{var u;switch((u=i.value)==null?void 0:u.type){case"call":return dL;case"service_request":return fL;case"response":return pL;case"jq":return mL;case"static":return _L;case"property":return EL;case"exit":return NL;case"branch":return xL;case"cache":return AL;case"xml_to_json":return vL;case"json_to_xml":return IL;case"jwt_decode":return BL;case"jwt_sign":return TL;case"jwt_verify":return OL;default:return null}});return(u,p)=>(e.openBlock(),e.createBlock(e.unref(Fe.KSlideout),{class:"dk-node-properties-panel","close-on-blur":!1,"has-overlay":!1,"max-width":n.maxWidth,"offset-top":n.offsetTop,visible:n.visible,"z-index":e.unref(K1),onClose:p[0]||(p[0]=d=>u.$emit("close"))},e.createSlots({default:e.withCtx(()=>[i.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"dk-node-properties-panel-desc",innerHTML:e.unref(si)(i.value.type)},null,8,PL)):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createElementBlock("div",VL,[e.createElementVNode("span",$L,[e.createVNode(e.unref($e.ArrowSplitIcon),{color:`var(--kui-color-text-neutral, ${e.unref(cr)})`,size:`var(--kui-icon-size-40, ${e.unref(_a)})`},null,8,["color","size"]),e.createElementVNode("span",RL,e.toDisplayString(s.value),1)]),e.createVNode(e.unref(Fe.KTooltip),{placement:"top",text:e.unref(t)("plugins.free-form.datakit.flow_editor.actions.remove_from_branch")},{default:e.withCtx(()=>[e.createVNode(e.unref(Fe.KButton),{appearance:"none","aria-label":e.unref(t)("plugins.free-form.datakit.flow_editor.actions.remove_from_branch"),class:"remove-branch",icon:"",size:"small",onClick:c},{default:e.withCtx(()=>[e.createVNode(e.unref($e.TrashIcon))]),_:1},8,["aria-label"])]),_:1},8,["text"])])):e.createCommentVNode("",!0),l.value?(e.openBlock(),e.createBlock(e.unref(l),{key:n.nodeId,class:"dk-node-properties-panel-form","node-id":n.nodeId},null,8,["node-id"])):e.createCommentVNode("",!0)]),_:2},[i.value?{name:"title",fn:e.withCtx(()=>[e.createVNode(ff,{type:i.value.type},null,8,["type"])]),key:"0"}:void 0]),1032,["max-width","offset-top","visible","z-index"]))}}),DL=je(LL,[["__scopeId","data-v-32602117"]]),ML={class:"dk-editor-content"},jL={class:"main"},FL=je(e.defineComponent({__name:"EditorContent",setup(n){const{propertiesPanelOpen:t,selectedNode:r}=$t();function o(){t.value=!1}e.watch(r,a=>{a||o()});const i=e.ref(!1);return e.onMounted(()=>{i.value=!0}),(a,s)=>{var c;return e.openBlock(),e.createElementBlock("div",ML,[e.createVNode(e.unref(HR)),e.createElementVNode("div",jL,[e.createVNode(nR)]),e.createVNode(DL,{"node-id":(c=e.unref(r))==null?void 0:c.id,visible:e.unref(t),onClose:o},null,8,["node-id","visible"])])}}}),[["__scopeId","data-v-66331c5c"]]),UL={key:0,class:"dk-editor-modal"},KL=je(e.defineComponent({__name:"EditorModal",props:{open:{type:Boolean},openModifiers:{}},emits:["update:open"],setup(n){e.useCssVars(c=>({v0a30a280:`${e.unref(U1)}px`,aee7cc1c:`${e.unref(eh)}px`}));const t=e.useModel(n,"open"),r=e.ref(!1),o=e.useTemplateRef("confirm-modal"),{clear:i}=$t();xB(async(...c)=>{r.value=!0;const l=await o.value.open(...c);return r.value=!1,l});const a=Pt.useScrollLock(document);e.watch(t,c=>{a.value=!!c,c||i()},{immediate:!0});function s(){t.value=!1}return(c,l)=>t.value?(e.openBlock(),e.createElementBlock("div",UL,[e.createVNode(J$,{class:"nav",onBack:s}),e.createVNode(FL,{ref:"content",class:"content",tabindex:"0"},null,512),e.createVNode(H$,{ref:"confirm-modal"},null,512)])):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-82b03578"]]),qL={class:"dk-flow-editor"},GL={class:"flow-panels-container"},HL={class:"overlay"},zL=je(e.defineComponent({__name:"FlowEditor",props:{isEditing:{type:Boolean}},emits:["change","error"],setup(n,{emit:t}){const{t:r}=jt.createI18n("en-us",Jt),{formData:o,setValue:i,getValue:a}=pt(),s=t;function c(p,d,f,m){const h={...o.config,nodes:p};f!==void 0&&(h.resources=f);const y={...o.__ui_data,...d},b={...o,config:h,__ui_data:y};m!=null?b.partials=[{id:m}]:b.partials&&(b.partials=null),i(b),s("change",h,y)}const{modalOpen:l,setPendingFitView:u}=uf(a(),{onChange:c,isEditing:n.isEditing});return e.watch(l,()=>{u(!0)},{flush:"post"}),D$({enabled:l}),(p,d)=>{const f=e.resolveComponent("KButton");return e.openBlock(),e.createElementBlock("div",qL,[e.createElementVNode("div",GL,[e.createVNode(up,{inactive:e.unref(l),mode:"preview"},null,8,["inactive"]),e.createElementVNode("div",HL,[e.createVNode(f,{appearance:"secondary",class:"button-open-editor",onClick:d[0]||(d[0]=m=>l.value=!0)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("plugins.free-form.datakit.flow_editor.cta"))+" ",1),e.createVNode(e.unref($e.ExpandIcon))]),_:1})])]),e.createVNode(KL,{open:e.unref(l),"onUpdate:open":d[1]||(d[1]=m=>e.isRef(l)?l.value=m:null)},null,8,["open"])])}}}),[["__scopeId","data-v-575018ff"]]),WL=["innerHTML"],YL={class:"dk-option-label"},JL=["innerHTML"],XL=ze({component:je(e.defineComponent({inheritAttrs:!1,__name:"DatakitForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},configSections:{},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const{t}=jt.createI18n("en-us",Jt),r=n,o=e.useAttrs(),i=e.inject(et.FORMS_CONFIG),a=e.ref(!1);e.onMounted(()=>{a.value=!!document.querySelector("#plugin-form-page-actions")});const{editorMode:s}=hc(),c=e.computed(()=>i.app!=="konnect"||p.value===!1?"code":s.value),l=e.computed(()=>i.app==="kongManager"?"code":c.value==="flow"?"form":"code"),u={flow:$e.DesignIcon,code:$e.CodeblockIcon},p=e.ref(!0),d=e.ref(""),f=e.computed(()=>{const E=[{label:t("plugins.free-form.datakit.flow_editor.mode"),value:"flow"},{label:t("plugins.free-form.datakit.code_editor.mode"),value:"code"}];return E[0].disabled=!p.value,E}),m=e.computed(()=>{switch(c.value){case"code":return t("plugins.free-form.datakit.description_code");case"flow":return t("plugins.free-form.datakit.description_flow");default:return""}}),h=e.computed(()=>p.value?"":t("plugins.free-form.datakit.flow_editor.disabled_tooltip",{reason:d.value,code:E=>`<code>${Xv(E)}</code>`}));e.watch(c,()=>{var E;(E=r.onValidityChange)==null||E.call(r,{model:"config",valid:!0})});function y(){var E;(E=r.onValidityChange)==null||E.call(r,{model:"config",valid:!0})}function b(){y()}function _(E){return E.map(w=>typeof w=="number"?`[${w}]`:E.length&&typeof w=="string"&&w.includes(".")?`["${w}"]`:`.${w}`).join("").replace(/^\./,"")}function k(E){return E.issues.map(w=>`${_(w.path)} - ${w.message}`).join("; ")}function C(E){if(y(),i.app!=="konnect")return;const w=E==null?void 0:E.config,{success:S,error:I}=vw.safeParse(w);d.value=S||!I?"":k(I),p.value=S}function N(E){var w;d.value=E,p.value=!1,(w=r.onValidityChange)==null||w.call(r,{model:"config",valid:!1,error:E})}return(E,w)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(i).app==="konnect"?(e.openBlock(),e.createBlock(e.Teleport,{key:0,disabled:!a.value,to:"#plugin-form-page-actions"},[e.createVNode(e.unref(Fe.KSegmentedControl),{"data-testid":"datakit-editor-mode-switcher","model-value":c.value,options:f.value,"onUpdate:modelValue":w[0]||(w[0]=S=>s.value=S)},{"option-label":e.withCtx(({option:S})=>[e.createVNode(e.unref(Fe.KTooltip),{disabled:p.value||S.value!=="flow"},{content:e.withCtx(()=>[e.createElementVNode("div",{innerHTML:h.value},null,8,WL)]),default:e.withCtx(()=>[e.createElementVNode("div",YL,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u[S.value]))),e.createTextVNode(" "+e.toDisplayString(S.label),1)])]),_:2},1032,["disabled"])]),_:1},8,["model-value","options"])],8,["disabled"])):e.createCommentVNode("",!0),e.createVNode(er,e.mergeProps({...e.unref(o),...r},{class:"dk-form","editor-mode":l.value,"hide-editor-mode-switcher":""}),{"code-editor":e.withCtx(()=>[e.createVNode(R$,{class:"code-editor",editing:r.isEditing,onChange:C,onError:N},null,8,["editing"])]),"plugin-config-title":e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.mode")),1)]),"plugin-config-description":e.withCtx(()=>[e.createElementVNode("span",{innerHTML:m.value},null,8,JL)]),default:e.withCtx(()=>[c.value==="flow"?(e.openBlock(),e.createBlock(zL,{key:0,"is-editing":r.isEditing,onChange:b},null,8,["is-editing"])):e.createCommentVNode("",!0)]),_:1},16,["editor-mode"])],64))}}),[["__scopeId","data-v-99d4e7f0"]])}),ZL=ze({experimental:!0,fieldRenderers:[{match:({genericPath:n})=>n==="config.functions.*",component:Xe,propsOverrides:n=>({...n,multiline:!0,rows:3})}]}),QL=ze({experimental:!0,fieldRenderers:[{match:"config.custom_fields_by_lua",component:pr,propsOverrides:{appearance:{string:{multiline:!0}}}}]}),eD=ze({experimental:!0,renderRules:{bundles:[["config.strategy","config.redis"]],dependencies:{"config.redis":["config.strategy","redis"]}}}),tD=ze({experimental:!0,fieldRenderers:[{match:"config.consumer_by",component:Dt,propsOverrides:{multiple:!0}}]}),nD=ze({experimental:!0,fieldRenderers:[{match:"config.custom_fields_by_lua",component:pr,propsOverrides:{appearance:{string:{multiline:!0}}}}]}),rD=ze({experimental:!0}),oD=ze({experimental:!0}),Pw=e.defineComponent({inheritAttrs:!1,__name:"KeysetField",props:{name:{},scope:{}},setup(n){const t=n,{i18n:{t:r}}=Qe(),o=e.inject(et.FORMS_CONFIG),i=e.computed(()=>(o==null?void 0:o.app)==="konnect"),{formData:a,config:s}=pt();function c(f){const m=`config.${f}`,h=Gl(f);return s.value.transformLabel?s.value.transformLabel(h,m):h}function l(f){if(typeof f!="string"||!f)return!1;try{const m=new URL(f);return(m.protocol==="http:"||m.protocol==="https:")&&!!m.host}catch{return!1}}const u=e.computed(()=>{if(!i.value)return{hasError:!1,message:""};const f=a.config,m=f==null?void 0:f[`${t.scope}_token_signing`],h=f==null?void 0:f[`${t.scope}_token_upstream_header`];if(!m)return{hasError:!1,message:""};if(typeof h!="string"||h==="")return{hasError:!1,message:""};const y=f==null?void 0:f[`${t.scope}_token_keyset`];return l(y)?{hasError:!1,message:""}:{hasError:!0,message:r("plugins.free-form.jwt-signer.keyset_url_required",{signingField:c(`${t.scope}_token_signing`),headerField:c(`${t.scope}_token_upstream_header`)})}}),p=e.computed(()=>u.value.hasError),d=e.computed(()=>u.value.message);return(f,m)=>(e.openBlock(),e.createBlock(Xe,e.mergeProps(f.$attrs,{error:p.value,"error-message":d.value,name:n.name}),null,16,["error","error-message","name"]))}}),iD=ze({component:e.defineComponent({__name:"JwtSignerForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},configSections:{},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const t=n,r={bundles:[["config.access_token_signing","config.access_token_upstream_header","config.access_token_keyset"],["config.channel_token_signing","config.channel_token_upstream_header","config.channel_token_keyset"]]},o=e.useSlots();return e.provide(et.AUTOFILL_SLOT,o==null?void 0:o[et.AUTOFILL_SLOT_NAME]),(i,a)=>(e.openBlock(),e.createBlock(er,e.mergeProps(t,{"render-rules":r}),{"field-renderers":e.withCtx(()=>[e.createVNode(Rt,{match:({path:s})=>s==="config.access_token_keyset"},{default:e.withCtx(s=>[e.createVNode(Pw,e.mergeProps(s,{scope:"access"}),null,16)]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:s})=>s==="config.channel_token_keyset"},{default:e.withCtx(s=>[e.createVNode(Pw,e.mergeProps(s,{scope:"channel"}),null,16)]),_:1},8,["match"])]),default:e.withCtx(()=>[e.createVNode(iw)]),_:1},16))}})}),aD=ze({experimental:!0}),sD=ze({experimental:!0,fieldRenderers:[{match:({genericPath:n})=>n==="config.message_by_lua_functions.*",component:Xe,propsOverrides:{multiline:!0,rows:3}}]}),lD=ze({experimental:!0,fieldRenderers:[{match:"config.custom_fields_by_lua",component:pr,propsOverrides:{appearance:{string:{multiline:!0}}}}]}),cD=ze({experimental:!0,fieldRenderers:[{match:({genericPath:n})=>n==="config.message_by_lua_functions.*",component:Xe,propsOverrides:{multiline:!0,rows:3}}]}),uD=ze({experimental:!0,component:dw,fieldRenderers:[{match:({path:n})=>n==="config.identity_realms",component:cw},{match:"config.anonymous",component:Xe,propsOverrides:{placeholder:"e.g., 00000000-0000-0000-0000-000000000001"}},{match:"config.realm",component:Xe,propsOverrides:{placeholder:"e.g., my-api"}}]}),dD={class:"ff-collapsible-section"},fD={class:"ff-collapsible-section-header"},pD={class:"ff-collapsible-section-header-toggle"},mD={key:0,class:"ff-collapsible-section-content"},gD={key:0,class:"ff-collapsible-section-indent-guide"},mp=je(e.defineComponent({__name:"CollapsibleSection",props:e.mergeModels({label:{}},{expanded:{type:Boolean,default:!0},expandedModifiers:{}}),emits:["update:expanded"],setup(n){const t=e.useModel(n,"expanded");return(r,o)=>(e.openBlock(),e.createElementBlock("div",dD,[e.createElementVNode("header",fD,[e.createElementVNode("div",pD,[e.createElementVNode("button",{class:"ff-collapsible-section-toggle-btn",type:"button",onClick:o[0]||(o[0]=e.withModifiers(i=>t.value=!t.value,["prevent","stop"]))},[e.createVNode(e.unref($e.ChevronRightIcon),{class:e.normalizeClass(["ff-collapsible-section-toggle-btn-trigger-icon",{"collapse-expanded":t.value}]),decorative:"",size:`var(--kui-icon-size-30, ${e.unref(Yn)})`},null,8,["class","size"])]),e.createVNode(e.unref(Fe.KLabel),{class:"ff-collapsible-section-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.label),1)]),_:1})])]),e.createVNode(zl,null,{default:e.withCtx(()=>[t.value?(e.openBlock(),e.createElementBlock("div",mD,[e.renderSlot(r.$slots,"default",{},void 0,!0)])):e.createCommentVNode("",!0)]),_:3}),t.value?(e.openBlock(),e.createElementBlock("div",gD)):e.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-39f2a44b"]]),hD={class:"ff-mb-subject"},yD={class:"ff-mb-attributes"},_D={class:"ff-metering-billing-inline-row"},bD={class:"ff-mb-queue"},wD=ze({experimental:!0,component:je(e.defineComponent({__name:"MeteringAndBillingForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},configSections:{},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const t=n,r=e.useSlots();e.provide(et.AUTOFILL_SLOT,r==null?void 0:r[et.AUTOFILL_SLOT_NAME]);const{i18n:{t:o}}=Qe(),i=e.inject(et.FORMS_CONFIG),a=e.computed(()=>{const p=i==null?void 0:i.geoApiServerUrl,d=p?new URL(p).hostname.split(".")[0]:null;return d?`https://${d}.api.konghq.com/v3/openmeter/events`:"https://{{region}}.api.konghq.com/v3/openmeter/events"}),s={hasValue:p=>!!p&&Object.keys(p).length>0,prepareFormData:p=>{var d;return t.isEditing?p:(i==null?void 0:i.app)==="konnect"&&!((d=p==null?void 0:p.config)!=null&&d.ingest_endpoint)?{...p,config:{...p==null?void 0:p.config,ingest_endpoint:a.value}}:p}},c=e.ref(!0),l=e.ref(!0),u=e.ref(!0);return(p,d)=>(e.openBlock(),e.createBlock(er,e.mergeProps(t,{"form-config":s,"plugin-config-description":e.unref(o)("plugins.free-form.metering-and-billing.sections.plugin_config.description")}),{"field-renderers":e.withCtx(()=>[e.createVNode(Rt,{match:({path:f})=>f==="config.meter_api_requests"},{default:e.withCtx(f=>[e.createVNode(hn,e.mergeProps(f,{description:e.unref(o)("plugins.free-form.metering-and-billing.fields.meter_api_requests.description")}),null,16,["description"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:f})=>f==="config.meter_ai_token_usage"},{default:e.withCtx(f=>[e.createVNode(hn,e.mergeProps(f,{description:e.unref(o)("plugins.free-form.metering-and-billing.fields.meter_ai_token_usage.description")}),null,16,["description"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:f})=>f==="config.ssl_verify"},{default:e.withCtx(f=>[e.createVNode(hn,e.mergeProps(f,{description:e.unref(o)("plugins.free-form.metering-and-billing.fields.ssl_verify.description"),label:e.unref(o)("plugins.free-form.metering-and-billing.fields.ssl_verify.label")}),null,16,["description","label"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:f})=>f==="config.subject.look_up_value_in"},{default:e.withCtx(f=>[e.createVNode(Dt,e.mergeProps(f,{help:e.unref(o)("plugins.free-form.metering-and-billing.fields.look_up_value_in.help"),label:e.unref(o)("plugins.free-form.metering-and-billing.fields.look_up_value_in.label")}),null,16,["help","label"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:f})=>f==="config.subject.field"},{default:e.withCtx(f=>[e.createVNode(Xe,e.mergeProps(f,{help:e.unref(o)("plugins.free-form.metering-and-billing.fields.subject_field.help"),label:e.unref(o)("plugins.free-form.metering-and-billing.fields.subject_field.label"),placeholder:e.unref(o)("plugins.free-form.metering-and-billing.fields.subject_field.placeholder")}),null,16,["help","label","placeholder"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:f})=>f==="config.timeout"},{default:e.withCtx(f=>[e.createVNode(Ht,e.mergeProps(f,{label:e.unref(o)("plugins.free-form.metering-and-billing.fields.timeout.label")}),null,16,["label"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:f})=>f==="config.keepalive"},{default:e.withCtx(f=>[e.createVNode(Ht,e.mergeProps(f,{label:e.unref(o)("plugins.free-form.metering-and-billing.fields.keepalive.label")}),null,16,["label"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:f})=>f==="config.queue.max_coalescing_delay"},{default:e.withCtx(f=>[e.createVNode(Ht,e.mergeProps(f,{label:e.unref(o)("plugins.free-form.metering-and-billing.fields.queue.max_coalescing_delay.label")}),null,16,["label"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:f})=>f==="config.queue.initial_retry_delay"},{default:e.withCtx(f=>[e.createVNode(Ht,e.mergeProps(f,{label:e.unref(o)("plugins.free-form.metering-and-billing.fields.queue.initial_retry_delay.label")}),null,16,["label"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:f})=>f==="config.queue.max_retry_delay"},{default:e.withCtx(f=>[e.createVNode(Ht,e.mergeProps(f,{label:e.unref(o)("plugins.free-form.metering-and-billing.fields.queue.max_retry_delay.label")}),null,16,["label"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:f})=>f==="config.queue.max_retry_time"},{default:e.withCtx(f=>[e.createVNode(Ht,e.mergeProps(f,{label:e.unref(o)("plugins.free-form.metering-and-billing.fields.queue.max_retry_time.label")}),null,16,["label"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:f})=>f.startsWith("config.attributes.")&&f.endsWith(".look_up_value_in")},{default:e.withCtx(f=>[e.createVNode(Xe,e.mergeProps(f,{placeholder:e.unref(o)("plugins.free-form.metering-and-billing.fields.attributes.look_up_value_in.placeholder")}),null,16,["placeholder"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:f})=>f.startsWith("config.attributes.")&&f.endsWith(".event_property_name")},{default:e.withCtx(f=>[e.createVNode(Xe,e.mergeProps(f,{placeholder:e.unref(o)("plugins.free-form.metering-and-billing.fields.attributes.event_property_name.placeholder")}),null,16,["placeholder"])]),_:1},8,["match"])]),default:e.withCtx(()=>[e.createVNode(mp,{expanded:c.value,"onUpdate:expanded":d[0]||(d[0]=f=>c.value=f),label:e.unref(o)("plugins.free-form.metering-and-billing.sections.metering.title")},{default:e.withCtx(()=>[e.createVNode(it,{name:"config.meter_api_requests"}),e.createVNode(it,{name:"config.meter_ai_token_usage"})]),_:1},8,["expanded","label"]),e.createElementVNode("div",hD,[e.createVNode(Ut,{label:e.unref(o)("plugins.free-form.metering-and-billing.sections.subject.title"),name:"config.subject","render-rules":{dependencies:{field:["look_up_value_in",["query","header"]]}},"reset-label-path":"reset"},null,8,["label"])]),e.createVNode(mp,{expanded:l.value,"onUpdate:expanded":d[1]||(d[1]=f=>l.value=f),label:e.unref(o)("plugins.free-form.metering-and-billing.fields.attributes.title")},{default:e.withCtx(()=>[e.createElementVNode("div",yD,[e.createVNode(zt,{"hide-label":"",name:"config.attributes"})])]),_:1},8,["expanded","label"]),e.createVNode(mp,{expanded:u.value,"onUpdate:expanded":d[2]||(d[2]=f=>u.value=f),label:e.unref(o)("plugins.free-form.metering-and-billing.sections.ingestion.title")},{default:e.withCtx(()=>[e.createVNode(Xe,{help:e.unref(o)("plugins.free-form.metering-and-billing.fields.ingest_endpoint.help"),name:"config.ingest_endpoint"},null,8,["help"]),e.createVNode(it,{name:"config.api_token"}),e.createVNode(it,{name:"config.ssl_verify"}),e.createElementVNode("div",_D,[e.createVNode(it,{name:"config.timeout"}),e.createVNode(it,{name:"config.keepalive"})])]),_:1},8,["expanded","label"]),e.createVNode(ts,{class:"ff-advanced-fields-container","data-testid":"ff-advanced-fields-container","hide-general-fields":""},{default:e.withCtx(()=>[e.createElementVNode("div",bD,[e.createVNode(e.unref(Fe.KLabel),{class:"ff-mb-queue-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.metering-and-billing.sections.queue.title")),1)]),_:1}),e.createVNode(Ut,{"as-child":"",name:"config.queue","reset-label-path":"reset"})])]),_:1})]),_:1},16,["plugin-config-description"]))}}),[["__scopeId","data-v-78972733"]])}),kD=ze({experimental:!0,fieldRenderers:[{match:"config.api_specification",component:Xe,propsOverrides:{multiline:!0,rows:15}}]}),CD=ze({experimental:!0,fieldRenderers:[{match:"config.consumer_by",component:Dt,propsOverrides:{multiple:!0}}]}),ED=ze({experimental:!0,fieldRenderers:[{match:"config.api_spec",component:Xe,propsOverrides:{multiline:!0,rows:15}}]}),ND=ze({experimental:!0}),SD=ze({experimental:!0,fieldRenderers:[{match:"config.access_logs.custom_attributes_by_lua",component:pr,propsOverrides:{appearance:{string:{multiline:!0}}}}]}),xD=ze({experimental:!0,fieldRenderers:[{match:({genericPath:n})=>["config.access.*","config.body_filter.*","config.header_filter.*","config.certificate.*","config.functions.*","config.log.*","config.rewrite.*","config.ws_handshake.*","config.ws_client_frame.*","config.ws_upstream_frame.*","config.ws_close.*"].includes(n),component:Xe,propsOverrides:{multiline:!0,rows:3}}]}),AD=ze({experimental:!0,fieldRenderers:[{match:({genericPath:n})=>["config.access.*","config.body_filter.*","config.header_filter.*","config.certificate.*","config.functions.*","config.log.*","config.rewrite.*","config.ws_handshake.*","config.ws_client_frame.*","config.ws_upstream_frame.*","config.ws_close.*"].includes(n),component:Xe,propsOverrides:{multiline:!0,rows:3}}]}),vD=ze({experimental:!0}),ID=ze({experimental:!0,renderRules:{bundles:[["config.strategy","config.redis"]],dependencies:{"config.redis":["config.strategy","redis"]}},fieldRenderers:[{match:({path:n})=>n==="config.methods"||n==="config.request_method",component:Dt,propsOverrides:{multiple:!0}}]}),BD=ze({experimental:!0,fieldRenderers:[{match:({path:n})=>n==="config.methods"||n==="config.request_method",component:Dt,propsOverrides:{multiple:!0}}]}),TD={class:"rla-form-request-limits-subtitle"},OD={class:"rla-form-request-limits-content"},PD={class:"rla-form-window-type"},VD={class:"rla-form-request-limits-items"},$D={class:"rla-form-request-limits-row"},RD=["id"],LD={class:"rla-form-request-limits-actions"},DD={key:0,class:"rla-form-request-limits-examples"},MD={class:"rla-form-request-limits-examples-badges"},gp="config.window_type",jD=je(e.defineComponent({__name:"RequestLimitsForm",setup(n){var b;const{i18n:{t}}=Qe(),{formData:r,getSelectItems:o,getSchema:i}=pt(),a=e.computed(()=>{var k,C;const _=(C=(k=r.config)==null?void 0:k.limit)==null?void 0:C.map((N,E)=>{var w,S;return{limit:N,windowSize:(S=(w=r.config)==null?void 0:w.window_size)==null?void 0:S[E]}});return!Array.isArray(_)||_.length===0?[{limit:null,windowSize:null}]:_}),{getKey:s}=ql("request-limits",a),c=_=>{var k,C;f.value=void 0,r.config&&((k=r.config.limit)!=null&&k.length||(r.config.limit=[null]),(C=r.config.window_size)!=null&&C.length||(r.config.window_size=[null]),r.config.limit.splice(_+1,0,null),r.config.window_size.splice(_+1,0,null))},l=_=>{r.config&&(r.config.limit.splice(_,1),r.config.window_size.splice(_,1))},u=(b=i(gp))==null?void 0:b.default,p=e.computed(()=>Aa(r,gp)),d=e.computed(()=>o(gp).sort((_,k)=>_.value===u?-1:k.value===u?1:0)),f=e.ref(),m={fixed:[{label:t("sp.use_cases.fixed.hourly_500.label"),description:t("sp.use_cases.fixed.hourly_500.description"),config:{limit:500,window_size:3600}},{label:t("sp.use_cases.fixed.half_hourly_200.label"),description:t("sp.use_cases.fixed.half_hourly_200.description"),config:{limit:200,window_size:1800}},{label:t("sp.use_cases.fixed.daily_500.label"),description:t("sp.use_cases.fixed.daily_500.description"),config:{limit:500,window_size:86400}}],sliding:[{label:t("sp.use_cases.sliding.hourly_100.label"),description:t("sp.use_cases.sliding.hourly_100.description"),config:{limit:100,window_size:3600}},{label:t("sp.use_cases.sliding.half_hourly_300.label"),description:t("sp.use_cases.sliding.half_hourly_300.description"),config:{limit:300,window_size:1800}},{label:t("sp.use_cases.sliding.hourly_500.label"),description:t("sp.use_cases.sliding.hourly_500.description"),config:{limit:500,window_size:3600}}]},h=e.computed(()=>Object.prototype.hasOwnProperty.call(m,p.value)?m[p.value]:[]),y=(_,k)=>{if(k===f.value){e.nextTick(()=>{f.value=void 0}),r.config.limit=[],r.config.window_size=[];return}e.nextTick(()=>{f.value=k}),r.config.limit=[_.config.limit],r.config.window_size=[_.config.window_size]};return(_,k)=>{const C=e.resolveComponent("KLabel"),N=e.resolveComponent("KButton"),E=e.resolveComponent("KBadge"),w=e.resolveComponent("KTooltip"),S=e.resolveComponent("KCard");return e.openBlock(),e.createBlock(S,{class:"rla-form-request-limits"},{title:e.withCtx(()=>[e.createVNode(C,{class:"rla-form-request-limits-title",for:"rla-form-request-limits-legend",required:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("sp.request_limits.title")),1)]),_:1}),e.createElementVNode("div",TD,e.toDisplayString(e.unref(t)("sp.request_limits.subtitle")),1)]),default:e.withCtx(()=>[e.createElementVNode("div",OD,[e.createElementVNode("div",PD,[e.createVNode(dp,{items:d.value,label:e.unref(t)("sp.window_type.label"),name:"window_type","onUpdate:modelValue":k[0]||(k[0]=I=>f.value=void 0)},null,8,["items","label"])]),e.createElementVNode("div",VD,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(I,U)=>(e.openBlock(),e.createElementBlock("div",{key:e.unref(s)(I,U)},[e.createVNode(C,{for:`rla-form-request-limits-item-${U}-legend`},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("sp.request_limits.label_index",{index:U+1})),1)]),_:2},1032,["for"]),e.createElementVNode("div",$D,[e.createElementVNode("legend",{id:`rla-form-request-limits-item-${U}-legend`,class:"rla-form-request-limits-inputs"},[e.createVNode(Ht,{name:`$.config.limit.${U}`,placeholder:e.unref(t)("sp.request_limits.request_number")},null,8,["name","placeholder"]),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.interval_determiner")),1),e.createVNode(Ht,{name:`$.config.window_size.${U}`,placeholder:e.unref(t)("sp.request_limits.time_interval")},null,8,["name","placeholder"]),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.seconds")),1)],8,RD),e.createElementVNode("div",LD,[e.createVNode(N,{appearance:"tertiary",disabled:a.value.length<=1,onClick:()=>l(U)},{default:e.withCtx(()=>[e.createVNode(e.unref($e.RemoveIcon))]),_:1},8,["disabled","onClick"]),e.createVNode(N,{appearance:"tertiary",onClick:()=>c(U)},{default:e.withCtx(()=>[e.createVNode(e.unref($e.AddIcon))]),_:1},8,["onClick"])])])]))),128))]),h.value.length>0?(e.openBlock(),e.createElementBlock("div",DD,[e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.start_with_a_use_case")),1),e.createElementVNode("div",MD,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(I,U)=>(e.openBlock(),e.createBlock(w,{key:`use-case-${U}`,"max-width":"300"},{content:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(I.description),1),k[1]||(k[1]=e.createElementVNode("br",null,null,-1)),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.label"))+": "+e.toDisplayString(I.config.limit),1),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.time_interval"))+": "+e.toDisplayString(I.config.window_size),1)]),default:e.withCtx(()=>[e.createVNode(E,{appearance:f.value===`${p.value}-${U}`?"info":"decorative",class:"rla-form-request-limits-examples-badge",onClick:()=>y(I,`${p.value}-${U}`)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(I.label),1)]),_:2},1032,["appearance","onClick"])]),_:2},1024))),128))])])):e.createCommentVNode("",!0)])]),_:1})}}}),[["__scopeId","data-v-1fac872b"]]),FD={id:"rla-form-error-legend",class:"rla-form-error-inputs"},UD=je(e.defineComponent({__name:"ErrorMessageForm",setup(n){const{i18n:{t}}=Qe();return(r,o)=>{const i=e.resolveComponent("KLabel");return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(i,{for:"rla-form-error-legend",info:e.unref(t)("sp.error_message.help"),required:"","tooltip-attributes":{maxWidth:"300",placement:"top"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("sp.error_message.label")),1)]),_:1},8,["info"]),e.createElementVNode("legend",FD,[e.createVNode(Ht,{class:"input-error-code",label:"",name:"error_code",placeholder:e.unref(t)("sp.error_message.code_placeholder")},null,8,["placeholder"]),o[0]||(o[0]=e.createElementVNode("div",null,":",-1)),e.createVNode(Xe,{class:"input-error-message",label:"",name:"error_message",placeholder:e.unref(t)("sp.error_message.message_placeholder")},null,8,["placeholder"])])])}}}),[["__scopeId","data-v-7b36f1f7"]]),KD=e.defineComponent({__name:"RedisField",setup(n){const{formData:t}=pt(),r=e.inject(et.FORMS_CONFIG),o=e.inject(Pi),i=(o==null?void 0:o.isEditing)||!1,a=e.computed(()=>{if((r==null?void 0:r.app)!=="konnect")return!1;const s=r;return!!s.isKonnectManagedRedisEnabled&&s.isCloudGateway===!0});return e.watchEffect(()=>{t.config&&t.config.strategy!=="redis"&&(t.partials=i?null:void 0)}),(s,c)=>(e.openBlock(),e.createBlock(zl,null,{default:e.withCtx(()=>{var l;return[((l=e.unref(t).config)==null?void 0:l.strategy)==="redis"?(e.openBlock(),e.createBlock(ap,{key:0,"is-konnect-managed-redis-enabled":a.value},null,8,["is-konnect-managed-redis-enabled"])):e.createCommentVNode("",!0)]}),_:1}))}}),qD=e.defineComponent({__name:"ConfigForm",setup(n){const{getSchema:t}=pt();return(r,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(Ut,{"as-child":"",name:"config","reset-label-path":"reset"},{default:e.withCtx(()=>[e.createVNode(it,{name:"identifier"}),e.createVNode(jD),e.createVNode(UD)]),_:1}),e.createVNode(ts,{"hide-general-fields":""},{default:e.withCtx(()=>[e.createVNode(Dt,{multiple:!0,name:"config.compound_identifier"}),e.unref(t)("config.counter_key")?(e.openBlock(),e.createBlock(it,{key:0,name:"config.counter_key"})):e.createCommentVNode("",!0),e.createVNode(it,{name:"config.sync_rate"}),e.createVNode(it,{name:"config.namespace"}),e.createVNode(it,{name:"config.strategy"}),e.createVNode(KD),e.createVNode(it,{name:"config.dictionary_name"}),e.createVNode(it,{name:"config.lock_dictionary_name"}),e.createVNode(it,{name:"config.hide_client_headers"}),e.createVNode(it,{name:"config.retry_after_jitter_max"}),e.createVNode(it,{name:"config.header_name"}),e.createVNode(it,{name:"config.path"}),e.createVNode(it,{name:"config.throttling"}),e.createVNode(it,{name:"config.enforce_consumer_groups"}),e.createVNode(it,{name:"config.consumer_groups"}),e.createVNode(it,{name:"config.disable_penalty"})]),_:1})],64))}}),GD=ze({experimental:!0,component:e.defineComponent({__name:"RateLimitingAdvancedForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},configSections:{},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const t=n,r=e.useSlots();e.provide(et.AUTOFILL_SLOT,r==null?void 0:r[et.AUTOFILL_SLOT_NAME]);function o(i,a){var s;((s=i.config)==null?void 0:s.namespace)===null&&delete i.config.namespace,t.onFormChange(i,a)}return(i,a)=>(e.openBlock(),e.createBlock(er,e.mergeProps(t,{"on-form-change":o}),{default:e.withCtx(()=>[e.createVNode(qD)]),_:1},16))}})}),HD=ze({experimental:!0,renderRules:{bundles:[["config.policy","config.redis"]],dependencies:{"config.redis":["config.policy","redis"]}}}),zD=ze({experimental:!0}),WD="__request_callout_";function Vw(){return Nl(WD)}const rs="_callout_id",YD=e.defineComponent({__name:"CalloutForm",props:{index:{},fieldName:{}},setup(n){const t=n,{formData:r}=pt(),o=e.computed(()=>{const{callouts:s}=r.config;return s==null?[]:s.filter(({name:c})=>{var l;return c&&c!==((l=s[t.index])==null?void 0:l.name)})}),i=e.computed(()=>o.value.map(({[rs]:s,name:c})=>({value:s,label:c}))),a=e.computed(()=>r.config.callouts[t.index]);return e.watch(i,()=>{a.value.depends_on=a.value.depends_on.filter(s=>i.value.some(c=>c.value===s))}),(s,c)=>(e.openBlock(),e.createBlock(Ut,{name:n.fieldName},{depends_on:e.withCtx(l=>[e.createVNode(Dt,e.mergeProps(l,{items:i.value,multiple:"",required:!1}),null,16,["items"])]),request:e.withCtx(l=>[e.createVNode(Ut,e.mergeProps(l,{"fields-order":["url","method","headers","query","body","http_opts","error","by_lua"]}),{method:e.withCtx(u=>[e.createVNode(Dt,e.mergeProps(u,{items:e.unref(gf)(["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS","CONNECT","TRACE"])}),null,16,["items"])]),_:1},16)]),_:1},8,["name"]))}}),JD=e.defineComponent({__name:"CalloutsForm",setup(n){const{formData:t}=pt();function r(){const o=t.config.callouts[t.config.callouts.length-1];o&&(o[rs]=Vw())}return(o,i)=>(e.openBlock(),e.createBlock(zt,{appearance:"tabs","item-label":a=>a.name||"New callout",name:"callouts",required:"","sticky-tabs":"",onAdd:r},{item:e.withCtx(({index:a,fieldName:s})=>[e.createVNode(YD,{"field-name":s,index:a},null,8,["field-name","index"])]),_:1},8,["item-label"]))}}),XD=e.defineComponent({__name:"ConfigForm",setup(n){return(t,r)=>(e.openBlock(),e.createBlock(Ut,{"as-child":"",name:"config","reset-label-path":"reset"},{default:e.withCtx(()=>[e.createVNode(JD),e.createVNode(Ut,{appearance:"card","fields-order":["headers","query","body","by_lua"],name:"upstream"}),e.createVNode(Ut,{appearance:"card",name:"cache"},{redis:e.withCtx(o=>[e.createVNode(Ut,e.mergeProps(o,{"fields-order":["host","port","connection_is_proxied","database","username","password","sentinel_master","sentinel_role","sentinel_nodes","sentinel_username","sentinel_password","cluster_nodes","cluster_max_redirections","ssl","ssl_verify","server_name","keepalive_backlog","keepalive_pool_size","read_timeout","send_timeout","connect_timeout"]}),null,16)]),_:2},1024)]),_:1}))}}),ZD=ze({component:je(e.defineComponent({__name:"RequestCalloutForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},configSections:{},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const t=n,r=e.useSlots();e.provide(et.AUTOFILL_SLOT,r==null?void 0:r[et.AUTOFILL_SLOT_NAME]);const{i18n:{t:o}}=Qe();function i(l,u=!1){return l.reduce((p,{[rs]:d,name:f})=>(u?p[f]=d:p[d]=f,p),{})}function a(l){var p;const u=Ia(l);if((p=u.config)!=null&&p.callouts){const{callouts:d}=u.config;d.forEach(m=>{m.request.body.custom=m.request.body.custom??{},m[rs]=Vw()});const f=i(d,!0);d.forEach(m=>{m.depends_on=m.depends_on.map(h=>f[h])})}return u}const s={hasValue:l=>!!l&&Object.keys(l).length>0,prepareFormData:a};function c(l,u){var f;if(!l)return;const p=Ia(l);if(!((f=p.config)!=null&&f.callouts)){t.onFormChange(p,u);return}const d=i(p.config.callouts);p.config.callouts=p.config.callouts.map(m=>{const{[rs]:h,depends_on:y,...b}=m;return{depends_on:y.map(_=>d[_]).filter(_=>_!=null),...b}}),t.onFormChange(p,u)}return(l,u)=>(e.openBlock(),e.createBlock(er,e.mergeProps(t,{"form-config":s,"on-form-change":c}),{"field-renderers":e.withCtx(()=>[e.createVNode(Rt,{match:({path:p})=>p.endsWith("by_lua")},{default:e.withCtx(p=>[e.createVNode(Xe,e.mergeProps(p,{autosize:"",class:"rc-code",multiline:"",placeholder:e.unref(o)("plugins.free-form.request-callout.by_lua_placeholder")}),null,16,["placeholder"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:p})=>["cluster_nodes","sentinel_nodes"].some(d=>p.endsWith(d))},{default:e.withCtx(p=>[e.createVNode(zt,e.mergeProps(p,{appearance:"card"}),null,16)]),_:1},8,["match"])]),default:e.withCtx(()=>[e.createVNode(XD)]),_:1},16))}}),[["__scopeId","data-v-dc955662"]])}),QD=ze({experimental:!0}),eM=ze({experimental:!0}),tM=ze({experimental:!0}),nM=ze({experimental:!0}),rM=ze({experimental:!0,fieldRenderers:[{match:"config.parameter_schema",component:zt,propsOverrides:{appearance:"tabs",itemLabel:(n,t)=>`#${t+1} Parameter schema`}},{match:"config.body_schema",component:Xe,propsOverrides:{multiline:!0,rows:4}},{match:"config.parameter_schema.*.schema",component:Xe,propsOverrides:{multiline:!0,rows:4}}]}),oM=ze({experimental:!0,renderRules:{bundles:[["config.policy","config.redis"]],dependencies:{"config.redis":["config.policy","redis"]}}}),iM=ze({experimental:!0,fieldRenderers:[{match:({path:n,genericPath:t})=>n==="config.replace.body"||t==="config.transform.functions.*"||t.endsWith(".json.*"),component:Xe,propsOverrides:{multiline:!0,rows:3}}]}),aM=ze({experimental:!0,fieldRenderers:[{match:({genericPath:n})=>n.endsWith(".json.*"),component:Xe,propsOverrides:{multiline:!0,rows:3}}]}),sM=ze({experimental:!0,fieldRenderers:[{match:"config.rules",component:zt,propsOverrides:{appearance:"tabs",itemLabel:(n,t)=>`#${t+1} Rule`}}]}),lM=ze({experimental:!0}),cM={class:"sp-form-request-limits-subtitle"},uM={class:"sp-form-request-limits-content"},dM={class:"sp-form-window-type"},fM={class:"sp-form-request-limits-items"},pM={class:"sp-form-request-limits-row"},mM=["id"],gM={class:"sp-form-request-limits-actions"},hM={key:0,class:"sp-form-request-limits-examples"},yM={class:"sp-form-request-limits-examples-badges"},hp="config.window_type",_M=je(e.defineComponent({__name:"RequestLimitsForm",setup(n){var b;const{t}=jt.createI18n("en-us",Jt),{formData:r,getSelectItems:o,getSchema:i}=pt(),a=e.computed(()=>{var k,C;const _=(C=(k=r.config)==null?void 0:k.limit)==null?void 0:C.map((N,E)=>{var w,S;return{limit:N,windowSize:(S=(w=r.config)==null?void 0:w.window_size)==null?void 0:S[E]}});return!Array.isArray(_)||_.length===0?[{limit:null,windowSize:null}]:_}),{getKey:s}=ql("request-limits",a),c=_=>{var k,C;f.value=void 0,r.config&&((k=r.config.limit)!=null&&k.length||(r.config.limit=[null]),(C=r.config.window_size)!=null&&C.length||(r.config.window_size=[null]),r.config.limit.splice(_+1,0,null),r.config.window_size.splice(_+1,0,null))},l=_=>{r.config&&(r.config.limit.splice(_,1),r.config.window_size.splice(_,1))},u=(b=i(hp))==null?void 0:b.default,p=e.computed(()=>Aa(r,hp)),d=e.computed(()=>o(hp).sort((_,k)=>_.value===u?-1:k.value===u?1:0)),f=e.ref(),m={fixed:[{label:t("sp.use_cases.fixed.hourly_500.label"),description:t("sp.use_cases.fixed.hourly_500.description"),config:{limit:500,window_size:3600}},{label:t("sp.use_cases.fixed.half_hourly_200.label"),description:t("sp.use_cases.fixed.half_hourly_200.description"),config:{limit:200,window_size:1800}},{label:t("sp.use_cases.fixed.daily_500.label"),description:t("sp.use_cases.fixed.daily_500.description"),config:{limit:500,window_size:86400}}],sliding:[{label:t("sp.use_cases.sliding.hourly_100.label"),description:t("sp.use_cases.sliding.hourly_100.description"),config:{limit:100,window_size:3600}},{label:t("sp.use_cases.sliding.half_hourly_300.label"),description:t("sp.use_cases.sliding.half_hourly_300.description"),config:{limit:300,window_size:1800}},{label:t("sp.use_cases.sliding.hourly_500.label"),description:t("sp.use_cases.sliding.hourly_500.description"),config:{limit:500,window_size:3600}}]},h=e.computed(()=>Object.prototype.hasOwnProperty.call(m,p.value)?m[p.value]:[]),y=(_,k)=>{if(k===f.value){e.nextTick(()=>{f.value=void 0}),r.config.limit=[],r.config.window_size=[];return}e.nextTick(()=>{f.value=k}),r.config.limit=[_.config.limit],r.config.window_size=[_.config.window_size]};return(_,k)=>{const C=e.resolveComponent("KLabel"),N=e.resolveComponent("KButton"),E=e.resolveComponent("KBadge"),w=e.resolveComponent("KTooltip"),S=e.resolveComponent("KCard");return e.openBlock(),e.createBlock(S,{class:"sp-form-request-limits"},{title:e.withCtx(()=>[e.createVNode(C,{class:"sp-form-request-limits-title",for:"sp-form-request-limits-legend",required:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("sp.request_limits.title")),1)]),_:1}),e.createElementVNode("div",cM,e.toDisplayString(e.unref(t)("sp.request_limits.subtitle")),1)]),default:e.withCtx(()=>[e.createElementVNode("div",uM,[e.createElementVNode("div",dM,[e.createVNode(dp,{items:d.value,label:e.unref(t)("sp.window_type.label"),name:"window_type","onUpdate:modelValue":k[0]||(k[0]=I=>f.value=void 0)},null,8,["items","label"])]),e.createElementVNode("div",fM,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(I,U)=>(e.openBlock(),e.createElementBlock("div",{key:e.unref(s)(I,U)},[e.createVNode(C,{for:`sp-form-request-limits-item-${U}-legend`},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("sp.request_limits.label_index",{index:U+1})),1)]),_:2},1032,["for"]),e.createElementVNode("div",pM,[e.createElementVNode("legend",{id:`sp-form-request-limits-item-${U}-legend`,class:"sp-form-request-limits-inputs"},[e.createVNode(Ht,{name:`$.config.limit.${U}`,placeholder:e.unref(t)("sp.request_limits.request_number")},null,8,["name","placeholder"]),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.interval_determiner")),1),e.createVNode(Ht,{name:`$.config.window_size.${U}`,placeholder:e.unref(t)("sp.request_limits.time_interval")},null,8,["name","placeholder"]),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.seconds")),1)],8,mM),e.createElementVNode("div",gM,[e.createVNode(N,{appearance:"tertiary",disabled:a.value.length<=1,onClick:()=>l(U)},{default:e.withCtx(()=>[e.createVNode(e.unref($e.RemoveIcon))]),_:1},8,["disabled","onClick"]),e.createVNode(N,{appearance:"tertiary",onClick:()=>c(U)},{default:e.withCtx(()=>[e.createVNode(e.unref($e.AddIcon))]),_:1},8,["onClick"])])])]))),128))]),h.value.length>0?(e.openBlock(),e.createElementBlock("div",hM,[e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.start_with_a_use_case")),1),e.createElementVNode("div",yM,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(I,U)=>(e.openBlock(),e.createBlock(w,{key:`use-case-${U}`,"max-width":"300"},{content:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(I.description),1),k[1]||(k[1]=e.createElementVNode("br",null,null,-1)),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.label"))+": "+e.toDisplayString(I.config.limit),1),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.time_interval"))+": "+e.toDisplayString(I.config.window_size),1)]),default:e.withCtx(()=>[e.createVNode(E,{appearance:f.value===`${p.value}-${U}`?"info":"decorative",class:"sp-form-request-limits-examples-badge",onClick:()=>y(I,`${p.value}-${U}`)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(I.label),1)]),_:2},1032,["appearance","onClick"])]),_:2},1024))),128))])])):e.createCommentVNode("",!0)])]),_:1})}}}),[["__scopeId","data-v-e12d9c9f"]]),bM={id:"sp-form-error-legend",class:"sp-form-error-inputs"},wM=je(e.defineComponent({__name:"ErrorMessageForm",setup(n){const{t}=jt.createI18n("en-us",Jt);return(r,o)=>{const i=e.resolveComponent("KLabel");return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(i,{for:"sp-form-error-legend",info:e.unref(t)("sp.error_message.help"),required:"","tooltip-attributes":{maxWidth:"300",placement:"top"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("sp.error_message.label")),1)]),_:1},8,["info"]),e.createElementVNode("legend",bM,[e.createVNode(Ht,{class:"input-error-code",label:"",name:"error_code",placeholder:e.unref(t)("sp.error_message.code_placeholder")},null,8,["placeholder"]),o[0]||(o[0]=e.createElementVNode("div",null,":",-1)),e.createVNode(Xe,{class:"input-error-message",label:"",name:"error_message",placeholder:e.unref(t)("sp.error_message.message_placeholder")},null,8,["placeholder"])])])}}}),[["__scopeId","data-v-0796e152"]]),kM=e.defineComponent({__name:"RedisField",setup(n){const{formData:t}=pt(),r=e.inject(et.FORMS_CONFIG),o=e.inject(Pi),i=(o==null?void 0:o.isEditing)||!1,a=e.computed(()=>{if((r==null?void 0:r.app)!=="konnect")return!1;const s=r;return!!s.isKonnectManagedRedisEnabled&&s.isCloudGateway===!0});return e.watchEffect(()=>{t.config&&t.config.strategy!=="redis"&&(t.partials=i?null:void 0)}),(s,c)=>(e.openBlock(),e.createBlock(zl,null,{default:e.withCtx(()=>{var l;return[((l=e.unref(t).config)==null?void 0:l.strategy)==="redis"?(e.openBlock(),e.createBlock(ap,{key:0,"is-konnect-managed-redis-enabled":a.value},null,8,["is-konnect-managed-redis-enabled"])):e.createCommentVNode("",!0)]}),_:1}))}}),CM=e.defineComponent({__name:"ConfigForm",setup(n){return(t,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(Ut,{"as-child":"",name:"config","reset-label-path":"reset"},{default:e.withCtx(()=>[e.createVNode(_M),e.createVNode(wM)]),_:1}),e.createVNode(ts,{"hide-general-fields":""},{default:e.withCtx(()=>[e.createVNode(it,{name:"config.dictionary_name"}),e.createVNode(it,{name:"config.lock_dictionary_name"}),e.createVNode(it,{name:"config.strategy"}),e.createVNode(kM),e.createVNode(it,{name:"config.namespace"}),e.createVNode(it,{name:"config.hide_client_headers"}),e.createVNode(it,{name:"config.disable_penalty"}),e.createVNode(it,{name:"config.retry_after_jitter_max"}),e.createVNode(it,{name:"config.sync_rate"})]),_:1})],64))}}),EM=ze({experimental:!0,component:e.defineComponent({__name:"ServiceProtectionForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},configSections:{},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const t=n,r=e.useSlots();e.provide(et.AUTOFILL_SLOT,r==null?void 0:r[et.AUTOFILL_SLOT_NAME]);function o(i,a){var s;((s=i.config)==null?void 0:s.namespace)===null&&delete i.config.namespace,t.onFormChange(i,a)}return(i,a)=>(e.openBlock(),e.createBlock(er,e.mergeProps(t,{"on-form-change":o}),{default:e.withCtx(()=>[e.createVNode(CM)]),_:1},16))}})}),NM=ze({experimental:!0}),SM=ze({experimental:!0,fieldRenderers:[{match:({genericPath:n})=>n==="config.flow.functions.*",component:Xe,propsOverrides:{multiline:!0,rows:3}}]}),xM=ze({experimental:!0,fieldRenderers:[{match:"config.message.custom_fields_by_lua",component:pr,propsOverrides:{appearance:{string:{multiline:!0}}}}]}),AM=ze({experimental:!0,fieldRenderers:[{match:"config.message.functions.*",component:Xe,propsOverrides:{multiline:!0,rows:3}}]}),vM=ze({experimental:!0,renderRules:{bundles:[["config.cache.strategy","config.cache.redis"]],dependencies:{"config.cache.redis":["config.cache.strategy","redis"]}},fieldRenderers:[{match:"config.behavior.idp_error_response_body_template",component:Xe,propsOverrides:{multiline:!0,rows:4}}]}),IM=Object.assign({"../plugins/acl/index.ts":t$,"../plugins/ai-custom-guardrail.ts":n$,"../plugins/ai-mcp-proxy/index.ts":r$,"../plugins/ai-prompt-decorator.ts":o$,"../plugins/ai-prompt-guard.ts":i$,"../plugins/ai-prompt-template.ts":a$,"../plugins/ai-proxy-advanced.ts":s$,"../plugins/ai-proxy.ts":l$,"../plugins/ai-rate-limiting-advanced.ts":c$,"../plugins/ai-request-transformer.ts":u$,"../plugins/ai-response-transformer.ts":d$,"../plugins/ai-semantic-cache.ts":f$,"../plugins/ai-semantic-prompt-guard.ts":p$,"../plugins/aws-lambda.ts":m$,"../plugins/basic-auth/index.ts":x$,"../plugins/bot-detection.ts":A$,"../plugins/canary.ts":v$,"../plugins/confluent-consume.ts":I$,"../plugins/confluent.ts":B$,"../plugins/correlation-id.ts":T$,"../plugins/cors.ts":O$,"../plugins/datakit/index.ts":XL,"../plugins/exit-transformer.ts":ZL,"../plugins/file-log.ts":QL,"../plugins/graphql-rate-limiting-advanced.ts":eD,"../plugins/header-cert-auth.ts":tD,"../plugins/http-log.ts":nD,"../plugins/ip-restriction.ts":rD,"../plugins/jwe-decrypt.ts":oD,"../plugins/jwt-signer/index.ts":iD,"../plugins/jwt.ts":aD,"../plugins/kafka-consume.ts":sD,"../plugins/kafka-log.ts":lD,"../plugins/kafka-upstream.ts":cD,"../plugins/key-auth/index.ts":uD,"../plugins/metering-and-billing/index.ts":wD,"../plugins/mocking.ts":kD,"../plugins/mtls-auth.ts":CD,"../plugins/oas-validation.ts":ED,"../plugins/oauth2.ts":ND,"../plugins/opentelemetry.ts":SD,"../plugins/post-function.ts":xD,"../plugins/pre-function.ts":AD,"../plugins/prometheus.ts":vD,"../plugins/proxy-cache-advanced.ts":ID,"../plugins/proxy-cache.ts":BD,"../plugins/rate-limiting-advanced/index.ts":GD,"../plugins/rate-limiting.ts":HD,"../plugins/redirect.ts":zD,"../plugins/request-callout/index.ts":ZD,"../plugins/request-size-limiting.ts":QD,"../plugins/request-termination.ts":eM,"../plugins/request-transformer-advanced.ts":tM,"../plugins/request-transformer.ts":nM,"../plugins/request-validator.ts":rM,"../plugins/response-ratelimiting.ts":oM,"../plugins/response-transformer-advanced.ts":iM,"../plugins/response-transformer.ts":aM,"../plugins/route-by-header.ts":sM,"../plugins/route-transformer-advanced.ts":lM,"../plugins/service-protection/index.ts":EM,"../plugins/session.ts":NM,"../plugins/solace-consume.ts":SM,"../plugins/solace-log.ts":xM,"../plugins/solace-upstream.ts":AM,"../plugins/upstream-oauth.ts":vM});function BM(n){const t=n.match(/\.\.\/plugins\/(.+?)(?:\/index)?\.ts$/);if(!t)throw new Error(`Unable to derive plugin name from path: ${n}`);const[,r]=t;return r}function TM(n){const t={},r=new Map;for(const[o,i]of Object.entries(n)){const a=BM(o);if(r.has(a))throw new Error(`Duplicate plugin config for "${a}": ${r.get(a)} and ${o}`);r.set(a,o),t[a]={...i,component:i.component,experimental:i.experimental??!1,fieldRenderers:i.fieldRenderers??[]}}return t}const yp=TM(IM);function $w(n){return yp[n]}function Rw(n,t){const r=$w(n);if(r&&!(r.experimental&&!t.includes(n)))return r.component}function Lw(n,t,r){return r==="freeform"?!0:r==="vfg"?!1:!!Rw(n,t)}function OM(){return Object.entries(yp).filter(([,n])=>n.experimental).map(([n])=>n).sort((n,t)=>n.localeCompare(t))}function _p(){return e.inject(Yd,[])}function PM(n){const t=new Set(OM()),r=n.filter(i=>t.has(i)),o=n.filter(i=>!t.has(i));return o.length>0&&console.warn(`[entities-plugins] Ignoring unknown experimental free-form plugins: ${o.join(", ")}`),r}function VM(n){e.provide(Yd,PM(n))}function $M(){const n=_p();return{shouldUseFreeForm:(t,r)=>Lw(t,n,r),getFreeFormComponent:t=>Rw(t,n)}}function Dw(n){var o,i;if(!n)return;if(!n.token_exchange)return n;if((Array.isArray((o=n.token_exchange.request)==null?void 0:o.audience)&&n.token_exchange.request.audience.length===0||n.token_exchange.request&&!n.token_exchange.request.audience)&&(n.token_exchange.request.audience=null),(Array.isArray((i=n.token_exchange.request)==null?void 0:i.scopes)&&n.token_exchange.request.scopes.length===0||n.token_exchange.request&&!n.token_exchange.request.scopes)&&(n.token_exchange.request.scopes=null),[{cache:{enabled:!0},request:{audience:null,scopes:null,empty_audience:!1,empty_scopes:!1},subject_token_issuers:null},{cache:{enabled:!0},request:{audience:null,scopes:null,empty_audience:!1,empty_scopes:!1}},{cache:{},request:{audience:null,scopes:null}}].some(a=>Xt(n.token_exchange,a)))return n.token_exchange=null,n;const r=n.token_exchange.subject_token_issuers;return r&&r.forEach(a=>{Xt(a.conditions,{})&&(a.conditions=null),a.conditions&&Object.values(a.conditions).every(s=>Array.isArray(s)&&s.length===0)&&(a.conditions=null)}),n}const Mw=n=>{const t=n==null?void 0:n.proof_of_possession_mtls_from_header;if(!t)return;if(!Array.isArray(t.ca_certificates)||t.ca_certificates.length===0){n.proof_of_possession_mtls_from_header=null;return}Xt(t,{allow_partial_chain:!1,cert_cache_ttl:6e4,certificate_header_format:"url_encoded",http_timeout:3e4,revocation_check_mode:"IGNORE_CA_ERROR",secure_source:!0,ssl_verify:!0})&&(n.proof_of_possession_mtls_from_header=null)},jw=n=>{const t=n==null?void 0:n.protected_resource_metadata;if(!t)return;if(!Array.isArray(t.authorization_servers)||t.authorization_servers.length===0){n.protected_resource_metadata=null;return}if(Xt(t,{authorization_servers:null,scopes_supported:null})){n.protected_resource_metadata=null;return}},RM={shamefullyTransformPayload(n){return Dw(n.payload.config),Mw(n.payload.config),jw(n.payload.config),n}},LM={shamefullyTransformPayload(n){var t,r,o,i,a;if(!((r=(t=n.payload.config)==null?void 0:t.access_logs)!=null&&r.custom_attributes_by_lua))return n;if(Xt((i=(o=n.payload.config)==null?void 0:o.access_logs)==null?void 0:i.custom_attributes_by_lua,{})){const s=(a=n.payload.config)==null?void 0:a.access_logs;s&&(s.custom_attributes_by_lua=null)}return n}},DM={shamefullyTransformPayload(n){var r,o;const t=(o=(r=n.payload.config)==null?void 0:r.v2_strategies)==null?void 0:o.openid_connect;return Array.isArray(t)&&t.forEach(i=>{Dw(i.config),Mw(i.config),jw(i.config)}),n}},MM={shamefullyTransformPayload(n){var r;return!n.payload.config||!((r=n.payload.config)!=null&&r.token_exchange)||[{cache:{enabled:!0,ttl:3600},client_auth:"client_secret_basic",enabled:!1,request:{actor_token_source:"none",actor_token_type:"urn:ietf:params:oauth:token-type:access_token",audience:null,requested_token_type:"urn:ietf:params:oauth:token-type:access_token",scopes:null,subject_token_type:"urn:ietf:params:oauth:token-type:access_token"}}].some(o=>{var i;return Xt((i=n.payload.config)==null?void 0:i.token_exchange,o)})&&(n.payload.config.token_exchange=null),n}},jM=(n,t)=>{const r=n.model.startsWith("config-"),o=t.model.startsWith("config-");return r&&!o?1:!r&&o?-1:0},Fw=(n,t)=>(n.order??0)-(t.order??0),Uw=(n,t)=>jM(n,t)||Fw(n,t)||n.model.localeCompare(t.model),FM=n=>{const{capitalize:t}=Ie.useStringHelpers(),{convertToDotNotation:r}=l_(),{i18n:{t:o}}=Qe(),i=_p(),a={"application-registration":{overwriteDefault:!0,formSchema:{...bT}},datadog:{...wT},"exit-transformer":{...kT},"upstream-tls":{"config-trusted_certificates":{type:"textArea",valueType:"array",rows:4,help:"A comma separated list of certificate values"}},statsd:{...VT},"statsd-advanced":{...$T},"route-by-header":{...BT},"ai-prompt-decorator":{...mT},"ai-prompt-template":{...gT},"ai-proxy-advanced":{...hT},"ai-rag-injector":{...yT},"ai-llm-as-judge":{..._T},"vault-auth":{...LT},"oas-validation":{...ST},mocking:{...NT},"rate-limiting":{...Ul},"rate-limiting-advanced":(n==null?void 0:n.app)==="kongManager"?{"config-consumer_groups":Ul["config-consumer_groups"]}:{...Ul},"graphql-rate-limiting-advanced":{...CT},"injection-protection":{...ET},"response-ratelimiting":{...Ul},"pre-function":{...__},"post-function":{...__},"request-transformer-advanced":{...vT},"response-transformer":{...b_},"response-transformer-advanced":{...IT},zipkin:{...HT},"upstream-oauth":{...RT},saml:{...TT},"kafka-upstream":{...FT},"solace-consume":{...OT},"solace-upstream":{...PT},"key-auth":iT(n),"key-auth-enc":dT(n),confluent:{...UT},"confluent-consume":{...KT},"kafka-consume":{...qT},"kafka-log":{...GT},"openid-connect":{...RM},opentelemetry:{...LM},"konnect-application-auth":{...DM},"ai-mcp-oauth2":{...MM}},s=()=>["created_at","updated_at","id","_isCustomPlugin","_sourcePlugin","_supported_redis_partial_type","_redis_partial_path"],c=(w,S,I,U)=>{let x={};(S||w)&&(x=S||(w.fields?w.fields:w));const A=s().concat(w.blacklist?w.blacklist:[]),T=Object.keys(x).filter(Z=>!A.includes(Z)),V=T.indexOf("comparator");V>-1&&T.splice(V,1);let R={fields:[]};const X={};T.forEach(Z=>{u(x[Z],Z,x,X,R,I)});const Y=X.name,ne=w._sourcePlugin||Y,M=Rn[ne],te=[],$=Z=>{const F=["cluster-cache"];for(const J of F)if(Z.model.includes(J))return!1;return new RegExp("(?<=-redis-).*").test(Z.model)};if(R._supported_redis_partial_type=w._supported_redis_partial_type,R._redis_partial_path=w._redis_partial_path,et.getSharedFormName(ne)||Lw(ne,i,U)||M!=null&&M.useLegacyForm||n!=null&&n.credential){if(M!=null&&M.useLegacyForm&&(n!=null&&n.enableRedisPartial)&&w._supported_redis_partial_type){for(const Z of R.fields)if($(Z)){te.push(Z);continue}R.fields=R.fields.filter(Z=>!$(Z)),te.length&&R.fields.push({id:"_redis",fields:te,model:"__redis_partial",pluginType:w._isCustomPlugin?"custom":"bundled",redisType:w._supported_redis_partial_type,redisPath:w._redis_partial_path})}R.fields.sort((Z,F)=>(Z.order=Z.order||0,F.order=F.order||0,Z.order-F.order))}else{const Z=[],F=[],J=[],G=[],v={};if(M!=null&&M.fieldRules){const oe=[...M.fieldRules.atLeastOneOf??[],...M.fieldRules.onlyOneOf??[],...M.fieldRules.mutuallyRequired??[]];if(M.fieldRules.onlyOneOfMutuallyRequired)for(const ke of M.fieldRules.onlyOneOfMutuallyRequired)oe.push(...ke);for(const ke of oe)for(const ye of ke)v[ye.replace(/-/g,"_").replace(/\./g,"-")]=!1}for(const oe of R.fields){if(n!=null&&n.enableRedisPartial&&w._supported_redis_partial_type&&$(oe)){G.push(oe);continue}if(oe.pinned){Z.push(oe);continue}if(oe.required||v[oe.model]!==void 0){v[oe.model]===!1&&(v[oe.model]=!0),F.push(oe);continue}J.push(oe)}G.length&&J.push({id:"_redis",fields:G,model:"__redis_partial",pluginType:w._isCustomPlugin?"custom":"bundled",redisType:w._supported_redis_partial_type,redisPath:w._redis_partial_path,order:-1});const q=Object.entries(v).filter(([,oe])=>!oe).map(([oe])=>oe.replace(/-/g,".").replace(/_/g,"-"));q.length>0&&console.warn(`Unknown checked fields for plugin ${Y}: ${q.join(", ")}`);const ie=[];Z.length>0&&ie.push({fields:Z.sort(Fw)}),(F.length>0||J.length>0)&&ie.push({fields:F.sort(Uw),collapsible:{title:o("plugins.form.grouping.plugin_configuration.title"),description:o("plugins.form.grouping.plugin_configuration.description"),nestedCollapsible:{fields:J.sort(Uw),triggerLabel:{expand:o("plugins.form.grouping.advanced_parameters.view"),collapse:o("plugins.form.grouping.advanced_parameters.hide")}}},slots:{beforeContent:"plugin-config-before-content",emptyState:"plugin-config-empty-state"}}),R={groups:ie}}return{schema:R,model:X,options:{noneSelectedText:"Nothing Selected...",helpAsHtml:!0}}},l=w=>Array.isArray(w.default)||w.default!=null&&typeof w.default!="object"&&w.default!=="function",u=(w,S,I,U,x,A)=>{const T=l(w);return U[S]=T?w.default:null,w.id=S,w.model=S,w.fields&&w.type==="record"?d(w,S,I,U,x,A):(I[S]=w,N(w,U),A&&A[S]&&p(I[S],A[S]),x.fields.push(w)),I},p=(w,S)=>(S&&(Object.assign(w,S),S.label&&(w.label=S.label)),w),d=(w,S,I,U,x,A)=>{w.fields.forEach(T=>{Object.keys(T).forEach(V=>{const R=T[V];I=u(R,S+"-"+V,I,U,x,A)})})},f=(w,S)=>{w.type="input",w.inputType="hidden",w.styleClasses="kong-form-hidden-field-wrapper";const I=n==null?void 0:n.entityId;S[w.model]=I?{id:I}:null},m=w=>{w.type="input",w.inputType="number",w.between&&w.between.length===2&&(w.min=w.between[0],w.max=w.between[1])},h=w=>{Object.prototype.hasOwnProperty.call(w,"one_of")?(w.type="select",w.values=w.one_of,w.selectOptions={hideNoneSelectedText:!0}):(w.type="input",w.inputType="text")},y=w=>{w.type="checkbox",w.default=!0,w.required=!1},b=w=>{if(w.type="object-advanced",w.values.type==="array"){const{type:S}=w.values.elements||{};w.schema={fields:[{schema:{fields:[{...ft,model:w.model,valueArrayType:S==="integer"?"number":S||"string",inputAttributes:{...ft.inputAttributes,type:S==="integer"?"number":"text",inputMode:S==="integer"?"numeric":"text"}}]}}]}}else w.values.fields&&(w.schema={fields:[{type:"object",model:"object",schema:{fields:w.values.fields.map(S=>{const I=Object.keys(S)[0];return{model:I,type:"input",label:t(I),placeholder:I,inputType:S[I].type}})}}]})},_=w=>w.fields.reduce((S,I)=>(I.fields&&I.fields.forEach(U=>{S[U.model]=U}),I.model&&(S[I.model]=I),S),{}),k=(w,S)=>{if(!et.customFields.includes(w.model))return;const I=_(w);et.customFields.forEach(U=>{Object.keys(I).forEach(x=>{const A=l(I[x]);S[x]=A?I[x].default:null}),delete S[U]})},C=(w,S)=>w.inputType==="hidden"?"":r(w.label||S.replace(/_/g," ")),N=(w,S)=>{switch(k(w,S),w.type){case"foreign":f(w,S);break;case"number":m(w),w.attributes={step:"any"};break;case"integer":m(w);break;case"string":h(w);break;case"boolean":y(w);break;case"map":b(w);break}w.inputType==="foreign"&&f(w,S),w.label=C(w,w.model)};function E(w,S){if(S==null||S.type&&S.type!=="record"||typeof w!="object"||w==null)return w;const I={};for(const U of S.fields){const x=Object.keys(U)[0],A=U[x];A.type==="record"?I[x]=E(w[x],A):A.type==="array"&&Array.isArray(w[x])&&A.elements.type==="record"?I[x]=w[x].map(T=>E(T,A.elements)):I[x]=w[x]}return I}return{buildFormSchema:u,parseSchema:c,customSchemas:a,typedefs:di,pruneRecord:E}},wc=Symbol("customPluginType"),UM=1e3,KM=20,Kw=5e3,qw=(n,t=UM)=>{const r=/^[a-z][a-z\d+.-]*:/i.test(n),o=new URL(n,"http://localhost");return o.searchParams.has("size")||o.searchParams.set("size",`${t}`),r?o.toString():`${o.pathname}${o.search}${o.hash}`},kc=async(n,t,r)=>{const o=[];let i=qw(t),a=null,s=0;for(;i&&s<KM&&o.length<Kw&&i!==a;){a=i;const l=(await n.get(i,{signal:r})).data;Array.isArray(l==null?void 0:l.data)&&o.push(...l.data),i=l!=null&&l.next?qw(l.next):null,s+=1}return o.slice(0,Kw)};function qM(n){const{axiosInstance:t,apiBaseUrl:r}=n,o=()=>{if(n.app!=="konnect")throw new Error("Installed custom plugin APIs are only available for Konnect")},i=(b,_)=>{let k=`${r}${b}`;return n.app==="konnect"&&(k=k.replace(/{controlPlaneId}/gi,n.controlPlaneId)),k=k.replace(/{pluginId}/gi,_??"").replace(/\/{workspace}/gi,n.workspace?`/${n.workspace}`:""),k},a=async b=>{o();const _=i(tt.customPlugin.konnect.installed.edit,b),{data:k}=await t.get(_);return k},s=async b=>{o();const _=i(tt.customPlugin.konnect.installed.create),{data:k}=await t.post(_,b);return k},c=async(b,_)=>{o();const k=i(tt.customPlugin.konnect.installed.edit,b),{data:C}=await t.put(k,_);return C},l=async b=>{const _=i(tt.customPlugin[n.app].streamed.edit,b),{data:k}=await t.get(_);return k},u=async b=>{const _=i(tt.customPlugin[n.app].streamed.create),{data:k}=await t.post(_,b);return k},p=async(b,_)=>{const k=i(tt.customPlugin[n.app].streamed.edit,b),C=n.app==="konnect"?"put":"patch",{data:N}=await t[C](k,_);return N},d=async b=>{const{aliasName:_,priority:k,sourcePlugin:C}=b,N=i(tt.customPlugin[n.app].cloned.create),{data:E}=await t.post(N,{name:_,ref:C,priority:k});return E},f=async(b,_)=>{const{aliasName:k,priority:C,sourcePlugin:N}=_,E=i(tt.customPlugin[n.app].cloned.edit,b),w=n.app==="konnect"?"put":"patch",{data:S}=await t[w](E,{ref:N,priority:C,name:k});return S},m=async b=>{const _=i(tt.customPlugin[n.app].cloned.edit,b),{data:k}=await t.get(_);return k};return{getInstalledPlugin:a,createInstalledPlugin:s,updateInstalledPlugin:c,getStreamedPlugin:l,createStreamedPlugin:u,updateStreamedPlugin:p,getPluginByUnknownType:async b=>{var _,k,C;if(n.app==="konnect")try{const N=await a(b);return Object.assign(N,{[wc]:"installed"})}catch(N){if(Zo.isAxiosError(N)&&((_=N.response)==null?void 0:_.status)!==404)throw N}try{const N=await l(b);return Object.assign(N,{[wc]:"streamed"})}catch(N){if(Zo.isAxiosError(N)&&((k=N.response)==null?void 0:k.status)!==404)throw N}try{const N=await m(b);return Object.assign(N,{[wc]:"cloned"})}catch(N){if(Zo.isAxiosError(N)&&((C=N.response)==null?void 0:C.status)!==404)throw N}return null},getPluginType:b=>b[wc],getClonedPlugin:m,createClonedPlugin:d,updateClonedPlugin:f}}const st={useI18n:Qe,usePluginMetaData:h_,usePluginHelpers:l_,useSchemas:FM,useExperimentalFreeForms:_p,useProvideExperimentalFreeForms:VM,useFreeFormResolver:$M,useCustomPluginApi:qM},Gw=n=>{var r,o,i,a;const t=n==null?void 0:n.response;return(t==null?void 0:t.status)===400&&(((o=(r=t.data)==null?void 0:r.message)==null?void 0:o.includes("plugin schema is currently in use"))||((i=t.data)==null?void 0:i.code)===19||((a=t.data)==null?void 0:a.name)==="referenced by others")},GM={class:"kong-ui-entities-custom-plugin-form"},HM={class:"plugin-type-radios"},zM={class:"compare-table-wrapper"},WM={class:"compare-table"},YM={key:0,scope:"col"},JM={key:1,scope:"col"},XM={key:2,scope:"col"},ZM={scope:"row"},QM={key:0},ej={key:1},tj={key:2},nj={scope:"row"},rj={key:0},oj={class:"compare-list"},ij={key:1},aj={class:"compare-list"},sj={key:2},lj={scope:"row"},cj={key:0},uj={key:1},dj={key:2},fj={scope:"row"},pj={key:0},mj={key:1},gj={key:2},hj={scope:"row"},yj={key:0},_j={key:1},bj={key:2},wj={class:"plugin-modules-section"},kj={class:"plugin-select-item"},Cj={class:"plugin-select-item"},Ej={key:1},Nj=1*1024*1024,Sj=je(e.defineComponent({__name:"CustomPluginForm",props:{config:{type:Object,required:!0,validator:n=>!(!n||!n.app||n.app==="konnect"&&!n.controlPlaneId||n.app==="kongManager"&&!n.workspace||!n.cancelRoute||!n.successRoute)},pluginName:{type:String,default:""},unsupportedTypes:{type:Array,default:()=>[]}},emits:["update","error","loading"],setup(n,{emit:t}){var ye;const r=["acl","datakit","file-log","http-log","ip-restriction","key-auth","opa","openid-connect","post-function","pre-function","request-transformer-advanced","request-transformer","response-transformer-advanced","response-transformer","route-by-header","tcp-log"],o=["installed","streamed","cloned"],i=n,a=t,{i18n:{t:s},i18nT:c}=st.useI18n(),l=Ar.useRouter(),{getMessageFromError:u}=Ie.useErrors(),{axiosInstance:p}=Ie.useAxios((ye=i.config)==null?void 0:ye.axiosRequestConfig),{createInstalledPlugin:d,updateInstalledPlugin:f,createStreamedPlugin:m,updateStreamedPlugin:h,getPluginType:y,getPluginByUnknownType:b,createClonedPlugin:_,updateClonedPlugin:k}=st.useCustomPluginApi({axiosInstance:p,apiBaseUrl:i.config.apiBaseUrl,controlPlaneId:i.config.controlPlaneId,app:i.config.app,workspace:i.config.workspace});e.provide(Ie.PLUGIN_FORM_LAYOUT_STATE,e.ref(!0));const C=e.ref(null),N=(ce,he)=>{const Oe=i.config.workspace??"",De=i.config.app==="konnect"?i.config.controlPlaneId:"";return`${i.config.apiBaseUrl}${ce}`.replace(/{controlPlaneId}/gi,De).replace(/{pluginId}/gi,he??"").replace(/\/\{workspace\}/gi,Oe?`/${Oe}`:"")},E=e.computed(()=>{const ce=$.fields.pluginType;if(!ce)return"";const he=U.value?i.pluginName:void 0,Oe=he?"edit":"create";if(i.config.app==="konnect"){if(ce==="installed")return N(tt.customPlugin.konnect.installed[Oe],he);if(ce==="streamed")return N(tt.customPlugin.konnect.streamed[Oe],he);if(ce==="cloned")return N(tt.customPlugin.konnect.cloned[Oe],he)}else{if(ce==="streamed")return N(tt.customPlugin.kongManager.streamed[Oe],he);if(ce==="cloned")return N(tt.customPlugin.kongManager.cloned[Oe],he)}return""}),w=e.computed(()=>U.value?$.fields.pluginType==="cloned"?i.config.app==="konnect"?"put":"patch":i.config.app==="kongManager"&&$.fields.pluginType==="streamed"?"patch":"put":"post"),S=e.computed(()=>{switch($.fields.pluginType){case"installed":return Ie.SupportedEntityType.PluginSchema;case"streamed":return Ie.SupportedEntityType.CustomPlugin;case"cloned":return Ie.SupportedEntityType.ClonedPlugin;default:return Ie.SupportedEntityType.Plugin}}),I=e.computed(()=>{switch($.fields.pluginType){case"installed":return{lua_schema:$.fields.schemaContent};case"streamed":return{name:$.fields.name,schema:$.fields.schemaContent,handler:$.fields.handlerContent};case"cloned":return{ref:$.fields.sourcePlugin,name:$.fields.aliasName,...$.fields.priority?{priority:parseInt($.fields.priority,10)}:{}};default:return{}}}),U=e.computed(()=>!!i.pluginName),x=e.ref(!1),A=e.ref(""),T=e.computed(()=>new Set(i.unsupportedTypes)),V=e.computed(()=>o.filter(ce=>!T.value.has(ce))),R=e.computed(()=>!U.value&&V.value.length===0),X=e.computed(()=>!U.value&&V.value.length>1),Y=()=>V.value[0]??null,ne=ce=>V.value.includes(ce),M=ce=>{if(U.value||!X.value){const he=ce-1;return($.fields.pluginType==="installed"?1:2)>1?he:void 0}return ce},te=e.ref(!0),$=e.reactive({fields:{pluginType:Y(),schemaContent:"",handlerContent:"",name:"",sourcePlugin:"",aliasName:"",priority:""},readonly:!1,errorMessage:""});let Z="";e.watch(V,ce=>{U.value||(!$.fields.pluginType||!ce.includes($.fields.pluginType))&&($.fields.pluginType=ce[0]??null)},{immediate:!0}),e.watch(()=>$.fields.pluginType,()=>{U.value||($.fields.schemaContent="",$.fields.handlerContent="",$.fields.name="",$.fields.sourcePlugin="",$.fields.aliasName="",$.fields.priority="")});const{getDisplayName:F}=h_(),J=e.computed(()=>{var De;const ce=((De=i.config)==null?void 0:De.clonablePlugins)??r;if(ce.length===0)return[];const he={};ce.forEach(Be=>{const qe=Rn[Be],We=qe==null?void 0:qe.group;We?(he[We]||(he[We]=[]),he[We].push({label:F(Be),value:Be})):console.warn(`Plugin ${Be} is missing metadata group and will be shown without grouping.`)});const Oe=[];return Object.keys(he).sort().forEach(Be=>{Oe.push({label:Be,items:he[Be]})}),Oe}),G=e.computed(()=>{if(R.value||!$.fields.pluginType)return!1;switch($.fields.pluginType){case"installed":return $.fields.schemaContent.length>0;case"streamed":return $.fields.schemaContent.length>0&&$.fields.handlerContent.length>0&&$.fields.name.trim().length>0;case"cloned":return!!$.fields.sourcePlugin&&$.fields.aliasName.trim().length>0;default:return!1}}),v=ce=>new Promise((he,Oe)=>{const De=new FileReader;De.onload=Be=>{var We;const qe=(We=Be.target)==null?void 0:We.result;typeof qe=="string"?he(qe):Oe(new Error("Failed to read file as text"))},De.onerror=Oe,De.readAsText(ce)}),q=async(ce,he)=>{const Oe=he[0];if(Oe){if(Oe.size>Nj){$.errorMessage=s("custom_plugin_form.errors.file_too_large");return}try{const De=await v(Oe);ce==="schema"?$.fields.schemaContent=De:$.fields.handlerContent=De}catch{$.errorMessage=s("custom_plugin_form.errors.file_read_error"),ce==="schema"?$.fields.schemaContent="":$.fields.handlerContent=""}}},ie=ce=>{ce==="schema"?$.fields.schemaContent="":$.fields.handlerContent=""},oe=()=>{l.push(i.config.cancelRoute)};e.onMounted(async()=>{if(i.pluginName){x.value=!0,a("loading",!0);try{const ce=await b(i.pluginName);if(!ce){A.value=s("custom_plugin_form.errors.plugin_not_found"),a("error",new Error(A.value));return}const he=y(ce);if($.fields.pluginType=he,he==="installed")$.fields.schemaContent=ce.item.lua_schema;else if(he==="streamed"){const{name:Oe,schema:De,handler:Be}=ce;$.fields.name=Oe,$.fields.schemaContent=De,$.fields.handlerContent=Be}else if(he==="cloned"){const{ref:Oe,name:De,priority:Be}=ce;$.fields.aliasName=De,$.fields.sourcePlugin=Oe,$.fields.priority=Be!==null?String(Be):"",Z=De}else A.value=s("custom_plugin_form.errors.unsupported_plugin_type",{type:he}),a("error",new Error(A.value))}catch(ce){A.value=u(ce),a("error",ce)}finally{x.value=!1,a("loading",!1)}}});const ke=async()=>{$.errorMessage="",$.readonly=!0;try{const ce=$.fields.pluginType;if(!ce)return;if(ce==="installed"){const he={lua_schema:$.fields.schemaContent},Oe=U.value?await f(i.pluginName,he):await d(he);a("update",Oe)}else if(ce==="streamed"){const he={name:$.fields.name,schema:$.fields.schemaContent,handler:$.fields.handlerContent},Oe=U.value?await h(i.pluginName,he):await m(he);a("update",Oe)}else{const he=U.value?await k(Z,{aliasName:$.fields.aliasName,sourcePlugin:$.fields.sourcePlugin,priority:$.fields.priority?parseInt($.fields.priority,10):void 0}):await _({aliasName:$.fields.aliasName,sourcePlugin:$.fields.sourcePlugin,priority:$.fields.priority?parseInt($.fields.priority,10):void 0});a("update",{pluginType:"cloned",sourcePlugin:he.ref,aliasName:he.name,priority:he.priority??void 0})}l.push(i.config.successRoute)}catch(ce){$.errorMessage=Gw(ce)?s("delete.plugin_schema_in_use_message"):u(ce),a("error",ce)}finally{$.readonly=!1}};return(ce,he)=>{const Oe=e.resolveComponent("KSkeleton"),De=e.resolveComponent("KEmptyState"),Be=e.resolveComponent("KRadio"),qe=e.resolveComponent("KCollapse"),We=e.resolveComponent("KFileUpload"),nt=e.resolveComponent("KLabel"),lt=e.resolveComponent("KAlert"),Re=e.resolveComponent("KSelect"),Ce=e.resolveComponent("KInput"),se=e.resolveComponent("KButton");return e.openBlock(),e.createElementBlock("div",GM,[e.createVNode(e.unref(Ie.EntityBaseForm),{ref_key:"entityBaseFormRef",ref:C,"can-submit":G.value,config:n.config,"entity-type":e.unref(Ie.SupportedEntityType).Plugin,"error-message":$.errorMessage,"form-fields":I.value,"is-readonly":$.readonly,"slideout-deck-entity-type":S.value,"slideout-fetch-url":E.value,"slideout-request-method":w.value,onCancel:oe,onSubmit:ke},{"form-actions":e.withCtx(()=>[x.value||A.value||R.value?(e.openBlock(),e.createElementBlock("span",Ej)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(se,{appearance:"primary","data-testid":"custom-plugin-form-submit",disabled:!G.value||$.readonly,type:"submit"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("actions.save")),1)]),_:1},8,["disabled"]),e.createVNode(se,{appearance:"secondary","data-testid":"custom-plugin-form-cancel",disabled:$.readonly,onClick:oe},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("actions.cancel")),1)]),_:1},8,["disabled"]),e.createVNode(se,{appearance:"tertiary","data-testid":"custom-plugin-form-view-configuration",onClick:he[14]||(he[14]=re=>{var Q;return(Q=C.value)==null?void 0:Q.viewConfig()})},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("actions.view_configuration")),1)]),_:1})],64))]),default:e.withCtx(()=>[x.value?(e.openBlock(),e.createBlock(Oe,{key:0,type:"form"})):A.value?(e.openBlock(),e.createBlock(De,{key:1,"action-button-visible":!1,"data-testid":"custom-plugin-form-fetch-error","icon-variant":"error"},{default:e.withCtx(()=>[e.createElementVNode("h3",null,e.toDisplayString(A.value),1)]),_:1})):R.value?(e.openBlock(),e.createBlock(De,{key:2,"action-button-visible":!1,"data-testid":"custom-plugin-form-unsupported-types-error","icon-variant":"error"},{default:e.withCtx(()=>[e.createElementVNode("h3",null,e.toDisplayString(e.unref(s)("custom_plugin_form.errors.no_supported_types")),1)]),_:1})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[X.value?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:0,class:"custom-plugin-form-steps",step:1,title:e.unref(s)("custom_plugin_form.step1.title")},{default:e.withCtx(()=>[e.createElementVNode("div",HM,[ne("installed")?(e.openBlock(),e.createBlock(Be,{key:0,modelValue:$.fields.pluginType,"onUpdate:modelValue":he[0]||(he[0]=re=>$.fields.pluginType=re),card:"","card-orientation":"horizontal","data-testid":"custom-plugin-type-installed",description:e.unref(s)("custom_plugin_form.step1.types.installed.description"),label:e.unref(s)("custom_plugin_form.step1.types.installed.label"),"selected-value":"installed"},null,8,["modelValue","description","label"])):e.createCommentVNode("",!0),ne("streamed")?(e.openBlock(),e.createBlock(Be,{key:1,modelValue:$.fields.pluginType,"onUpdate:modelValue":he[1]||(he[1]=re=>$.fields.pluginType=re),card:"","card-orientation":"horizontal","data-testid":"custom-plugin-type-streamed",description:e.unref(s)("custom_plugin_form.step1.types.streamed.description"),label:e.unref(s)("custom_plugin_form.step1.types.streamed.label"),"selected-value":"streamed"},null,8,["modelValue","description","label"])):e.createCommentVNode("",!0),ne("cloned")?(e.openBlock(),e.createBlock(Be,{key:2,modelValue:$.fields.pluginType,"onUpdate:modelValue":he[2]||(he[2]=re=>$.fields.pluginType=re),card:"","card-orientation":"horizontal","data-testid":"custom-plugin-type-cloned",description:e.unref(s)("custom_plugin_form.step1.types.cloned.description"),label:e.unref(s)("custom_plugin_form.step1.types.cloned.label"),"selected-value":"cloned"},null,8,["modelValue","description","label"])):e.createCommentVNode("",!0)]),e.createVNode(qe,{modelValue:te.value,"onUpdate:modelValue":he[3]||(he[3]=re=>te.value=re),class:"custom-plugin-form-compare-collapse","data-testid":"compare-deployment-options","trigger-alignment":"leading","trigger-label":e.unref(s)("custom_plugin_form.step1.compare_trigger")},{default:e.withCtx(()=>[e.createElementVNode("div",zM,[e.createElementVNode("table",WM,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[he[15]||(he[15]=e.createElementVNode("th",{scope:"col"},null,-1)),ne("installed")?(e.openBlock(),e.createElementBlock("th",YM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.columns.installed")),1)):e.createCommentVNode("",!0),ne("streamed")?(e.openBlock(),e.createElementBlock("th",JM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.columns.streamed")),1)):e.createCommentVNode("",!0),ne("cloned")?(e.openBlock(),e.createElementBlock("th",XM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.columns.cloned")),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("tbody",null,[e.createElementVNode("tr",null,[e.createElementVNode("th",ZM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.main_use_case.header")),1),ne("installed")?(e.openBlock(),e.createElementBlock("td",QM,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.main_use_case.installed")),1)):e.createCommentVNode("",!0),ne("streamed")?(e.openBlock(),e.createElementBlock("td",ej,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.main_use_case.streamed")),1)):e.createCommentVNode("",!0),ne("cloned")?(e.openBlock(),e.createElementBlock("td",tj,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.main_use_case.cloned")),1)):e.createCommentVNode("",!0)]),e.createElementVNode("tr",null,[e.createElementVNode("th",nj,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.file_supplied.header")),1),ne("installed")?(e.openBlock(),e.createElementBlock("td",rj,[e.createElementVNode("ul",oj,[e.createElementVNode("li",null,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.file_supplied.installed.handler")),1),e.createElementVNode("li",null,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.file_supplied.installed.schema")),1),e.createElementVNode("li",null,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.file_supplied.installed.additional")),1)])])):e.createCommentVNode("",!0),ne("streamed")?(e.openBlock(),e.createElementBlock("td",ij,[e.createElementVNode("ul",aj,[e.createElementVNode("li",null,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.file_supplied.streamed.handler")),1),e.createElementVNode("li",null,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.file_supplied.streamed.schema")),1)])])):e.createCommentVNode("",!0),ne("cloned")?(e.openBlock(),e.createElementBlock("td",sj,[e.createVNode(e.unref($e.ClearIcon),{color:`var(--kui-color-text-neutral, ${e.unref(cr)})`,size:`var(--kui-icon-size-30, ${e.unref(Yn)})`},null,8,["color","size"])])):e.createCommentVNode("",!0)]),e.createElementVNode("tr",null,[e.createElementVNode("th",lj,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.how_installed.header")),1),ne("installed")?(e.openBlock(),e.createElementBlock("td",cj,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.how_installed.installed")),1)):e.createCommentVNode("",!0),ne("streamed")?(e.openBlock(),e.createElementBlock("td",uj,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.how_installed.streamed")),1)):e.createCommentVNode("",!0),ne("cloned")?(e.openBlock(),e.createElementBlock("td",dj,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.how_installed.cloned")),1)):e.createCommentVNode("",!0)]),e.createElementVNode("tr",null,[e.createElementVNode("th",fj,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.sandboxing.header")),1),ne("installed")?(e.openBlock(),e.createElementBlock("td",pj,[e.createVNode(e.unref($e.ClearIcon),{color:`var(--kui-color-text-neutral, ${e.unref(cr)})`,size:`var(--kui-icon-size-30, ${e.unref(Yn)})`},null,8,["color","size"])])):e.createCommentVNode("",!0),ne("streamed")?(e.openBlock(),e.createElementBlock("td",mj,[e.createVNode(e.unref(c),{keypath:"custom_plugin_form.step1.compare_table.rows.sandboxing.streamed"},{link:e.withCtx(()=>[e.createVNode(e.unref(Fe.KExternalLink),{"hide-icon":"",href:e.unref(es).customPluginSandboxing},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.sandboxing.streamed_link")),1)]),_:1},8,["href"])]),_:1})])):e.createCommentVNode("",!0),ne("cloned")?(e.openBlock(),e.createElementBlock("td",gj,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.sandboxing.cloned")),1)):e.createCommentVNode("",!0)]),e.createElementVNode("tr",null,[e.createElementVNode("th",hj,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.data_plane_reload.header")),1),ne("installed")?(e.openBlock(),e.createElementBlock("td",yj,[e.createVNode(e.unref($e.CheckCircleIcon),{color:`var(--kui-color-text-success, ${e.unref(Zg)})`,size:`var(--kui-icon-size-30, ${e.unref(Yn)})`},null,8,["color","size"])])):e.createCommentVNode("",!0),ne("streamed")?(e.openBlock(),e.createElementBlock("td",_j,[e.createVNode(e.unref($e.ClearIcon),{color:`var(--kui-color-text-neutral, ${e.unref(cr)})`,size:`var(--kui-icon-size-30, ${e.unref(Yn)})`},null,8,["color","size"])])):e.createCommentVNode("",!0),ne("cloned")?(e.openBlock(),e.createElementBlock("td",bj,[e.createVNode(e.unref($e.ClearIcon),{color:`var(--kui-color-text-neutral, ${e.unref(cr)})`,size:`var(--kui-icon-size-30, ${e.unref(Yn)})`},null,8,["color","size"])])):e.createCommentVNode("",!0)])])])])]),_:1},8,["modelValue","trigger-label"])]),_:1},8,["title"])):e.createCommentVNode("",!0),$.fields.pluginType==="installed"?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:1,class:"custom-plugin-form-steps",step:M(2),title:e.unref(s)("custom_plugin_form.step2_files.title")},{default:e.withCtx(()=>[e.createVNode(We,{accept:[".lua"],"button-text":e.unref(s)("custom_plugin_form.step2_files.schema_file.button_text"),"data-testid":"custom-plugin-schema-upload",help:e.unref(s)("custom_plugin_form.step2_files.schema_file.help"),label:e.unref(s)("custom_plugin_form.step2_files.schema_file.label"),placeholder:U.value&&$.fields.schemaContent?e.unref(s)("custom_plugin_form.step2_files.schema_file.placeholder_edit"):e.unref(s)("custom_plugin_form.step2_files.schema_file.placeholder"),required:!U.value,onFileAdded:he[4]||(he[4]=re=>q("schema",re)),onFileRemoved:he[5]||(he[5]=re=>ie("schema"))},null,8,["button-text","help","label","placeholder","required"]),e.createElementVNode("div",wj,[e.createVNode(nt,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("custom_plugin_form.step2_files.plugin_modules.label")),1)]),_:1}),e.createVNode(lt,{appearance:"warning",message:e.unref(s)("custom_plugin_form.step2_files.plugin_modules.alert")},null,8,["message"])])]),_:1},8,["step","title"])):e.createCommentVNode("",!0),$.fields.pluginType==="streamed"?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:2,class:"custom-plugin-form-steps",step:M(2),title:e.unref(s)("custom_plugin_form.step2_files.title")},{default:e.withCtx(()=>[e.createVNode(We,{accept:[".lua"],"button-text":e.unref(s)("custom_plugin_form.step2_files.schema_file.button_text"),"data-testid":"custom-plugin-schema-upload",help:e.unref(s)("custom_plugin_form.step2_files.schema_file.help"),label:e.unref(s)("custom_plugin_form.step2_files.schema_file.label"),placeholder:U.value&&$.fields.schemaContent?e.unref(s)("custom_plugin_form.step2_files.schema_file.placeholder_edit"):e.unref(s)("custom_plugin_form.step2_files.schema_file.placeholder"),required:!U.value,onFileAdded:he[6]||(he[6]=re=>q("schema",re)),onFileRemoved:he[7]||(he[7]=re=>ie("schema"))},null,8,["button-text","help","label","placeholder","required"]),e.createVNode(We,{accept:[".lua"],"button-text":e.unref(s)("custom_plugin_form.step2_files.handler_file.button_text"),"data-testid":"custom-plugin-handler-upload",help:e.unref(s)("custom_plugin_form.step2_files.handler_file.help"),label:e.unref(s)("custom_plugin_form.step2_files.handler_file.label"),placeholder:U.value&&$.fields.handlerContent?e.unref(s)("custom_plugin_form.step2_files.handler_file.placeholder_edit"):e.unref(s)("custom_plugin_form.step2_files.handler_file.placeholder"),required:!U.value,onFileAdded:he[8]||(he[8]=re=>q("handler",re)),onFileRemoved:he[9]||(he[9]=re=>ie("handler"))},null,8,["button-text","help","label","placeholder","required"])]),_:1},8,["step","title"])):e.createCommentVNode("",!0),$.fields.pluginType==="cloned"?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:3,class:"custom-plugin-form-steps",step:M(2),title:e.unref(s)("custom_plugin_form.step2_clone.title")},{default:e.withCtx(()=>[e.createVNode(Re,{modelValue:$.fields.sourcePlugin,"onUpdate:modelValue":he[10]||(he[10]=re=>$.fields.sourcePlugin=re),"data-testid":"custom-plugin-clone-select","enable-filtering":"",items:J.value,label:e.unref(s)("custom_plugin_form.step2_clone.select_plugin.label"),placeholder:e.unref(s)("custom_plugin_form.step2_clone.select_plugin.placeholder"),required:""},{"item-template":e.withCtx(({item:re})=>[e.createElementVNode("div",kj,[e.createVNode(e.unref(xr.PluginIcon),{name:String(re.value),size:20},null,8,["name"]),e.createElementVNode("span",null,e.toDisplayString(re.label),1)])]),"selected-item-template":e.withCtx(({item:re})=>[e.createElementVNode("div",Cj,[e.createVNode(e.unref(xr.PluginIcon),{name:String(re.value),size:20},null,8,["name"]),e.createElementVNode("span",null,e.toDisplayString(re.label),1)])]),_:1},8,["modelValue","items","label","placeholder"])]),_:1},8,["step","title"])):e.createCommentVNode("",!0),$.fields.pluginType==="streamed"?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:4,class:"custom-plugin-form-steps",description:e.unref(s)("custom_plugin_form.step3.description"),step:M(3),title:e.unref(s)("custom_plugin_form.step3.title")},{default:e.withCtx(()=>[e.createVNode(Ce,{modelValue:$.fields.name,"onUpdate:modelValue":he[11]||(he[11]=re=>$.fields.name=re),modelModifiers:{trim:!0},"data-testid":"custom-plugin-name",help:e.unref(s)("custom_plugin_form.step3.name.help"),label:e.unref(s)("custom_plugin_form.step3.name.label"),placeholder:e.unref(s)("custom_plugin_form.step3.name.placeholder"),readonly:$.readonly,required:"",type:"text"},null,8,["modelValue","help","label","placeholder","readonly"])]),_:1},8,["description","step","title"])):e.createCommentVNode("",!0),$.fields.pluginType==="cloned"?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:5,class:"custom-plugin-form-steps",description:e.unref(s)("custom_plugin_form.step3.description"),step:M(3),title:e.unref(s)("custom_plugin_form.step3.title")},{default:e.withCtx(()=>[e.createVNode(Ce,{modelValue:$.fields.aliasName,"onUpdate:modelValue":he[12]||(he[12]=re=>$.fields.aliasName=re),modelModifiers:{trim:!0},"data-testid":"custom-plugin-alias-name",help:e.unref(s)("custom_plugin_form.step3.alias_name.help"),label:e.unref(s)("custom_plugin_form.step3.alias_name.label"),placeholder:e.unref(s)("custom_plugin_form.step3.alias_name.placeholder"),readonly:$.readonly,required:"",type:"text"},null,8,["modelValue","help","label","placeholder","readonly"]),e.createVNode(Ce,{modelValue:$.fields.priority,"onUpdate:modelValue":he[13]||(he[13]=re=>$.fields.priority=re),modelModifiers:{trim:!0},"data-testid":"custom-plugin-priority",label:e.unref(s)("custom_plugin_form.step3.priority.label"),"label-attributes":{info:e.unref(s)("custom_plugin_form.step3.priority.tooltip")},readonly:$.readonly,type:"number"},{help:e.withCtx(()=>[e.createVNode(e.unref(c),{keypath:"custom_plugin_form.step3.priority.help.text"},{link:e.withCtx(()=>[e.createVNode(e.unref(Fe.KExternalLink),{"hide-icon":"",href:e.unref(es).pluginPriority},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("custom_plugin_form.step3.priority.help.link")),1)]),_:1},8,["href"])]),_:1})]),_:1},8,["modelValue","label","label-attributes","readonly"])]),_:1},8,["description","step","title"])):e.createCommentVNode("",!0)],64))]),_:1},8,["can-submit","config","entity-type","error-message","form-fields","is-readonly","slideout-deck-entity-type","slideout-fetch-url","slideout-request-method"])])}}}),[["__scopeId","data-v-0c1e017a"]]),xj=(n,t)=>({type:"array",valueType:"string",valueArrayType:"array",itemContainerComponent:"FieldArrayItem",fieldClasses:"kong-form-array-field",fieldItemsClasses:"kong-form-array-field-item",validator:"array",styleClasses:"kong-form-field-wrapper",newElementButtonLabel:"+ Add",newElementButtonLabelClasses:"kong-form-new-element-button-label",items:{type:"select",values:n,selectOptions:{hideNoneSelectedText:!0},...(t==null?void 0:t[0])!=null?{default:t[0]}:{}}}),Aj={class:"referable-field-item"},vj=24,Hw=je(e.defineComponent({__name:"ReferableFieldItem",props:{field:{},isLast:{type:Boolean}},setup(n){const t=n,{formatPluginFieldLabel:r}=st.usePluginHelpers(),o=e.computed(()=>t.field.replace(/\./g,"-")),i=e.computed(()=>t.field.replace(/^[cC]onfig\./,"").split(".").map(s=>r(s)).join(".")),a=()=>{if(!o.value)return;const s=`label[for="${o.value}"]`,c=document.querySelector(s)||document.getElementById(o.value);if(!c)return;const l=Math.max(0,c.getBoundingClientRect().top+window.scrollY-vj),u=()=>{var p;(p=c.click)==null||p.call(c)};window.addEventListener("scrollend",u,{once:!0}),window.scrollTo({top:l,behavior:"smooth"})};return(s,c)=>(e.openBlock(),e.createElementBlock("span",Aj,[e.createElementVNode("span",{class:"referable-field-link",role:"button",tabindex:"0",onClick:a},e.toDisplayString(i.value),1),n.isLast?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(", ")],64))]))}}),[["__scopeId","data-v-949a9ea1"]]),Ij={key:0},Bj=je(e.defineComponent({__name:"PluginFieldRuleAlerts",props:{rules:{}},setup(n){const t=n,{i18n:{t:r},i18nT:o}=st.useI18n(),i=e.computed(()=>{const a=[];if(t.rules.atLeastOneOf)for(const s of t.rules.atLeastOneOf)a.push({key:"plugins.form.field_rules.at_least_one_of",fields:s});if(t.rules.onlyOneOf)for(const s of t.rules.onlyOneOf)a.push({key:"plugins.form.field_rules.only_one_of",fields:s});if(t.rules.mutuallyRequired)for(const s of t.rules.mutuallyRequired)a.push({key:"plugins.form.field_rules.mutually_required",fields:s});return a});return(a,s)=>{const c=e.resolveComponent("KAlert");return e.openBlock(),e.createBlock(c,{class:"plugin-field-rule-alerts"},{default:e.withCtx(()=>[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,({key:l,fields:u},p)=>(e.openBlock(),e.createElementBlock("li",{key:`simple-alert-${p}`},[e.createVNode(e.unref(o),{keypath:l},{parameters:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u,(d,f)=>(e.openBlock(),e.createBlock(Hw,{key:`alert-field-${d}`,field:d,"is-last":f===u.length-1},null,8,["field","is-last"]))),128))]),_:2},1032,["keypath"])]))),128)),t.rules.onlyOneOfMutuallyRequired&&t.rules.onlyOneOfMutuallyRequired.length>0?(e.openBlock(),e.createElementBlock("li",Ij,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.rules.onlyOneOfMutuallyRequired,(l,u)=>(e.openBlock(),e.createElementBlock("div",{key:`only-one-mutually-alert-${u}`},[e.createElementVNode("div",null,e.toDisplayString(e.unref(r)("plugins.form.field_rules.only_one_of_mutually_required")),1),e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l,(p,d)=>(e.openBlock(),e.createElementBlock("li",{key:`only-one-mutually-alert-${u}-combination-${d}`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p,(f,m)=>(e.openBlock(),e.createBlock(Hw,{key:`only-one-mutually-field-${f}`,field:f,"is-last":m===p.length-1},null,8,["field","is-last"]))),128))]))),128))])]))),128))])):e.createCommentVNode("",!0)])]),_:1})}}}),[["__scopeId","data-v-5f9ff453"]]);function Tj(n){if(n.length===0)return"";if(n.length===1){const i=gn(n[0]);return yt(...i.slice(0,-1))}const t=n.map(i=>gn(i)),r=Math.min(...t.map(i=>i.length)),o=[];for(let i=0;i<r-1;i++){const a=t[0][i];if(t.every(s=>s[i]===a))o.push(a);else break}return yt(...o)}function bp(n){return"at_least_one_of"in n?n.at_least_one_of:"mutually_required"in n?n.mutually_required:"mutually_exclusive"in n?n.mutually_exclusive:null}function Oj(n,t){if(!t)return n;const r=t+Ma;return n.map(o=>o.startsWith(r)?o.slice(r.length):o)}function Pj(n,t){const r=bp(n),o=Oj(r,t);return"at_least_one_of"in n?{at_least_one_of:o}:"mutually_required"in n?{mutually_required:o}:{mutually_exclusive:o}}function Vj(n){const t=[],r=new Map;for(const o of n){const i=bp(o);if(!i){t.push(o);continue}const a=Tj(i);if(!a){t.push(o);continue}const s=Pj(o,a);r.has(a)||r.set(a,[]),r.get(a).push(s)}return{keep:t,move:r}}function $j(n,t,r){const o=gn(t);let i=n;for(const a of o){const s=i.fields.find(l=>Object.keys(l)[0]===a);if(!s)return;const c=s[a];if(c.type!=="record")return;i=c}i.entity_checks=[...i.entity_checks||[],...r]}function zw(n){var t;if((t=n.entity_checks)!=null&&t.length){const{keep:r,move:o}=Vj(n.entity_checks);n.entity_checks=r.length?r:void 0;for(const[i,a]of o)$j(n,i,a)}for(const r of n.fields){const o=Object.values(r)[0];o.type==="record"&&zw(o)}}function Rj(n){const t=JSON.parse(JSON.stringify(n)),r={fields:t.fields};return zw(r),t.fields=r.fields,t}function Lj(n,t){const r=Rn[n];if(!r||!r.fieldRules)return t;const o=Dj(r.fieldRules),i={...t};return i.fields=i.fields.map(a=>{if(Object.keys(a)[0]==="config"){const c=a.config.entity_checks||[],l=d=>{const m=[...bp(d)??[]].slice().sort();return`${Object.keys(d)[0]}:${m.join(",")}`},u=new Set(c.map(l)),p=o.filter(d=>{const f=l(d);return u.has(f)?!1:(u.add(f),!0)});return{config:{...a.config,entity_checks:[...c,...p]}}}return a}),i}function Dj(n){const t=[],r=o=>o.startsWith("config.")?o.substring(7):o;return n.atLeastOneOf&&n.atLeastOneOf.forEach(o=>{t.push({at_least_one_of:o.map(r)})}),n.onlyOneOf&&n.onlyOneOf.forEach(o=>{t.push({mutually_exclusive:o.map(r)})}),n.mutuallyRequired&&n.mutuallyRequired.forEach(o=>{t.push({mutually_required:o.map(r)})}),n.onlyOneOfMutuallyRequired&&n.onlyOneOfMutuallyRequired.forEach(o=>{if(o.forEach(i=>{t.push({mutually_required:i.map(r)})}),o.length>1)for(let i=0;i<o.length;i++)for(let a=i+1;a<o.length;a++){const s=o[i].map(r),c=o[a].map(r);s.forEach(l=>{c.forEach(u=>{t.push({mutually_exclusive:[l,u]})})})}}),t}const Mj={class:"kong-ui-entities-plugin-form"},jj={key:1,class:"entity-form"},Fj={class:"plugin-config-empty-state"},Uj=je(e.defineComponent({__name:"PluginEntityForm",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||n.app==="konnect"&&!n.controlPlaneId||n.app==="kongManager"&&typeof n.workspace!="string")},entityMap:{type:Object,default:()=>({})},record:{type:Object,default:()=>({})},schema:{type:Object,default:()=>({})},rawSchema:{type:Object,default:()=>({})},editing:{type:Boolean,default:!1},credential:{type:Boolean,default:!1},enableVaultSecretPicker:{type:Boolean,default:!1},enableRedisPartial:{type:Boolean,default:!1},engine:{type:String,required:!1,default:void 0},developer:{type:Boolean,default:!1}},emits:["loading","model-updated","showNewPartialModal","globalAction","click:learn-more","click:create-entity","validity-change"],setup(n,{emit:t}){var lt,Re;const r=t,o=n,i=e.computed(()=>{if(o.config.app!=="konnect")return!1;const Ce=o.config;return!!Ce.isKonnectManagedRedisEnabled&&Ce.isCloudGateway===!0}),a=e.inject(fr.KM_2306_CONDITION_FIELD_314,!1),s=e.inject(fr.KHCP_20393_IDENTITY_PRINCIPALS_UI,!1),{axiosInstance:c}=Ie.useAxios((lt=o.config)==null?void 0:lt.axiosRequestConfig),{parseSchema:l}=st.useSchemas({entityId:((Re=o.entityMap.focusedEntity)==null?void 0:Re.id)||void 0,credential:o.credential,enableRedisPartial:o.enableRedisPartial,experimentalRenders:o.config.app==="konnect"?o.config.experimentalRenders:void 0}),{convertToDotNotation:u,unFlattenObject:p,dismissField:d,isObjectEmpty:f,unsetNullForeignKey:m}=st.usePluginHelpers(),{shouldUseFreeForm:h,getFreeFormComponent:y}=st.useFreeFormResolver(),b=e.inject(Ie.PLUGIN_FORM_LAYOUT_STATE),_=Ce=>{b&&(b.value=Ce)},{objectsAreEqual:k}=Ie.useHelpers(),{i18n:{t:C}}=Qe(),N=Ce=>{let se=Ce;return o.config.app==="konnect"&&(se=se.replace(/{controlPlaneId}/gi,o.config.controlPlaneId||"")),se.replace(/\/{workspace}/gi,o.config.workspace?`/${o.config.workspace}`:"")},E=(Ce,se)=>{let re=`${o.config.apiBaseUrl}${tt.form[o.config.app].entityGetOne}`;return re=N(re),re=re.replace(/{entity}/gi,Ce),re=re.replace(/{id}/gi,se),re},w=Ce=>{let se=`${o.config.apiBaseUrl}${tt.form[o.config.app].entityGetAll}`;return se=N(se),se=se.replace(/{entity}/gi,Ce),se},S=(Ce,se,re)=>{const Q=E(Ce,se);return c.get(Q,re)},I=(Ce,se)=>{const re=w(Ce);return o.config.app==="konnect"?c.get(re).then(Q=>{const{data:{data:le}}=Q;if(delete se.size,delete se.offset,le.length&&Object.keys(se).length===1){const de=Object.keys(se)[0],_e=le.filter(xe=>xe[de]?!!xe[de].toLowerCase().includes(se[de].toLowerCase()):!1);Q.data.data=_e}return Q}):c.get(re,{params:se})},U=(Ce,se,re)=>{const Q=w(Ce);if(o.config.app==="konnect"){const{size:le,offset:de,..._e}=se;if(Ce==="consumer_groups")return c.get(Q,{params:{size:1e3},signal:re}).then(Ne=>{const{data:{data:g}}=Ne;if(g.length&&Object.keys(_e).length===1){const O=Object.keys(_e)[0],j=g.filter(W=>W[O]?!!W[O].toLowerCase().includes(_e[O].toLowerCase()):!1);Ne.data.data=j}return Ne});const xe={size:le,offset:de};for(const Ne of Object.keys(_e))xe.filter={[Ne]:{contains:_e[Ne]}};return c.get(Q,{params:xe,signal:re})}return c.get(Q,{params:se,signal:re})},x=(Ce,se=50)=>{const re=w(Ce);return c.get(re,{params:{size:se}})};e.provide(et.FORMS_API_KEY,{getOne:S,getAll:I,getAllV2:U,peek:x});const A=e.shallowReactive({...o.config});e.watch(()=>o.config,Ce=>{Object.assign(A,Ce)}),e.provide(et.FORMS_CONFIG,A);const T=e.ref(""),V=e.ref(),R=e.shallowRef(),X=e.ref(null),Y=e.ref({}),ne=e.reactive({}),M=e.reactive({}),te=e.computed(()=>{var Ce;return(Ce=X.value)==null?void 0:Ce.options}),$=e.computed(()=>{const Ce=Lj(M.name,o.rawSchema);return Rj(Ce)}),Z=e.ref(!1),F=e.ref(),J=(Ce,se)=>{Z.value=Ce??"",F.value=se},G=Ce=>{var se;(se=F.value)==null||se.call(F,Ce),Z.value=!1},v=Ce=>{var re;if(!Ce){V.value=void 0,R.value=void 0,T.value="",_(!1);return}const se=((re=o.schema)==null?void 0:re._sourcePlugin)||Ce;V.value=$w(se),R.value=h(se,o.engine)?y(se)??sp:void 0,T.value=et.getSharedFormName(se),_(!!R.value)},q=Ce=>{var xe,Ne;const se={...o.schema},re=M,Q=ne,le=Object.keys(re),de={};if(!f(Y.value))for(let g=0;g<((Ne=(xe=Y.value)==null?void 0:xe.fields)==null?void 0:Ne.length);g++)se[Y.value.fields[g].model]=Y.value.fields[g];et.customFields.forEach(g=>{se[g]&&(se[g].fields.forEach(O=>{O.fields&&O.fields.forEach(j=>{se[j.model]=j}),O.model&&(se[O.model]=O)}),delete se[g])}),le.forEach(g=>{var ue;if(!se[g]){g==="partials"&&(de[g]=re[g]);return}const O=se[g];let j=re[g];const W=Q[g],ae=Array.isArray(j)?"array":typeof j,be=O?O.valueType:null,L=O?O.valueArrayType:null,ge=O?O.transform:null;if(j==null&&W==null&&!O.submitWhenNull)return;if(O){if(be&&ae!==be)switch(be){case"array":ae==="string"&&j.length&&(j=j.split(",").map(P=>{if(P=P.trim(),L==="string")return String(P);if(L==="number")return Number(P);if(L==="boolean"){if(typeof P=="string")return P.toLowerCase()==="true"||P==="1";if(typeof P=="number")return P===1}return P})),(!j||!j.length)&&(j=O.submitWhenNull?null:[]);break;case"number":O.referenceable!==!0&&(j=Number(j));break;case"boolean":ae==="string"&&(j=j.toLowerCase()==="true"||j==="1"),ae==="number"&&(j=j===1);break;case"string":j=j==null?"":String(j);break}else be==="array"&&(!j||!j.length?j=O.submitWhenNull?null:[]:((ue=O.inputAttributes)==null?void 0:ue.type)==="number"&&(j=j.map(P=>Number(P))));if(O.type==="array"&&O.nestedFields){const P=z=>{Object.keys(z).forEach(D=>{z[D]&&typeof z[D]=="object"&&!Array.isArray(z[D])&&z[D]!==null?P(z[D]):(z[D]===void 0||z[D]===null||typeof z[D]=="number"&&isNaN(z[D])||typeof z[D]=="string"&&z[D].trim().length===0)&&delete z[D]})};j&&typeof j=="object"&&P(j)}O.type==="object-advanced"&&O.fields&&j!==null&&(Object.entries(j).length===0?j=null:Object.keys(j).forEach(P=>{Array.isArray(j[P])||(j[P]=j[P].split(","))}))}let Ee=u(g);if(O.fieldNameHasDashes){const[P,...z]=Ee.split(".").reverse();Ee=[P.replace(/_/g,"-"),...z].reverse().join(".")}if(be==="object-expand"){let P;[Ee,P]=Ee.split(".");let z={};de[Ee]&&(z=de[Ee]),z[P]=j,j=z}W!==void 0&&j===""&&j!==W?de[Ee]=be==="object"?{}:null:O.type==="checklist"&&j===""?de[Ee]=[]:j!==""&&(de[Ee]=j),de[Ee]=ge?ge(j):de[Ee],m(Ee,de)});const _e=p(de);if(R.value){if(Ce&&Ce.length)for(const g of Ce)delete _e[g];Object.assign(_e,Be.value)}return _e},ie=(Ce,se={})=>{d(M,se,Ce,o.editing),r("model-updated",{model:M,originalModel:ne,data:q()})},oe=(Ce,se)=>{var le;const re={[se]:Ce};typeof((le=o.schema[se])==null?void 0:le.modelTransformer)=="function"&&(re[se]=o.schema[se].modelTransformer(Ce));const Q=Object.assign({},M,re);Object.assign(M,Q),r("model-updated",{model:M,originalModel:ne,data:q()})},ke=Ce=>{r("validity-change",Ce)},ye=(Ce,se)=>{Object.keys(Ce).forEach(re=>{var xe,Ne;let Q=se?`${se}-${re}`:re,le=o.schema[Q];if(!le){const g=se?`${se}-${re.replace(/-/g,"_")}`:re.replace(/-/g,"_");(xe=o.schema[g])!=null&&xe.fieldNameHasDashes&&(Q=g,le=o.schema[Q]),se&&((Ne=o.schema[se])==null?void 0:Ne.keyFromObject)===re&&(Q=se,le=o.schema[Q])}const de=Ce[re],_e=typeof de;if(le&&le.type==="object-advanced"&&!de){M[Q]={},ne[Q]={};return}if(Array.isArray(de)){M[Q]=JSON.parse(JSON.stringify(de)),ne[Q]=JSON.parse(JSON.stringify(de));return}if(_e==="object"&&de&&!de.length)return ye(de,Q);if(_e==="object"&&de&&de.length&&le.type==="input"){M[Q]=de.join(", "),ne[Q]=de.join(", ");return}M[Q]=de,ne[Q]=de}),r("model-updated",{model:M,originalModel:ne,data:q()})},ce=(Ce,se)=>{if(!se)return Ce;if(Array.isArray(Ce)){const le=se.elements;return le?Ce.map(de=>ce(de,le)):Ce}if(!Ce||typeof Ce!="object")return Ce;if(se.type==="map"&&se.values){const le=se.values,de={};for(const _e of Object.keys(Ce))de[_e]=ce(Ce[_e],le);return de}if(!Array.isArray(se.fields))return Ce;const re=new Map;for(const le of se.fields){const de=le&&Object.keys(le)[0];de&&re.set(de,le[de])}const Q={};for(const le of Object.keys(Ce)){const de=re.get(le);de&&(Q[le]=ce(Ce[le],de))}return Q},he=()=>{var re;const Ce=(re=o.rawSchema)==null?void 0:re.fields;if(!Array.isArray(Ce))return;const se=Ce.find(Q=>Q==null?void 0:Q.config);return se==null?void 0:se.config},Oe=new Set(["datakit"]),De=e.computed(()=>{var Ce;return((Ce=o.schema)==null?void 0:Ce._sourcePlugin)||M.name}),Be=e.shallowRef(o.record),qe=(Ce,se)=>{const re=Oe.has(De.value)?Ce:{...Ce,config:ce(Ce.config,he())};Be.value=re;const Q={...M};for(const le of se||[])delete Q[le];r("model-updated",{model:{...Q,...re},originalModel:ne,data:q(se)})},We=e.ref(!0),nt=()=>{var Ce;if(o.record&&o.schema&&(ye({enabled:o.record.enabled??!0,...o.record.instance_name&&{instance_name:o.record.instance_name||""},...a&&o.record.condition!=null&&{condition:o.record.condition},...o.record.protocols&&{protocols:o.record.protocols},...o.record.tags&&{tags:o.record.tags}}),o.credential?((o.record.consumer_id||o.record.consumer)&&ye({consumer_id:o.record.consumer_id||o.record.consumer}),ye(o.record)):o.record.config&&((o.record.consumer_id||o.record.consumer||o.record.service_id||o.record.service||o.record.route_id||o.record.route||o.record.consumer_group_id||o.record.consumer_group)&&ye({service_id:o.record.service_id||o.record.service,route_id:o.record.route_id||o.record.route,consumer_id:o.record.consumer_id||o.record.consumer,consumer_group_id:o.record.consumer_group_id||o.record.consumer_group}),o.record.partials&&ie("redis",{partials:o.record.partials}),R.value?qe(o.record):ye(o.record.config,"config"))),Object.keys(o.entityMap).length&&!o.entityMap.global&&o.schema){const se={};for(const re in o.entityMap){const Q=o.entityMap[re].id,le=o.entityMap[re].idField,de=le==="consumer_group_id"?"consumer_group-id":JSON.parse(JSON.stringify(le).replace("_","-"));Object.prototype.hasOwnProperty.call(M,de)&&(se[de]=Q)}ye(se)}if((Ce=o.entityMap.consumer)!=null&&Ce.id&&o.schema&&o.credential){const se={};Object.prototype.hasOwnProperty.call(M,"consumer")&&(se.consumer=o.entityMap.consumer.id),ye(se)}We.value=!1};return e.watch(We,Ce=>{r("loading",Ce)}),e.watch(()=>o.schema,(Ce,se)=>{var Q,le;if(k(Ce||{},se||{}))return;const re=l(Ce,void 0,void 0,o.engine);Object.assign(M,re.model),Y.value={fields:(le=(Q=Y.value)==null?void 0:Q.fields)==null?void 0:le.map(de=>({...de,disabled:de.disabled||!1}))},Object.assign(ne,JSON.parse(JSON.stringify(re.model))),v(re.model.name),nt()},{immediate:!0,deep:!0}),e.onBeforeMount(()=>{var Ce,se,re,Q;X.value=l(o.schema,void 0,void 0,o.engine),Object.assign(M,((Ce=X.value)==null?void 0:Ce.model)||{}),Y.value=((se=X.value)==null?void 0:se.schema)||{},v((Q=(re=X.value)==null?void 0:re.model)==null?void 0:Q.name),nt()}),e.onBeforeUnmount(()=>{_(!1)}),(Ce,se)=>{var Q,le,de;const re=e.resolveComponent("KSkeleton");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",Mj,[We.value?(e.openBlock(),e.createBlock(re,{key:0,type:"form"})):M.id&&n.editing||!n.editing?(e.openBlock(),e.createElementBlock("div",jj,[R.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(R.value),{key:0,developer:n.developer,"field-renderers":(Q=V.value)==null?void 0:Q.fieldRenderers,"form-model":M,"form-schema":Y.value,"is-editing":n.editing,"is-konnect-managed-redis-enabled":i.value,model:n.record,"on-form-change":qe,"on-validity-change":ke,"plugin-name":M.name,"render-rules":(le=V.value)==null?void 0:le.renderRules,schema:$.value,"onClick:createEntity":se[0]||(se[0]=_e=>Ce.$emit("click:create-entity",_e)),"onClick:learnMore":se[1]||(se[1]=_e=>Ce.$emit("click:learn-more",_e)),onGlobalAction:se[2]||(se[2]=(_e,xe)=>Ce.$emit("globalAction",_e,xe))},e.createSlots({_:2},[n.enableVaultSecretPicker?{name:e.unref(et.AUTOFILL_SLOT_NAME),fn:e.withCtx(_e=>[_e.schema.referenceable?(e.openBlock(),e.createBlock(e.unref(ya.VaultSecretPickerProvider),e.mergeProps({key:0},_e,{onOpen:J}),null,16)):e.createCommentVNode("",!0)]),key:"0"}:void 0]),1064,["developer","field-renderers","form-model","form-schema","is-editing","is-konnect-managed-redis-enabled","model","plugin-name","render-rules","schema"])):T.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(et.sharedForms)[T.value]),{key:1,"enable-redis-partial":n.enableRedisPartial,"form-model":M,"form-options":te.value,"form-schema":Y.value,"identity-principals-ui-enabled":e.unref(s),"is-editing":n.editing,"is-konnect-managed-redis-enabled":i.value,"on-model-updated":oe,"on-partial-toggled":ie,"show-new-partial-modal":_e=>Ce.$emit("showNewPartialModal",_e),"onClick:createEntity":se[3]||(se[3]=_e=>Ce.$emit("click:create-entity",_e)),"onClick:learnMore":se[4]||(se[4]=_e=>Ce.$emit("click:learn-more",_e))},e.createSlots({_:2},[n.enableVaultSecretPicker?{name:e.unref(et.AUTOFILL_SLOT_NAME),fn:e.withCtx(_e=>[_e.schema.referenceable?(e.openBlock(),e.createBlock(e.unref(ya.VaultSecretPickerProvider),e.mergeProps({key:0},_e,{onOpen:J}),null,16)):e.createCommentVNode("",!0)]),key:"0"}:void 0]),1064,["enable-redis-partial","form-model","form-options","form-schema","identity-principals-ui-enabled","is-editing","is-konnect-managed-redis-enabled","show-new-partial-modal"])):(e.openBlock(),e.createBlock(e.unref(et.VueFormGenerator),{key:2,"enable-redis-partial":n.enableRedisPartial,"is-editing":n.editing,"is-konnect-managed-redis-enabled":i.value,model:M,options:te.value,schema:Y.value,onModelUpdated:oe,onPartialToggled:ie,onRefreshModel:q,onShowNewPartialModal:se[5]||(se[5]=_e=>Ce.$emit("showNewPartialModal",_e))},e.createSlots({"plugin-config-empty-state":e.withCtx(()=>[e.createElementVNode("div",Fj,e.toDisplayString(e.unref(C)("plugins.form.grouping.plugin_configuration.empty")),1)]),_:2},[(de=e.unref(Rn)[M.name])!=null&&de.fieldRules&&(o.config.isNewOtelSchema||M.name!=="opentelemetry")?{name:"plugin-config-before-content",fn:e.withCtx(()=>[e.createVNode(Bj,{rules:e.unref(Rn)[M.name].fieldRules},null,8,["rules"])]),key:"0"}:void 0,n.enableVaultSecretPicker?{name:e.unref(et.AUTOFILL_SLOT_NAME),fn:e.withCtx(_e=>[_e.schema.referenceable?(e.openBlock(),e.createBlock(e.unref(ya.VaultSecretPickerProvider),e.mergeProps({key:0},_e,{onOpen:J}),null,16)):e.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["enable-redis-partial","is-editing","is-konnect-managed-redis-enabled","model","options","schema"]))])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(ya.VaultSecretPicker),{config:o.config,setup:Z.value,onCancel:se[6]||(se[6]=()=>Z.value=!1),onProceed:G},null,8,["config","setup"])],64)}}}),[["__scopeId","data-v-7f30f062"]]),Kj={key:1},qj=e.defineComponent({__name:"PluginFormActionsWrapper",props:{teleportTarget:{type:String,default:""}},setup(n){return(t,r)=>n.teleportTarget?(e.openBlock(),e.createBlock(e.Teleport,{key:0,to:n.teleportTarget},[e.renderSlot(t.$slots,"default")],8,["to"])):(e.openBlock(),e.createElementBlock("div",Kj,[e.renderSlot(t.$slots,"default")]))}}),Gj={key:0},Hj={class:"plugin-form-actions"},zj={key:0,class:"button-customize-deck-wrapper"},Wj=je(e.defineComponent({__name:"PluginForm",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||n.app==="konnect"&&!n.controlPlaneId||n.app==="kongManager"&&typeof n.workspace!="string")},pluginType:{type:String,required:!0},pluginId:{type:String,default:null},hideScopeSelection:{type:Boolean,default:!1},disableScopeSelection:{type:Boolean,default:!1},credential:{type:Boolean,default:!1},developer:{type:Boolean,default:!1},isWizardStep:{type:Boolean,default:!1},actionsTeleportTarget:{type:String,default:""},noCardWrapper:{type:Boolean,default:!1},hideViewConfigAction:{type:Boolean,default:!1},enableVaultSecretPicker:{type:Boolean,default:!1},schema:{type:Object,default:null},enableRedisPartial:{type:Boolean,default:!1},scopedEntitiesPermissions:{type:Object,default:null},engine:{type:String,required:!1,default:void 0}},emits:["cancel","error:fetch-schema","error","loading","update","model-updated","showNewPartialModal","globalAction","click:create-entity","click:learn-more"],setup(n,{emit:t}){var Ee,ue;const r=e.inject(fr.KM_2306_CONDITION_FIELD_314,!1),o=e.inject(fr.KM_2485_CLONED_PLUGINS,!1),i=e.ref(!1);e.provide(Ie.PLUGIN_FORM_LAYOUT_STATE,i);const a=t,s=n,c=Ar.useRouter(),{i18n:{t:l}}=st.useI18n(),{customSchemas:u,typedefs:p}=st.useSchemas({app:s.config.app,credential:s.credential,experimentalRenders:s.config.app==="konnect"?s.config.experimentalRenders:void 0}),{formatPluginFieldLabel:d}=st.usePluginHelpers(),{shouldUseFreeForm:f}=st.useFreeFormResolver(),{getMessageFromError:m}=Ie.useErrors(),{capitalize:h}=Ie.useStringHelpers(),{objectsAreEqual:y}=Ie.useHelpers(),{axiosInstance:b}=Ie.useAxios((Ee=s.config)==null?void 0:Ee.axiosRequestConfig),{getClonedPlugin:_}=st.useCustomPluginApi({axiosInstance:Ie.useAxios({...((ue=s.config)==null?void 0:ue.axiosRequestConfig)??{},konnect:{bypassGlobal404Handler:!0}}).axiosInstance,apiBaseUrl:s.config.apiBaseUrl,app:s.config.app,workspace:s.config.workspace,controlPlaneId:s.config.controlPlaneId}),k=e.ref(!1),C=e.computed(()=>!!s.pluginId),N=e.computed(()=>s.pluginId?Ie.EntityBaseFormType.Edit:Ie.EntityBaseFormType.Create),E=e.ref(void 0),w=e.ref(void 0),S=e.computed(()=>!!(s.credential&&s.config.entityId)),I=e.ref(void 0),U=e.ref({}),x=e.ref(),A=e.ref(),T=e.inject(fr.KM_2503_CUSTOM_PLUGIN_FREEFORM,!1),V=e.ref(null),R=e.computed(()=>V.value!==null),X=e.computed(()=>R.value&&V.value?V.value:s.pluginType),Y=e.computed(()=>{if(s.engine)return s.engine;if(!(!T||!Ne.value))return R.value&&V.value?f(V.value)?"freeform":"vfg":"freeform"}),ne=e.computed(()=>f(s.pluginType,Y.value));e.provide(Pi,{redisType:x,redisPath:A,isEditing:C.value});const M=[];e.provide(uw,P=>(M.push(P),()=>{const z=M.indexOf(P);z!==-1&&M.splice(z,1)}));const te=e.ref(!1),{isDeckEnabled:$,deckCustomizationOptions:Z,deckCalloutPreferenceKey:F}=Ie.useBaseFormDeckOptions(()=>s.config,Ie.SupportedEntityType.Plugin),J=e.ref(!1),G=e.reactive({enabled:!0,protocols:[],tags:[]}),v=e.reactive({fields:{enabled:!0,protocols:[],tags:[]},isReadonly:!1,clientErrorMessage:"",serverErrorMessage:""}),q=e.ref([{title:l("view_configuration.json"),hash:"#json"},{title:l("view_configuration.yaml"),hash:"#yaml"}]);s.config.app==="konnect"&&q.value.splice(1,0,{title:l("view_configuration.terraform"),hash:"#terraform"}),$.value&&q.value.push({title:l("view_configuration.deck"),hash:"#deck"});const ie=e.ref(q.value[0].hash),oe=e.ref(""),ke=e.computed(()=>{var z;if(S.value){let D=tt.form[s.config.app].credential[N.value];return D=D.replace(/{resourceEndpoint}/gi,Oe.value),D}let P;return s.config.entityType&&s.config.entityId?P=tt.form[s.config.app].edit.forEntity.replace(/{entityType}/gi,s.config.entityType).replace(/{entityId}/gi,s.config.entityId):P=tt.form[s.config.app].edit.all,s.config.app==="konnect"&&((z=Rn[s.pluginType])!=null&&z.useUIData)?`${P}?__ui_data=true`:P}),ye=()=>{k.value=!k.value},ce=e.computed(()=>{var Se,Ve,Me,Ze,Ye,Te,Ae,bt;const P=s.config.entityType==="consumers"&&s.config.entityId||((Ve=(Se=I.value)==null?void 0:Se.consumer)==null?void 0:Ve.id),z=s.config.entityType==="consumer_groups"&&s.config.entityId||((Ze=(Me=I.value)==null?void 0:Me.consumer_group)==null?void 0:Ze.id),D=s.config.entityType==="services"&&s.config.entityId||((Te=(Ye=I.value)==null?void 0:Ye.service)==null?void 0:Te.id),pe=s.config.entityType==="routes"&&s.config.entityId||((bt=(Ae=I.value)==null?void 0:Ae.route)==null?void 0:bt.id);if(!(P||z||D||pe))return{global:{entity:fe.PluginScope.GLOBAL,entityEndpoint:"plugins"}};const we={};return D&&(we.service={entity:fe.PluginScope.SERVICE,entityEndpoint:"services",id:D,idField:wo.SERVICE}),pe&&(we.route={entity:fe.PluginScope.ROUTE,entityEndpoint:"routes",id:pe,idField:wo.ROUTE}),P&&(we.consumer={entity:fe.PluginScope.CONSUMER,entityEndpoint:"consumers",id:P,idField:wo.CONSUMER}),z&&(we.consumer_group={entity:fe.PluginScope.CONSUMER_GROUP,entityEndpoint:"consumer_groups",id:z,idField:wo.CONSUMER_GROUP}),s.config.entityType&&(we.focusedEntity={entity:fe.PluginScope[s.config.entityType.substring(0,s.config.entityType.length-1).toUpperCase()],entityEndpoint:s.config.entityType,id:s.config.entityId,idField:wo[s.config.entityType.substring(0,s.config.entityType.length-1).toUpperCase()]}),we}),he=e.reactive({name:{default:s.pluginType,type:"input",inputType:"hidden",styleClasses:"d-none hidden-field",pinned:!0},enabled:{type:"switch",model:"enabled",label:l("plugins.form.fields.enabled.label"),textOn:l("plugins.form.fields.enabled.on_text"),textOff:l("plugins.form.fields.enabled.off_text"),styleClasses:"field-switch hide-label",default:!0,pinned:!0},selectionGroup:{type:s.hideScopeSelection&&(s.hideScopeSelection||N.value===Ie.EntityBaseFormType.Create&&s.config.entityId)?"foreign":"selectionGroup",disabled:s.disableScopeSelection,inputType:"hidden",styleClasses:"hide-label",fields:[{label:l("plugins.form.scoping.global.label"),description:l("plugins.form.scoping.global.help")}],pinned:!0},protocols:{id:"protocols",default:[],help:l("plugins.form.fields.protocols.help"),label:l("plugins.form.fields.protocols.label"),required:!0,styleClasses:"plugin-protocols-select",type:"multiselect",values:[{label:"grpc",value:"grpc"},{label:"grpcs",value:"grpcs"},{label:"http",value:"http"},{label:"https",value:"https"},{label:"tcp",value:"tcp"},{label:"tls",value:"tls"},{label:"tls_passthrough",value:"tls_passthrough"},{label:"udp",value:"udp"},{label:"ws",value:"ws"},{label:"wss",value:"wss"}]},instance_name:{default:"",type:"input",label:l("plugins.form.fields.instance_name.label"),inputType:"text",help:l("plugins.form.fields.instance_name.help")},tags:p.tags,...r?{condition:{default:"",type:"input",label:l("plugins.form.fields.condition.label"),inputType:"text",help:l("plugins.form.fields.condition.tooltip"),placeholder:l("plugins.form.fields.condition.placeholder")}}:{}}),Oe=e.computed(()=>{var D;const P=s.developer?"developers":"consumers",z=((D=fi[s.pluginType])==null?void 0:D.endpoint)||"/plugins";return`${P}/${s.config.entityId}${s.developer?"/credentials":""}${z}`}),De=P=>{const z=Array.from(new Set(P.map(D=>typeof D)));return z.length>1?"string":z[0]},Be=(P,z,D,pe)=>{var Me,Ze;let we=z&&z.fields||[];const Se=u[X.value],Ve=(Ze=(Me=fi[s.pluginType])==null?void 0:Me.schema)==null?void 0:Ze.fields;return Array.isArray(we)&&(we=we.reduce((Ye,Te)=>{const Ae=Object.keys(Te)[0];return Ae.match(/-/g)?Ye[Ae.replace(/-/g,"_")]={...Te[Ae],fieldNameHasDashes:!0}:Ye[Ae]=Te[Ae],Ye},{})),Object.keys(we).sort().forEach(Ye=>{var lr,vt,en,il,al,sl,ll;const Te=we[Ye];Te.type==="set"&&!(ne.value&&Te.elements.one_of)&&(Te.type="array");const Ae=P?`${P}-${Ye}`:`${Ye}`;if((lr=Se==null?void 0:Se.fieldsToDelete)!=null&&lr.includes(Ae)){$y(D,Ae);return}if(Object.prototype.hasOwnProperty.call(Te,"overwrite")||Te.hidden)return;if(Te.type==="table")return Be(Ae,Te.schema,D);if(Te.fields)return pe&&Te.type==="record"?(D[Ae]={type:"object",model:Ye,schema:{fields:Object.values(Be(Ae,Te,{},!0))}},D):Be(Ae,Te,D);if(D[Ae]={id:Ae,model:Ye},D[Ae].type=Te.type==="boolean"?"checkbox":"input",D[Ae].required=Te.required,D[Ae].referenceable=Te.referenceable,Ae.startsWith("config-"))if(!pe&&Te.type==="array"&&(oe.value=Ae),pe&&oe.value&&Ae.startsWith(oe.value)){const dt=Ae.slice(oe.value.length+1);D[Ae].label=dt.split("-").map(d).join(".")}else D[Ae].label=d(Ae);if((P==="config"||P.startsWith("config-"))&&(vt=we[Ye])!=null&&vt.description&&(D[Ae].help=cl.marked.parse(we[Ye].description,{mangle:!1,headerIds:!1})),Te.type==="map"){if(D[Ae].type="object-advanced",D[Ae].values=Te.values,Te.values.type==="array"){const{type:dt}=Te.values.elements||{};D[Ae].schema={fields:[{schema:{fields:[{...ft,model:Ae,valueArrayType:dt==="integer"?"number":dt||"string",inputAttributes:{...ft.inputAttributes,type:dt==="integer"?"number":"text",inputMode:dt==="integer"?"numeric":"text"}}]}}]}}else Te.values.fields&&(D[Ae].schema={fields:[{type:"object",model:"object",schema:{fields:Te.values.fields.map(dt=>{const tn=Object.keys(dt)[0];return{model:tn,type:"input",label:h(tn),placeholder:tn,inputType:dt[tn].type}})}}]});return D}if(Te.enum&&Te.type==="array"&&(D[Ae].type="checklist",D[Ae].values=Te.enum,D[Ae].multi=!0,D[Ae].multiSelect=!0),Te.one_of&&Te.type!=="array"&&(D[Ae].type="select",D[Ae].values=Te.one_of,D[Ae].selectOptions={noneSelectedText:l("plugins.form.no_selection")}),Te.elements&&Te.type==="array"){const dt=Te.elements;if(D[Ae].referenceable=dt.referenceable,D[Ae].elements=dt,["string","integer","number"].includes(dt.type)&&!dt.one_of){const{id:tn,help:It,label:ht,hint:ct,values:Nt,referenceable:wt,model:Pn}=D[Ae],{inputAttributes:Wn,...qg}=JSON.parse(JSON.stringify(ft));Wn.type=dt.type==="string"?"text":"number",D[Ae]={id:tn,help:It,label:ht,hint:ct,values:Nt,referenceable:wt,model:Pn,inputAttributes:Wn,...qg}}else if(["string","integer","number"].includes(dt.type)&&dt.one_of){if(pe){const{id:tn,help:It,label:ht,hint:ct,values:Nt,referenceable:wt,model:Pn}=D[Ae];D[Ae]={id:tn,help:It,label:ht,hint:ct,values:Nt,referenceable:wt,model:Pn,...xj(dt.one_of,Te.default)}}}else if(dt.type==="array"){const{id:tn,help:It,label:ht,hint:ct,values:Nt,referenceable:wt,model:Pn,elements:Wn}=D[Ae],{inputAttributes:qg,...GK}=JSON.parse(JSON.stringify(ft));D[Ae]={id:tn,help:It,label:ht,hint:ct,values:Nt,referenceable:wt,model:Pn,elements:Wn,inputAttributes:qg,...GK}}}if(Te.hint&&(D[Ae].hint=Te.hint),Se&&!Se.overwriteDefault&&Object.keys(Se).forEach(dt=>{if(dt===Ae){const{help:tn,label:It,hint:ht,values:ct,referenceable:Nt,elements:wt}=D[Ae],{help:Pn,...Wn}=Se[dt];D[Ae]={help:tn,label:It,hint:ht,values:ct,referenceable:Nt,elements:wt,...Wn},typeof Pn=="string"&&(D[Ae].help=cl.marked.parse(Pn,{mangle:!1,headerIds:!1}))}}),Te.type==="array"&&((en=Te.elements)==null?void 0:en.type)==="record"&&Array.isArray(Te.elements.fields)){let dt={};for(const It of Te.elements.fields)dt={...dt,...It};const tn=(sl=(al=(il=D[Ae])==null?void 0:il.items)==null?void 0:al.schema)==null?void 0:sl.fields;if(Array.isArray(tn))for(const It of D[Ae].items.schema.fields){const ht=(ll=dt[It.model])==null?void 0:ll.description;It.help===void 0&&typeof ht=="string"&&(It.help=cl.marked.parse(ht,{mangle:!1,headerIds:!1}))}if(tn||(D[Ae].type="array",D[Ae].newElementButtonLabelClasses="kong-form-new-element-button-label",D[Ae].fieldClasses="array-card-container-wrapper",D[Ae].itemContainerComponent="FieldArrayCardContainer",D[Ae].items={type:"object",schema:{fields:Object.values(Be(Ae,Te.elements,{},!0))}},D[Ae].items.schema.fields.forEach(It=>{var ht,ct;for(const Nt of Te.elements.fields){const wt=Object.keys(Nt)[0],Pn=((ct=(ht=It.id)==null?void 0:ht.split)==null?void 0:ct.call(ht,"-"))??[];if(Pn[Pn.length-1]===wt){It.model=wt,It.label=d(wt);break}}}),Te.elements.type==="record"&&(D[Ae].nestedFields=!0)),!D[Ae].nestedFields)D[Ae].items.default=()=>Te.elements.fields.reduce((It,ht)=>{const ct=Object.keys(ht)[0];return It[ct]=ht[ct].default,It},{});else{const It=(ht,ct)=>{if(ht.type==="object"){ht.model&&(ct[ht.model]={});for(const Nt of ht.schema.fields)It(Nt,ht.model?ct[ht.model]:ct)}else ht.model&&(ct[ht.model]=ht.default)};D[Ae].items.default=()=>{const ht={};return It(D[Ae].items,ht),ht}}}if(S.value&&Ve){for(let dt=0;dt<Ve.length;dt++)if(Ve[dt][Ae]){D[Ae]={...D[Ae],...Ve[dt][Ae]};break}}if(Te.required&&Te.type!=="boolean"&&(D[Ae].required=!0,D[Ae].selectOptions={hideNoneSelectedText:!0}),Te.required&&Te.type==="boolean"&&(D[Ae].default=Te.default??!1),Te.default!=null&&typeof Te.default!="object"&&Te.default!=="function"&&(D[Ae].default=Te.default),D[Ae].type==="input"){["string","number"].includes(typeof D[Ae].default)&&s.config.app==="konnect"&&(D[Ae].placeholder=`Default: ${D[Ae].default===""?"<empty string>":D[Ae].default}`);const{type:dt}=Te.elements||{};dt&&(D[Ae].valueArrayType=dt==="integer"?"number":dt),D[Ae].inputType=Te.type==="array"||Te.type==="string"?Te.encrypted?"password":"text":Te.type}let bt="string";Te.enum?bt=De(Te.enum):Te.type==="boolean"?bt="boolean":Te.type==="number"||Te.type==="integer"?(bt="number",D[Ae].inputType="number"):Te.type==="array"?(bt="array",D[Ae].default=Te.default,Te.len_min>0&&(D[Ae].submitWhenNull=!0)):Te.type==="foreign"?bt="object":Te.default&&Array.isArray(Te.default)?(bt="array",D[Ae].valueArrayType=De(Te.default)):Te.default&&(bt=typeof Te.default),D[Ae].valueType=bt,Te.fieldNameHasDashes&&(D[Ae].fieldNameHasDashes=!0)}),D},qe=()=>{var bt,lr,vt,en,il,al,sl,ll,dt,tn,It,ht;const P=R.value&&V.value?V.value:s.pluginType,z=((bt=Rn[P])==null?void 0:bt.scope.includes(fe.PluginScope.SERVICE))??!0,D=((lr=Rn[P])==null?void 0:lr.scope.includes(fe.PluginScope.ROUTE))??!0,pe=((vt=Rn[P])==null?void 0:vt.scope.includes(fe.PluginScope.CONSUMER))??!0,we=s.config.disableConsumerGroupScope?!1:((en=Rn[P])==null?void 0:en.scope.includes(fe.PluginScope.CONSUMER_GROUP))??!0,Se=s.config.entityType==="consumers"&&!!s.config.entityId||!!((al=(il=I.value)==null?void 0:il.consumer)!=null&&al.id),Ve=s.config.entityType==="consumer_groups"&&!!s.config.entityId||!!((ll=(sl=I.value)==null?void 0:sl.consumer_group)!=null&&ll.id),Me=s.config.entityType==="services"&&!!s.config.entityId||!!((tn=(dt=I.value)==null?void 0:dt.service)!=null&&tn.id),Ze=s.config.entityType==="routes"&&!!s.config.entityId||!!((ht=(It=I.value)==null?void 0:It.route)!=null&&ht.id),Ye=[],Te=(ct,Nt,wt)=>ct?l("plugins.form.disable_source_scope_change",{scope:wt}):Nt?l("plugins.form.disable_data_retrieving",{scope:wt}):"",Ae=ct=>{var Nt,wt;return((wt=(Nt=s.scopedEntitiesPermissions)==null?void 0:Nt[ct])==null?void 0:wt.canRetrieve)===!1};if(z){const ct=Ae("service"),Nt="services",wt=Me&&s.disableScopeSelection;Ye.push({id:"service-id",model:"service-id",label:l("plugins.form.scoping.gateway_service.label"),placeholder:l("plugins.form.scoping.placeholder"),type:"AutoSuggest",labelField:"name",entity:Nt,inputValues:{fields:["name","id"]},help:l("plugins.form.scoping.gateway_service.help"),disabled:wt||ct,disabledTooltip:Te(wt,ct,Nt)})}if(D){const ct=Ae("route"),Nt="routes",wt=Ze&&s.disableScopeSelection;Ye.push({id:"route-id",model:"route-id",label:l("plugins.form.scoping.route.label"),placeholder:l("plugins.form.scoping.placeholder"),type:"AutoSuggest",entity:Nt,labelField:"name",inputValues:{fields:["name","id"],primaryField:"id"},help:l("plugins.form.scoping.route.help"),disabled:wt||ct,disabledTooltip:Te(wt,ct,Nt)})}if(pe){const ct=Ae("consumer"),Nt="consumers",wt=Se&&s.disableScopeSelection;Ye.push({model:"consumer-id",label:l("plugins.form.scoping.consumer.label"),placeholder:l("plugins.form.scoping.placeholder"),type:"AutoSuggest",entity:Nt,labelField:"username",inputValues:{fields:["username","custom_id","id"],primaryField:"username"},help:l("plugins.form.scoping.consumer.help"),disabled:wt||ct,disabledTooltip:Te(wt,ct,Nt)})}if(we){const ct=Ae("consumer_group"),Nt="consumer_groups",wt=Ve&&s.disableScopeSelection;Ye.push({model:"consumer_group-id",label:l("plugins.form.scoping.consumer_group.label"),placeholder:l("plugins.form.scoping.placeholder"),type:"AutoSuggest",entity:Nt,entityDataKey:"consumer_group",labelField:"name",inputValues:{fields:["name","id"],primaryField:"name"},help:l("plugins.form.scoping.consumer_group.help"),disabled:wt||ct,disabledTooltip:Te(wt,ct,Nt)})}if(Ye.length){const ct=[...z?["service"]:[],...D?["route"]:[],...pe?["consumer"]:[],...we?["consumer_group"]:[]],wt=ct.splice(ct.length-2,2).map(Wn=>l(Wn==="service"?"plugins.form.scoping.gateway_service.plural":`plugins.form.scoping.${Wn}.plural`)).join(`${ct.length>0?",":""} and/or `),Pn=["Specific",[...ct.length>0?[ct.map(Wn=>l(Wn==="service"?"plugins.form.scoping.gateway_service.plural":`plugins.form.scoping.${Wn}.plural`)).join(", ")]:[],wt].join(", ")].join(" ");he.selectionGroup.fields.push({label:l("plugins.form.scoping.label"),description:Pn,fields:[]}),he.selectionGroup.fields[1].fields=Ye}u[X.value]&&u[X.value].overwriteDefault&&Object.hasOwnProperty.call(u[X.value],"formSchema")&&Object.assign(he,u[X.value].formSchema)},We=e.computed(()=>!y(v.fields,G,!0)),nt=e.computed(()=>!be.value&&!J.value&&(N.value===Ie.EntityBaseFormType.Create||We.value)),lt=e.ref(!1),Re=e.ref(),Ce=P=>{s.credential&&P.password&&(P.password=""),v.fields.id=(P==null?void 0:P.id)||void 0,Re.value=P==null?void 0:P.ordering,Object.assign(G,v.fields),I.value=P,lt.value=!0},se=e.ref({}),re=P=>{var z;v.fields=P.model,v.fields.id=((z=I.value)==null?void 0:z.id)||void 0,Object.assign(G,P.originalModel),se.value=P.data,s.isWizardStep&&a("model-updated",{model:v.fields,data:P.data,resourceEndpoint:Oe.value})},Q=e.ref(new Map),le=e.computed(()=>[v.clientErrorMessage,v.serverErrorMessage].filter(Boolean).join("; ")),de=P=>{P.valid?Q.value.delete(P.model):Q.value.set(P.model,P.error),v.clientErrorMessage=[...Q.value.entries()].map(([z,D])=>`${z}: ${typeof D=="string"?D:m(D)}`).join("; "),v.clientErrorMessage&&(v.serverErrorMessage="")};e.watch([ce,lt],(P,z)=>{const D=P[0]!==z[0],pe=P[1],we=z[1];if(!S.value&&N.value===Ie.EntityBaseFormType.Edit&&(D||pe&&pe!==we)){const Se=Be("config",U.value,he);Ne.value&&(Se._isCustomPlugin=!0),R.value&&V.value&&(Se._sourcePlugin=V.value),x.value&&(Se._supported_redis_partial_type=x.value),w.value=Se}},{deep:!0});const _e=()=>{s.config.cancelRoute?c.push(s.config.cancelRoute):a("cancel")},xe=e.computed(()=>{const P=s.config.entityType&&s.config.entityId&&!s.developer,z=S.value?tt.form[s.config.app].credential[N.value]:tt.form[s.config.app][N.value][P?"forEntity":"all"];let D=`${s.config.apiBaseUrl}${z}`;return s.config.app==="konnect"&&(D=D.replace(/{controlPlaneId}/gi,s.config.controlPlaneId||"")),D=D.replace(/\/{workspace}/gi,s.config.workspace?`/${s.config.workspace}`:""),D=D.replace(/{resourceEndpoint}/gi,Oe.value),D=D.replace(/{id}/gi,s.pluginId??""),D=D.replace(/{entityType}/gi,s.config.entityType||""),D=D.replace(/{entityId}/gi,s.config.entityId||""),D}),Ne=e.computed(()=>!Object.keys(Rn).includes(s.pluginType)),g=e.computed(()=>{const P=se.value;if(S.value){for(const z in fe.PluginScope){const D=fe.PluginScope[z];P[D]&&!P[D].id&&(P[D]={id:s.config.entityId})}delete P.created_at}return se.value.partials&&A.value&&$y(P,A.value),P}),O=e.computed(()=>{const{__ui_data:P,...z}={...g.value};return z}),j=async()=>{if(M.every(P=>P())&&!v.clientErrorMessage&&!s.isWizardStep)try{v.isReadonly=!0;let P;const z=JSON.parse(JSON.stringify(g.value)),D=u[X.value];!ne.value&&typeof(D==null?void 0:D.shamefullyTransformPayload)=="function"&&D.shamefullyTransformPayload({originalModel:G,model:v.fields,payload:z,schema:w.value}),N.value==="create"?P=await b.post(xe.value,z):N.value==="edit"&&(P=s.config.app==="konnect"||x.value&&z.partials?await b.put(xe.value,Object.assign({ordering:Re.value},z)):await b.patch(xe.value,z)),Object.assign(G,v.fields),a("update",P==null?void 0:P.data)}catch(P){v.serverErrorMessage=m(P),a("error",P)}finally{v.isReadonly=!1}},W=e.computed(()=>{var pe;const P=S.value?(pe=fi[s.pluginType])==null?void 0:pe.schemaEndpoint:s.pluginType,z=S.value?tt.form[s.config.app].credentialSchema:tt.form[s.config.app].pluginSchema;let D=`${s.config.apiBaseUrl}${z}`;return s.config.app==="konnect"&&(D=D.replace(/{controlPlaneId}/gi,s.config.controlPlaneId||"")),D.replace(/\/{workspace}/gi,s.config.workspace?`/${s.config.workspace}`:"").replace(/{plugin}/gi,P)}),ae=e.ref(""),be=e.ref(!1),L=e.ref("");e.onBeforeMount(async()=>{var P,z,D,pe;be.value=!0;try{if(S.value&&s.config.app==="konnect"){const we=(P=fi[s.pluginType])==null?void 0:P.schemaEndpoint,Se=pT[we];ae.value=we,w.value=Be("",Se,{}),be.value=!1}else{const we=o&&Ne.value,Se=s.schema?Promise.resolve(s.schema):b.get(W.value).then(Me=>Me.data),[Ve]=await Promise.all([Se,we?ge(s.pluginType):Promise.resolve()]);if(E.value=Ve,Ve)if(S.value)w.value=Be("",Ve,{}),be.value=!1;else{const Me=Ve.fields.find(Ye=>Ye.config);U.value=Me?Me.config:Ve,Ve.supported_partials&&(x.value=Object.keys(Ve.supported_partials).find(Ye=>[Dl.REDIS_CE,Dl.REDIS_EE].includes(Ye)),A.value=(z=Ve.supported_partials[x.value])==null?void 0:z[0]),qe();const Ze=(D=Ve.fields.find(Ye=>Ye.protocols))==null?void 0:D.protocols;if(Ze){const{default:Ye=[],elements:Te={}}=Ze;he.protocols.default=Ye,he.protocols.placeholder=s.config.app==="konnect"?l("plugins.form.fields.protocols.placeholderWithDefaultValues",{protocols:Ye.join(", ")}):l("plugins.form.fields.protocols.placeholder"),(pe=Te.one_of)!=null&&pe.length&&(he.protocols.values=Te.one_of.map(Ae=>({label:Ae,value:Ae})))}if(lt.value||N.value===Ie.EntityBaseFormType.Create){const Ye=Be("config",U.value,he);x.value&&(Ye._supported_redis_partial_type=x.value),Ne.value&&(Ye._isCustomPlugin=!0),R.value&&V.value&&(Ye._sourcePlugin=V.value),w.value=Ye}}}}catch(we){console.error(we),L.value=m(we),a("error:fetch-schema",we)}finally{be.value=!1}});async function ge(P){var z;try{const D=await _(P);V.value=(D==null?void 0:D.ref)??null}catch(D){if(Zo.isAxiosError(D)&&((z=D.response)==null?void 0:z.status)===404)return;throw D}}return(P,z)=>{const D=e.resolveComponent("KSkeleton"),pe=e.resolveComponent("KEmptyState"),we=e.resolveComponent("KButton"),Se=e.resolveComponent("KTabs"),Ve=e.resolveComponent("KSlideout");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["kong-ui-entities-plugin-form-container",{"new-form-layout":i.value}])},[be.value?(e.openBlock(),e.createBlock(D,{key:0,type:"form"})):L.value?(e.openBlock(),e.createBlock(pe,{key:1,"action-button-visible":!1,"data-testid":"plugin-form-schema-error","icon-variant":"error"},{default:e.withCtx(()=>[e.createElementVNode("h3",null,e.toDisplayString(e.unref(l)("errors.load_schema")),1)]),_:1})):(e.openBlock(),e.createBlock(e.unref(Ie.EntityBaseForm),{key:2,"can-submit":nt.value,config:n.config,"edit-id":n.pluginId,"entity-type":e.unref(Ie.SupportedEntityType).Plugin,"error-message":le.value,"fetch-url":ke.value,"form-fields":g.value,"is-readonly":v.isReadonly,"no-validate":"","wrapper-component":n.noCardWrapper?"div":void 0,onCancel:_e,"onFetch:error":z[6]||(z[6]=Me=>P.$emit("error",Me)),"onFetch:success":Ce,onLoading:z[7]||(z[7]=Me=>P.$emit("loading",Me))},{"form-actions":e.withCtx(()=>[n.isWizardStep?(e.openBlock(),e.createElementBlock("div",Gj)):(e.openBlock(),e.createBlock(qj,{key:1,"teleport-target":n.actionsTeleportTarget},{default:e.withCtx(()=>[e.createElementVNode("div",Hj,[n.hideViewConfigAction?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(we,{key:0,appearance:"tertiary","data-testid":`plugin-${C.value?"edit":"create"}-form-view-configuration`,onClick:z[5]||(z[5]=Me=>ye())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)("actions.view_configuration")),1)]),_:1},8,["data-testid"])),e.createVNode(we,{appearance:"secondary",class:"form-action-button","data-testid":`plugin-${C.value?"edit":"create"}-form-cancel`,disabled:v.isReadonly,onClick:_e},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)("actions.cancel")),1)]),_:1},8,["data-testid","disabled"]),e.createVNode(we,{appearance:"primary","data-testid":`plugin-${C.value?"edit":"create"}-form-submit`,disabled:!nt.value||v.isReadonly,type:"submit",onClick:j},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)("actions.save")),1)]),_:1},8,["data-testid","disabled"])])]),_:1},8,["teleport-target"]))]),default:e.withCtx(()=>[e.createElementVNode("form",{hidden:"",onSubmit:j},null,32),e.createVNode(Uj,{config:n.config,credential:S.value,developer:n.developer,editing:N.value===e.unref(Ie.EntityBaseFormType).Edit,"enable-redis-partial":n.enableRedisPartial,"enable-vault-secret-picker":s.enableVaultSecretPicker,engine:Y.value,"entity-map":ce.value,"raw-schema":E.value,record:I.value,schema:w.value,"onClick:createEntity":z[0]||(z[0]=Me=>P.$emit("click:create-entity",Me)),"onClick:learnMore":z[1]||(z[1]=Me=>P.$emit("click:learn-more",Me)),onGlobalAction:z[2]||(z[2]=(Me,Ze)=>P.$emit("globalAction",Me,Ze)),onLoading:z[3]||(z[3]=Me=>J.value=Me),onModelUpdated:re,onShowNewPartialModal:z[4]||(z[4]=Me=>P.$emit("showNewPartialModal",Me)),onValidityChange:de},null,8,["config","credential","developer","editing","enable-redis-partial","enable-vault-secret-picker","engine","entity-map","raw-schema","record","schema"])]),_:1},8,["can-submit","config","edit-id","entity-type","error-message","fetch-url","form-fields","is-readonly","wrapper-component"])),e.createVNode(Ve,{"close-on-blur":!1,"data-testid":"form-view-configuration-slideout","has-overlay":!1,"offset-top":60,title:e.unref(l)("view_configuration.title"),visible:k.value,onClose:ye},{default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(e.unref(l)("view_configuration.message")),1),e.createVNode(Se,{modelValue:ie.value,"onUpdate:modelValue":z[11]||(z[11]=Me=>ie.value=Me),"data-testid":"form-view-configuration-slideout-tabs",tabs:q.value},{json:e.withCtx(()=>[e.createVNode(e.unref(Ie.JsonCodeBlock),{config:n.config,"entity-record":O.value,"fetcher-url":xe.value,"request-method":s.pluginId?"put":"post"},null,8,["config","entity-record","fetcher-url","request-method"])]),yaml:e.withCtx(()=>[e.createVNode(e.unref(Ie.YamlCodeBlock),{"deck-callout-preference-key":e.unref($)?e.unref(F):void 0,"entity-record":O.value,"onDeckCallout:clickCta":z[8]||(z[8]=Me=>ie.value="#deck")},null,8,["deck-callout-preference-key","entity-record"])]),terraform:e.withCtx(()=>[e.createVNode(e.unref(Ie.TerraformCodeBlock),{"credential-type":ae.value,"entity-record":O.value,"entity-type":e.unref(Ie.SupportedEntityType).Plugin},null,8,["credential-type","entity-record","entity-type"])]),deck:e.withCtx(()=>[e.unref(Z)?(e.openBlock(),e.createElementBlock("div",zj,[e.createVNode(we,{appearance:"secondary",class:"button-customize-deck",onClick:z[9]||(z[9]=Me=>te.value=!0)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)("plugins.form.button_deck_customize")),1)]),_:1})])):e.createCommentVNode("",!0),e.createVNode(e.unref(Ie.DeckCodeBlock),{app:n.config.app,"control-plane-name":n.config.app==="konnect"?n.config.controlPlaneName:void 0,"customization-options":e.unref(Z),"entity-record":O.value,"entity-type":e.unref(Ie.SupportedEntityType).Plugin,"geo-api-server-url":n.config.app==="konnect"?n.config.geoApiServerUrl:void 0,"is-customization-modal-visible":te.value,"kong-admin-api-url":n.config.app==="kongManager"?n.config.apiBaseUrl:void 0,workspace:n.config.workspace||void 0,onCustomizationClose:z[10]||(z[10]=Me=>te.value=!1)},null,8,["app","control-plane-name","customization-options","entity-record","entity-type","geo-api-server-url","is-customization-modal-visible","kong-admin-api-url","workspace"])]),_:1},8,["modelValue","tabs"])]),_:1},8,["title","visible"])],2)}}}),[["__scopeId","data-v-cd2d48f0"]]),Yj={class:"kong-ui-entities-plugins-list"},Jj={class:"button-row"},Xj={class:"name-cell-wrapper"},Zj={class:"info-wrapper"},Qj={key:0,class:"info-name"},eF={key:1,class:"info-name"},tF={key:2,class:"info-type"},nF={key:1},rF=je(e.defineComponent({__name:"PluginList",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||!n.createRoute||!n.getViewRoute||!n.getEditRoute||!n.getConfigureDynamicOrderingRoute||n.app==="kongManager"&&!n.isExactMatch&&!n.filterSchema)},cacheIdentifier:{type:String,default:""},canCreate:{type:Function,required:!1,default:async()=>!0},canDelete:{type:Function,required:!1,default:async()=>!0},canEdit:{type:Function,required:!1,default:async()=>!0},canToggle:{type:Function,required:!1,default:async()=>!0},canRetrieve:{type:Function,required:!1,default:async()=>!0},canRetrieveScopedEntity:{type:Function,required:!1,default:async()=>!0},canConfigureDynamicOrdering:{type:Function,required:!1,default:async()=>!0},title:{type:String,default:""},titleTag:{type:String,default:"h2"},useActionOutside:{type:Boolean,default:!1}},emits:["error","click:learn-more","copy:success","copy:error","delete:success","toggle-enabled"],setup(n,{emit:t}){var nt,lt;const r=st.usePluginMetaData(),o=t,i=n,{i18n:{t:a,formatUnixTimeStamp:s}}=st.useI18n(),c=Ar.useRouter(),{axiosInstance:l}=Ie.useAxios((nt=i.config)==null?void 0:nt.axiosRequestConfig),{hasRecords:u,handleStateChange:p}=Ie.useTableState(()=>N.value),d=e.computed(()=>u.value&&i.config.app==="konnect"),f=e.computed(()=>!!i.config.entityId),m=e.computed(()=>{var Re;return((Re=i.config)==null?void 0:Re.entityType)==="consumers"}),h=e.computed(()=>{var Re;return((Re=i.config)==null?void 0:Re.entityType)==="consumer_groups"}),y=i.config.app==="konnect"||Ie.useGatewayFeatureSupported({gatewayInfo:i.config.gatewayInfo,supportedRange:{enterprise:["3.0"]}}),b=e.computed(()=>i.config.app!=="kongManager"||!!i.config.disableSorting),_={name:{label:a("plugins.list.table_headers.name"),searchable:!0,sortable:!0,hidable:!1}};(lt=i.config)!=null&&lt.entityId||(_.appliedTo={label:a("plugins.list.table_headers.applied_to"),sortable:!1}),_.enabled={label:a("plugins.list.table_headers.enabled"),searchable:!0,sortable:!0},y&&(_.ordering={label:a("plugins.list.table_headers.ordering"),sortable:!0}),_.tags={label:a("plugins.list.table_headers.tags"),sortable:!1},_.updated_at={label:a("plugins.list.table_headers.updated_at"),sortable:!0};const k=_,C=e.computed(()=>{var Ce,se,re,Q;let Re=i.config.entityType?`${i.config.apiBaseUrl}${tt.list[i.config.app].forEntity}`:`${i.config.apiBaseUrl}${tt.list[i.config.app].all}`;return i.config.app==="konnect"&&(Re=Re.replace(/{controlPlaneId}/gi,((Ce=i.config)==null?void 0:Ce.controlPlaneId)||"")),Re.replace(/\/{workspace}/gi,(se=i.config)!=null&&se.workspace?`/${i.config.workspace}`:"").replace(/{entityType}/gi,((re=i.config)==null?void 0:re.entityType)||"").replace(/{entityId}/gi,((Q=i.config)==null?void 0:Q.entityId)||"")}),N=e.ref(""),E=e.computed(()=>i.config.app==="konnect"||i.config.isExactMatch?{isExactMatch:!0,fields:{name:_.name,id:{label:a("plugins.list.table_headers.id"),sortable:!0}},placeholder:a(`search.placeholder.${i.config.isExactMatch?"exact":i.config.app}`)}:{isExactMatch:!1,fields:{enabled:{..._.enabled,label:a("search.filter.field.enabled")},name:_.name,instance_name:{label:a("plugins.list.table_headers.instance_name"),searchable:!0}},schema:i.config.filterSchema}),{fetcher:w,fetcherState:S,fetcherCacheKey:I}=Ie.useFetcher(e.computed(()=>({...i.config,cacheIdentifier:i.cacheIdentifier})),C),U=()=>{N.value=""},x=()=>{I.value++},A=e.ref(null),T=Re=>{var se,re,Q,le;const Ce=[];return((se=Re.route)!=null&&se.id||Re.route_id)&&Ce.push({type:"route",badgeText:a("plugins.list.table_headers.applied_to_badges.route")}),((re=Re.service)!=null&&re.id||Re.service_id)&&Ce.push({type:"service",badgeText:a("plugins.list.table_headers.applied_to_badges.service")}),((Q=Re.consumer)!=null&&Q.id||Re.consumer_id)&&Ce.push({type:"consumer",badgeText:a("plugins.list.table_headers.applied_to_badges.consumer")}),((le=Re.consumer_group)!=null&&le.id||Re.consumer_group_id)&&Ce.push({type:"consumer_group",badgeText:a("plugins.list.table_headers.applied_to_badges.consumer_group")}),Ce.length?Ce:[{type:null,badgeText:a("plugins.list.table_headers.applied_to_badges.global")}]},V=async(Re,Ce)=>{var se;return Re===null?!1:await((se=i.canRetrieveScopedEntity)==null?void 0:se.call(i,Re,Ce.id))},R=(Re,Ce)=>{var re,Q,le,de,_e;let se=null;switch(Re){case"route":se=(re=Ce.route)==null?void 0:re.id;break;case"service":se=(Q=Ce.service)==null?void 0:Q.id;break;case"consumer":se=(le=Ce.consumer)==null?void 0:le.id;break;case"consumer_group":se=(de=Ce.consumer_group)==null?void 0:de.id;break}se&&((_e=i.config)!=null&&_e.getScopedEntityViewRoute)&&c.push(i.config.getScopedEntityViewRoute(Re,se))},X=e.ref(!1),Y=e.ref(null),ne=e.computed(()=>{const Re={action:"disable",id:"",name:""};if(Y.value){const{enabled:Ce,id:se,name:re}=Y.value;Re.action=Ce?"disable":"enable",Re.id=se,Re.name=r.getDisplayName(re)||se}return Re}),M=Re=>{X.value=!0,Y.value=Re},te=()=>{X.value=!1,Y.value=null},$=async()=>{var re,Q,le,de,_e,xe,Ne,g;if(!await((re=i.canEdit)==null?void 0:re.call(i,Y.value))||!Y.value)return;let Ce=`${i.config.apiBaseUrl}${(_e=tt.item[i.config.app])==null?void 0:_e[(Q=i.config)!=null&&Q.entityType?"forEntity":"all"].replace(/{entityType}/gi,((le=i.config)==null?void 0:le.entityType)||"").replace(/{entityId}/gi,((de=i.config)==null?void 0:de.entityId)||"")}`.replace(/{id}/gi,Y.value.id||"");i.config.app==="konnect"&&(Ce=Ce.replace(/{controlPlaneId}/gi,((xe=i.config)==null?void 0:xe.controlPlaneId)||"")),Ce=Ce.replace(/\/{workspace}/gi,(Ne=i.config)!=null&&Ne.workspace?`/${i.config.workspace}`:"");const se=!Y.value.enabled;try{const O=(g=i.config)==null?void 0:g.app;let j;N.value&&O==="konnect"&&(j=await l.get(Ce));const{data:W}=O==="konnect"?await l.put(Ce,{...(j==null?void 0:j.data)||Y.value,enabled:se},{timeout:12e4}):await l.patch(Ce,{...Y.value,enabled:se},{timeout:12e4});o("toggle-enabled",se,W),Y.value.enabled=se}catch(O){o("error",O)}},Z=async(Re,Ce)=>{const se=Re.id;if(!await Ce(se)){o("copy:error",{entity:Re,field:"id",message:a("errors.copy")});return}o("copy:success",{entity:Re,field:"id",message:a("copy.success",{val:se})})},F=async(Re,Ce)=>{const se=JSON.stringify(Re);if(!await Ce(se)){o("copy:error",{entity:Re,message:a("errors.copy")});return}o("copy:success",{entity:Re,message:a("copy.success_brief")})},J=async Re=>{var se;await((se=i.canRetrieve)==null?void 0:se.call(i,Re))&&c.push(i.config.getViewRoute(Re))},G=Re=>({label:a("actions.view"),to:i.config.getViewRoute(Re)}),v=Re=>({label:a("actions.edit"),to:i.config.getEditRoute(Re)}),q=Re=>({label:a("actions.configure_dynamic_ordering"),to:i.config.getConfigureDynamicOrderingRoute(Re)}),ie=e.ref(void 0),oe=e.ref(!1),ke=e.ref(!1),ye=e.ref(""),ce=Ie.useDeleteUrlBuilder(i.config,C.value),he=Re=>{ie.value=Re,oe.value=!0},Oe=()=>{oe.value=!1},De=async()=>{var Re,Ce,se;if((Re=ie.value)!=null&&Re.id){ke.value=!0;try{await l.delete(ce(ie.value.id)),ke.value=!1,oe.value=!1,I.value++,o("delete:success",ie.value)}catch(re){ye.value=((se=(Ce=re.response)==null?void 0:Ce.data)==null?void 0:se.message)||re.message||a("errors.delete"),o("error",re)}finally{ke.value=!1}}},Be=()=>{c.push(i.config.createRoute)};e.watch(S,Re=>{var Ce,se,re;if(Re.status===Ie.FetcherStatus.Error){A.value={title:a("errors.general")},(re=(se=(Ce=Re.error)==null?void 0:Ce.response)==null?void 0:se.data)!=null&&re.message&&(A.value.message=Re.error.response.data.message),o("error",Re.error);return}A.value=null});const qe=e.ref({ctaPath:i.config.createRoute,ctaText:void 0,message:`${a("plugins.list.empty_state.description")}${i.config.additionMessageForEmptyState?` ${i.config.additionMessageForEmptyState}`:""}`,title:a("plugins.title")}),We=e.ref(!1);return e.onBeforeMount(async()=>{We.value=await i.canCreate(),We.value&&(qe.value.title=a("plugins.list.empty_state.title"),qe.value.ctaText=a("actions.create"))}),(Re,Ce)=>{const se=e.resolveComponent("KButton"),re=e.resolveComponent("KEmptyState"),Q=e.resolveComponent("KBadge"),le=e.resolveComponent("KTruncate"),de=e.resolveComponent("KInputSwitch"),_e=e.resolveComponent("KDropdownItem"),xe=e.resolveComponent("KClipboardProvider");return e.openBlock(),e.createElementBlock("div",Yj,[e.createVNode(e.unref(Ie.EntityBaseTable),{"cache-identifier":n.cacheIdentifier,"disable-sorting":b.value,"empty-state-options":qe.value,"enable-entity-actions":"","error-message":A.value,fetcher:e.unref(w),"fetcher-cache-key":e.unref(I),"pagination-type":"offset","preferences-storage-key":"kong-ui-entities-plugins-list",query:N.value,"table-headers":e.unref(k),title:n.title,"title-tag":n.titleTag,onClearSearchInput:U,"onClick:row":Ce[4]||(Ce[4]=Ne=>J(Ne)),onSort:x,onState:e.unref(p)},e.createSlots({"toolbar-filter":e.withCtx(()=>[e.createVNode(e.unref(Ie.EntityFilter),{modelValue:N.value,"onUpdate:modelValue":Ce[0]||(Ce[0]=Ne=>N.value=Ne),config:E.value},null,8,["modelValue","config"])]),"toolbar-button":e.withCtx(()=>[(e.openBlock(),e.createBlock(e.Teleport,{disabled:!n.useActionOutside,to:"#kong-ui-app-page-header-action-button"},[e.createElementVNode("div",Jj,[!f.value&&d.value?(e.openBlock(),e.createBlock(se,{key:0,appearance:"secondary",class:"open-learning-hub","data-testid":"plugins-learn-more-button",icon:"",onClick:Ce[1]||(Ce[1]=Ne=>Re.$emit("click:learn-more"))},{default:e.withCtx(()=>[e.createVNode(e.unref($e.BookIcon),{decorative:""})]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(Ie.PermissionsWrapper),{"auth-function":()=>n.canCreate()},{default:e.withCtx(()=>[e.createVNode(se,{appearance:"primary","data-testid":"toolbar-add-plugin",size:n.useActionOutside?"medium":"large",to:n.config.createRoute},{default:e.withCtx(()=>[e.createVNode(e.unref($e.AddIcon)),e.createTextVNode(" "+e.toDisplayString(e.unref(a)("plugins.list.toolbar_actions.new_plugin")),1)]),_:1},8,["size","to"])]),_:1},8,["auth-function"])])],8,["disabled"]))]),name:e.withCtx(({row:Ne})=>[e.createElementVNode("div",Xj,[e.createVNode(e.unref(xr.PluginIcon),{class:"plugin-icon",name:Ne.name,size:24},null,8,["name"]),e.createElementVNode("div",Zj,[Ne.instance_name?(e.openBlock(),e.createElementBlock("span",Qj,e.toDisplayString(Ne.instance_name),1)):(e.openBlock(),e.createElementBlock("span",eF,e.toDisplayString(e.unref(r).getDisplayName(Ne.name)),1)),Ne.instance_name?(e.openBlock(),e.createElementBlock("span",tF,e.toDisplayString(e.unref(r).getDisplayName(Ne.name)),1)):e.createCommentVNode("",!0)])])]),appliedTo:e.withCtx(({row:Ne})=>[T(Ne).length>0?(e.openBlock(),e.createBlock(le,{key:0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T(Ne),g=>(e.openBlock(),e.createBlock(e.unref(Ie.PermissionsWrapper),{key:g.badgeText,"auth-function":()=>V(g.type,Ne),"force-show":""},{default:e.withCtx(({isAllowed:O})=>[e.createVNode(Q,{class:e.normalizeClass(O||"disabled"),onClick:e.withModifiers(j=>O&&g.type&&R(g.type,Ne),["stop"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(g.badgeText),1)]),_:2},1032,["class","onClick"])]),_:2},1032,["auth-function"]))),128))]),_:2},1024)):(e.openBlock(),e.createElementBlock("span",nF,"-"))]),enabled:e.withCtx(({row:Ne})=>[e.createVNode(e.unref(Ie.PermissionsWrapper),{"auth-function":async()=>!!(await n.canEdit(Ne)&&await n.canToggle(Ne)),"force-show":""},{default:e.withCtx(({isAllowed:g})=>{var O,j;return[e.createElementVNode("div",{onClick:Ce[3]||(Ce[3]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(de,{disabled:!g,"disabled-tooltip-text":!g&&((j=(O=n.config).getToggleDisabledTooltip)==null?void 0:j.call(O,Ne))||void 0,"model-value":Ne.enabled,onClick:e.withModifiers(W=>g&&M(Ne),["stop","prevent"])},null,8,["disabled","disabled-tooltip-text","model-value","onClick"])])]}),_:2},1032,["auth-function"])]),ordering:e.withCtx(({rowValue:Ne})=>[e.createVNode(Q,{appearance:e.unref(Ty)(Ne)?"info":"warning"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(Ty)(Ne)?e.unref(a)("plugins.list.table_headers.ordering_badge.static"):e.unref(a)("plugins.list.table_headers.ordering_badge.dynamic")),1)]),_:2},1032,["appearance"])]),tags:e.withCtx(({rowValue:Ne})=>[e.createVNode(e.unref(Ie.TableTags),{tags:Ne},null,8,["tags"])]),updated_at:e.withCtx(({row:Ne,rowValue:g})=>[e.createTextVNode(e.toDisplayString(e.unref(s)(g??Ne.created_at)),1)]),actions:e.withCtx(({row:Ne})=>[e.createVNode(xe,null,{default:e.withCtx(({copyToClipboard:g})=>[e.createVNode(_e,{"data-testid":"action-entity-copy-id",onClick:O=>Z(Ne,g)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("actions.copy_id")),1)]),_:1},8,["onClick"])]),_:2},1024),e.createVNode(xe,null,{default:e.withCtx(({copyToClipboard:g})=>[e.createVNode(_e,{"data-testid":"action-entity-copy-json",onClick:O=>F(Ne,g)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("actions.copy_json")),1)]),_:1},8,["onClick"])]),_:2},1024),e.createVNode(e.unref(Ie.PermissionsWrapper),{"auth-function":()=>n.canRetrieve(Ne)},{default:e.withCtx(()=>[e.createVNode(_e,{"data-testid":"action-entity-view","has-divider":"",item:G(Ne)},null,8,["item"])]),_:2},1032,["auth-function"]),e.createVNode(e.unref(Ie.PermissionsWrapper),{"auth-function":()=>n.canEdit(Ne)},{default:e.withCtx(()=>[e.createVNode(_e,{"data-testid":"action-entity-edit",item:v(Ne)},null,8,["item"])]),_:2},1032,["auth-function"]),!m.value&&!h.value&&e.unref(y)?(e.openBlock(),e.createBlock(e.unref(Ie.PermissionsWrapper),{key:0,"auth-function":()=>n.canConfigureDynamicOrdering(Ne)},{default:e.withCtx(()=>[q(Ne)?(e.openBlock(),e.createBlock(_e,{key:0,"data-testid":"action-entity-config-dyn-order",item:q(Ne)},null,8,["item"])):e.createCommentVNode("",!0)]),_:2},1032,["auth-function"])):e.createCommentVNode("",!0),e.createVNode(e.unref(Ie.PermissionsWrapper),{"auth-function":()=>n.canDelete(Ne)},{default:e.withCtx(()=>[e.createVNode(_e,{danger:"","data-testid":"action-entity-delete","has-divider":"",onClick:g=>he(Ne)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("actions.delete")),1)]),_:1},8,["onClick"])]),_:2},1032,["auth-function"])]),_:2},[!N.value&&n.config.app==="konnect"?{name:"empty-state",fn:e.withCtx(()=>{var Ne;return[e.createVNode(re,{"data-testid":n.config.entityId?"nested-plugins-entity-empty-state":"plugins-entity-empty-state","icon-background":"",message:e.unref(a)("plugins.list.empty_state_v2.description"),title:e.unref(a)("plugins.list.empty_state_v2.title")},e.createSlots({icon:e.withCtx(()=>[e.createVNode(e.unref($e.PlugIcon),{decorative:""})]),action:e.withCtx(()=>[We.value?(e.openBlock(),e.createBlock(se,{key:0,"data-testid":"entity-create-button",onClick:Be},{default:e.withCtx(()=>[e.createVNode(e.unref($e.AddIcon),{decorative:""}),e.createTextVNode(" "+e.toDisplayString(e.unref(a)("plugins.list.empty_state_v2.create_cta")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(se,{appearance:"secondary","data-testid":"entity-learn-more-button",onClick:Ce[2]||(Ce[2]=g=>Re.$emit("click:learn-more"))},{default:e.withCtx(()=>[e.createVNode(e.unref($e.BookIcon),{decorative:""}),e.createTextVNode(" "+e.toDisplayString(e.unref(a)("plugins.list.empty_state_v2.learn_more")),1)]),_:1})]),_:2},[(Ne=n.config)!=null&&Ne.isControlPlaneGroup?{name:"default",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("plugins.list.empty_state_v2.group")),1)]),key:"0"}:void 0]),1032,["data-testid","message","title"])]}),key:"0"}:void 0]),1032,["cache-identifier","disable-sorting","empty-state-options","error-message","fetcher","fetcher-cache-key","query","table-headers","title","title-tag","onState"]),e.createVNode(e.unref(Ie.EntityToggleModal),{action:ne.value.action,"entity-id":ne.value.id,"entity-name":ne.value.name,"entity-type":e.unref(a)("glossary.plugin"),"on-confirm":$,visible:X.value,onCancel:te,onProceed:te},null,8,["action","entity-id","entity-name","entity-type","visible"]),e.createVNode(e.unref(Ie.EntityDeleteModal),{"action-pending":ke.value,description:e.unref(a)("delete.description"),"entity-name":ie.value&&(ie.value.instance_name||ie.value.name||ie.value.id),"entity-type":e.unref(Ie.EntityTypes).Plugin,error:ye.value,title:e.unref(a)("delete.title"),visible:oe.value,onCancel:Oe,onProceed:De},null,8,["action-pending","description","entity-name","entity-type","error","title","visible"])])}}}),[["__scopeId","data-v-bb7d2cdb"]]),oF={class:"plugin-select-card-wrapper"},iF=["data-testid"],aF={class:"plugin-card-header"},sF={class:"plugin-card-title"},lF={key:0,class:"plugin-card-actions"},cF=["data-testid","title"],uF={key:0,class:"plugin-card-text"},dF={key:0,class:"custom-plugin-badges"},fF=["title"],wp=je(e.defineComponent({__name:"PluginSelectCard",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||!n.getCreateRoute)},canDeleteCustomPlugin:{type:Boolean,default:!1},canDeleteClonedPlugin:{type:Boolean,default:!1},canEditCustomPlugin:{type:Boolean,default:!1},canEditClonedPlugin:{type:Boolean,default:!1},plugin:{type:Object,required:!0},navigateOnClick:{type:Boolean,default:!0}},emits:["plugin-clicked","custom-plugin-delete"],setup(n,{emit:t}){const r=t,o=n,i=Ar.useRouter(),{i18n:{t:a}}=st.useI18n(),s=e.computed(()=>o.plugin.customPluginType==="cloned"&&o.plugin.clonedFromRef?o.plugin.clonedFromRef:o.plugin.id),c=e.computed(()=>!E.value||N.value?[]:o.plugin.customPluginType==="cloned"&&o.plugin.clonedFromRef?[a("plugins.select.cloned_from_badge",{link:o.plugin.clonedFromRef})]:o.plugin.customPluginType==="streaming"?[a("plugins.select.streamed_custom_badge")]:[a("plugins.select.installed_custom_badge")]),l=e.computed(()=>!!(!o.plugin.available||o.plugin.disabledMessage)),u=e.computed(()=>typeof o.config.getCustomEditRoute=="function"),p=e.computed(()=>o.plugin.customPluginType==="cloned"),d=e.computed(()=>p.value?o.canDeleteClonedPlugin:o.canDeleteCustomPlugin),f=e.computed(()=>p.value?o.canEditClonedPlugin:o.canEditCustomPlugin),m=e.computed(()=>!(o.config.app==="kongManager"&&o.plugin.customPluginType==="schema")),h=e.computed(()=>f.value&&u.value),y=e.computed(()=>d.value),b=e.computed(()=>!!(E.value&&!N.value&&m.value&&o.navigateOnClick&&(y.value||h.value))),_=()=>{i.push(o.config.getCreateRoute(o.plugin.id))},k=()=>{o.navigateOnClick?_():C()},C=()=>{r("plugin-clicked",o.plugin)},N=e.computed(()=>o.plugin.id==="custom-plugin-create"),E=e.computed(()=>o.plugin.group===fe.PluginGroup.CUSTOM_PLUGINS),w=()=>{E.value&&r("custom-plugin-delete")},S=(U,x)=>{const A=o.config;typeof A.getCustomEditRoute=="function"&&i.push(A.getCustomEditRoute(U,x))},I=()=>{if(!l.value&&E.value){const U=o.config;N.value&&U.createCustomRoute?i.push(U.createCustomRoute):E.value&&_()}};return(U,x)=>{const A=e.resolveComponent("KButton"),T=e.resolveComponent("KDropdownItem"),V=e.resolveComponent("KDropdownMenu"),R=e.resolveComponent("KBadge"),X=e.resolveComponent("KTooltip");return e.openBlock(),e.createElementBlock("div",oF,[e.createVNode(X,{text:n.plugin.disabledMessage},{default:e.withCtx(()=>[e.createElementVNode("a",{class:e.normalizeClass(["plugin-select-card",{disabled:l.value}]),"data-testid":`${n.plugin.id}-card`,role:"button",onClick:x[1]||(x[1]=Y=>l.value||E.value?void 0:k())},[e.createElementVNode("div",aF,[e.createElementVNode("div",sF,[e.createElementVNode("span",{class:e.normalizeClass({"non-custom-title":!E.value})},e.toDisplayString(n.plugin.name),3)]),b.value?(e.openBlock(),e.createElementBlock("div",lF,[e.createVNode(V,{"data-testid":"custom-plugin-actions","kpop-attributes":{placement:"bottom-end"},width:"150"},{default:e.withCtx(()=>[e.createVNode(A,{appearance:"tertiary",class:"actions-trigger","data-testid":"overflow-actions-button",icon:"",size:"small"},{default:e.withCtx(()=>[e.createVNode(e.unref($e.MoreIcon),{size:`var(--kui-icon-size-30, ${e.unref(Yn)})`},null,8,["size"])]),_:1})]),items:e.withCtx(()=>[h.value?(e.openBlock(),e.createBlock(T,{key:0,"data-testid":"edit-plugin-schema",onClick:x[0]||(x[0]=e.withModifiers(Y=>S(n.plugin.name,n.plugin.customPluginType),["stop"]))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("actions.edit")),1)]),_:1})):e.createCommentVNode("",!0),y.value?(e.openBlock(),e.createBlock(T,{key:1,danger:"","data-testid":"delete-plugin-schema","has-divider":h.value,onClick:e.withModifiers(w,["stop"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("actions.delete")),1)]),_:1},8,["has-divider"])):e.createCommentVNode("",!0)]),_:1})])):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:e.normalizeClass(["plugin-card-body",{"custom-plugin":E.value}]),"data-testid":n.plugin.name,title:n.plugin.available?n.plugin.name:e.unref(a)("plugins.select.unavailable_tooltip"),onClick:I},[e.createVNode(e.unref(xr.PluginIcon),{alt:n.plugin.name,class:"plugin-card-icon",name:s.value,size:55},null,8,["alt","name"]),n.plugin.description||c.value.length?(e.openBlock(),e.createElementBlock("div",uF,[c.value.length?(e.openBlock(),e.createElementBlock("div",dF,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,Y=>(e.openBlock(),e.createBlock(R,{key:Y,appearance:"info"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(Y),1)]),_:2},1024))),128))])):e.createCommentVNode("",!0),n.plugin.description?(e.openBlock(),e.createElementBlock("p",{key:1,class:"plugin-card-text",title:n.plugin.description},e.toDisplayString(n.plugin.description),9,fF)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],10,cF),e.createElementVNode("div",{class:"plugin-card-footer",onClick:I},e.toDisplayString(N.value?e.unref(a)("actions.create_custom"):n.plugin.exists?e.unref(a)("actions.enabled"):e.unref(a)("actions.enable")),1)],10,iF)]),_:1},8,["text"])])}}}),[["__scopeId","data-v-eb0977c9"]]),Cc=je(e.defineComponent({__name:"DeleteCustomPluginSchemaModal",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app))},plugin:{type:Object,required:!0}},emits:["closed","proceed"],setup(n,{emit:t}){var m;const r=n,o=t,{i18n:{t:i}}=st.useI18n(),{getMessageFromError:a}=Ie.useErrors(),{axiosInstance:s}=Ie.useAxios((m=r.config)==null?void 0:m.axiosRequestConfig),c=e.computed(()=>{var h;return p.value?i("delete.plugin_schema_in_use_title"):i("delete.title",{name:((h=r.plugin)==null?void 0:h.name)||i("delete.custom_plugin")})}),l=e.ref(!1),u=e.ref(""),p=e.ref(!1),d=e.computed(()=>{const h=r.plugin.customPluginType;if(r.config.app==="konnect"){const y=h==="streaming"?tt.select[r.config.app].streamingCustomPluginItem:h==="cloned"?tt.customPlugin[r.config.app].cloned.edit:tt.select[r.config.app].schemaCustomPluginItem;return`${r.config.apiBaseUrl}${y}`.replace(/{controlPlaneId}/gi,r.config.controlPlaneId||"").replace(/{pluginId}/gi,r.plugin.id)}if(r.config.app==="kongManager"&&h&&h!=="schema"){const y=h==="cloned"?tt.customPlugin[r.config.app].cloned.edit:tt.customPlugin[r.config.app].streamed.edit;return`${r.config.apiBaseUrl}${y}`.replace(/\/{workspace}/gi,r.config.workspace?`/${r.config.workspace}`:"").replace(/{pluginId}/gi,r.plugin.id)}return null}),f=async()=>{var h;if(l.value=!0,u.value="",!((h=r.plugin)!=null&&h.name)){l.value=!1;return}try{d.value&&await s.delete(d.value),o("proceed")}catch(y){Gw(y)?p.value=!0:u.value=a(y)}finally{l.value=!1}};return(h,y)=>{const b=e.resolveComponent("KAlert"),_=e.resolveComponent("KButton"),k=e.resolveComponent("KModal");return!p.value&&n.plugin?(e.openBlock(),e.createBlock(e.unref(Ie.EntityDeleteModal),{key:0,"action-pending":l.value,class:"delete-custom-plugin-schema-modal","data-testid":"delete-custom-plugin-schema-modal",description:e.unref(i)("delete.description_custom"),"entity-name":n.plugin.name,"entity-type":e.unref(Ie.EntityTypes).Plugin,error:u.value,"need-confirm":"",title:c.value,visible:"",onCancel:y[0]||(y[0]=C=>h.$emit("closed")),onProceed:f},null,8,["action-pending","description","entity-name","entity-type","error","title"])):n.plugin?(e.openBlock(),e.createBlock(k,{key:1,"action-button-disabled":l.value,class:"delete-custom-plugin-schema-modal","data-testid":"delete-custom-plugin-schema-modal",title:c.value,visible:"",onCancel:y[2]||(y[2]=C=>h.$emit("closed"))},{default:e.withCtx(()=>[e.createVNode(b,{appearance:"danger",message:e.unref(i)("delete.plugin_schema_in_use_message")},null,8,["message"])]),"footer-actions":e.withCtx(()=>[e.createElementVNode("div",null,[e.createVNode(_,{appearance:"tertiary",class:"cancel-button","data-testid":"delete-custom-plugin-form-cancel",onClick:y[1]||(y[1]=C=>h.$emit("closed"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)("actions.cancel")),1)]),_:1})])]),_:1},8,["action-button-disabled","title"])):e.createCommentVNode("",!0)}}}),[["__scopeId","data-v-9514182c"]]),pF={class:"custom-plugins-grid"},mF={class:"empty-state-title"},gF={class:"empty-state-description"},kp=310,hF=je(e.defineComponent({__name:"PluginCustomGrid",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||!n.getCreateRoute)},canCreateCustomPlugin:{type:Boolean,default:!1},canDeleteCustomPlugin:{type:Boolean,default:!1},canDeleteClonedPlugin:{type:Boolean,default:!1},canEditCustomPlugin:{type:Boolean,default:!1},canEditClonedPlugin:{type:Boolean,default:!1},pluginList:{type:Object,default:()=>({})},navigateOnClick:{type:Boolean,default:!0}},emits:["plugin-clicked","revalidate","delete:success"],setup(n,{emit:t}){const r=n,o=t,{i18n:{t:i}}=st.useI18n(),{getTallestPluginCardHeight:a,getToggleVisibility:s}=st.usePluginHelpers(),c=e.ref(!0),l=E=>{o("plugin-clicked",E)},u=e.computed(()=>{const E=JSON.parse(JSON.stringify(r.pluginList))[fe.PluginGroup.CUSTOM_PLUGINS]||[];return r.canCreateCustomPlugin&&r.navigateOnClick&&r.config.createCustomRoute?[{id:"custom-plugin-create",name:i("plugins.select.tabs.custom.create.name"),available:!0,group:fe.PluginGroup.CUSTOM_PLUGINS,description:i("plugins.select.tabs.custom.create.description")}].concat(E):E}),p=e.ref(!1),d=e.ref(null),f=E=>{p.value=!0,d.value={id:E.id,name:E.name,customPluginType:E.customPluginType}},m=E=>{var w;E&&(o("revalidate"),o("delete:success",((w=d.value)==null?void 0:w.name)||"")),p.value=!1,d.value=null},h=e.ref(kp),y=e.ref(null),b=e.ref(null),_=e.computed(()=>c.value?{overflowY:"hidden",maxHeight:`${h.value}px`}:{}),k=e.ref(!1),C=()=>{h.value=Math.max(a(b.value),kp),N()},N=()=>{var E,w;(E=b.value)!=null&&E.length&&(k.value=s(y.value,(w=b.value)==null?void 0:w.length))};return e.onMounted(async()=>{await e.nextTick(),h.value=Math.max(a(b.value),kp),N(),window==null||window.addEventListener("resize",C)}),e.onUnmounted(()=>{window==null||window.removeEventListener("resize",C)}),(E,w)=>{const S=e.resolveComponent("KEmptyState"),I=e.resolveComponent("KCollapse");return e.openBlock(),e.createElementBlock("div",pF,[u.value.length?(e.openBlock(),e.createBlock(I,{key:1,modelValue:c.value,"onUpdate:modelValue":w[0]||(w[0]=U=>c.value=U),class:"custom-plugins-collapse","data-testid":`${e.unref(fe.PluginGroup).CUSTOM_PLUGINS}-collapse`,title:e.unref(fe.PluginGroup).CUSTOM_PLUGINS,"trigger-label":c.value?e.unref(i)("plugins.select.view_more"):e.unref(i)("plugins.select.view_less")},e.createSlots({"visible-content":e.withCtx(()=>[e.createElementVNode("div",{ref_key:"pluginCardContainerRef",ref:y,class:"plugin-card-container",style:e.normalizeStyle(_.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(U,x)=>(e.openBlock(),e.createBlock(wp,{key:`plugin-card-${x}`,ref_for:!0,ref_key:"pluginCardRef",ref:b,"can-delete-cloned-plugin":n.canDeleteClonedPlugin,"can-delete-custom-plugin":n.canDeleteCustomPlugin,"can-edit-cloned-plugin":n.canEditClonedPlugin,"can-edit-custom-plugin":n.canEditCustomPlugin,config:n.config,"navigate-on-click":n.navigateOnClick,plugin:U,onCustomPluginDelete:A=>f(U),onPluginClicked:l},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","navigate-on-click","plugin","onCustomPluginDelete"]))),128))],4)]),_:2},[k.value?void 0:{name:"trigger",fn:e.withCtx(()=>[w[2]||(w[2]=e.createTextVNode("   ",-1))]),key:"0"}]),1032,["modelValue","data-testid","title","trigger-label"])):(e.openBlock(),e.createBlock(S,{key:0,"action-button-visible":!1,class:"custom-plugins-empty-state","icon-variant":"kong"},{title:e.withCtx(()=>[e.createElementVNode("span",mF,e.toDisplayString(e.unref(i)("plugins.select.tabs.custom.empty_title")),1)]),default:e.withCtx(()=>[e.createElementVNode("span",gF,e.toDisplayString(e.unref(i)("plugins.select.tabs.custom.empty_description")),1)]),_:1})),p.value&&d.value?(e.openBlock(),e.createBlock(Cc,{key:2,config:n.config,plugin:d.value,onClosed:m,onProceed:w[1]||(w[1]=U=>m(!0))},null,8,["config","plugin"])):e.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-909f4d5f"]]),Cp=310,Ww=je(e.defineComponent({__name:"PluginSelectGroup",props:e.mergeModels({config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||!n.getCreateRoute)},name:{type:String,required:!0},plugins:{type:Array,required:!0},navigateOnClick:{type:Boolean,default:!0},canDeleteCustomPlugin:{type:Boolean,default:!1},canDeleteClonedPlugin:{type:Boolean,default:!1},canEditCustomPlugin:{type:Boolean,default:!1},canEditClonedPlugin:{type:Boolean,default:!1}},{modelValue:{type:Boolean,required:!0},modelModifiers:{}}),emits:e.mergeModels(["plugin-clicked","delete:success"],["update:modelValue"]),setup(n,{emit:t}){const r=e.useModel(n,"modelValue"),o=n,i=t,{i18n:{t:a}}=st.useI18n(),{getTallestPluginCardHeight:s,getToggleVisibility:c}=st.usePluginHelpers(),l=e.ref(Cp),u=e.ref(null),p=e.ref(null),d=e.computed(()=>r.value?{overflowY:"hidden",maxHeight:`${l.value}px`}:{}),f=e.ref(!1),m=e.ref(!1),h=e.ref(null),y=C=>{m.value=!0,h.value={id:C.id,name:C.name,customPluginType:C.customPluginType}},b=C=>{var N;C&&i("delete:success",((N=h.value)==null?void 0:N.name)||""),m.value=!1,h.value=null},_=()=>{l.value=Math.max(s(p.value),Cp),k()},k=()=>{var C,N;(C=p.value)!=null&&C.length&&(f.value=c(u.value,(N=p.value)==null?void 0:N.length))};return e.onMounted(async()=>{await e.nextTick(),l.value=Math.max(s(p.value),Cp),k(),window==null||window.addEventListener("resize",_)}),e.onUnmounted(()=>{window==null||window.removeEventListener("resize",_)}),(C,N)=>{const E=e.resolveComponent("KCollapse");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(E,{modelValue:r.value,"onUpdate:modelValue":N[0]||(N[0]=w=>r.value=w),class:"plugins-collapse","data-testid":`${o.name}-collapse`,title:o.name,"trigger-label":r.value?e.unref(a)("plugins.select.view_more"):e.unref(a)("plugins.select.view_less")},e.createSlots({"visible-content":e.withCtx(()=>[e.createElementVNode("div",{ref_key:"pluginCardContainerRef",ref:u,class:"plugin-card-container",style:e.normalizeStyle(d.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.plugins,w=>(e.openBlock(),e.createBlock(wp,{key:`plugin-card-${w.id}`,ref_for:!0,ref_key:"pluginCardRef",ref:p,"can-delete-cloned-plugin":n.canDeleteClonedPlugin,"can-delete-custom-plugin":n.canDeleteCustomPlugin,"can-edit-cloned-plugin":n.canEditClonedPlugin,"can-edit-custom-plugin":n.canEditCustomPlugin,config:n.config,"navigate-on-click":n.navigateOnClick,plugin:w,onCustomPluginDelete:S=>y(w),onPluginClicked:S=>i("plugin-clicked",w)},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","navigate-on-click","plugin","onCustomPluginDelete","onPluginClicked"]))),128))],4)]),_:2},[f.value?void 0:{name:"trigger",fn:e.withCtx(()=>[N[2]||(N[2]=e.createTextVNode("   ",-1))]),key:"0"}]),1032,["modelValue","data-testid","title","trigger-label"]),m.value&&h.value?(e.openBlock(),e.createBlock(Cc,{key:0,config:n.config,plugin:h.value,onClosed:b,onProceed:N[1]||(N[1]=w=>b(!0))},null,8,["config","plugin"])):e.createCommentVNode("",!0)],64)}}}),[["__scopeId","data-v-7f683497"]]),yF={class:"plugin-select-grid"},_F={class:"empty-state-title"},bF={class:"empty-state-description"},Ep=e.defineComponent({__name:"PluginSelectGrid",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||!n.getCreateRoute)},pluginList:{type:Object,default:()=>({})},navigateOnClick:{type:Boolean,default:!0},canDeleteCustomPlugin:{type:Boolean,default:!1},canDeleteClonedPlugin:{type:Boolean,default:!1},canEditCustomPlugin:{type:Boolean,default:!1},canEditClonedPlugin:{type:Boolean,default:!1},highlightedPlugins:{type:Array,default:()=>[]},highlightedPluginsTitle:{type:String,default:""},hideHighlightedPlugins:{type:Boolean,default:!1}},emits:["plugin-clicked","delete:success"],setup(n,{emit:t}){const r=n,o=t,{i18n:{t:i}}=st.useI18n(),a=e.ref(!1),s=e.ref(mf.reduce((u,p)=>(u[p]=!1,u),{})),c=u=>{o("plugin-clicked",u)},l=e.computed(()=>{const u=JSON.parse(JSON.stringify(r.pluginList));return r.config.app==="konnect"&&delete u[fe.PluginGroup.CUSTOM_PLUGINS],u});return(u,p)=>{const d=e.resolveComponent("KEmptyState");return e.openBlock(),e.createElementBlock("div",yF,[Object.keys(l.value).length?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(d,{key:0,"action-button-visible":!1,class:"plugins-empty-state","data-testid":"plugins-empty-state","icon-variant":"kong"},{title:e.withCtx(()=>[e.createElementVNode("span",_F,e.toDisplayString(e.unref(i)("plugins.select.tabs.kong.empty_title")),1)]),default:e.withCtx(()=>[e.createElementVNode("span",bF,e.toDisplayString(e.unref(i)("plugins.select.tabs.kong.empty_description")),1)]),_:1})),!r.hideHighlightedPlugins&&r.highlightedPlugins.length>0?(e.openBlock(),e.createBlock(Ww,{key:1,modelValue:a.value,"onUpdate:modelValue":p[0]||(p[0]=f=>a.value=f),"can-delete-cloned-plugin":n.canDeleteClonedPlugin,"can-delete-custom-plugin":n.canDeleteCustomPlugin,"can-edit-cloned-plugin":n.canEditClonedPlugin,"can-edit-custom-plugin":n.canEditCustomPlugin,config:n.config,name:r.highlightedPluginsTitle||e.unref(i)("plugins.select.highlighted_plugins.title"),"navigate-on-click":n.navigateOnClick,plugins:r.highlightedPlugins,"onDelete:success":p[1]||(p[1]=f=>o("delete:success",f)),onPluginClicked:p[2]||(p[2]=f=>c(f))},null,8,["modelValue","can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","name","navigate-on-click","plugins"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(mf),f=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[l.value[f]?(e.openBlock(),e.createElementBlock("div",{key:f},[e.createVNode(Ww,{modelValue:s.value[f],"onUpdate:modelValue":m=>s.value[f]=m,"can-delete-cloned-plugin":n.canDeleteClonedPlugin,"can-delete-custom-plugin":n.canDeleteCustomPlugin,"can-edit-cloned-plugin":n.canEditClonedPlugin,"can-edit-custom-plugin":n.canEditCustomPlugin,config:n.config,name:f,"navigate-on-click":n.navigateOnClick,plugins:l.value[f]||[],"onDelete:success":p[3]||(p[3]=m=>o("delete:success",m)),onPluginClicked:p[4]||(p[4]=m=>c(m))},null,8,["modelValue","onUpdate:modelValue","can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","name","navigate-on-click","plugins"])])):e.createCommentVNode("",!0)],64))),256))])}}}),wF={class:"kong-ui-entities-plugin-select-form"},kF={class:"plugins-filter-input-container"},CF={key:0},EF={key:3,"aria-live":"polite",class:"plugins-results-container"},NF={"data-testid":"kong-tab"},SF={class:"tab-description"},xF={"data-testid":"custom-tab"},AF={class:"tab-description"},vF={key:1},IF=je(e.defineComponent({__name:"PluginSelect",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||n.app==="kongManager"&&!n.workspace||n.app==="konnect"&&(!n.controlPlaneId||n.workspace)||!n.getCreateRoute)},customPluginSupport:{type:[String,Array],default:"none"},canCreateCustomPlugin:{type:Function,required:!1,default:async()=>!0},canDeleteCustomPlugin:{type:Function,required:!1,default:async()=>!0},canReadCustomPlugin:{type:Function,required:!1,default:async()=>!0},canDeleteClonedPlugin:{type:Function,required:!1},canReadClonedPlugin:{type:Function,required:!1,default:async()=>!0},canEditCustomPlugin:{type:Function,required:!1,default:async()=>!0},canEditClonedPlugin:{type:Function,required:!1},navigateOnClick:{type:Boolean,default:!0},availableOnServer:{type:Boolean,default:!0},ignoredPlugins:{type:Array,default:()=>[]},disabledPlugins:{type:Object,default:()=>({})},highlightedPluginIds:{type:Array,default:()=>[]},highlightedPluginsTitle:{type:String,default:""}},emits:["loading","plugin-clicked","delete-custom:success"],setup(n,{emit:t}){var se;const r=n,o=t,i=Ar.useRoute(),a=Ar.useRouter(),{i18n:{t:s}}=st.useI18n(),{pluginMetaData:c}=st.usePluginMetaData(),{getMessageFromError:l}=Ie.useErrors(),{sortAlpha:u,objectsAreEqual:p}=Ie.useHelpers(),d=e.ref(""),f=e.ref(!0),m=e.ref(!1),h=e.ref(""),y=e.ref(""),b=e.ref([]),_=e.ref([]),k=e.ref([]),C=e.ref({}),N=e.ref([]),E=e.ref(null),w=e.ref(!1),{axiosInstance:S}=Ie.useAxios((se=r.config)==null?void 0:se.axiosRequestConfig),I=re=>re==="none"||re==="disabled"?new Set:new Set(Array.isArray(re)?re:[re]),U=e.computed(()=>I(r.customPluginSupport)),x=e.computed(()=>[...U.value].sort().join("|")),A=e.computed(()=>r.customPluginSupport==="disabled"),T=e.computed(()=>A.value||U.value.size>0),V=e.computed(()=>U.value.has("streaming")),R=e.computed(()=>U.value.has("cloned")),X=re=>Zo.isAxiosError(re)&&re.code==="ERR_CANCELED",Y=re=>l(re).toLowerCase().includes("requires a license"),ne=e.computed(()=>C.value?Object.entries(C.value).filter(([re])=>re!==fe.PluginGroup.CUSTOM_PLUGINS).reduce((re,[,Q])=>{for(const le of Q??[])re[le.id]=le;return re},{}):{}),M=e.computed(()=>{var le;if(!C.value)return{};const re=d.value.toLowerCase(),Q=JSON.parse(JSON.stringify(C.value));for(const de in C.value){const _e=((le=C.value[de])==null?void 0:le.filter(xe=>{var Ne,g;return xe.name.toLowerCase().includes(re)||xe.id.toLowerCase().includes(re)||xe.group.toLowerCase().includes(re)||((Ne=xe.clonedFromRef)==null?void 0:Ne.toLowerCase().includes(re))||((g=xe.customPluginType)==null?void 0:g.toLowerCase().includes(re))}))||[];_e.length?Q[de]=_e:delete Q[de]}return Q}),te=e.computed(()=>r.highlightedPluginIds.reduce((re,Q)=>{const le=ne.value[Q];return le&&re.push(le),re},[])),$=e.computed(()=>Object.keys(M.value).length>0),Z=e.computed(()=>Object.keys(C.value).length>0&&!$.value),F=e.computed(()=>r.config.app!=="konnect"||!T.value?[]:[{hash:"#kong",title:s("plugins.select.tabs.kong.title")},{hash:"#custom",title:s("plugins.select.tabs.custom.title"),disabled:A.value}]),J=e.computed(()=>{var Q;let re=F.value.length&&((i==null?void 0:i.hash)||((Q=F.value[0])==null?void 0:Q.hash))||"";return re==="#custom"&&A.value&&(re="#kong"),re}),G=()=>{const re=new Map(k.value.map(de=>[de.name,de])),Q=new Set(_.value.map(de=>de.name)),le=new Set([...Q,...re.keys()]);return[...new Set([...Object.keys({...r.availableOnServer?{}:c}),...b.value,...le])].filter(de=>!r.ignoredPlugins.includes(de)).filter(de=>{if(!r.config.entityType)return de;const _e=re.has(de)?re.get(de).ref:de;return r.config.entityType==="services"&&c[_e]&&!c[_e].scope.includes(fe.PluginScope.SERVICE)||r.config.entityType==="routes"&&c[_e]&&!c[_e].scope.includes(fe.PluginScope.ROUTE)||r.config.entityType==="consumer_groups"&&c[_e]&&!c[_e].scope.includes(fe.PluginScope.CONSUMER_GROUP)||r.config.entityType==="consumers"&&c[_e]&&!c[_e].scope.includes(fe.PluginScope.CONSUMER)?!1:de}).reduce((de,_e)=>{var ae;const xe=c[_e]&&c[_e].name||_e,Ne=re.get(_e),g=Q.has(_e),O={...c[_e],id:_e,name:xe,available:b.value.includes(_e)||!!Ne||g,disabledMessage:"",group:((ae=c[_e])==null?void 0:ae.group)||fe.PluginGroup.CUSTOM_PLUGINS};O.group===fe.PluginGroup.CUSTOM_PLUGINS&&(Ne?(O.customPluginType="cloned",O.clonedFromRef=Ne.ref):g?O.customPluginType="streaming":O.customPluginType="schema"),r.disabledPlugins&&(O.disabledMessage=r.disabledPlugins[_e]);const j=O.group||s("plugins.select.misc_plugins");let W=de[j];return W||(W=[]),W.push(O),W.sort(u("name")),de[j]=W,de},{})},v=e.computed(()=>{var Q;let re=`${r.config.apiBaseUrl}${tt.select[r.config.app].availablePlugins}`;if(r.config.app==="konnect")re=re.replace(/{controlPlaneId}/gi,r.config.controlPlaneId||"");else if(r.config.app==="kongManager"&&((Q=r.config.gatewayInfo)==null?void 0:Q.edition)==="community")return`${r.config.apiBaseUrl}${tt.select[r.config.app].availablePluginsForOss}`;return re.replace(/\/{workspace}/gi,r.config.workspace?`/${r.config.workspace}`:"")}),q=e.computed(()=>{if(V.value){let re=`${r.config.apiBaseUrl}${tt.select[r.config.app].streamingCustomPlugins}`;return r.config.app==="konnect"?re.replace(/{controlPlaneId}/gi,r.config.controlPlaneId||""):re.replace(/\/{workspace}/gi,r.config.workspace?`/${r.config.workspace}`:"")}return null}),ie=e.computed(()=>{if(R.value){let re=`${r.config.apiBaseUrl}${tt.select[r.config.app].clonedPlugins}`;return r.config.app==="konnect"?re.replace(/{controlPlaneId}/gi,r.config.controlPlaneId||""):re.replace(/\/{workspace}/gi,r.config.workspace?`/${r.config.workspace}`:"")}return null}),oe=e.computed(()=>{if(r.config.entityType&&r.config.entityId){let re=`${r.config.apiBaseUrl}${tt.list[r.config.app].forEntity}`;return r.config.app==="konnect"&&(re=re.replace(/{controlPlaneId}/gi,r.config.controlPlaneId||"")),re.replace(/\/{workspace}/gi,r.config.workspace?`/${r.config.workspace}`:"").replace(/{entityType}/gi,r.config.entityType||"").replace(/{entityId}/gi,r.config.entityId||"")}return""}),ke=re=>{a.replace({hash:re,query:i.query})};e.watch(()=>r.disabledPlugins,(re,Q)=>{!p(re,Q)&&!f.value&&(C.value=G())}),e.watch(()=>r.ignoredPlugins,(re,Q)=>{!p(re,Q)&&!f.value&&(C.value=G())}),e.watch(f,re=>{o("loading",re)});const ye=async re=>{if(!oe.value){N.value=[];return}try{const{data:{data:Q}}=await S.get(oe.value,{signal:re});Q!=null&&Q.length&&(N.value=Q.reduce((le,de)=>(de.name&&le.push(de.name),le),[]))}catch(Q){X(Q)||(N.value=[])}},ce=async re=>{const Q=[];q.value&&qe.value&&Q.push(kc(S,q.value,re).then(le=>{_.value=le}).catch(le=>{X(le)||y.value||(y.value=l(le)??s("plugins.select.tabs.custom.fetch_error"))})),ie.value&&lt.value&&Q.push(kc(S,ie.value,re).then(le=>{k.value=le}).catch(le=>{if(X(le))return;const de=Y(le);(de||!y.value)&&(y.value=de?s("plugins.select.tabs.custom.license_required"):l(le)??s("plugins.select.tabs.custom.fetch_error"))})),Q.push(ye(re)),await Promise.allSettled(Q)},he=async()=>{var re,Q;(re=E.value)==null||re.abort(),E.value=new AbortController,f.value=!0,m.value=!1,h.value="",y.value="",b.value=[],_.value=[],k.value=[],N.value=[];try{const{data:le}=await S.get(v.value,{signal:E.value.signal});if(r.config.app==="konnect"){const{names:de}=le;b.value=de||[]}else if(r.config.app==="kongManager"){const{plugins:{available_on_server:de}}=le;b.value=de?Object.keys(de):[]}await ce(E.value.signal),C.value=G()}catch(le){X(le)||(m.value=!0,h.value=l(le))}finally{(Q=E.value)!=null&&Q.signal.aborted||(f.value=!1)}},Oe=e.ref(!1),De=e.ref(!1),Be=e.ref(!1),qe=e.ref(!1),We=e.ref(!1),nt=e.ref(!1),lt=e.ref(!1),Re=re=>{_.value=_.value.filter(Q=>Q.name!==re),k.value=k.value.filter(Q=>Q.name!==re),C.value=G(),o("delete-custom:success",re)};e.onBeforeMount(async()=>{const[re,Q,le,de,_e,xe,Ne]=await Promise.all([r.canCreateCustomPlugin(),r.canEditCustomPlugin(),r.canDeleteCustomPlugin(),r.canReadCustomPlugin(),r.canEditClonedPlugin?r.canEditClonedPlugin():Promise.resolve(null),r.canDeleteClonedPlugin?r.canDeleteClonedPlugin():Promise.resolve(null),r.canReadClonedPlugin()]);Oe.value=re,De.value=Q,Be.value=le,qe.value=de,We.value=_e??Q,nt.value=xe??le,lt.value=Ne});const Ce=e.useTemplateRef("filter-input");return e.onMounted(async()=>{var re,Q;w.value=!0,(Q=(re=Ce.value)==null?void 0:re.input)==null||Q.focus(),await he()}),e.watch(()=>{var re;return[r.config.app==="konnect"?r.config.controlPlaneId:void 0,r.config.workspace,r.config.entityType,r.config.entityId,r.config.app==="kongManager"?(re=r.config.gatewayInfo)==null?void 0:re.edition:void 0,x.value,A.value]},async()=>{w.value&&await he()}),e.onBeforeUnmount(()=>{var re;(re=E.value)==null||re.abort()}),(re,Q)=>{const le=e.resolveComponent("KInput"),de=e.resolveComponent("KSkeletonBox"),_e=e.resolveComponent("KSkeleton"),xe=e.resolveComponent("KEmptyState"),Ne=e.resolveComponent("KTooltip"),g=e.resolveComponent("KAlert"),O=e.resolveComponent("KTabs");return e.openBlock(),e.createElementBlock("div",wF,[e.createElementVNode("div",kF,[e.createVNode(le,{ref:"filter-input",modelValue:d.value,"onUpdate:modelValue":Q[0]||(Q[0]=j=>d.value=j),modelModifiers:{trim:!0},class:"plugins-filter-input","data-testid":"plugins-filter",placeholder:e.unref(s)("search.placeholder.select"),type:"search"},null,8,["modelValue","placeholder"])]),f.value?(e.openBlock(),e.createElementBlock("section",CF,[e.createVNode(de,{class:"plugins-skeleton-title",width:"10"}),e.createVNode(_e,{"card-count":8,class:"plugins-skeleton-cards",type:"card"})])):m.value?(e.openBlock(),e.createBlock(xe,{key:1,"action-button-visible":!1,"data-testid":"plugins-fetch-error","icon-variant":"error"},{default:e.withCtx(()=>[e.createElementVNode("h3",null,e.toDisplayString(h.value),1)]),_:1})):Z.value&&d.value?(e.openBlock(),e.createBlock(xe,{key:2,"action-button-visible":!1,"data-testid":"plugins-empty-state","icon-variant":"search"},{default:e.withCtx(()=>[e.createElementVNode("h5",null,e.toDisplayString(e.unref(s)("search.no_results",{filter:d.value})),1)]),_:1})):(e.openBlock(),e.createElementBlock("section",EF,[F.value.length?(e.openBlock(),e.createBlock(O,{key:0,modelValue:J.value,"onUpdate:modelValue":Q[3]||(Q[3]=j=>J.value=j),"data-testid":"plugins-tabs",tabs:F.value,onChange:ke},e.createSlots({kong:e.withCtx(()=>[e.createElementVNode("div",NF,[e.createElementVNode("p",SF,e.toDisplayString(e.unref(s)("plugins.select.tabs.kong.description")),1),e.createVNode(Ep,{"can-delete-cloned-plugin":nt.value,"can-delete-custom-plugin":Be.value,"can-edit-cloned-plugin":We.value,"can-edit-custom-plugin":De.value,config:n.config,"hide-highlighted-plugins":d.value.length>0,"highlighted-plugins":te.value,"highlighted-plugins-title":r.highlightedPluginsTitle,"navigate-on-click":n.navigateOnClick,"plugin-list":M.value,"onDelete:success":Re,onPluginClicked:Q[1]||(Q[1]=j=>re.$emit("plugin-clicked",j))},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","hide-highlighted-plugins","highlighted-plugins","highlighted-plugins-title","navigate-on-click","plugin-list"])])]),custom:e.withCtx(()=>[e.createElementVNode("div",xF,[e.renderSlot(re.$slots,"before-custom-tab-content",{},void 0,!0),e.createElementVNode("p",AF,e.toDisplayString(e.unref(s)("plugins.select.tabs.custom.description")),1),y.value?(e.openBlock(),e.createBlock(g,{key:0,appearance:"warning",class:"custom-plugins-warning",message:y.value},null,8,["message"])):e.createCommentVNode("",!0),e.createVNode(hF,{"can-create-custom-plugin":Oe.value,"can-delete-cloned-plugin":nt.value,"can-delete-custom-plugin":Be.value,"can-edit-cloned-plugin":We.value,"can-edit-custom-plugin":De.value,config:n.config,"navigate-on-click":n.navigateOnClick,"plugin-list":M.value,"onDelete:success":Re,onPluginClicked:Q[2]||(Q[2]=j=>re.$emit("plugin-clicked",j))},null,8,["can-create-custom-plugin","can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","navigate-on-click","plugin-list"])])]),_:2},[A.value?{name:"custom-anchor",fn:e.withCtx(()=>[e.createVNode(Ne,{"max-width":"300",text:e.unref(s)("plugins.select.tabs.custom.disabled_tooltip")},{default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(e.unref(s)("plugins.select.tabs.custom.title")),1)]),_:1},8,["text"])]),key:"0"}:void 0]),1032,["modelValue","tabs"])):(e.openBlock(),e.createElementBlock("div",vF,[y.value?(e.openBlock(),e.createBlock(g,{key:0,appearance:"warning",class:"custom-plugins-warning",message:y.value},null,8,["message"])):e.createCommentVNode("",!0),e.createVNode(Ep,{"can-delete-cloned-plugin":nt.value,"can-delete-custom-plugin":Be.value,"can-edit-cloned-plugin":We.value,"can-edit-custom-plugin":De.value,config:n.config,"hide-highlighted-plugins":d.value.length>0,"highlighted-plugins":te.value,"highlighted-plugins-title":r.highlightedPluginsTitle,"navigate-on-click":n.navigateOnClick,"plugin-list":M.value,"onDelete:success":Re,onPluginClicked:Q[4]||(Q[4]=j=>re.$emit("plugin-clicked",j))},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","hide-highlighted-plugins","highlighted-plugins","highlighted-plugins-title","navigate-on-click","plugin-list"])]))]))])}}}),[["__scopeId","data-v-40b228cd"]]),BF={class:"plugin-select-card-wrapper","data-testid":"plugin-catalog-card-wrapper"},TF={class:"plugin-card-header"},OF={class:"plugin-card-title"},PF={key:0,class:"plugin-card-actions"},VF=["data-testid","title"],$F={key:0},RF=["title"],LF={class:"plugin-card-footer"},DF={class:"plugin-card-footer-extra"},MF={key:0,class:"custom-plugin-badges"},jF=je(e.defineComponent({__name:"PluginCatalogCard",props:{config:{},plugin:{},canDeleteCustomPlugin:{type:Boolean},canDeleteClonedPlugin:{type:Boolean},canEditCustomPlugin:{type:Boolean},canEditClonedPlugin:{type:Boolean}},emits:["plugin-clicked","custom-plugin-delete"],setup(n,{emit:t}){const r=t,o=n,i=Ar.useRouter(),{i18n:{t:a}}=st.useI18n(),s=e.computed(()=>o.plugin.customPluginType==="cloned"&&o.plugin.clonedFromRef?o.plugin.clonedFromRef:o.plugin.id),c=e.computed(()=>!C.value||k.value?[]:o.plugin.customPluginType==="cloned"&&o.plugin.clonedFromRef?[a("plugins.select.cloned_from_badge",{link:o.plugin.clonedFromRef})]:o.plugin.customPluginType==="streaming"?[a("plugins.select.streamed_custom_badge")]:[a("plugins.select.installed_custom_badge")]),l=e.computed(()=>!!(!o.plugin.available||o.plugin.disabledMessage)),u=e.computed(()=>typeof o.config.getCustomEditRoute=="function"),p=e.computed(()=>o.plugin.customPluginType==="cloned"),d=e.computed(()=>p.value?!!o.canDeleteClonedPlugin:!!o.canDeleteCustomPlugin),f=e.computed(()=>p.value?!!o.canEditClonedPlugin:!!o.canEditCustomPlugin),m=e.computed(()=>!(o.config.app==="kongManager"&&o.plugin.customPluginType==="schema")),h=e.computed(()=>f.value&&u.value),y=e.computed(()=>d.value),b=e.computed(()=>!!(C.value&&!k.value&&m.value&&(y.value||h.value))),_=e.computed(()=>l.value?{}:C.value&&k.value&&o.config.createCustomRoute?o.config.createCustomRoute:o.config.getCreateRoute(o.plugin.id)),k=e.computed(()=>o.plugin.id==="custom-plugin-create"),C=e.computed(()=>o.plugin.group===fe.PluginGroup.CUSTOM_PLUGINS),N=()=>{C.value&&r("custom-plugin-delete")},E=(w,S)=>{typeof o.config.getCustomEditRoute=="function"&&i.push(o.config.getCustomEditRoute(w,S))};return(w,S)=>{const I=e.resolveComponent("KButton"),U=e.resolveComponent("KDropdownItem"),x=e.resolveComponent("KDropdownMenu"),A=e.resolveComponent("KBadge"),T=e.resolveComponent("RouterLink"),V=e.resolveComponent("KTooltip");return e.openBlock(),e.createElementBlock("div",BF,[e.createVNode(V,{text:n.plugin.disabledMessage},{default:e.withCtx(()=>[e.createVNode(T,{class:e.normalizeClass(["plugin-select-card",{disabled:l.value}]),"data-testid":`${n.plugin.id}-card`,to:_.value},{default:e.withCtx(()=>[e.createElementVNode("div",TF,[e.createElementVNode("div",OF,[e.createVNode(e.unref(xr.PluginIcon),{alt:n.plugin.name,class:"plugin-card-icon",name:s.value,size:55},null,8,["alt","name"]),e.createElementVNode("span",{class:e.normalizeClass({"non-custom-title":!C.value})},e.toDisplayString(n.plugin.name),3)]),b.value?(e.openBlock(),e.createElementBlock("div",PF,[e.createVNode(x,{"data-testid":"custom-plugin-actions","kpop-attributes":{placement:"bottom-end"},width:"150",onClick:S[1]||(S[1]=e.withModifiers(()=>{},["stop","prevent"]))},{default:e.withCtx(()=>[e.createVNode(I,{appearance:"tertiary",class:"actions-trigger","data-testid":"overflow-actions-button",icon:"",size:"small"},{default:e.withCtx(()=>[e.createVNode(e.unref($e.MoreIcon),{size:`var(--kui-icon-size-30, ${e.unref(Yn)})`},null,8,["size"])]),_:1})]),items:e.withCtx(()=>[h.value?(e.openBlock(),e.createBlock(U,{key:0,"data-testid":"edit-plugin-schema",onClick:S[0]||(S[0]=e.withModifiers(R=>E(n.plugin.name,n.plugin.customPluginType),["stop","prevent"]))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("actions.edit")),1)]),_:1})):e.createCommentVNode("",!0),y.value?(e.openBlock(),e.createBlock(U,{key:1,danger:"","data-testid":"delete-plugin-schema","has-divider":h.value,onClick:e.withModifiers(N,["stop","prevent"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("actions.delete")),1)]),_:1},8,["has-divider"])):e.createCommentVNode("",!0)]),_:1})])):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:"plugin-card-body","data-testid":`${n.plugin.id}-card-body`,title:n.plugin.available?n.plugin.name:e.unref(a)("plugins.select.unavailable_tooltip")},[n.plugin.description?(e.openBlock(),e.createElementBlock("div",$F,[e.createElementVNode("div",{title:n.plugin.description},e.toDisplayString(n.plugin.description),9,RF)])):e.createCommentVNode("",!0)],8,VF),e.createElementVNode("div",LF,[e.createElementVNode("div",null,e.toDisplayString(k.value?e.unref(a)("actions.create_custom"):e.unref(a)("actions.configure")),1),e.createElementVNode("div",DF,[c.value.length?(e.openBlock(),e.createElementBlock("div",MF,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,R=>(e.openBlock(),e.createBlock(A,{key:R,appearance:"info"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(R),1)]),_:2},1024))),128))])):e.createCommentVNode("",!0),e.renderSlot(w.$slots,"footer-extra",{},void 0,!0)])])]),_:3},8,["class","data-testid","to"])]),_:3},8,["text"])])}}}),[["__scopeId","data-v-cabcdb98"]]),FF=["data-testid"],UF={class:"group-icon-wrapper"},KF={class:"group-title-text"},qF=["data-testid"],GF=["data-testid"],Yw=je(e.defineComponent({__name:"PluginCatalogGroup",props:{config:{},name:{},plugins:{},canDeleteCustomPlugin:{type:Boolean},canDeleteClonedPlugin:{type:Boolean},canEditCustomPlugin:{type:Boolean},canEditClonedPlugin:{type:Boolean},showAllCard:{type:Boolean}},emits:["plugin-clicked","revalidate","delete:success"],setup(n,{emit:t}){const r=n,o=e.computed(()=>{switch(r.name){case fe.PluginGroup.FEATURED:return $e.PopularIcon;case fe.PluginGroup.AI:return $e.BotIcon;case fe.PluginGroup.ANALYTICS_AND_MONITORING:return $e.AnalyticsIcon;case fe.PluginGroup.AUTHENTICATION:return $e.LockIcon;case fe.PluginGroup.LOGGING:return $e.ServiceDocumentIcon;case fe.PluginGroup.MONETIZATION:return $e.MoneyIcon;case fe.PluginGroup.SECURITY:return $e.SecurityIcon;case fe.PluginGroup.SERVERLESS:return $e.RuntimeServerlessIcon;case fe.PluginGroup.TRAFFIC_CONTROL:return $e.TrafficIcon;case fe.PluginGroup.TRANSFORMATIONS:return $e.TransformationIcon;case fe.PluginGroup.DEPLOYMENT:return $e.DeployIcon;case fe.PluginGroup.CUSTOM_PLUGINS:return $e.CodeblockIcon;default:return null}}),i=t,{i18n:{t:a}}=st.useI18n(),s=e.ref(!1),c=e.computed(()=>r.showAllCard?r.plugins:!s.value&&r.plugins.length>9?r.plugins.slice(0,8):r.plugins),l=e.computed(()=>!r.showAllCard&&!s.value&&r.plugins.length>9);function u(){s.value=!0}const p=e.ref(!1),d=e.ref(null),f=h=>{p.value=!0,d.value={id:h.id,name:h.name,group:h.group,customPluginType:h.customPluginType}},m=h=>{var y,b,_;h&&(i("revalidate"),i("delete:success",{name:((y=d.value)==null?void 0:y.name)||"",group:(b=d.value)==null?void 0:b.group,customPluginType:(_=d.value)==null?void 0:_.customPluginType})),p.value=!1,d.value=null};return(h,y)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[n.name?(e.openBlock(),e.createElementBlock("div",{key:0,class:"group-title","data-testid":`plugin-group-${n.name}-title`},[e.createElementVNode("div",UF,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.value),{color:`var(--kui-color-text-decorative-purple, ${e.unref(Jg)})`},null,8,["color"]))]),e.createElementVNode("span",KF,e.toDisplayString(n.name),1)],8,FF)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"plugin-card-container","data-testid":`plugin-group-${n.name}`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,b=>(e.openBlock(),e.createBlock(jF,{key:`plugin-card-${b.id}`,"can-delete-cloned-plugin":n.canDeleteClonedPlugin,"can-delete-custom-plugin":n.canDeleteCustomPlugin,"can-edit-cloned-plugin":n.canEditClonedPlugin,"can-edit-custom-plugin":n.canEditCustomPlugin,config:n.config,plugin:b,onCustomPluginDelete:_=>f(b),onPluginClicked:_=>i("plugin-clicked",b)},e.createSlots({_:2},[b.gatewayVersion&&e.unref(jT)(e.unref(fe.GATEWAY_VERSION_TIMESTAMP_MAP)[b.gatewayVersion])?{name:"footer-extra",fn:e.withCtx(()=>[e.createElementVNode("span",{class:"plugin-card-new-badge","data-testid":`plugin-card-${b.id}-new-badge`},e.toDisplayString(e.unref(a)("labels.new")),9,GF)]),key:"0"}:void 0]),1032,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","plugin","onCustomPluginDelete","onPluginClicked"]))),128)),l.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"show-all-plugin-card",onClick:u},e.toDisplayString(e.unref(a)("plugins.select.show_all")),1)):e.createCommentVNode("",!0)],8,qF),p.value&&d.value?(e.openBlock(),e.createBlock(Cc,{key:1,config:n.config,plugin:d.value,onClosed:m,onProceed:y[0]||(y[0]=b=>m(!0))},null,8,["config","plugin"])):e.createCommentVNode("",!0)],64))}}),[["__scopeId","data-v-f9a9a47c"]]),HF={class:"plugin-select-grid"},zF={class:"empty-state-title"},WF={class:"empty-state-description"},YF={key:1},JF=je(e.defineComponent({__name:"PluginCatalogGrid",props:{config:{},pluginList:{},canDeleteCustomPlugin:{type:Boolean},canDeleteClonedPlugin:{type:Boolean},canEditCustomPlugin:{type:Boolean},canEditClonedPlugin:{type:Boolean}},emits:["plugin-clicked","delete:success"],setup(n,{emit:t}){const r=Ml.concat(jl),o=t,{i18n:{t:i}}=st.useI18n(),a=s=>{o("plugin-clicked",s)};return(s,c)=>{var u;const l=e.resolveComponent("KEmptyState");return e.openBlock(),e.createElementBlock("div",HF,[Object.keys(n.pluginList||[]).length?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(l,{key:0,"action-button-visible":!1,class:"plugins-empty-state","data-testid":"plugins-empty-state","icon-variant":"kong"},{title:e.withCtx(()=>[e.createElementVNode("span",zF,e.toDisplayString(e.unref(i)("plugins.select.tabs.kong.empty_title")),1)]),default:e.withCtx(()=>[e.createElementVNode("span",WF,e.toDisplayString(e.unref(i)("plugins.select.tabs.kong.empty_description")),1)]),_:1})),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r),p=>{var d;return e.openBlock(),e.createElementBlock(e.Fragment,null,[(d=n.pluginList)!=null&&d[p]?(e.openBlock(),e.createElementBlock("div",{key:p},[e.createVNode(Yw,{"can-delete-cloned-plugin":n.canDeleteClonedPlugin,"can-delete-custom-plugin":n.canDeleteCustomPlugin,"can-edit-cloned-plugin":n.canEditClonedPlugin,"can-edit-custom-plugin":n.canEditCustomPlugin,config:n.config,name:p,plugins:n.pluginList[p]||[],"onDelete:success":c[0]||(c[0]=f=>o("delete:success",f)),onPluginClicked:c[1]||(c[1]=f=>a(f))},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","name","plugins"])])):e.createCommentVNode("",!0)],64)}),256)),(u=n.pluginList)!=null&&u["Query Result"]?(e.openBlock(),e.createElementBlock("div",YF,[e.createVNode(Yw,{"can-delete-cloned-plugin":n.canDeleteClonedPlugin,"can-delete-custom-plugin":n.canDeleteCustomPlugin,"can-edit-cloned-plugin":n.canEditClonedPlugin,"can-edit-custom-plugin":n.canEditCustomPlugin,config:n.config,plugins:n.pluginList["Query Result"]||[],"show-all-card":"","onDelete:success":c[2]||(c[2]=p=>o("delete:success",p)),onPluginClicked:c[3]||(c[3]=p=>a(p))},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","plugins"])])):e.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-e3bf3819"]]),XF={class:"plugin-name-cell","data-testid":"plugin-catalog-list-view-name"},ZF=["title"],QF=["title"],eU={class:"plugin-action-cell","data-testid":"plugin-catalog-list-view-action"},tU={key:0,class:"plugin-more-action-cell","data-testid":"plugin-catalog-list-view-more-actions"},nU=je(e.defineComponent({__name:"PluginCatalogListView",props:{config:{},pluginList:{},canDeleteCustomPlugin:{type:Boolean},canDeleteClonedPlugin:{type:Boolean},canEditCustomPlugin:{type:Boolean},canEditClonedPlugin:{type:Boolean}},emits:["revalidate","delete:success"],setup(n,{emit:t}){const r=t,o=n,{i18n:{t:i}}=st.useI18n(),a=x=>x.customPluginType==="cloned"&&x.clonedFromRef?i("plugins.select.cloned_from_badge",{link:x.clonedFromRef}):x.customPluginType==="streaming"?i("plugins.select.streamed_custom_badge"):x.customPluginType?i("plugins.select.installed_custom_badge"):"",s=e.computed(()=>w.value.some(x=>C(x.plugin))),c=e.computed(()=>{const x=[{key:"name",label:i("plugins.select.list.table_headers.name"),sortable:!0},{key:"description",label:i("plugins.select.list.table_headers.description")},{key:"action",hideLabel:!0}];return s.value&&x.push({key:"more-actions",hideLabel:!0}),x}),l=e.computed(()=>{if(!o.pluginList)return[];const x=Object.values(o.pluginList).flat();return Array.from(new Map(x.map(T=>[T.id,T])).values()).map(T=>({id:T.id,name:T.name,description:T.description,badge:a(T),plugin:T}))}),u=e.ref(0),p=e.ref(10),d=e.ref(1),f=e.ref(l.value),m=e.ref(!1),h=e.ref(null),y=x=>x.customPluginType==="cloned"&&x.clonedFromRef?x.clonedFromRef:x.id,b=x=>(x==null?void 0:x.customPluginType)==="cloned",_=x=>!(x!=null&&x.customPluginType)||o.config.app==="kongManager"&&x.customPluginType==="schema"?!1:b(x)?!!o.canDeleteClonedPlugin:!!o.canDeleteCustomPlugin,k=x=>!(x!=null&&x.customPluginType)||typeof o.config.getCustomEditRoute!="function"||o.config.app==="kongManager"&&x.customPluginType==="schema"?!1:b(x)?!!o.canEditClonedPlugin:!!o.canEditCustomPlugin,C=x=>_(x)||k(x),N=x=>{m.value=!0,h.value={id:x.id,name:x.name,group:x.group,customPluginType:x.customPluginType}},E=x=>{var A,T,V;x&&(r("revalidate"),r("delete:success",{name:((A=h.value)==null?void 0:A.name)||"",group:(T=h.value)==null?void 0:T.group,customPluginType:(V=h.value)==null?void 0:V.customPluginType})),m.value=!1,h.value=null},w=e.computed(()=>{const x=f.value.length,A=Math.max(1,Math.ceil(x/p.value)),V=(Math.min(d.value,A)-1)*p.value;return f.value.slice(V,V+p.value)});e.watch(l,()=>{f.value=[...l.value],d.value=1,u.value++});const S=({page:x})=>{d.value=x},I=({pageSize:x})=>{p.value=x},U=x=>{const{sortColumnKey:A,sortColumnOrder:T}=x;A==="name"&&(f.value=[...f.value].sort((V,R)=>{const X=(V[A]||"").toLowerCase(),Y=(R[A]||"").toLowerCase();return X<Y?T==="asc"?-1:1:X>Y?T==="asc"?1:-1:0}))};return(x,A)=>{const T=e.resolveComponent("KBadge"),V=e.resolveComponent("KButton"),R=e.resolveComponent("KDropdownItem"),X=e.resolveComponent("KDropdown"),Y=e.resolveComponent("KTableView"),ne=e.resolveComponent("KCard");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(ne,{"data-testid":"plugin-catalog-list-view-card"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(Y,{key:u.value,class:"plugin-catalog-table","client-sort":"",data:w.value,"data-testid":"plugin-catalog-list-view-table",headers:c.value,"pagination-attributes":{totalCount:l.value.length,currentPage:d.value,initialPageSize:p.value,pageSizes:[10,25,50]},"resize-columns":"","row-key":"id",onPageChange:S,onPageSizeChange:I,onSort:U},{name:e.withCtx(({row:M})=>[e.createElementVNode("span",XF,[e.createVNode(e.unref(xr.PluginIcon),{"data-testid":`plugin-catalog-list-view-${M.plugin.id}-icon`,name:y(M.plugin),size:20},null,8,["data-testid","name"]),e.createElementVNode("span",{class:"plugin-name-text","data-testid":"plugin-catalog-list-view-name-text",title:M.name},e.toDisplayString(M.name),9,ZF),M.badge?(e.openBlock(),e.createBlock(T,{key:0,appearance:"info",class:"plugin-name-badge","data-testid":"plugin-catalog-list-view-custom-badge"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(M.badge),1)]),_:2},1024)):e.createCommentVNode("",!0)])]),description:e.withCtx(({row:M})=>[e.createElementVNode("span",{class:"plugin-description-cell","data-testid":"plugin-catalog-list-view-description",title:M.description},e.toDisplayString(M.description),9,QF)]),action:e.withCtx(({row:M})=>[e.createElementVNode("div",eU,[e.createVNode(V,{appearance:"tertiary","data-testid":"plugin-catalog-list-view-configure-btn",size:"small",to:o.config.getCreateRoute(M.id)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)("actions.configure")),1)]),_:1},8,["to"])])]),"more-actions":e.withCtx(({row:M})=>[C(M.plugin)?(e.openBlock(),e.createElementBlock("div",tU,[e.createVNode(X,{appearance:"tertiary",class:"actions-trigger","data-testid":"plugin-catalog-list-view-more-actions-button",icon:"",size:"small"},{items:e.withCtx(()=>{var te,$;return[k(M.plugin)?(e.openBlock(),e.createBlock(R,{key:0,"data-testid":"edit-plugin-schema",item:{label:e.unref(i)("actions.edit"),to:($=(te=n.config).getCustomEditRoute)==null?void 0:$.call(te,M.plugin.name,M.plugin.customPluginType)}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)("actions.edit")),1)]),_:1},8,["item"])):e.createCommentVNode("",!0),_(M.plugin)?(e.openBlock(),e.createBlock(R,{key:1,danger:"","data-testid":"delete-plugin-schema","has-divider":k(M.plugin),onClick:()=>N(M.plugin)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)("actions.delete")),1)]),_:1},8,["has-divider","onClick"])):e.createCommentVNode("",!0)]}),default:e.withCtx(()=>[e.createVNode(e.unref($e.MoreIcon),{color:`var(--kui-color-text-neutral, ${e.unref(cr)})`,size:`var(--kui-icon-size-30, ${e.unref(Yn)})`},null,8,["color","size"])]),_:2},1024)])):e.createCommentVNode("",!0)]),_:1},8,["data","headers","pagination-attributes"]))]),_:1}),m.value&&h.value?(e.openBlock(),e.createBlock(Cc,{key:0,config:n.config,plugin:h.value,onClosed:E,onProceed:A[0]||(A[0]=M=>E(!0))},null,8,["config","plugin"])):e.createCommentVNode("",!0)],64)}}}),[["__scopeId","data-v-986d34db"]]),rU={class:"plugin-catalog","data-testid":"plugin-catalog"},oU={class:"plugin-filter","data-testid":"plugin-filter"},iU={class:"plugin-filter-title"},aU={class:"featured-title"},sU={class:"plugin-featured-filter"},lU=["data-testid"],cU={class:"group-title"},uU={class:"plugin-type-filter"},dU=["data-testid"],fU={class:"plugins-container"},pU={class:"plugins-filter-input-container"},mU={class:"icon-container"},gU={key:0},hU={key:3,"aria-live":"polite",class:"plugins-results-container"},yU=je(e.defineComponent({__name:"PluginCatalog",props:{config:{},disabledPlugins:{},highlightedPluginIds:{},customPluginSupport:{default:"none"},availableOnServer:{type:Boolean,default:!0},canDeleteCustomPlugin:{type:Function,default:async()=>!0},canReadCustomPlugin:{type:Function,default:async()=>!0},canEditCustomPlugin:{type:Function,default:async()=>!0},canDeleteClonedPlugin:{},canReadClonedPlugin:{type:Function,default:async()=>!0},canEditClonedPlugin:{}},emits:["loading","plugin-clicked","delete-custom:success"],setup(n,{emit:t}){var Ce;const r=t,{i18n:{t:o}}=st.useI18n(),{pluginMetaData:i}=st.usePluginMetaData(),{getMessageFromError:a}=Ie.useErrors(),{sortAlpha:s,objectsAreEqual:c}=Ie.useHelpers(),l=n,{axiosInstance:u}=Ie.useAxios((Ce=l.config)==null?void 0:Ce.axiosRequestConfig),p=e.useTemplateRef("filter-input"),d=e.ref(""),f=e.ref(!1),m=e.ref(!1),h=e.ref(Object.fromEntries(Ml.concat(jl).map(se=>[se,!1]))),y=e.ref(!0),b=e.ref(!1),_=e.ref(""),k=e.ref(""),C=e.ref([]),N=e.ref([]),E=e.ref([]),w=e.ref({}),S=e.ref([]),I=e.ref(!1),U=e.ref(null),x=e.ref(!1),A=e.computed(()=>I.value?$e.GridIcon:$e.ListIcon),T=e.inject(fr.KM_2485_CLONED_PLUGINS,!1),V=e.computed(()=>e.unref(T)),R=se=>se==="none"||se==="disabled"?new Set:new Set(Array.isArray(se)?se:[se]),X=e.computed(()=>R(l.customPluginSupport)),Y=e.computed(()=>[...X.value].sort().join("|")),ne=e.computed(()=>X.value.has("streaming")),M=e.computed(()=>V.value&&X.value.has("cloned")),te=se=>Zo.isAxiosError(se)&&se.code==="ERR_CANCELED",$=se=>a(se).toLowerCase().includes("requires a license"),Z=e.computed(()=>{var re;let se=`${l.config.apiBaseUrl}${tt.select[l.config.app].availablePlugins}`;if(l.config.app==="konnect")se=se.replace(/{controlPlaneId}/gi,l.config.controlPlaneId||"");else if(l.config.app==="kongManager"&&((re=l.config.gatewayInfo)==null?void 0:re.edition)==="community")return`${l.config.apiBaseUrl}${tt.select[l.config.app].availablePluginsForOss}`;return se.replace(/\/{workspace}/gi,l.config.workspace?`/${l.config.workspace}`:"")}),F=e.computed(()=>{if(ne.value){let se=`${l.config.apiBaseUrl}${tt.select[l.config.app].streamingCustomPlugins}`;return l.config.app==="konnect"?se.replace(/{controlPlaneId}/gi,l.config.controlPlaneId||""):se.replace(/\/{workspace}/gi,l.config.workspace?`/${l.config.workspace}`:"")}return null}),J=e.computed(()=>{if(M.value){let se=`${l.config.apiBaseUrl}${tt.select[l.config.app].clonedPlugins}`;return l.config.app==="konnect"?se.replace(/{controlPlaneId}/gi,l.config.controlPlaneId||""):se.replace(/\/{workspace}/gi,l.config.workspace?`/${l.config.workspace}`:"")}return null}),G=e.computed(()=>{if(l.config.entityType&&l.config.entityId){let se=`${l.config.apiBaseUrl}${tt.list[l.config.app].forEntity}`;return l.config.app==="konnect"&&(se=se.replace(/{controlPlaneId}/gi,l.config.controlPlaneId||"")),se.replace(/\/{workspace}/gi,l.config.workspace?`/${l.config.workspace}`:"").replace(/{entityType}/gi,l.config.entityType||"").replace(/{entityId}/gi,l.config.entityId||"")}return""}),v=e.computed(()=>{var xe;if(!w.value)return{};const se=Object.entries(h.value).filter(([,Ne])=>Ne).map(([Ne])=>Ne);let re={};se.length===0&&(re=w.value),se.forEach(Ne=>{w.value[Ne]&&(re[Ne]=w.value[Ne])});const Q=d.value.toLowerCase();if(!Q)return re;const le=JSON.parse(JSON.stringify(re));for(const Ne in re){const g=((xe=re[Ne])==null?void 0:xe.filter(O=>[O.name.toLowerCase(),O.id.toLowerCase()].some(W=>MT(Q,W).length===Q.length)))||[];g.length?le[Ne]=g:delete le[Ne]}const de=Object.values(le).flat().filter(Ne=>!!Ne),_e=Array.from(de.reduce((Ne,g)=>(Ne.has(g.id)||Ne.set(g.id,g),Ne),new Map).values());return _e.length?{"Query Result":_e}:{}}),q=e.computed(()=>Object.keys(v.value).length>0),ie=e.computed(()=>Object.keys(w.value).length>0&&!q.value),oe=()=>{Object.keys(h.value).forEach(se=>{h.value[se]=!1})},ke=()=>{const se=new Map(E.value.map(de=>[de.name,de])),re=new Set(N.value.map(de=>de.name)),Q=new Set([...re,...se.keys()]),le=[...new Set([...Object.keys({...l.availableOnServer?{}:i}),...C.value,...Q])].filter(de=>{if(!l.config.entityType)return de;const _e=se.has(de)?se.get(de).ref:de;return l.config.entityType==="services"&&i[_e]&&!i[_e].scope.includes(fe.PluginScope.SERVICE)||l.config.entityType==="routes"&&i[_e]&&!i[_e].scope.includes(fe.PluginScope.ROUTE)||l.config.entityType==="consumer_groups"&&i[_e]&&!i[_e].scope.includes(fe.PluginScope.CONSUMER_GROUP)||l.config.entityType==="consumers"&&i[_e]&&!i[_e].scope.includes(fe.PluginScope.CONSUMER)?!1:de}).reduce((de,_e)=>{var ae;const xe=i[_e]&&i[_e].name||_e,Ne=se.get(_e),g=re.has(_e),O={...i[_e],id:_e,name:xe,available:C.value.includes(_e)||!!Ne||g,disabledMessage:"",group:((ae=i[_e])==null?void 0:ae.group)||fe.PluginGroup.CUSTOM_PLUGINS};O.group===fe.PluginGroup.CUSTOM_PLUGINS&&(Ne?(O.customPluginType="cloned",O.clonedFromRef=Ne.ref):g?O.customPluginType="streaming":O.customPluginType="schema"),l.disabledPlugins&&(O.disabledMessage=l.disabledPlugins[_e]);const j=O.group||o("plugins.select.misc_plugins");let W=de[j];return W||(W=[]),W.push(O),W.sort(s("name")),de[j]=W,de},{});if(l.highlightedPluginIds&&l.highlightedPluginIds.length>0){const de=new Set(Object.values(le).flat().map(xe=>xe==null?void 0:xe.id)),_e=l.highlightedPluginIds.flatMap(xe=>{var g;const Ne=i[xe];return!Ne||!de.has(xe)?[]:{...Ne,id:xe,name:Ne.name||xe,available:C.value.includes(xe),disabledMessage:((g=l.disabledPlugins)==null?void 0:g[xe])||"",group:Ne.group||fe.PluginGroup.CUSTOM_PLUGINS}}).filter(Boolean);_e.length>0&&(le[fe.PluginGroup.FEATURED]=_e)}return le};e.watch(()=>l.disabledPlugins,(se,re)=>{!c(se||{},re||{})&&!y.value&&(w.value=ke())}),e.watch(y,se=>{r("loading",se)});const ye=e.ref(!1),ce=e.ref(!1),he=e.ref(!1),Oe=e.ref(!1),De=e.ref(!1),Be=e.ref(!1),qe=async()=>{try{const[se,re,Q,le,de,_e]=await Promise.all([l.canEditCustomPlugin(),l.canDeleteCustomPlugin(),l.canReadCustomPlugin(),l.canEditClonedPlugin?l.canEditClonedPlugin():Promise.resolve(null),l.canDeleteClonedPlugin?l.canDeleteClonedPlugin():Promise.resolve(null),l.canReadClonedPlugin()]);ye.value=se,ce.value=re,he.value=Q,Oe.value=le??se,De.value=de??re,Be.value=_e}catch{ye.value=!1,ce.value=!1,he.value=!1,Oe.value=!1,De.value=!1,Be.value=!1}},We=async se=>{if(!G.value){S.value=[];return}try{const{data:{data:re}}=await u.get(G.value,{signal:se});re!=null&&re.length&&(S.value=re.reduce((Q,le)=>(le.name&&Q.push(le.name),Q),[]))}catch(re){te(re)||(S.value=[])}},nt=async se=>{const re=[];F.value&&he.value&&re.push(kc(u,F.value,se).then(Q=>{N.value=Q}).catch(Q=>{te(Q)||k.value||(k.value=a(Q)??o("plugins.select.tabs.custom.fetch_error"))})),J.value&&Be.value&&re.push(kc(u,J.value,se).then(Q=>{E.value=Q}).catch(Q=>{if(te(Q))return;const le=$(Q);(le||!k.value)&&(k.value=le?o("plugins.select.tabs.custom.license_required"):a(Q)??o("plugins.select.tabs.custom.fetch_error"))})),re.push(We(se)),await Promise.allSettled(re)},lt=async()=>{var re;(re=U.value)==null||re.abort();const se=new AbortController;U.value=se,y.value=!0,b.value=!1,_.value="",k.value="",C.value=[],N.value=[],E.value=[],S.value=[];try{const{data:Q}=await u.get(Z.value,{signal:se.signal});if(l.config.app==="konnect"){const{names:le}=Q;C.value=le||[]}else if(l.config.app==="kongManager"){const{plugins:{available_on_server:le}}=Q;C.value=le?Object.keys(le):[]}await nt(se.signal),w.value=ke()}catch(Q){te(Q)||(b.value=!0,_.value=a(Q))}finally{U.value===se&&!se.signal.aborted&&(y.value=!1)}},Re=async({name:se})=>{se&&(r("delete-custom:success",se),await lt())};return e.onMounted(async()=>{var se,re;x.value=!0,(re=(se=p.value)==null?void 0:se.input)==null||re.focus(),await qe(),await lt()}),e.watch(()=>{var se;return[l.config.app==="konnect"?l.config.controlPlaneId:void 0,l.config.workspace,l.config.entityType,l.config.entityId,l.config.app==="kongManager"?(se=l.config.gatewayInfo)==null?void 0:se.edition:void 0,Y.value,V.value]},async()=>{x.value&&(await qe(),await lt())}),e.onBeforeUnmount(()=>{var se;(se=U.value)==null||se.abort()}),(se,re)=>{const Q=e.resolveComponent("KButton"),le=e.resolveComponent("KCheckbox"),de=e.resolveComponent("KBadge"),_e=e.resolveComponent("KCollapse"),xe=e.resolveComponent("KInput"),Ne=e.resolveComponent("KSkeletonBox"),g=e.resolveComponent("KSkeleton"),O=e.resolveComponent("KEmptyState"),j=e.resolveComponent("KAlert");return e.openBlock(),e.createElementBlock("div",rU,[e.createElementVNode("div",oU,[e.createElementVNode("div",iU,[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.select.filter.title"))+" ",1),e.createVNode(Q,{appearance:"tertiary",class:"clear-selection","data-testid":"clear-filter-selection",disabled:!Object.values(h.value).some(W=>W),onClick:oe},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.select.filter.clear")),1)]),_:1},8,["disabled"])]),e.createVNode(_e,{modelValue:f.value,"onUpdate:modelValue":re[0]||(re[0]=W=>f.value=W)},{title:e.withCtx(()=>[e.createElementVNode("div",aU,e.toDisplayString(e.unref(o)("plugins.select.filter.featured")),1)]),default:e.withCtx(()=>[e.createElementVNode("div",sU,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(Ml),W=>(e.openBlock(),e.createElementBlock("div",{key:W,class:"plugin-filter-item","data-testid":`plugin-filter-item-${W}`},[e.createVNode(le,{modelValue:h.value[W],"onUpdate:modelValue":ae=>h.value[W]=ae,label:W},null,8,["modelValue","onUpdate:modelValue","label"]),e.createVNode(de,{appearance:"neutral"},{default:e.withCtx(()=>{var ae,be;return[e.createTextVNode(e.toDisplayString(((be=(ae=w.value)==null?void 0:ae[W])==null?void 0:be.length)||0),1)]}),_:2},1024)],8,lU))),128))])]),_:1},8,["modelValue"]),e.createVNode(_e,{modelValue:m.value,"onUpdate:modelValue":re[1]||(re[1]=W=>m.value=W)},{title:e.withCtx(()=>[e.createElementVNode("div",cU,e.toDisplayString(e.unref(o)("plugins.select.filter.type")),1)]),default:e.withCtx(()=>[e.createElementVNode("div",uU,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(jl),W=>(e.openBlock(),e.createElementBlock("div",{key:W,class:"plugin-filter-item","data-testid":`plugin-filter-item-${W}`},[e.createVNode(le,{modelValue:h.value[W],"onUpdate:modelValue":ae=>h.value[W]=ae,"data-testid":`plugin-filter-checkbox-${W}`,label:W},null,8,["modelValue","onUpdate:modelValue","data-testid","label"]),e.createVNode(de,{appearance:"neutral","data-testid":`plugin-filter-count-${W}`},{default:e.withCtx(()=>{var ae,be;return[e.createTextVNode(e.toDisplayString(((be=(ae=w.value)==null?void 0:ae[W])==null?void 0:be.length)||0),1)]}),_:2},1032,["data-testid"])],8,dU))),128))])]),_:1},8,["modelValue"])]),e.createElementVNode("div",fU,[e.createElementVNode("div",pU,[e.createVNode(xe,{ref:"filter-input",modelValue:d.value,"onUpdate:modelValue":re[2]||(re[2]=W=>d.value=W),modelModifiers:{trim:!0},class:"plugins-filter-input","data-testid":"plugins-filter-input",placeholder:e.unref(o)("search.placeholder.search_plugins"),type:"search"},null,8,["modelValue","placeholder"]),e.createElementVNode("div",mU,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(A.value),{class:"plugins-filter-icon",color:`var(--kui-icon-color-primary, ${e.unref(M1)})`,onClick:re[3]||(re[3]=W=>I.value=!I.value)},null,8,["color"]))])]),y.value?(e.openBlock(),e.createElementBlock("section",gU,[e.createVNode(Ne,{class:"plugins-skeleton-title",width:"10"}),e.createVNode(g,{"card-count":8,class:"plugins-skeleton-cards",type:"card"})])):b.value?(e.openBlock(),e.createBlock(O,{key:1,"action-button-visible":!1,"data-testid":"plugins-fetch-error","icon-variant":"error"},{default:e.withCtx(()=>[e.createElementVNode("h3",null,e.toDisplayString(_.value),1)]),_:1})):ie.value&&d.value?(e.openBlock(),e.createBlock(O,{key:2,"action-button-visible":!1,"data-testid":"plugins-empty-state","icon-variant":"search"},{default:e.withCtx(()=>[e.createElementVNode("h5",null,e.toDisplayString(e.unref(o)("search.no_results",{filter:d.value})),1)]),_:1})):(e.openBlock(),e.createElementBlock("section",hU,[k.value?(e.openBlock(),e.createBlock(j,{key:0,appearance:"warning",class:"custom-plugins-warning",message:k.value},null,8,["message"])):e.createCommentVNode("",!0),I.value?(e.openBlock(),e.createBlock(nU,{key:1,"can-delete-cloned-plugin":De.value,"can-delete-custom-plugin":ce.value,"can-edit-cloned-plugin":Oe.value,"can-edit-custom-plugin":ye.value,config:n.config,"plugin-list":v.value,"onDelete:success":Re},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","plugin-list"])):(e.openBlock(),e.createBlock(JF,{key:2,"can-delete-cloned-plugin":De.value,"can-delete-custom-plugin":ce.value,"can-edit-cloned-plugin":Oe.value,"can-edit-custom-plugin":ye.value,config:n.config,"plugin-list":v.value,"onDelete:success":Re,onPluginClicked:re[4]||(re[4]=W=>se.$emit("plugin-clicked",W))},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","plugin-list"]))]))])])}}}),[["__scopeId","data-v-679e985d"]]),_U={key:1,class:"datakit-config-card-canvas"},bU={class:"config-card-details-label","data-testid":"datakit-configuration-label"},wU={class:"config-card-details-value datakit-canvas-container","data-testid":"datakit-configuration-canvas"},kU={class:"canvas-wrapper"},CU=je(e.defineComponent({__name:"DatakitConfigCardCanvas",props:{pluginData:{},item:{}},setup(n){const t=e.computed(()=>{var r;return vw.safeParse((r=n.pluginData)==null?void 0:r.config).success});return uf(n.pluginData),(r,o)=>{const i=e.resolveComponent("KLabel");return t.value?(e.openBlock(),e.createElementBlock("div",_U,[e.createElementVNode("div",bU,[e.createVNode(i,null,{default:e.withCtx(()=>[...o[0]||(o[0]=[e.createElementVNode("span",{class:"label-content"}," Nodes ",-1)])]),_:1})]),e.createElementVNode("div",wU,[e.createElementVNode("div",kU,[e.createVNode(up,{class:"datakit-flow-panels",mode:"view",resizable:""})])])])):(e.openBlock(),e.createBlock(e.unref(Ie.ConfigCardItem),{key:0,item:n.item},null,8,["item"]))}}}),[["__scopeId","data-v-9a3ef1ac"]]),EU={class:"kong-ui-entity-plugin-config-card"},NU={class:"name-cell-wrapper"},SU={class:"info-name"},xU={key:0},AU={key:0},vU={key:0},IU={key:0},BU={key:0},Np="config",TU=je(e.defineComponent({__name:"PluginConfigCard",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||n.app==="konnect"&&!n.controlPlaneId||n.app==="kongManager"&&typeof n.workspace!="string"||!n.entityId||!n.pluginType)},configCardDoc:{type:String,default:"",required:!1},showIdAsLink:{type:Boolean,default:!1},hideTitle:{type:Boolean,default:!1},scopedEntityType:{type:String,required:!1,default:""},scopedEntityId:{type:String,required:!1,default:null},expandPartial:{type:Boolean,default:!0}},emits:["loading","fetch:error","error:fetch-schema","fetch:success","navigation-click"],setup(n,{emit:t}){var N;const r=t,o=n,{i18n:{t:i}}=st.useI18n(),a=st.usePluginMetaData(),{setFieldType:s}=st.usePluginHelpers(),{getPropValue:c}=Ie.useHelpers(),l=e.computed(()=>{var w;let E=(w=tt.item[o.config.app])==null?void 0:w[o.scopedEntityType?"forEntity":"all"].replace(/{entityType}/gi,o.scopedEntityType).replace(/{entityId}/gi,o.scopedEntityId??"").concat(o.expandPartial?"?expand_partials=true":"");if(o.config.app==="konnect"){const S=o.expandPartial?"&":"?";E=E.concat(`${S}__ui_data=true`)}return E}),u=e.computed(()=>{var S,I;const E={},w=((S=_.value)==null?void 0:S.fields)||[];for(let U=0;U<w.length;U++){const x=_.value.fields[U],A=(I=Object.keys(x))==null?void 0:I[0];s(E,A,x[A])}return{...E,instance_name:{section:Ie.ConfigurationSchemaSection.Basic,order:1.5},consumer:{label:i("plugins.fields.consumer"),section:Ie.ConfigurationSchemaSection.Basic,order:6},route:{label:i("plugins.fields.route"),section:Ie.ConfigurationSchemaSection.Basic,order:6},service:{label:i("plugins.fields.service"),section:Ie.ConfigurationSchemaSection.Basic,order:6},consumer_group:{label:i("plugins.fields.consumer_group"),section:Ie.ConfigurationSchemaSection.Basic,order:6},protocols:{type:Ie.ConfigurationSchemaType.BadgeTag,section:Ie.ConfigurationSchemaSection.Basic,order:7}}}),p=e.computed(()=>{var w,S,I;if(!((w=_.value)!=null&&w.fields))return[];const E=(S=_.value.fields)==null?void 0:S.find(U=>{var A;return((A=Object.keys(U))==null?void 0:A[0])===Np});return((I=E==null?void 0:E[Np])==null?void 0:I.fields)||[]}),d=e.computed(()=>{var w,S;const E={};if(!p.value)return E;for(let I=0;I<((w=p.value)==null?void 0:w.length);I++){const U=p.value[I],x=(S=Object.keys(U))==null?void 0:S[0],A=U[x];A.required&&(E[x]={order:1}),s(E,x,A)}return E}),f=E=>{var S;const w=(S=a.pluginMetaData[o.config.pluginType])==null?void 0:S.scope;return w?Object.fromEntries(Object.entries(E).filter(([I,U])=>U?!0:!(I==="service"&&!w.includes(fe.PluginScope.SERVICE)||I==="route"&&!w.includes(fe.PluginScope.ROUTE)||I==="consumer"&&!w.includes(fe.PluginScope.CONSUMER)||I==="consumer_group"&&!w.includes(fe.PluginScope.CONSUMER_GROUP)))):E},m=E=>Xr(E,"__ui_data"),{getMessageFromError:h}=Ie.useErrors(),{axiosInstance:y}=Ie.useAxios((N=o.config)==null?void 0:N.axiosRequestConfig),b=e.computed(()=>{var w,S;let E=`${o.config.apiBaseUrl}${tt.form[o.config.app].pluginSchema}`;return o.config.app==="konnect"&&(E=E.replace(/{controlPlaneId}/gi,((w=o.config)==null?void 0:w.controlPlaneId)||"")),E.replace(/\/{workspace}/gi,(S=o.config)!=null&&S.workspace?`/${o.config.workspace}`:"").replace(/{plugin}/gi,o.config.pluginType)}),_=e.ref({});Ie.useSchemaProvider(_);const k=e.ref(!1),C=e.ref("");return e.onBeforeMount(async()=>{k.value=!0;try{const{data:E}=await y.get(b.value);_.value=E}catch(E){C.value=h(E),r("error:fetch-schema",E)}finally{k.value=!1}}),(E,w)=>{const S=e.resolveComponent("KSkeleton"),I=e.resolveComponent("KEmptyState"),U=e.resolveComponent("KCopy");return e.openBlock(),e.createElementBlock("div",EU,[k.value?(e.openBlock(),e.createBlock(S,{key:0,"data-testid":"plugin-config-card-loader","table-columns":2,type:"table"})):C.value?(e.openBlock(),e.createBlock(I,{key:1,"data-testid":"plugin-config-card-schema-error","icon-variant":"error"},{default:e.withCtx(()=>[e.createElementVNode("h3",null,e.toDisplayString(C.value),1)]),_:1})):(e.openBlock(),e.createBlock(e.unref(Ie.EntityBaseConfigCard),{key:2,"code-block-record-formatter":m,config:n.config,"config-card-doc":n.configCardDoc,"config-schema":u.value,"entity-type":e.unref(Ie.SupportedEntityType).Plugin,"fetch-url":l.value,"hide-title":n.hideTitle,"plugin-config-key":Np,"plugin-config-schema":d.value,"record-resolver":f,"onFetch:error":w[0]||(w[0]=x=>E.$emit("fetch:error",x)),"onFetch:success":w[1]||(w[1]=x=>E.$emit("fetch:success",x)),onLoading:w[2]||(w[2]=x=>E.$emit("loading",x))},e.createSlots({name:e.withCtx(x=>[e.createElementVNode("div",NU,[e.createVNode(e.unref(xr.PluginIcon),{class:"plugin-icon",name:e.unref(c)("rowValue",x),size:24},null,8,["name"]),e.createElementVNode("span",SU,e.toDisplayString(e.unref(a).getDisplayName(e.unref(c)("rowValue",x))),1)])]),consumer:e.withCtx(x=>[e.unref(c)("rowValue",x)?n.showIdAsLink?(e.openBlock(),e.createBlock(e.unref(Ie.InternalLinkItem),{key:1,item:{key:e.unref(c)("rowValue",x).id,value:e.unref(c)("rowValue",x).id,type:e.unref(Ie.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>E.$emit("navigation-click",e.unref(c)("rowValue",x).id,"consumer")},null,8,["item","onNavigationClick"])):(e.openBlock(),e.createBlock(U,{key:2,"copy-tooltip":e.unref(i)("copy.tooltip",{label:e.unref(c)("row",x).label}),"data-testid":"consumer-copy-uuid",text:e.unref(c)("rowValue",x).id},null,8,["copy-tooltip","text"])):(e.openBlock(),e.createElementBlock("span",xU,"–"))]),route:e.withCtx(x=>[e.unref(c)("rowValue",x)?n.showIdAsLink?(e.openBlock(),e.createBlock(e.unref(Ie.InternalLinkItem),{key:1,item:{key:e.unref(c)("rowValue",x).id,value:e.unref(c)("rowValue",x).id,type:e.unref(Ie.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>E.$emit("navigation-click",e.unref(c)("rowValue",x).id,"route")},null,8,["item","onNavigationClick"])):(e.openBlock(),e.createBlock(U,{key:2,"copy-tooltip":e.unref(i)("copy.tooltip",{label:e.unref(c)("row",x).label}),"data-testid":"route-copy-uuid",text:e.unref(c)("rowValue",x).id},null,8,["copy-tooltip","text"])):(e.openBlock(),e.createElementBlock("span",AU,"–"))]),service:e.withCtx(x=>[e.unref(c)("rowValue",x)?n.showIdAsLink?(e.openBlock(),e.createBlock(e.unref(Ie.InternalLinkItem),{key:1,item:{key:e.unref(c)("rowValue",x).id,value:e.unref(c)("rowValue",x).id,type:e.unref(Ie.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>E.$emit("navigation-click",e.unref(c)("rowValue",x).id,"service")},null,8,["item","onNavigationClick"])):(e.openBlock(),e.createBlock(U,{key:2,"copy-tooltip":e.unref(i)("copy.tooltip",{label:e.unref(c)("row",x).label}),"data-testid":"service-copy-uuid",text:e.unref(c)("rowValue",x).id},null,8,["copy-tooltip","text"])):(e.openBlock(),e.createElementBlock("span",vU,"–"))]),consumer_group:e.withCtx(x=>[e.unref(c)("rowValue",x)?n.showIdAsLink?(e.openBlock(),e.createBlock(e.unref(Ie.InternalLinkItem),{key:1,item:{key:e.unref(c)("rowValue",x).id,value:e.unref(c)("rowValue",x).id,type:e.unref(Ie.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>E.$emit("navigation-click",e.unref(c)("rowValue",x).id,"consumer_group")},null,8,["item","onNavigationClick"])):(e.openBlock(),e.createBlock(U,{key:2,"copy-tooltip":e.unref(i)("copy.tooltip",{label:e.unref(c)("row",x).label}),"data-testid":"consumer-group-copy-uuid",text:e.unref(c)("rowValue",x).id},null,8,["copy-tooltip","text"])):(e.openBlock(),e.createElementBlock("span",IU,"–"))]),partials:e.withCtx(x=>{var A,T,V,R,X,Y,ne,M,te;return[e.unref(c)("rowValue",x)?n.showIdAsLink?(e.openBlock(),e.createBlock(e.unref(Ie.InternalLinkItem),{key:1,item:{key:(T=(A=e.unref(c)("rowValue",x))==null?void 0:A[0])==null?void 0:T.id,value:((R=(V=e.unref(c)("rowValue",x))==null?void 0:V[0])==null?void 0:R.id)+((Y=(X=e.unref(c)("rowValue",x))==null?void 0:X[0])!=null&&Y.name?"/"+((M=(ne=e.unref(c)("rowValue",x))==null?void 0:ne[0])==null?void 0:M.name):""),type:e.unref(Ie.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>{var $,Z;return E.$emit("navigation-click",(Z=($=e.unref(c)("rowValue",x))==null?void 0:$[0])==null?void 0:Z.id,"partial")}},null,8,["item","onNavigationClick"])):(e.openBlock(),e.createBlock(U,{key:2,"copy-tooltip":e.unref(i)("copy.tooltip",{label:e.unref(c)("row",x).label}),"data-testid":"partial-copy-uuid",text:(te=e.unref(c)("rowValue",x))==null?void 0:te[0].id},null,8,["copy-tooltip","text"])):(e.openBlock(),e.createElementBlock("span",BU,"–"))]}),_:2},[n.config.pluginType==="datakit"&&n.config.app==="konnect"?{name:"config-card-item-nodes",fn:e.withCtx(x=>[e.createVNode(CU,{item:x.row,"plugin-data":x.record},null,8,["item","plugin-data"])]),key:"0"}:void 0]),1032,["config","config-card-doc","config-schema","entity-type","fetch-url","hide-title","plugin-config-schema"]))])}}}),[["__scopeId","data-v-03dcf2b4"]]),{usePluginMetaData:OU,useProvideExperimentalFreeForms:PU}=st;function VU(n,t=!1){const r=n.length;let o=0,i="",a=0,s=16,c=0,l=0,u=0,p=0,d=0;function f(C,N){let E=0,w=0;for(;E<C;){let S=n.charCodeAt(o);if(S>=48&&S<=57)w=w*16+S-48;else if(S>=65&&S<=70)w=w*16+S-65+10;else if(S>=97&&S<=102)w=w*16+S-97+10;else break;o++,E++}return E<C&&(w=-1),w}function m(C){o=C,i="",a=0,s=16,d=0}function h(){let C=o;if(n.charCodeAt(o)===48)o++;else for(o++;o<n.length&&Ri(n.charCodeAt(o));)o++;if(o<n.length&&n.charCodeAt(o)===46)if(o++,o<n.length&&Ri(n.charCodeAt(o)))for(o++;o<n.length&&Ri(n.charCodeAt(o));)o++;else return d=3,n.substring(C,o);let N=o;if(o<n.length&&(n.charCodeAt(o)===69||n.charCodeAt(o)===101))if(o++,(o<n.length&&n.charCodeAt(o)===43||n.charCodeAt(o)===45)&&o++,o<n.length&&Ri(n.charCodeAt(o))){for(o++;o<n.length&&Ri(n.charCodeAt(o));)o++;N=o}else d=3;return n.substring(C,N)}function y(){let C="",N=o;for(;;){if(o>=r){C+=n.substring(N,o),d=2;break}const E=n.charCodeAt(o);if(E===34){C+=n.substring(N,o),o++;break}if(E===92){if(C+=n.substring(N,o),o++,o>=r){d=2;break}switch(n.charCodeAt(o++)){case 34:C+='"';break;case 92:C+="\\";break;case 47:C+="/";break;case 98:C+="\b";break;case 102:C+="\f";break;case 110:C+=`
438
+ `)[0],R=[{startLineNumber:A+1,startColumn:T+1,endLineNumber:A+1,endColumn:T+2,message:V,severity:ul.MarkerSeverity.Error,source:lp}];ul.editor.setModelMarkers(S,lp,R),s("error",V)}}),w.onDidPaste(I=>{const U=w.getModel();if(!U)return;const x=U.getValueInRange(I.range);for(const A of P$){const T=A.extract(x);if(T){y.value=T,b.value=A.name,h.value=!0;return}}}),E())}const h=e.shallowRef(!1),y=e.shallowRef(null),b=e.shallowRef("");function _(){h.value=!1,y.value=null,b.value=""}function k(){y.value&&(d.value=u(y.value),_())}function C(w){return o(`plugins.free-form.datakit.examples.${w}`)}function N(w){const S=w.code;try{const I=Ln.load(d.value,{schema:xo,json:!0}),U=Ln.load(S,{schema:xo,json:!0});if(typeof I=="object"&&I!==null&&Xt(I.config,U))return;const x=Xr({...i,config:{...U}},["__ui_data"]);d.value=u(x)}catch(I){s("error",c(I))}E()}function E(){const w=l.value,S=w==null?void 0:w.getModel();!w||!S||(w.setPosition(S.getFullModelRange().getEndPosition()),w.focus())}return t({setExampleCode:N}),(w,S)=>(e.openBlock(),e.createElementBlock("div",V$,[e.createVNode(e.unref(Fe.KAlert),{class:"examples"},{icon:e.withCtx(()=>[e.createVNode(e.unref($e.SparklesIcon))]),default:e.withCtx(()=>[e.createElementVNode("div",$$,[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.datakit.description_example"))+" ",1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(fw),I=>(e.openBlock(),e.createBlock(e.unref(Fe.KButton),{key:I.id,appearance:"secondary",size:"small",onClick:U=>N(I)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(C(I.i18nKey)),1)]),_:2},1032,["onClick"]))),128))])]),_:1}),e.createVNode(e.unref(ha.MonacoEditor),{ref:"editor",modelValue:d.value,"onUpdate:modelValue":S[0]||(S[0]=I=>d.value=I),appearance:"standalone",class:"editor",language:"yaml",options:f,theme:"light",onReady:m},null,8,["modelValue"]),e.createVNode(e.unref(Fe.KModal),{"action-button-text":e.unref(o)("plugins.free-form.datakit.detected_config_format_confirm"),title:e.unref(o)("plugins.free-form.datakit.detected_config_format_title"),visible:h.value,onCancel:_,onProceed:k},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.datakit.detected_config_format",{format:b.value})),1)]),_:1},8,["action-button-text","title","visible"])]))}}),[["__scopeId","data-v-20217c6a"]]),{t:L$}=jt.createI18n("en-us",Jt),hc=Pt.createGlobalState(()=>{const n=Pt.useLocalStorage("datakit-editor-mode","flow"),t=Pt.useLocalStorage("datakit-editor-sidebar-expanded",!0),r=Pt.useLocalStorage("datakit-editor-response-panel-collapsed",!1);return{editorMode:n,sidePanelExpanded:t,responsePanelCollapsed:r}});function D$({enabled:n,confirm:t}){Ar.onBeforeRouteLeave(()=>e.toValue(n)?t?t():window.confirm(L$("plugins.free-form.datakit.flow_editor.leave_confirm")):!0);const r=o=>{e.toValue(n)&&o.preventDefault()};Pt.useEventListener("beforeunload",r)}const M$={class:"label-content"},j$={class:"count"},F$={class:"label-content"},U$={class:"count"},pw=.5,cp=.03,K$=30,up=je(e.defineComponent({__name:"FlowPanels",props:{inactive:{type:Boolean},mode:{},resizable:{type:Boolean}},setup(n){const{t}=jt.createI18n("en-us",Jt),r=e.ref(!1),o=e.ref(!1),{responsePanelCollapsed:i}=hc(),{state:a,configNodeCounts:s,clearPendingLayout:c,setPendingFitView:l,commit:u,clear:p,portalSelection:d}=$t(),f=e.useId(),m=`${f}-request`,h=`${f}-response`,y=xt.useVueFlow(m),b=xt.useVueFlow(h);function _(ce,he){const{onPaneClick:Oe,onNodesChange:De,onEdgesChange:Be,getSelectedNodes:Ge,getSelectedEdges:We}=ce,{removeSelectedElements:nt}=he;function lt(Re){if(!Re){nt();return}Re.some(Ce=>Ce.type==="select")&&Ge.value.length+We.value.length>0&&nt()}De(lt),Be(lt),Oe(()=>lt())}_(y,b),_(b,y),e.watch(d,ce=>{ce&&(y.removeSelectedElements(),b.removeSelectedElements())});const k=e.useTemplateRef("flowPanels"),C=e.useTemplateRef("requestLabel"),N=e.useTemplateRef("requestCanvasContainer"),E=e.useTemplateRef("requestFlow"),w=e.useTemplateRef("resizeHandle"),S=e.useTemplateRef("responseLabel"),I=e.useTemplateRef("responseCanvasContainer"),U=e.useTemplateRef("responseFlow"),x=Pt.useElementBounding(k),A=Pt.useElementBounding(C),T=Pt.useElementBounding(N),V=Pt.useElementBounding(w),R=Pt.useElementBounding(S),X=Pt.useElementBounding(I),Y=e.computed(()=>Math.max(K$,x.height.value*cp)),ne=e.computed(()=>x.height.value-A.height.value-V.height.value-R.height.value),M=e.computed(()=>{const ce=ne.value;return ce?Math.max(cp,Y.value/ce):cp}),te=e.ref(pw),$=e.computed(()=>`${te.value*100}%`),Z=e.computed(()=>`${(1-te.value)*100}%`),F=e.computed(()=>te.value<=M.value),J=e.computed(()=>1-te.value<=M.value);function G(ce,{persist:he=!0}={}){const Oe=Math.min(1,Math.max(0,ce));te.value=Oe,he&&n.mode==="edit"&&(i.value=J.value)}function v(ce,he=!0){G(ce?1:pw,{persist:he})}function q(ce=!0){G(0,{persist:ce})}if(n.mode==="edit"){const ce=s.value.response===0,he=i.value;v(ce||he,!1)}else e.watch(()=>s.value.response,ce=>{v(ce===0,!1)},{immediate:!0});const ie=()=>{n.resizable&&(F.value?v(!1):q())},oe=()=>{n.resizable&&v(!J.value)},{isDragging:ke}=Pt.useDraggable(w,{onMove(ce){if(!n.resizable)return;const he=Math.max(0,ce.y-T.top.value),Oe=Math.min(1,Math.max(0,he/ne.value));G(Oe,{persist:!1})},onEnd(){n.resizable&&(T.height.value<Y.value?q():X.height.value<Y.value?v(!0):G(te.value))}});function ye(){e.nextTick(()=>{var ce,he;(ce=E.value)==null||ce.fitView(),(he=U.value)==null||he.fitView()})}return e.watch([r,o,()=>a.value.pendingLayout,()=>a.value.pendingFitView],([ce,he,Oe,De])=>{n.inactive||!ce||!he||!Oe&&!De||(Oe&&c(),De&&l(!1),setTimeout(async()=>{var Be,Ge;Oe&&(await((Be=E.value)==null?void 0:Be.autoLayout(!1)),await((Ge=U.value)==null?void 0:Ge.autoLayout(!1)),u("*"),Oe==="clearHistory"&&p()),De&&setTimeout(()=>ye(),0)},0))}),(ce,he)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"flowPanels",ref:k,class:"flow-panels"},[e.createElementVNode("div",{ref_key:"requestLabel",ref:C,class:e.normalizeClass(["label request",{resizable:n.resizable}]),onClick:ie},[n.resizable?(e.openBlock(),e.createBlock(e.unref($e.ChevronDownIcon),{key:0,class:e.normalizeClass(["icon",{collapsed:F.value}])},null,8,["class"])):e.createCommentVNode("",!0),e.createElementVNode("div",M$,[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.canvas_panel.request"))+" ",1),e.createElementVNode("span",j$,[e.unref(s).request===1?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(" ("+e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.canvas_panel.node_count_singular"))+") ",1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(" ("+e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.canvas_panel.node_count_plural",{count:e.unref(s).request}))+") ",1)],64))])])],2),e.createElementVNode("div",{ref_key:"requestCanvasContainer",ref:N,class:e.normalizeClass(["canvas",{dragging:e.unref(ke)}]),style:e.normalizeStyle({flexBasis:$.value})},[e.createVNode(pf,{ref_key:"requestFlow",ref:E,"flow-id":m,mode:n.mode,phase:"request",onInitialized:he[0]||(he[0]=Oe=>r.value=!0),onNodesChange:he[1]||(he[1]=Oe=>r.value=!1)},null,8,["mode"])],6),e.createElementVNode("div",{ref_key:"resizeHandle",ref:w,class:e.normalizeClass(["resize-handle",{resizable:n.resizable}])},null,2),e.createElementVNode("div",{ref_key:"responseLabel",ref:S,class:e.normalizeClass(["label response",{dragging:e.unref(ke),resizable:n.resizable}]),onClick:oe},[n.resizable?(e.openBlock(),e.createBlock(e.unref($e.ChevronDownIcon),{key:0,class:e.normalizeClass(["icon",{collapsed:J.value}])},null,8,["class"])):e.createCommentVNode("",!0),e.createElementVNode("div",F$,[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.canvas_panel.response"))+" ",1),e.createElementVNode("span",U$,[e.unref(s).response===1?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(" ("+e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.canvas_panel.node_count_singular"))+") ",1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(" ("+e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.canvas_panel.node_count_plural",{count:e.unref(s).response}))+") ",1)],64))])])],2),e.createElementVNode("div",{ref_key:"responseCanvasContainer",ref:I,class:e.normalizeClass(["canvas response",{dragging:e.unref(ke)}]),style:e.normalizeStyle({flexBasis:Z.value})},[e.createVNode(pf,{ref_key:"responseFlow",ref:U,"flow-id":h,mode:n.mode,phase:"response",onInitialized:he[2]||(he[2]=Oe=>o.value=!0),onNodesChange:he[3]||(he[3]=Oe=>o.value=!1)},null,8,["mode"])],6)],512))}}),[["__scopeId","data-v-5a4fec80"]]),q$={class:"dk-confirm-modal-body"},G$={class:"connections"},H$=je(e.defineComponent({__name:"ConflictModal",props:{title:{},message:{},addedConnections:{},removedConnections:{}},emits:["cancel","confirm"],setup(n,{expose:t,emit:r}){const{i18n:{t:o}}=Qe(),i=r,a=e.ref(!1),s=e.ref(n.message),c=e.ref(n.addedConnections??[]),l=e.ref(n.removedConnections??[]);let u=null;function p(){a.value=!1,i("cancel"),u==null||u(!1)}function d(){a.value=!1,i("confirm"),u==null||u(!0)}async function f(m,h,y){return s.value=m,c.value=h??[],l.value=y??[],a.value=!0,await new Promise(b=>{u=b})}return t({open:f}),(m,h)=>{const y=e.resolveComponent("KModal");return e.openBlock(),e.createBlock(y,{"action-button-text":e.unref(o)("plugins.free-form.datakit.flow_editor.confirm.proceed"),"close-on-backdrop-click":"","max-width":"660px",title:n.title??e.unref(o)("plugins.free-form.datakit.flow_editor.confirm.title"),visible:a.value,"z-index":9999,onCancel:p,onProceed:d},{default:e.withCtx(()=>[e.createElementVNode("div",q$,[e.createElementVNode("p",null,e.toDisplayString(s.value),1),e.createElementVNode("p",null,e.toDisplayString(e.unref(o)("plugins.free-form.datakit.flow_editor.confirm.message.confirm")),1),e.createElementVNode("div",G$,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value??[],([b,_])=>(e.openBlock(),e.createElementBlock("div",{key:`${b}-${_}`,class:"connection"},[e.createVNode(e.unref($e.AddIcon),{color:`var(--kui-color-background-success, ${e.unref(I1)})`},null,8,["color"]),e.createTextVNode(" "+e.toDisplayString(b)+" → "+e.toDisplayString(_),1)]))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value??[],([b,_])=>(e.openBlock(),e.createElementBlock("div",{key:`${b}-${_}`,class:"connection"},[e.createVNode(e.unref($e.RemoveIcon),{color:`var(--kui-color-text-danger, ${e.unref(Yg)})`},null,8,["color"]),e.createTextVNode(" "+e.toDisplayString(b)+" → "+e.toDisplayString(_),1)]))),128))])])]),_:1},8,["action-button-text","title","visible"])}}}),[["__scopeId","data-v-e6df03c2"]]),z$={class:"dk-editor-nav"},W$={class:"top"},Y$={class:"bottom"},J$=je(e.defineComponent({__name:"EditorNav",emits:["back"],setup(n,{emit:t}){const{t:r}=jt.createI18n("en-us",Jt),o=t,i=[{label:r("plugins.free-form.datakit.flow_editor.return_to_config"),icon:$e.ArrowLeftIcon,onClick:()=>o("back")}],{sidePanelExpanded:a}=hc(),s=e.computed(()=>a.value?r("plugins.free-form.datakit.flow_editor.collapse_panel"):r("plugins.free-form.datakit.flow_editor.expand_panel")),c=e.ref(!1);function l(){a.value=!a.value}return(u,p)=>(e.openBlock(),e.createElementBlock("nav",z$,[e.createElementVNode("div",W$,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(i,({label:d,to:f,icon:m,onClick:h})=>e.createVNode(e.unref(Fe.KTooltip),{key:d,"kpop-attributes":{offset:"10px"},label:d,placement:"right"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(Fe.KButton),{key:d,appearance:"none",class:"nav-item",icon:"",to:f,onClick:h},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m),{decorative:"",size:`var(--kui-icon-size-40, ${e.unref(_a)})`},null,8,["size"]))]),_:2},1032,["to","onClick"]))]),_:2},1032,["label"])),64))]),e.createElementVNode("div",Y$,[e.createElementVNode("div",{class:e.normalizeClass(["side-panel-toggle",{expanded:e.unref(a)}]),onTransitionend:p[0]||(p[0]=e.withModifiers(d=>c.value=!1,["self"])),onTransitionstart:p[1]||(p[1]=e.withModifiers(d=>c.value=!0,["self"]))},[e.createVNode(e.unref(Fe.KTooltip),{label:c.value?void 0:s.value,placement:e.unref(a)?"left":"right"},{default:e.withCtx(()=>[e.createVNode(e.unref(Fe.KButton),{appearance:"none",class:"nav-item nav-item-toggle",icon:"",size:"large",onClick:l},{default:e.withCtx(()=>[e.unref(a)?(e.openBlock(),e.createBlock(e.unref($e.ChevronDoubleLeftIcon),{key:0,decorative:"",size:`var(--kui-icon-size-40, ${e.unref(_a)})`},null,8,["size"])):(e.openBlock(),e.createBlock(e.unref($e.ChevronDoubleRightIcon),{key:1,decorative:"",size:`var(--kui-icon-size-40, ${e.unref(_a)})`},null,8,["size"]))]),_:1})]),_:1},8,["label","placement"])],34)])]))}}),[["__scopeId","data-v-0dcd2605"]]),X$={class:"dk-editor-main"},Z$={class:"header"},Q$={class:"actions"},eR={class:"settings"},tR={ref:"canvasContainer",class:"body"},nR=je(e.defineComponent({__name:"EditorMain",setup(n){const{t}=jt.createI18n("en-us",Jt),{modalOpen:r,undo:o,redo:i,canUndo:a,canRedo:s,load:c}=$t();function l(f){return t(`plugins.free-form.datakit.examples.${f}`)}function u(f){const m=Ln.load(f.code,{schema:xo,json:!0});if(typeof m!="object"||m===null)return;const h=m,y={config:{...h,nodes:h.nodes??[]}};c(y,!0)}function p(){r.value=!1}Wg({enabled:r,undo:o,redo:i});const d={maxWidth:"300px",zIndex:1e4};return(f,m)=>(e.openBlock(),e.createElementBlock("div",X$,[e.createElementVNode("header",Z$,[e.createElementVNode("div",Q$,[e.createVNode(e.unref(Fe.KTooltip),{"z-index":1e4},{content:e.withCtx(()=>[e.createVNode($l,{keys:e.unref(pl).undo,label:e.unref(t)("plugins.free-form.datakit.flow_editor.actions.undo"),reverse:""},null,8,["keys","label"])]),default:e.withCtx(()=>[e.createVNode(e.unref(Fe.KButton),{appearance:"tertiary",disabled:!e.unref(a),icon:"",onClick:e.unref(o)},{default:e.withCtx(()=>[e.createVNode(e.unref($e.UndoIcon))]),_:1},8,["disabled","onClick"])]),_:1}),e.createVNode(e.unref(Fe.KTooltip),{"z-index":1e4},{content:e.withCtx(()=>[e.createVNode($l,{keys:e.unref(pl).redo,label:e.unref(t)("plugins.free-form.datakit.flow_editor.actions.redo"),reverse:""},null,8,["keys","label"])]),default:e.withCtx(()=>[e.createVNode(e.unref(Fe.KButton),{appearance:"tertiary",disabled:!e.unref(s),icon:"",onClick:e.unref(i)},{default:e.withCtx(()=>[e.createVNode(e.unref($e.RedoIcon))]),_:1},8,["disabled","onClick"])]),_:1}),m[0]||(m[0]=e.createElementVNode("div",{class:"divider"},null,-1)),e.createElementVNode("div",eR,[e.createVNode(hn,{label:e.unref(t)("plugins.free-form.datakit.flow_editor.debug.label"),"label-attributes":{info:e.unref(t)("plugins.free-form.datakit.flow_editor.debug.description"),tooltipAttributes:d},name:"config.debug"},null,8,["label","label-attributes"])]),m[1]||(m[1]=e.createElementVNode("div",{class:"divider"},null,-1)),e.createVNode(e.unref(Fe.KDropdown),{appearance:"tertiary","kpop-attributes":{placement:"bottom-end",target:"body"},"show-caret":"","trigger-text":e.unref(t)("plugins.free-form.datakit.flow_editor.examples"),width:240},{items:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(fw),h=>(e.openBlock(),e.createBlock(e.unref(Fe.KDropdownItem),{key:h.id,onClick:y=>u(h)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l(h.i18nKey)),1)]),_:2},1032,["onClick"]))),128))]),_:1},8,["trigger-text"]),e.createVNode(e.unref(Fe.KButton),{appearance:"tertiary",target:"_blank",to:"https://developer.konghq.com/plugins/datakit/"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.actions.view_docs"))+" ",1),e.createVNode(e.unref($e.ExternalLinkIcon))]),_:1}),e.createVNode(e.unref(Fe.KButton),{onClick:p},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.actions.done")),1)]),_:1})])]),e.createElementVNode("div",tR,[e.createVNode(up,{mode:"edit",resizable:""})],512)]))}}),[["__scopeId","data-v-1cf532ff"]]),rR=["draggable"],oR={class:"icon"},iR={class:"content"},aR={class:"title"},sR={class:"description"},lR=je(e.defineComponent({__name:"NodePanelItem",props:{type:{},unsupported:{type:Boolean}},emits:["dragstart"],setup(n,{emit:t}){e.useCssVars(l=>({f502bd0e:e.unref(a),v4b2eb58e:e.unref(s)}));const r=t,{summary:o,icon:i}=xl[n.type],{colors:{background:a,foreground:s}}=VI(xl[n.type].group);function c(l){r("dragstart",l,n.type)}return(l,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["dk-node-panel-item",{[`node-type-${n.type}`]:!0,unsupported:n.unsupported}]),draggable:!n.unsupported,onDragstart:c},[e.createElementVNode("div",oR,[e.createVNode(e.unref(i),{size:16})]),e.createElementVNode("div",iR,[e.createElementVNode("div",aR,e.toDisplayString(n.type),1),e.createElementVNode("div",sR,e.toDisplayString(e.unref(o)),1)])],42,rR))}}),[["__scopeId","data-v-829422ff"]]),cR={class:"dk-node-panel"},uR={key:0,class:"title"},dR={class:"node-list"},fR={class:"group-title"},pR={class:"group-items"},mR={"aria-hidden":"true",class:"preview",inert:""},gR=je(e.defineComponent({__name:"NodePanel",props:{hideTitle:{type:Boolean}},setup(n){const{t}=jt.createI18n("en-us",Jt),{createNode:r}=$t(),o=e.inject(fr.KM_2446_DATAKIT_JWT_NODES,!1),i=e.computed(()=>o?Uy:Uy.filter(({id:u})=>u!=="authentication")),a=`dk-drag-preview-${e.useId()}`,s=e.shallowRef(),c=e.computed(()=>s.value?[{id:"preview",type:"flow",data:s.value,position:{x:0,y:0}}]:[]),l=async(u,p)=>{var x,A,T;const d=u.currentTarget,{left:f,top:m,width:h,height:y}=d.getBoundingClientRect(),b=u.clientX-f,_=u.clientY-m;s.value=r({type:p}),await e.nextTick();const k=document.querySelector(`#${a}`)||d,C=k.cloneNode(!0);C.classList.add("dk-drag-snapshot");const{offsetWidth:N,offsetHeight:E}=k;Object.assign(C.style,{position:"absolute",top:"-9999px",left:"-9999px",width:`${N}px`,height:`${E}px`}),document.body.appendChild(C);const w=b/h,S=_/y,I={ratioX:w,ratioY:S,offsetX:N*w,offsetY:E*S},U={action:"create-node",data:{type:p,anchor:I}};(x=u.dataTransfer)==null||x.setData(ba,JSON.stringify(U)),(A=u.dataTransfer)==null||A.setData(`${ba}/${p}`,p),(T=u.dataTransfer)==null||T.setDragImage(C,I.offsetX,I.offsetY),requestAnimationFrame(()=>{C.remove(),s.value=void 0})};return(u,p)=>{const d=e.resolveComponent("KLabel");return e.openBlock(),e.createElementBlock("div",cR,[n.hideTitle?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("h3",uR,[e.createVNode(d,{class:"label",info:e.unref(t)("plugins.free-form.datakit.flow_editor.node_panel.description")},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.node_panel.title")),1)]),_:1},8,["info"])])),e.createElementVNode("div",dR,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,f=>(e.openBlock(),e.createElementBlock("section",{key:f.id,class:"node-group"},[e.createElementVNode("h4",fR,e.toDisplayString(f.title),1),e.createElementVNode("div",pR,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.nodes,m=>(e.openBlock(),e.createBlock(lR,{key:m.type,type:m.type,onDragstart:l},null,8,["type"]))),128))])]))),128))]),e.createElementVNode("div",mR,[e.createVNode(e.unref(xt.VueFlow),{nodes:c.value},{"node-flow":e.withCtx(f=>[e.createVNode(s_,{id:a,data:f.data},null,8,["data"])]),_:1},8,["nodes"])])])}}}),[["__scopeId","data-v-f2040974"]]);function hR(){const{addField:n,getNodeByName:t,removeField:r,replaceConfig:o,renameField:i,disconnectOutEdges:a,nodeMapByName:s}=$t(),c=t("vault");if(!c)throw new Error("no vault node");const l=e.computed(()=>{var h;return((h=s.value.get("vault"))==null?void 0:h.config)||{}});return{formData:e.computed(()=>({vault:{...l.value}})),addVault:(h,y)=>{n(c.id,"output",h,!1);const b={...c.config,[h]:y};o(c.id,b)},removeVault:h=>{const y=Zr(c,"output",h);if(!y)return;const b=c.fields.output.length===1;r(c.id,y.id,!0,!1);const _=Xr(c.config,h);o(c.id,_,!b),b&&a(c.id)},updateVault:(h,y,b=!0)=>{const _={...c.config,[h]:y};o(c.id,_,b)},renameVault:(h,y,b=!0)=>{var N;const _=Zr(c,"output",h);if(!_)return;i(c.id,_.id,y,!1);const k=((N=c.config)==null?void 0:N[h])??"",C={...Xr(c.config,h),[y]:k};o(c.id,C,b)}}}const yR=e.defineComponent({__name:"VaultSecretPicker",props:{secretRef:{type:[String,Boolean]},secretName:{},validateName:{type:Function,default:()=>{}},isEditing:{type:Boolean,default:!1}},emits:["proceed","cancel"],setup(n,{emit:t}){const r=t,{i18n:{t:o}}=st.useI18n(),i=e.inject(et.FORMS_CONFIG),a=e.ref(n.secretName||""),s=e.ref(""),c=e.computed(()=>a.value.trim()?n.validateName(a.value.trim(),n.isEditing)===void 0:!1),l=e.computed(()=>!c.value),u=()=>{const m=a.value.trim(),h=n.validateName(m,n.isEditing);return s.value=h||"",h===void 0},p=()=>{s.value="",u()},d=m=>{u()&&r("proceed",{secretRef:m,secretName:a.value.trim()})},f=()=>{a.value="",s.value="",r("cancel")};return e.watch(()=>n.secretName,m=>{a.value=m||"",s.value=""}),(m,h)=>{const y=e.resolveComponent("KInput"),b=e.resolveComponent("KEmptyState");return e.unref(i)?(e.openBlock(),e.createBlock(e.unref(ya.VaultSecretPicker),{key:0,"additional-disabled":l.value,config:e.unref(i),"proceed-button-text":e.unref(o)("plugins.free-form.datakit.flow_editor.vault_secret_picker.proceed_button_text"),setup:n.secretRef,title:e.unref(o)("plugins.free-form.datakit.flow_editor.vault_secret_picker.title"),onCancel:f,onProceed:d},{"form-prefix":e.withCtx(()=>[e.createVNode(y,{"model-value":a.value,"onUpdate:modelValue":[h[0]||(h[0]=_=>a.value=_),p],"data-testid":"vault-secret-picker-secret-name-input",error:!!s.value,"error-message":s.value,label:e.unref(o)("plugins.free-form.datakit.flow_editor.vault_secret_picker.secret_name.label"),"label-attributes":{info:e.unref(o)("plugins.free-form.datakit.flow_editor.vault_secret_picker.secret_name.help")},placeholder:e.unref(o)("plugins.free-form.datakit.flow_editor.vault_secret_picker.secret_name.placeholder"),required:""},null,8,["model-value","error","error-message","label","label-attributes","placeholder"])]),_:1},8,["additional-disabled","config","proceed-button-text","setup","title"])):(e.openBlock(),e.createBlock(b,{key:1,"icon-variant":"error",message:e.unref(o)("plugins.free-form.vault_picker.component_error")},null,8,["message"]))}}}),_R={class:"dk-vault-panel"},bR={class:"title"},wR={class:"vault-list"},kR={key:0,class:"vault-list-item"},CR={class:"vault-list-item-key"},ER={class:"vault-list-item-key-text"},NR=je(e.defineComponent({__name:"VaultField",props:{autofocus:{type:Boolean},name:{},labelAttributes:{}},emits:["update","add","remove"],setup(n,{emit:t}){const r=n,o=t,{keys:i,addKey:a,removeKey:s,updateKey:c,getKeyName:l}=Hl(e.toRef(r,"name")),u=Ft(e.toRef(r,"name")),p=e.ref(null),d=e.ref(null),f=e.computed(()=>{if(!p.value)return null;const E=l(p.value),w=u.value?u.value.value[p.value]:void 0;return E===void 0||w===void 0?null:{id:p.value,key:E,value:w}}),{i18n:{t:m}}=st.useI18n(),h=e.computed(()=>new Set(i.value.map(([,E])=>E))),y=()=>{if(!u.value)return;const w=a();d.value=w,p.value=w},b=()=>{p.value=null,d.value&&(s(d.value),d.value=null)},_=E=>{if(!f.value)throw new Error("no selected entry");const w=f.value.key,S=w!==E.secretName,I=f.value.value!==E.secretRef,U=S||I;f.value.value=E.secretRef,f.value.key=E.secretName,I&&(u.value.value[f.value.id]=E.secretRef),S&&c(f.value.id,E.secretName),d.value?o("add",E.secretName,E.secretRef):U&&o("update",E.secretName,E.secretRef,S?w:void 0),d.value=null,b()},k=E=>{p.value=E},C=E=>{const w=l(E);s(E),o("remove",w)},N=(E,w)=>{var S;if(!E)return m("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.name_required_error");if(h.value.has(E)&&!(w&&E===((S=f.value)==null?void 0:S.key)))return m("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.name_exists_error")};return(E,w)=>{var x,A;const S=e.resolveComponent("KButton"),I=e.resolveComponent("KDropdownItem"),U=e.resolveComponent("KDropdown");return e.openBlock(),e.createElementBlock("div",_R,[e.createElementVNode("h3",bR,e.toDisplayString(e.unref(m)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.title")),1),e.createVNode(S,{appearance:"tertiary",class:"add-button",size:"small",onClick:y},{default:e.withCtx(()=>[e.createVNode(e.unref($e.AddIcon)),e.createTextVNode(" "+e.toDisplayString(e.unref(m)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.add_button")),1)]),_:1}),e.createElementVNode("div",wR,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(i),([T,V])=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:T},[V?(e.openBlock(),e.createElementBlock("div",kR,[e.createElementVNode("div",CR,[e.createVNode(e.unref($e.KeyIcon),{color:`var(--kui-color-text-neutral, ${e.unref(cr)})`,size:16},null,8,["color"]),e.createElementVNode("div",ER,e.toDisplayString(V),1)]),e.createVNode(U,null,{items:e.withCtx(()=>[e.createVNode(I,{onClick:R=>k(T)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(m)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.edit")),1)]),_:1},8,["onClick"]),e.createVNode(I,{danger:"",onClick:R=>C(T)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(m)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.delete")),1)]),_:1},8,["onClick"])]),default:e.withCtx(()=>[e.createVNode(S,{appearance:"tertiary",icon:""},{default:e.withCtx(()=>[e.createVNode(e.unref($e.MoreIcon),{color:`var(--kui-color-text, ${e.unref(hd)})`},null,8,["color"])]),_:1})]),_:2},1024)])):e.createCommentVNode("",!0)],64))),128))]),e.createVNode(yR,{"is-editing":!!p.value&&!d.value,"secret-name":(x=f.value)==null?void 0:x.key,"secret-ref":(A=f.value)==null?void 0:A.value,"validate-name":N,onCancel:b,onProceed:_},null,8,["is-editing","secret-name","secret-ref"])])}}}),[["__scopeId","data-v-a7726f48"]]);function SR(){const{getSchema:n}=pt();return e.computed(()=>{const t=n("config.resources");if(!t)throw new Error("Failed to get resource schema");const r=Tr(t);return r.fields.forEach(o=>{const i=Object.keys(o)[0];if(i==="cache"){const a=o[i];o[i]={...a,fields:[...a.fields,{partial_id:{type:"string"}}]},a.fields.forEach(s=>{const c=Object.keys(s)[0];if(c==="redis"){const l=s[c];s[c]={...l},delete s[c].required}})}}),r})}const xR={key:1},AR=["innerHTML"],vR={class:"horizontal-container"},dp=je(e.defineComponent({__name:"RadioField",props:{labelAttributes:{},multiple:{type:Boolean},items:{},label:{},autofocus:{type:Boolean},name:{}},emits:["update:modelValue"],setup(n,{emit:t}){const r=t,o=e.createPropsRestProxy(n,["name","items"]),{getSelectItems:i}=pt(),a=Ft(e.toRef(()=>n.name)),s=ln(a.path,o),c=e.computed(()=>n.items?n.items:a.path?i(a.path.value):[]),l=u=>{a.value&&(a.value.value=u),r("update:modelValue",u)};return(u,p)=>{var m;const d=e.resolveComponent("KAlert"),f=e.resolveComponent("KLabel");return e.unref(a).error?(e.openBlock(),e.createBlock(d,{key:0,appearance:"danger",message:e.unref(a).error.message},null,8,["message"])):e.withDirectives((e.openBlock(),e.createElementBlock("div",xR,[e.createVNode(f,e.normalizeProps(e.guardReactiveProps(e.unref(s).labelAttributes)),e.createSlots({default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s).label)+" ",1)]),_:2},[(m=e.unref(s).labelAttributes)!=null&&m.info?{name:"tooltip",fn:e.withCtx(()=>[e.createElementVNode("div",{innerHTML:e.unref(s).labelAttributes.info},null,8,AR)]),key:"0"}:void 0]),1040),e.createElementVNode("div",vR,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,h=>(e.openBlock(),e.createBlock(e.unref(Fe.KRadio),{key:h.value,"model-value":e.unref(a).value.value,"onUpdate:modelValue":[p[0]||(p[0]=y=>e.unref(a).value.value=y),l],"card-orientation":"horizontal",label:h.label,"selected-value":h.value},null,8,["model-value","label","selected-value"]))),128))])],512)),[[e.vShow,!e.unref(a).hide.value]])}}}),[["__scopeId","data-v-7c0483f3"]]),IR={class:"dk-cache-panel"},BR={class:"title"},TR={key:0,class:"cache-item"},OR={class:"cache-item-key"},PR={class:"cache-item-key-text"},VR={class:"dk-resource-cache-form"},$R={key:1},RR={key:2,class:"dk-cache-inline-redis"},LR={key:3,class:"dk-cache-redis-editor"},DR={key:0,class:"redis-editor-error"},MR=je(e.defineComponent({__name:"CacheField",props:{strategy:{}},emits:["update","remove","cancel"],setup(n,{emit:t}){const r=Ln.dump({host:"127.0.0.1",port:6379},{indent:2}),o=t,{getDefault:i,formData:a}=pt(),s=Ft("cache");if(s.error)throw new Error("No cache schema");const c=e.inject(Pi),l=e.computed(()=>!!c),u=e.shallowRef(""),p=e.ref(""),d=e.ref(!1),{i18n:{t:f}}=st.useI18n(),m=e.computed(()=>{var S,I,U;return h.value==="redis"?l.value?!!((S=a.cache)!=null&&S.partial_id||(I=a.cache)!=null&&I.redis):!!((U=a.cache)!=null&&U.redis)&&!p.value:!0}),h=e.computed(()=>{var S;return(S=s.value.value)==null?void 0:S.strategy}),y=e.computed(()=>{var S;return(S=s.value.value)!=null&&S.redis?Ln.dump(s.value.value.redis,{indent:2,noRefs:!0}):""});e.watch([d,h],([S,I])=>{S&&I==="redis"&&!l.value&&(u.value=y.value||r,p.value="")}),e.watch(u,S=>{var I;if(!l.value&&h.value==="redis")try{const U=Ln.load(S,{json:!0});U&&typeof U=="object"&&(a.cache.redis=U,p.value="")}catch(U){p.value=((I=U.message)==null?void 0:I.split(`
439
+ `)[0])||"Invalid YAML"}});const b=()=>{d.value=!0},_=()=>{d.value=!1,o("cancel")},k=()=>{o("remove")},C=()=>{b(),s.value.value||(s.value.value=i("cache"),s.value.value.strategy="memory")},N=()=>{d.value=!1,o("update",a)},E=()=>{var S,I;h.value==="memory"&&((S=a.cache)!=null&&S.partial_id)&&((I=a.cache)==null||delete I.partial_id)};async function w({codeElement:S,language:I,code:U}){S.innerHTML=await _1.codeToHtml(U,{lang:I,theme:"material-theme-darker",structure:"inline"})}return(S,I)=>{const U=e.resolveComponent("KButton"),x=e.resolveComponent("KDropdownItem"),A=e.resolveComponent("KDropdown"),T=e.resolveComponent("KLabel"),V=e.resolveComponent("KCodeBlock"),R=e.resolveComponent("KModal");return e.openBlock(),e.createElementBlock("div",IR,[e.createElementVNode("h3",BR,e.toDisplayString(e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.title")),1),n.strategy?(e.openBlock(),e.createElementBlock("div",TR,[e.createElementVNode("div",OR,[e.createVNode(e.unref($e.DatabaseIcon),{color:`var(--kui-color-text-neutral, ${e.unref(cr)})`,size:`var(--kui-icon-size-30, ${e.unref(Yn)})`},null,8,["color","size"]),e.createElementVNode("div",PR,e.toDisplayString(n.strategy),1)]),e.createVNode(A,null,{items:e.withCtx(()=>[e.createVNode(x,{onClick:b},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.edit")),1)]),_:1}),e.createVNode(x,{danger:"",onClick:k},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.vault.delete")),1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(U,{appearance:"tertiary",icon:""},{default:e.withCtx(()=>[e.createVNode(e.unref($e.MoreIcon),{color:`var(--kui-color-text, ${e.unref(hd)})`},null,8,["color"])]),_:1})]),_:1})])):(e.openBlock(),e.createBlock(U,{key:1,appearance:"tertiary",class:"add-button",size:"small",onClick:C},{default:e.withCtx(()=>[e.createVNode(e.unref($e.AddIcon)),e.createTextVNode(" "+e.toDisplayString(e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.add_button")),1)]),_:1})),e.createVNode(R,{"action-button-disabled":!m.value,"action-button-text":e.unref(f)("actions.save"),"max-width":"640px",title:e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.title"),visible:d.value,onCancel:_,onProceed:N},{default:e.withCtx(()=>{var X,Y;return[e.createElementVNode("div",VR,[e.createVNode(dp,{items:[{label:e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.strategy_options.memory"),value:"memory"},{label:e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.strategy_options.redis"),value:"redis"}],name:"strategy","onUpdate:modelValue":E},null,8,["items"]),h.value==="memory"?(e.openBlock(),e.createBlock(it,{key:0,name:"memory.dictionary_name"})):e.createCommentVNode("",!0),h.value==="redis"&&l.value?(e.openBlock(),e.createElementBlock("div",$R,[e.createVNode(T,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.select_redis_configuration")),1)]),_:1}),e.createVNode(e.unref(Hg.RedisConfigurationSelector),{"model-value":(X=e.unref(a).cache)==null?void 0:X.partial_id,"redis-type":"redis-ee","onUpdate:modelValue":I[0]||(I[0]=ne=>e.unref(a).cache.partial_id=ne)},null,8,["model-value"])])):e.createCommentVNode("",!0),h.value==="redis"&&l.value&&!((Y=e.unref(a).cache)!=null&&Y.partial_id)&&y.value?(e.openBlock(),e.createElementBlock("div",RR,[e.createElementVNode("div",null,e.toDisplayString(e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.inline_config_preview")),1),e.createVNode(V,{id:"dk-cache-redis-configuration",code:y.value,language:"yaml",theme:"dark",onCodeBlockRender:w},null,8,["code"])])):e.createCommentVNode("",!0),h.value==="redis"&&!l.value?(e.openBlock(),e.createElementBlock("div",LR,[e.createVNode(T,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(f)("plugins.free-form.datakit.flow_editor.panel_segments.resources.cache.inline_config")),1)]),_:1}),e.createVNode(e.unref(ha.MonacoEditor),{modelValue:u.value,"onUpdate:modelValue":I[1]||(I[1]=ne=>u.value=ne),appearance:"standalone",class:"redis-editor",language:"yaml",theme:"light"},null,8,["modelValue"]),p.value?(e.openBlock(),e.createElementBlock("p",DR,e.toDisplayString(p.value),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)])]}),_:1},8,["action-button-disabled","action-button-text","title","visible"])])}}}),[["__scopeId","data-v-4ffd057c"]]),jR={class:"dk-resources-panel"},FR=je(e.defineComponent({__name:"ResourcesPanel",setup(n){const t=SR(),r=e.ref(0),{addVault:o,removeVault:i,updateVault:a,renameVault:s,formData:c}=hR();function l(y,b,_){_&&_!==y&&s(_,y,!1),a(y,b)}const{state:u,commit:p}=$t(),d=e.computed(()=>({cache:u.value.cacheConfig}));function f(y){u.value.cacheConfig=y.cache,p()}function m(){u.value.cacheConfig=void 0,p()}function h(){r.value++}return(y,b)=>(e.openBlock(),e.createElementBlock("div",jR,[e.createVNode(Zt,{data:e.unref(c),schema:e.unref(t)},{default:e.withCtx(()=>[e.createVNode(NR,{name:"vault",onAdd:e.unref(o),onRemove:e.unref(i),onUpdate:l},null,8,["onAdd","onRemove"])]),_:1},8,["data","schema"]),b[0]||(b[0]=e.createElementVNode("hr",{class:"dk-resources-divider"},null,-1)),(e.openBlock(),e.createBlock(Zt,{key:`${r.value}`,data:d.value,schema:e.unref(t)},{default:e.withCtx(()=>{var _;return[e.createVNode(MR,{strategy:(_=d.value.cache)==null?void 0:_.strategy,onCancel:h,onRemove:m,onUpdate:f},null,8,["strategy"])]}),_:1},8,["data","schema"]))]))}}),[["__scopeId","data-v-9093c001"]]),UR={class:"header"},KR={class:"title"},qR={class:"body"},GR={class:"panel"},HR=je(e.defineComponent({__name:"SidePanel",setup(n){const{t}=jt.createI18n("en-us",Jt),{sidePanelExpanded:r}=hc(),{propertiesPanelOpen:o,selectedNode:i}=$t(),a=e.ref("nodes");function s(){o.value=!1}e.watch(i,l=>{l||s()});const c=e.ref(!1);return e.onMounted(()=>{c.value=!0}),(l,u)=>{const p=e.resolveComponent("KSegmentedControl");return e.openBlock(),e.createElementBlock("aside",{class:e.normalizeClass(["side-panel",{expanded:e.unref(r),inited:c.value}])},[e.createElementVNode("header",UR,[e.createElementVNode("h2",KR,e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.name")),1)]),e.createElementVNode("div",qR,[e.createElementVNode("div",GR,[e.createVNode(p,{modelValue:a.value,"onUpdate:modelValue":u[0]||(u[0]=d=>a.value=d),options:[{label:e.unref(t)("plugins.free-form.datakit.flow_editor.panel_segments.nodes"),value:"nodes"},{label:e.unref(t)("plugins.free-form.datakit.flow_editor.panel_segments.resources.title"),value:"resources"}]},null,8,["modelValue","options"]),a.value==="nodes"?(e.openBlock(),e.createBlock(gR,{key:0,class:"node-panel","hide-title":""})):e.createCommentVNode("",!0),a.value==="resources"?(e.openBlock(),e.createBlock(FR,{key:1})):e.createCommentVNode("",!0)])])],2)}}}),[["__scopeId","data-v-9e854e60"]]),zR=e.defineComponent({__name:"HttpMethodField",props:{name:{}},setup(n){return(t,r)=>(e.openBlock(),e.createBlock(Dt,{items:e.unref(gf)([...e.unref(jy)]),name:n.name},null,8,["items","name"]))}});function WR(n,t){const r=[],o=(i,a)=>{typeof a=="string"&&r.push({nodeName:n.name,path:["nodes",t,...i],value:a})};if("input"in n&&n.input!=null&&o(["input"],n.input),"inputs"in n&&n.inputs&&typeof n.inputs=="object")for(const[i,a]of Object.entries(n.inputs))a!=null&&o(["inputs",i],a);if("output"in n&&n.output!=null&&o(["output"],n.output),"outputs"in n&&n.outputs&&typeof n.outputs=="object")for(const[i,a]of Object.entries(n.outputs))a!=null&&o(["outputs",i],a);return r}function YR(n){const t=n.path[2];return t==="output"||t==="outputs"}function mw(n){if(!n)return!1;for(const t of Object.values(n))if(t!=null)return!0;return!1}function gw(n,t){const r=n.input!==void 0&&n.input!==null,o=mw(n.inputs);r&&o&&t.addIssue({code:"custom",message:'A node cannot use both "input" and "inputs". Use one or the other.',path:["inputs"]});const i=n.output!==void 0&&n.output!==null,a=mw(n.outputs);i&&a&&t.addIssue({code:"custom",message:'A node cannot use both "output" and "outputs". Use one or the other.',path:["outputs"]})}function hw(n,t,r){if(!n.nodes)return;const o=n.nodes.map(l=>l.name),i=new Set;o.forEach((l,u)=>{i.has(l)&&r.addIssue({code:"custom",message:`Duplicate node name: "${l}"`,path:["nodes",u,"name"]}),i.add(l)});const a=new Set([...t,...o]),s=new Map,c=new Map;n.nodes.forEach((l,u)=>{for(const p of WR(l,u)){const d=p.value.split(".",1)[0];if(a.has(d)||r.addIssue({code:"custom",message:`Unknown node "${d}" in connection "${p.value}"`,path:p.path}),YR(p)){const f=`${p.nodeName}->${d}`;c.has(f)?r.addIssue({code:"custom",message:`Connection specified on both sides: "${p.nodeName}" outputs to "${d}" and "${d}" inputs from "${p.nodeName}". Specify it on one side only.`,path:p.path}):s.set(f,s.get(f)??p.path)}else{const f=`${d}->${p.nodeName}`;s.has(f)?r.addIssue({code:"custom",message:`Connection specified on both sides: "${d}" outputs to "${p.nodeName}" and "${p.nodeName}" inputs from "${d}". Specify it on one side only.`,path:p.path}):c.set(f,c.get(f)??p.path)}}})}const JR=ee.z.enum(Dy),XR=ee.z.enum(ii),yw=n=>ii.includes(n),fp=ee.z.enum(My),_w=fp.options;ee.z.union([fp,JR]);const ZR=/^[A-Za-z_][A-Za-z0-9_-]{0,254}$/,yc=ee.z.string().min(1).max(255).regex(ZR,"Invalid node name (snake_case / kebab-case only)").refine(n=>!yw(n),"Name clashes with reserved implicit node").brand(),bw=ee.z.union([XR,yc]),QR=ee.z.string().min(1).brand(),e2=["then","else"];ee.z.enum(e2);const ut=ee.z.string().min(1).max(255).refine(n=>{if(bw.safeParse(n).success)return!0;const t=n.match(/^([^.]+)\.([^.]+)$/);if(!t)return!1;const[,r,o]=t;return bw.safeParse(r).success&&QR.safeParse(o).success},'Invalid connection, expected "NODE" or "NODE.FIELD"').nullish(),t2=ee.z.object({body:ut,headers:ut,http_proxy:ut,https_proxy:ut,proxy_auth_password:ut,proxy_auth_username:ut,query:ut,url:ut}).partial().strict(),n2=ee.z.object({headers:ut,body:ut}).partial().strict(),r2=ee.z.object({data:ut,key:ut,ttl:ut}).partial().strict(),o2=ee.z.object({claims:ut,key:ut}).partial().strict(),i2=ee.z.object({key:ut,token:ut}).partial().strict(),ww=ee.z.enum(jy),kw=ee.z.enum(Xd),Fn=ee.z.object({type:ee.z.string(),name:yc,input:ut,inputs:ee.z.record(ee.z.string().min(1).max(255),ut).nullish(),output:ut,outputs:ee.z.record(ee.z.string().min(1).max(255),ut).nullish()}).loose().superRefine((n,t)=>{gw(n,t)}),a2=ee.z.object({type:ee.z.string(),name:ee.z.string()}).loose().superRefine((n,t)=>{const r=n.type,o=n.name;(typeof o!="string"||o.length===0||o.includes("."))&&t.addIssue({code:"custom",path:["name"],message:"invalid node name",fatal:!1}),_w.includes(r)||t.addIssue({code:"custom",path:["type"],message:`unknown node type "${r}", expected one of: ${_w.join(", ")}`})}),s2=Fn.safeExtend({type:ee.z.literal("call"),method:ww.default("GET").nullish(),ssl_server_name:ee.z.string().nullish(),ssl_verify:ee.z.boolean().default(!0).nullish(),timeout:ee.z.number().int().min(0).max(2147483646).nullish(),url:ee.z.url().nullish(),inputs:t2.nullish(),outputs:ee.z.object({body:ut,headers:ut,raw_body:ut,status:ut}).partial().nullish()}).strict(),l2=Fn.safeExtend({type:ee.z.literal("exit"),status:ee.z.number().int().min(200).max(599).default(200).nullish(),warn_headers_sent:ee.z.boolean().nullish(),inputs:n2.nullish(),output:ee.z.never().nullish(),outputs:ee.z.never().nullish()}).strict(),c2=Fn.safeExtend({type:ee.z.literal("jq"),jq:ee.z.string().min(1).max(10240),outputs:ee.z.never().nullish()}).strict(),u2=Fn.safeExtend({type:ee.z.literal("xml_to_json"),recognize_type:ee.z.boolean().nullish().default(!0),attributes_block_name:ee.z.string().min(1).max(32).nullish(),attributes_name_prefix:ee.z.string().min(1).max(32).nullish(),text_block_name:ee.z.string().min(1).max(32).nullish().default("#text"),text_as_property:ee.z.boolean().nullish().default(!1),xpath:ee.z.string().min(1).max(256).nullish(),inputs:ee.z.never().nullish(),outputs:ee.z.never().nullish()}).strict().superRefine((n,t)=>{!n.attributes_block_name&&!n.attributes_name_prefix&&(t.addIssue({code:"custom",path:["attributes_block_name"],message:"At least one of attributes_block_name or attributes_name_prefix is required"}),t.addIssue({code:"custom",path:["attributes_name_prefix"],message:"At least one of attributes_block_name or attributes_name_prefix is required"}))}),d2=Fn.safeExtend({type:ee.z.literal("json_to_xml"),attributes_block_name:ee.z.string().min(1).max(32).nullish(),attributes_name_prefix:ee.z.string().min(1).max(32).nullish(),root_element_name:ee.z.string().min(1).max(64).nullish(),text_block_name:ee.z.string().min(1).max(32).nullish().default("#text"),inputs:ee.z.record(ee.z.string().min(1).max(255),ut).nullish(),outputs:ee.z.never().nullish()}).strict().superRefine((n,t)=>{!n.attributes_block_name&&!n.attributes_name_prefix&&(t.addIssue({code:"custom",path:["attributes_block_name"],message:"At least one of attributes_block_name or attributes_name_prefix is required"}),t.addIssue({code:"custom",path:["attributes_name_prefix"],message:"At least one of attributes_block_name or attributes_name_prefix is required"}))}),f2=Fn.safeExtend({type:ee.z.literal("jwt_decode"),inputs:ee.z.never().nullish(),outputs:ee.z.object({header:ut,payload:ut,signature:ut}).partial().nullish()}).strict(),p2=Fn.safeExtend({type:ee.z.literal("jwt_sign"),algorithm:kw,expires_in:ee.z.number().int().min(1).default(300).nullish(),inputs:o2.nullish(),kid:ee.z.string().nullish(),not_before:ee.z.number().int().min(0).default(0).nullish(),outputs:ee.z.object({claims:ut,header:ut,token:ut}).partial().nullish(),static_claims:ee.z.record(ee.z.string(),ee.z.string()).default({}).nullish(),typ:ee.z.string().default("JWT").nullish()}).strict(),m2=Fn.safeExtend({type:ee.z.literal("jwt_verify"),allowed_algorithms:ee.z.array(kw).default([]).nullish(),audiences:ee.z.array(ee.z.string()).default([]).nullish(),inputs:i2.nullish(),issuers:ee.z.array(ee.z.string()).default([]).nullish(),leeway:ee.z.number().int().min(0).default(0).nullish(),outputs:ee.z.object({claims:ut,header:ut}).partial().nullish(),required_claims:ee.z.array(ee.z.string()).default([]).nullish(),validate_exp:ee.z.boolean().default(!0).nullish(),validate_nbf:ee.z.boolean().default(!0).nullish()}).strict(),g2=Fn.safeExtend({type:ee.z.literal("property"),content_type:ee.z.enum(["application/json","text/plain","application/octet-stream"]).nullish(),property:ee.z.string().min(1).max(255),non_nil:ee.z.boolean().default(!1).nullish(),inputs:ee.z.never().nullish(),outputs:ee.z.never().nullish()}).strict(),h2=Fn.safeExtend({type:ee.z.literal("static"),values:ee.z.record(ee.z.string(),ee.z.unknown()),input:ee.z.never().nullish(),inputs:ee.z.never().nullish()}).strict(),y2=Fn.safeExtend({type:ee.z.literal("cache"),bypass_on_error:ee.z.boolean().nullish(),inputs:r2.nullish(),outputs:ee.z.object({data:ut,hit:ut,miss:ut,stored:ut}).partial().nullish(),ttl:ee.z.number().int().gt(0).nullish()}).strict(),_2=Fn.safeExtend({type:ee.z.literal("branch"),then:ee.z.array(yc).min(1).max(64).nullish(),else:ee.z.array(yc).min(1).max(64).nullish()}).strict(),b2=a2.pipe(ee.z.discriminatedUnion("type",[s2,l2,c2,u2,d2,f2,p2,m2,g2,h2,y2,_2])),w2=ee.z.record(ee.z.string().regex(/^[A-Za-z_][A-Za-z0-9_-]*$/).min(1).max(255),ee.z.string().min(1).max(4095)),k2=ee.z.object({dictionary_name:ee.z.string().nullish().default("kong_db_cache")}),C2=ee.z.object({host:ee.z.string().default("127.0.0.1"),port:ee.z.number().int().min(0).max(65535).default(6379)}),E2=ee.z.object({ip:ee.z.string().default("127.0.0.1"),port:ee.z.number().int().min(0).max(65535).default(6379)}),N2=ee.z.object({host:ee.z.string().nullish().default("127.0.0.1"),port:ee.z.number().int().min(0).max(65535).nullish().default(6379),connect_timeout:ee.z.number().int().min(0).max(2147483646).nullish().default(2e3),send_timeout:ee.z.number().int().min(0).max(2147483646).nullish().default(2e3),read_timeout:ee.z.number().int().min(0).max(2147483646).nullish().default(2e3),username:ee.z.string().nullish(),password:ee.z.string().nullish(),sentinel_username:ee.z.string().nullish(),sentinel_password:ee.z.string().nullish(),database:ee.z.number().int().nullish().default(0),keepalive_pool_size:ee.z.number().int().min(1).max(2147483646).nullish().default(256),keepalive_backlog:ee.z.number().int().min(0).max(2147483646).nullish(),sentinel_master:ee.z.string().nullish(),sentinel_role:ee.z.enum(["master","slave","any"]).nullish(),sentinel_nodes:ee.z.array(C2).min(1,{message:"sentinel_nodes must contain at least 1 item"}).nullish(),cluster_nodes:ee.z.array(E2).min(1,{message:"cluster_nodes must contain at least 1 item"}).nullish(),ssl:ee.z.boolean().default(!1).nullish(),ssl_verify:ee.z.boolean().default(!0).nullish(),server_name:ee.z.string().nullish(),cluster_max_redirections:ee.z.number().int().default(5).nullish(),connection_is_proxied:ee.z.boolean().default(!1).nullish(),cloud_authentication:ee.z.object({auth_provider:ee.z.enum(["aws","azure","gcp"]).nullish(),aws_access_key_id:ee.z.string().nullish(),aws_assume_role_arn:ee.z.string().nullish(),aws_cache_name:ee.z.string().nullish(),aws_is_serverless:ee.z.boolean().default(!0).nullish(),aws_region:ee.z.string().nullish(),aws_role_session_name:ee.z.string().nullish(),aws_secret_access_key:ee.z.string().nullish(),azure_client_id:ee.z.string().nullish(),azure_client_secret:ee.z.string().nullish(),azure_tenant_id:ee.z.string().nullish(),gcp_service_account_json:ee.z.string().nullish()}).nullish(),timeout:ee.z.number().int().nullish(),sentinel_addresses:ee.z.array(ee.z.string()).min(1).nullish(),cluster_addresses:ee.z.array(ee.z.string()).min(1).nullish()}).superRefine((n,t)=>{var l;const r=n.host!==void 0&&n.host!==null,o=n.port!==void 0&&n.port!==null;(r&&!o||!r&&o)&&t.addIssue({code:"custom",message:"host and port must be specified together",path:r?["port"]:["host"]});const i=!!n.sentinel_master,a=!!n.sentinel_role,s=!!((l=n.sentinel_nodes)!=null&&l.length),c=[i,a,s].filter(Boolean).length;c>0&&c<3&&t.addIssue({code:"custom",message:"sentinel_master, sentinel_role and sentinel_nodes must be provided together"}),n.connection_is_proxied===!0&&!r&&t.addIssue({code:"custom",message:"host is required when connection_is_proxied is true (host/port should point to the proxy)",path:["host"]})}),S2=ee.z.object({strategy:ee.z.enum(["memory","redis"]).nullish(),memory:k2,redis:N2}),x2=ee.z.object({vault:w2.nullish(),cache:S2.nullish()});ee.z.array(ee.z.object({id:ee.z.string()})),ee.z.object({nodes:ee.z.array(b2).min(1,"At least one node is required").max(64),debug:ee.z.boolean().default(!1).nullish(),resources:x2.nullish()}).strict().superRefine((n,t)=>{hw(n,ii,t)});const Cw=fp.options,pp=ee.z.string().min(1).refine(n=>!n.includes("."),"Invalid node name").refine(n=>!yw(n),"Node name conflicts with reserved implicit node"),_t=ee.z.string().refine(n=>{if(!n||/\s/.test(n))return!1;const t=n.indexOf(".");if(t===-1)return!0;const r=n.slice(0,t),o=n.slice(t+1);return r.length>0&&o.length>0},"Invalid connection"),Ew=ee.z.object({body:_t.nullish(),headers:_t.nullish(),query:_t.nullish()}).partial().strict(),Nw=ee.z.object({headers:_t.nullish(),body:_t.nullish()}).partial().strict(),Sw=ee.z.object({data:_t.nullish(),key:_t.nullish(),ttl:_t.nullish()}).partial().strict(),xw=ee.z.object({claims:_t.nullish(),key:_t.nullish()}).partial().strict(),Aw=ee.z.object({key:_t.nullish(),token:_t.nullish()}).partial().strict(),A2={call:Ew,exit:Nw,cache:Sw,jwt_sign:xw,jwt_verify:Aw};function v2(n){const t=A2[n];return t?Object.keys(t.shape):null}const Un=ee.z.object({type:ee.z.string(),name:pp,input:_t.nullish(),inputs:ee.z.record(ee.z.string(),_t.nullish()).nullish(),output:_t.nullish(),outputs:ee.z.record(ee.z.string(),_t.nullish()).nullish()}).loose().superRefine((n,t)=>{gw(n,t)}),I2=ee.z.object({type:ee.z.string(),name:ee.z.string()}).loose().superRefine((n,t)=>{const r=n.type,o=n.name;(typeof o!="string"||o.length===0||o.includes("."))&&t.addIssue({code:"custom",path:["name"],message:"Invalid node name",fatal:!1}),Cw.includes(r)||t.addIssue({code:"custom",path:["type"],message:`unknown node type "${r}", expected one of: ${Cw.join(", ")}`})}),B2=Un.safeExtend({type:ee.z.literal("call"),method:ww.nullish(),ssl_server_name:ee.z.string().nullish(),ssl_verify:ee.z.boolean().nullish(),timeout:ee.z.union([ee.z.number(),ee.z.string()]).nullish(),url:ee.z.string().nullish(),inputs:Ew.nullish(),outputs:ee.z.object({body:_t.nullish(),headers:_t.nullish(),status:_t.nullish()}).partial().nullish()}).strict(),T2=Un.safeExtend({type:ee.z.literal("exit"),status:ee.z.union([ee.z.number(),ee.z.string()]).nullish(),warn_headers_sent:ee.z.boolean().nullish(),inputs:Nw.nullish(),output:ee.z.never().nullish(),outputs:ee.z.never().nullish()}).strict(),O2=Un.safeExtend({type:ee.z.literal("jq"),jq:ee.z.string().nullish(),outputs:ee.z.never().nullish()}).strict(),P2=Un.safeExtend({type:ee.z.literal("xml_to_json"),recognize_type:ee.z.boolean().nullish(),attributes_block_name:ee.z.string().nullish(),attributes_name_prefix:ee.z.string().nullish(),text_block_name:ee.z.string().nullish(),text_as_property:ee.z.boolean().nullish(),xpath:ee.z.string().nullish(),inputs:ee.z.never().nullish(),outputs:ee.z.never().nullish()}).strict(),V2=Un.safeExtend({type:ee.z.literal("json_to_xml"),attributes_block_name:ee.z.string().nullish(),attributes_name_prefix:ee.z.string().nullish(),root_element_name:ee.z.string().nullish(),text_block_name:ee.z.string().nullish(),inputs:ee.z.record(ee.z.string(),_t.nullish()).nullish(),outputs:ee.z.never().nullish()}).strict(),$2=Un.safeExtend({type:ee.z.literal("property"),content_type:ee.z.string().nullish(),non_nil:ee.z.boolean().nullish(),property:ee.z.string().nullish(),inputs:ee.z.never().nullish(),outputs:ee.z.never().nullish()}).strict(),R2=Un.safeExtend({type:ee.z.literal("static"),values:ee.z.record(ee.z.string(),ee.z.unknown()).nullish(),input:ee.z.never().nullish(),inputs:ee.z.never().nullish()}).strict(),L2=Un.safeExtend({type:ee.z.literal("cache"),bypass_on_error:ee.z.boolean().nullish(),inputs:Sw.nullish(),outputs:ee.z.object({data:_t.nullish(),hit:_t.nullish(),miss:_t.nullish(),stored:_t.nullish()}).partial().nullish(),ttl:ee.z.union([ee.z.number(),ee.z.string()]).nullish()}).strict(),D2=Un.safeExtend({type:ee.z.literal("jwt_decode"),inputs:ee.z.never().nullish(),outputs:ee.z.object({header:_t.nullish(),payload:_t.nullish(),signature:_t.nullish()}).partial().nullish()}).strict(),M2=Un.safeExtend({type:ee.z.literal("jwt_sign"),algorithm:ee.z.enum(Xd).nullish(),expires_in:ee.z.union([ee.z.number(),ee.z.string()]).nullish(),inputs:xw.nullish(),kid:ee.z.string().nullish(),not_before:ee.z.union([ee.z.number(),ee.z.string()]).nullish(),outputs:ee.z.object({claims:_t.nullish(),header:_t.nullish(),token:_t.nullish()}).partial().nullish(),static_claims:ee.z.record(ee.z.string(),ee.z.string()).nullish(),typ:ee.z.string().nullish()}).strict(),j2=Un.safeExtend({type:ee.z.literal("jwt_verify"),allowed_algorithms:ee.z.array(ee.z.enum(Xd)).nullish(),audiences:ee.z.array(ee.z.string()).nullish(),inputs:Aw.nullish(),issuers:ee.z.array(ee.z.string()).nullish(),leeway:ee.z.union([ee.z.number(),ee.z.string()]).nullish(),outputs:ee.z.object({claims:_t.nullish(),header:_t.nullish()}).partial().nullish(),required_claims:ee.z.array(ee.z.string()).nullish(),validate_exp:ee.z.boolean().nullish(),validate_nbf:ee.z.boolean().nullish()}).strict(),F2=Un.safeExtend({type:ee.z.literal("branch"),then:ee.z.array(pp).nullish(),else:ee.z.array(pp).nullish()}).strict(),U2=I2.pipe(ee.z.discriminatedUnion("type",[B2,T2,O2,P2,V2,D2,M2,j2,$2,R2,L2,F2])),K2=ee.z.record(ee.z.string(),ee.z.string()),q2=ee.z.object({dictionary_name:ee.z.string().nullish()}),G2=ee.z.object(),H2=ee.z.object({strategy:ee.z.enum(["memory","redis"]).nullish(),memory:q2.nullish(),redis:G2.nullish()}),z2=ee.z.object({vault:K2.nullish(),cache:H2.nullish()}),vw=ee.z.object({nodes:ee.z.array(U2).nullish(),debug:ee.z.boolean().nullish(),resources:z2.nullish()}).strict().superRefine((n,t)=>{!n||!Array.isArray(n.nodes)||hw(n,ii,t)}).nullish(),Iw=e.defineComponent({__name:"InputsRecordField",props:{name:{},items:{},nodeType:{}},emits:["change:inputs"],setup(n){const{getSchema:t}=pt(),{i18n:r}=Qe(),o=e.computed(()=>{const i=t("inputs");if(!i)return[];const a=i.fields.map(c=>Object.keys(c)[0]);if(mn(n.nodeType))return a;const s=v2(n.nodeType);return s===null?a:s.length===0?[]:oI(a,s)});return(i,a)=>(e.openBlock(),e.createBlock(Ut,{"as-child":"",name:n.name,"reset-label-path":"isolate"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,s=>(e.openBlock(),e.createBlock(Dt,{key:s,clearable:"","enable-filtering":"",items:n.items,name:s,placeholder:e.unref(r).t("plugins.free-form.datakit.flow_editor.node_properties.input.placeholder"),onChange:c=>i.$emit("change:inputs",s,c?c.value:null)},e.createSlots({_:2},[i.$slots["item-label"]?{name:"item-label",fn:e.withCtx(c=>[e.renderSlot(i.$slots,"item-label",e.mergeProps({ref_for:!0},c))]),key:"0"}:void 0]),1032,["items","name","placeholder","onChange"]))),128))]),_:3},8,["name"]))}}),W2=["data-testid"],Y2={class:"dk-inputs-map-field-entry-body"},J2={class:"dk-inputs-map-field-entry-content"},X2=je(e.defineComponent({__name:"InputsMapField",props:{name:{},items:{},fieldNameValidator:{},keyOrder:{}},emits:["change:inputs","add:field","remove:field","rename:field"],setup(n,{emit:t}){const r=n,o=t,{keys:i,addKey:a,removeKey:s,updateKey:c,getKeyName:l,field:u}=Hl(e.toRef(r,"name")),{value:p}=Ft(e.toRef(r,"name")),{i18n:{t:d}}=Qe(),f=e.useTemplateRef("root"),m=e.ref(null),h=e.ref({}),y=e.ref({});let b;const _=e.computed(()=>{var A;return(A=r.keyOrder)!=null&&A.length?[...i.value].sort((T,V)=>{const R=r.keyOrder.indexOf(T[1]),X=r.keyOrder.indexOf(V[1]);return(R===-1?1/0:R)-(X===-1?1/0:X)}):i.value});async function k(A,T="key"){var V;f.value&&(await e.nextTick(),(V=f.value.querySelector(`[data-${T}-input="${A}"]`))==null||V.focus())}function C(){const A=a();if(!A)return;y.value[A]="";const T=_.value.findIndex(([,V])=>!V);k(T===-1?_.value.length-1:T),m.value=A}function N(A,T){s(A),delete y.value[A],delete h.value[A],A===m.value&&(m.value=null),T.trim()!==""&&o("remove:field",T)}function E(A){b=y.value[A]??l(A)??""}function w(A,T){const V=T.trim();y.value[A]=V,I(A,V)}function S(A){var V;const T=y.value[A]??l(A)??"";if(I(A,T)){y.value[A]=b,c(A,b),delete h.value[A];return}if(A===m.value){if(T.trim()==="")return;c(A,T),o("add:field",T,((V=p==null?void 0:p.value)==null?void 0:V[A])??null),m.value=null}else c(A,T),o("rename:field",b,T);delete h.value[A],b=T}function I(A,T){delete h.value[A];const V=r.fieldNameValidator("input",b,T);if(V)return h.value[A]=V,V}function U(A){I(A,y.value[A]??l(A)??"")}function x(A,T){if(p!=null&&p.value&&(p.value[A]=T),A===m.value)return;const V=l(A);V&&o("change:inputs",V,T)}return e.watch(i,A=>{const T=new Set(A.map(([V])=>V));Object.keys(y.value).forEach(V=>{T.has(V)?y.value[V]=y.value[V]??l(V)??"":(delete y.value[V],delete h.value[V])}),A.forEach(([V,R])=>{y.value[V]=y.value[V]??R}),m.value&&!T.has(m.value)&&(m.value=null)},{immediate:!0}),e.watch(()=>r.keyOrder,()=>{if(!m.value)return;const A=_.value.findIndex(([T])=>T===m.value);A!==-1&&k(A)}),(A,T)=>{const V=e.resolveComponent("KAlert"),R=e.resolveComponent("KLabel"),X=e.resolveComponent("KInput"),Y=e.resolveComponent("KSelect"),ne=e.resolveComponent("KButton");return e.unref(u).error?(e.openBlock(),e.createBlock(V,{key:0,appearance:"danger",message:e.unref(u).error.message},null,8,["message"])):(e.openBlock(),e.createElementBlock("div",{key:1,ref_key:"root",ref:f,class:"dk-inputs-map-field"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value,([M,te],$)=>{var Z;return e.openBlock(),e.createElementBlock("div",{key:M,class:"dk-inputs-map-field-entry","data-testid":`ff-kv-container-${e.unref(u).path.value}.${$}`},[e.createVNode(R,{for:`ff-kv-entry-key-${e.unref(u).path.value}.${$}`},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(d)("plugins.free-form.datakit.flow_editor.node_properties.input_name.label")),1)]),_:1},8,["for"]),e.createElementVNode("div",Y2,[e.createElementVNode("div",J2,[e.createVNode(X,{id:`ff-kv-entry-key-${e.unref(u).path.value}.${$}`,class:"ff-kv-field-entry-key","data-key-input":$,"data-testid":`ff-key-${e.unref(u).path.value}.${$}`,error:!!h.value[M],"error-message":h.value[M],"model-value":y.value[M]??te,placeholder:e.unref(d)("plugins.free-form.datakit.flow_editor.node_properties.input_name.placeholder"),onBlur:F=>U(M),onChange:F=>S(M),onFocus:F=>E(M),"onUpdate:modelValue":F=>w(M,F)},null,8,["id","data-key-input","data-testid","error","error-message","model-value","placeholder","onBlur","onChange","onFocus","onUpdate:modelValue"]),e.createVNode(Y,{class:"ff-kv-field-entry-value",clearable:"","data-testid":`ff-value-${e.unref(u).path.value}.${$}`,"enable-filtering":"",items:n.items,label:e.unref(d)("plugins.free-form.datakit.flow_editor.node_properties.input.source"),"model-value":(Z=e.unref(p))==null?void 0:Z[M],placeholder:e.unref(d)("plugins.free-form.datakit.flow_editor.node_properties.input.placeholder"),onChange:F=>x(M,(F==null?void 0:F.value)??null)},e.createSlots({_:2},[A.$slots["item-label"]?{name:"item-template",fn:e.withCtx(({item:F})=>[e.renderSlot(A.$slots,"item-label",e.mergeProps({ref_for:!0},F),void 0,!0)]),key:"0"}:void 0]),1032,["data-testid","items","label","model-value","placeholder","onChange"])]),e.createVNode(ne,{appearance:"tertiary",class:"dk-inputs-map-field-remove-btn","data-testid":`ff-kv-remove-btn-${e.unref(u).path.value}.${$}`,icon:"",onClick:F=>N(M,te)},{default:e.withCtx(()=>[e.createVNode(e.unref($e.CloseIcon))]),_:1},8,["data-testid","onClick"])])],8,W2)}),128)),e.createVNode(ne,{appearance:"tertiary","data-testid":`ff-kv-add-btn-${e.unref(u).path.value}`,disabled:!!m.value,onClick:C},{default:e.withCtx(()=>[e.createVNode(e.unref($e.AddIcon)),e.createTextVNode(" "+e.toDisplayString(e.unref(d)("plugins.free-form.datakit.flow_editor.node_properties.input.add_button")),1)]),_:1},8,["data-testid","disabled"])],512))}}}),[["__scopeId","data-v-43dcb370"]]),Z2={class:"dk-source-item"},_c=je(e.defineComponent({__name:"SourceItem",props:{item:{}},setup(n){return(t,r)=>(e.openBlock(),e.createElementBlock("span",Z2,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Zd)(n.item.type).icon),{color:`var(--kui-color-text-neutral, ${e.unref(cr)})`,size:`var(--kui-icon-size-40, ${e.unref(_a)})`},null,8,["color","size"])),e.createTextVNode(" "+e.toDisplayString(n.item.label),1)]))}}),[["__scopeId","data-v-d9aa16eb"]]),Q2={key:1,class:"dk-inputs-field-or"},In=je(e.defineComponent({__name:"InputsField",props:{items:{},fieldNames:{},fieldNameValidator:{},nodeType:{}},emits:["change:input","change:inputs","add:field","remove:field","rename:field"],setup(n,{emit:t}){const r=t,{getSchema:o}=pt(),{i18n:{t:i}}=Qe(),a=e.computed(()=>o("inputs")),s=e.computed(()=>a.value?a.value.type==="record"?Iw:X2:null);function c(f){r("change:input",f?f.value:null)}function l(f,m){r("add:field",f,m)}function u(f,m){r("change:inputs",f,m)}function p(f){r("remove:field",f)}function d(f,m){r("rename:field",f,m)}return(f,m)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(Fe.KLabel),{class:"dk-inputs-field-h1",info:e.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.tooltip")},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.label")),1)]),_:1},8,["info"]),e.unref(o)("input")?(e.openBlock(),e.createBlock(Dt,{key:0,class:"dk-inputs-field-h2",clearable:"","enable-filtering":"",items:n.items,label:e.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.input"),"label-attributes":{info:void 0},name:"input",placeholder:e.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.placeholder"),onChange:c},{"item-label":e.withCtx(h=>[e.renderSlot(f.$slots,"item-label",e.normalizeProps(e.guardReactiveProps(h)),()=>[e.createVNode(_c,{item:h},null,8,["item"])],!0)]),_:3},8,["items","label","placeholder"])):e.createCommentVNode("",!0),s.value?(e.openBlock(),e.createElementBlock("div",Q2,[e.createElementVNode("span",null,e.toDisplayString(e.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.or")),1)])):e.createCommentVNode("",!0),s.value?(e.openBlock(),e.createBlock(e.unref(Fe.KLabel),{key:2,class:"dk-inputs-field-h2 dk-margin-0"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.input.fields")),1)]),_:1})):e.createCommentVNode("",!0),s.value?(e.openBlock(),e.createBlock(e.unref(s),e.mergeProps({key:3,items:n.items,"key-order":n.fieldNames,name:"inputs"},s.value===Iw?{nodeType:n.nodeType}:{fieldNameValidator:n.fieldNameValidator},{"onAdd:field":l,"onChange:inputs":u,"onRemove:field":p,"onRename:field":d}),{"item-label":e.withCtx(h=>[e.createVNode(_c,{item:h},null,8,["item"])]),_:1},16,["items","key-order"])):e.createCommentVNode("",!0)],64))}}),[["__scopeId","data-v-4f1ce4e7"]]),eL={},tL={class:"dk-node-form-divider"};function nL(n,t){return e.openBlock(),e.createElementBlock("hr",tL)}const tr=je(eL,[["render",nL],["__scopeId","data-v-35ed58be"]]),rL={fields:[{input:{description:"filter input(s)",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{inputs:{description:"call node inputs",fields:[{body:{description:"HTTP request body",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{headers:{description:"HTTP request headers",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{query:{description:"HTTP request query",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}}],required:!1,type:"record"}}],type:"record"},oL={fields:[{input:{description:"filter input(s)",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{inputs:{description:"call node inputs",fields:[{body:{description:"HTTP request body",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}},{headers:{description:"HTTP request headers",len_max:255,len_min:1,match_any:{err:"must be one of NODE_NAME or NODE_NAME.FIELD",patterns:["^[A-Za-z_][A-Za-z0-9_-]*$","^[A-Za-z_][A-Za-z0-9_-]*%..+$"]},required:!1,type:"string"}}],required:!1,type:"record"}}],type:"record"};function iL(n){const t=Number(n);return!isNaN(t)&&isFinite(t)}function yn(...n){return function(r){for(const o of n){const i=o(r);if(i)return i}}}function To(n){const{i18n:{t}}=Qe(),r=()=>n?typeof n=="string"?n:t("plugins.free-form.datakit.flow_editor.node_properties.errors.not_empty",n):"Field is required";return function(i){if(i==null||typeof i=="string"&&i.trim()==="")return r()}}function Bw(n,t){const{i18n:{t:r}}=Qe();return function(i){if(i!=null)switch(n){case"identifier":{const a=()=>t?typeof t=="string"?t:r("plugins.free-form.datakit.flow_editor.node_properties.errors.invalid_identifier_format",t):"Invalid identifier format";return/^[A-Za-z_][A-Za-z0-9_-]*$/.test(i)?void 0:a()}case"url":{const a=()=>t?typeof t=="string"?t:r("plugins.free-form.datakit.flow_editor.node_properties.errors.invalid_url_format"):"Invalid URL format";try{new URL(i);return}catch{return a()}}default:return}}}function $r(n=0,t=1/0,r){const{i18n:{t:o}}=Qe();return function(a){if(a!=null&&typeof a=="string"&&(a.length<n||a.length>t))return r?typeof r=="string"?r:o("plugins.free-form.datakit.flow_editor.node_properties.errors.string_len_range",{fieldName:r.fieldName,minLength:n,maxLength:t}):`Value must be between ${n} and ${t} characters`}}function Tw(n){const{i18n:{t}}=Qe();return function(o){if(!iL(o))return n?typeof n=="string"?n:t("plugins.free-form.datakit.flow_editor.node_properties.errors.not_number",n):"Value must be a number"}}function Vi(n,t){const{i18n:{t:r}}=Qe();return function(i){if(i==null)return;const a=Tw(t)(i);if(a)return a;const s=Number(i);switch(n){case"float":{const c=()=>t?typeof t=="string"?t:r("plugins.free-form.datakit.flow_editor.node_properties.errors.not_float",t):"Invalid float format";return Number.isFinite(s)?void 0:c()}case"integer":{const c=()=>t?typeof t=="string"?t:r("plugins.free-form.datakit.flow_editor.node_properties.errors.not_integer",t):"Invalid integer format";return Number.isInteger(s)?void 0:c()}default:return}}}function $i(n=-1/0,t=1/0,r){const{i18n:{t:o}}=Qe();return function(a){if(a==null)return;const s=Tw(r)(a);if(s)return s;const c=Number(a);if(c<n||c>t)return r?typeof r=="string"?r:o("plugins.free-form.datakit.flow_editor.node_properties.errors.number_range",{fieldName:r.fieldName,min:n,max:t}):`Value must be between ${n} and ${t}`}}function aL(n,t){const{state:r}=$t(),{i18n:{t:o}}=Qe();return function(a){if(r.value.nodes.some(s=>s.name===a&&s.id!==n))return t?typeof t=="string"?t:o("plugins.free-form.datakit.flow_editor.node_properties.errors.not_unique",t):"Name must be unique."}}function sL(n,t,r){const{i18n:{t:o}}=Qe();return function(a){if(!t)return;if(r?t.fields[n].some(c=>c.name===a&&c.id!==r):t.fields[n].some(c=>c.name===a)){const c=o(n==="input"?"plugins.free-form.datakit.flow_editor.node_properties.input_name.label":"plugins.free-form.datakit.flow_editor.node_properties.output_value.value_name");return o("plugins.free-form.datakit.flow_editor.node_properties.errors.not_unique",{fieldName:c})}}}function lL(){const{i18n:{t:n}}=Qe();return function(r){if(tf(r))return n("plugins.free-form.datakit.flow_editor.node_properties.errors.reserved_node_name",{nodeName:r})}}function Ow(n){const{i18n:{t}}=Qe(),r={fieldName:t("plugins.free-form.datakit.flow_editor.node_properties.name")};return yn(To(r),Bw("identifier",r),lL(),aL(n,r))}function cL(n){const{i18n:{t}}=Qe(),{getNodeById:r}=$t();return function(i,a,s){const c={fieldName:t(i==="input"?"plugins.free-form.datakit.flow_editor.node_properties.input_name.label":"plugins.free-form.datakit.flow_editor.node_properties.output_value.value_name")};return yn(To(c),sL(i,r(n),s))(a)}}function uL(n){const t=e.ref({}),r=e.computed(()=>Object.values(t.value).every(s=>!s)),o={};Object.keys(n).forEach(s=>{const c=n[s],l=d=>{const f=typeof d=="function"?d():d,m=c(f);return t.value[s]=m,m},u=()=>{t.value[s]=void 0},p=d=>(u(),l(d));o[s]={handleChange:p,handleBlur:p,validate:p,isValid:e.computed(()=>t.value[s]===void 0),error:e.computed(()=>t.value[s])}});function i(){t.value={}}function a(s){var c;for(const l of Object.keys(n)){const u=s[l],p=typeof u=="function"?u():u;(c=o[l])==null||c.validate(p)}return t.value}return{isValid:r,errorMap:t,fields:o,clearErrors:i,validate:a}}function Rr(n){const{validationConfig:t,getValidationData:r,toggleNodeValid:o}=n,{skipValidation:i}=$t(),a=e.computed(()=>typeof t=="function"?t():t),s=e.computed(()=>uL(a.value)),c=e.computed(()=>s.value.fields),l=e.computed(()=>s.value.isValid.value);function u(){const d=r(),f=s.value.validate(d),m={};for(const h in a.value)m[h]=f[h];return m}function p(d,f){const m=()=>{const y=r(),b=c.value[d];b&&b.handleBlur(y[d])},h=()=>{f==null||f();const y=r(),b=c.value[d];b&&b.handleChange(y[d])};return e.computed(()=>{const y=c.value[d];return{validate:m,update:h,error:y?!y.isValid.value:!1,errorMessage:y?y.error.value??"":""}})}return e.onMounted(()=>{i.value?i.value=!1:u()}),e.onBeforeUnmount(async()=>{try{const d=u(),f=Object.values(d).filter(Boolean).length>0;o(!f)}catch{}}),e.watch(()=>l.value,o,{immediate:!0}),{fields:c.value,isValid:l,validateAll:u,createFieldHandler:p}}function _n(n,t){const{state:r,renameNode:o,getNodeById:i,addField:a,renameField:s,removeField:c,replaceConfig:l,disconnectEdge:u,connectEdge:p,invalidConfigNodeIds:d,commit:f,revert:m}=$t(),{i18n:{t:h}}=Qe(),y=r_(),b=e.computed(()=>{const M=i(n);if(!M)throw new Error("Node not existed");return M}),_=e.computed(()=>{const te=r.value.edges.filter($=>$.target===n).reduce(($,Z)=>{var q,ie;const F=i(Z.source),J=(q=Qr(F,"output",Z.sourceField))==null?void 0:q.id,G=(ie=Qr(b.value,"input",Z.targetField))==null?void 0:ie.name,v=F.id+(J?`.${J}`:"");return G?$.inputs={...$.inputs,[G]:v}:$.input=v,$},{});return b.value.fields.input.forEach($=>{te.inputs||(te.inputs={}),te.inputs[$.name]||(te.inputs[$.name]=null)}),{...b.value.config,...te,name:b.value.name}}),k=M=>{o(n,M??"",!0,`${n}:rename`)},C=(M,te=!0)=>{if(!t)throw new Error("getFormValue is not defined");const $=Xr(t(),["name","input","inputs"]),Z=M?`update:${n}:${M}`:void 0;l(n,$,te,Z)},N=(M,te)=>{const $=Zr(b.value,M,te);if(!$)throw new Error(`Field with name "${te}" not found in node "${b.value.name}"`);return $},E=(M,te,$)=>{const Z=!!$;a(n,M,te,!Z),Z&&x(te,$)},w=(M,te,$)=>{const Z=N(M,te).id;s(n,Z,$)},S=(M,te)=>{const $=N(M,te).id;c(n,$)},I=e.computed(()=>r.value.edges.filter(M=>M.target===n&&!M.targetField)[0]),U=e.computed(()=>r.value.edges.filter(M=>M.target===n&&M.targetField)),x=async(M,te)=>{const $=te==null,Z=N("input",M).id;if($){const ye=U.value.find(ce=>ce.targetField===Z);ye&&u(ye.id);return}const{nodeId:F,fieldId:J}=Ky(te),G=N("input",M).id,v=[];I.value&&(v.push(Ra(I.value,i)),u(I.value.id,!1));const q=U.value.find(ye=>ye.targetField===Z);q&&(v.push(Ra(q,i)),u(q.id,!1)),p({source:F,sourceField:J,target:n,targetField:G},!1);const ie=sf(F,J,n,G,i),oe=v[0]&&ie?v[0][1]===ie[1]:!1;if(f(),oe||v.length===0)return;await y(h("plugins.free-form.datakit.flow_editor.confirm.message.switch"),[ie],v)||m()},A=async M=>{if(M==null){I.value&&u(I.value.id);return}const $=[];for(const v of U.value)$.push(Ra(v,i)),u(v.id,!1);I.value&&u(I.value.id,!1);const{nodeId:Z,fieldId:F}=Ky(M);p({source:Z,sourceField:F,target:n,targetField:void 0},!1);const J=sf(Z,F,n,void 0,i);if(f(),$.length===0)return;await y(h("plugins.free-form.datakit.flow_editor.confirm.message.switch"),[J],$)||m()},T=M=>{const te=[...r.value.edges,{source:M,target:n}];return lf(Pl(te))},V=e.computed(()=>{var te,$;const M=[];for(const Z of r.value.nodes)if((te=ci(Z.type).io)!=null&&te.output&&Z.fields.output&&Z.id!==n&&!(Z.type==="property"&&!zd(($=Z.config)==null?void 0:$.property))&&!T(Z.id)&&!(b.value.phase==="request"&&Z.phase==="response")&&!(Z.type==="vault"&&Z.fields.output.length===0)){M.push({value:Z.id,label:Z.name,type:Z.type});for(const J of Z.fields.output)M.push({value:`${Z.id}.${J.id}`,label:`${Z.name}.${J.name}`,type:Z.type})}return M}),R=e.computed(()=>b.value.fields.input.map(M=>M.name)||[]);function X(M){d.value.delete(n),M||d.value.add(n)}const Y=cL(n);function ne(M,te,$){const Z=i(n);if(!Z)throw new Error("Node not found when validating field name");const F=Zr(Z,M,te);return Y(M,$,F==null?void 0:F.id)}return{formData:_,inputOptions:V,inputEdge:I,inputsEdges:U,inputsFieldNames:R,currentNode:b,setName:k,setConfig:C,addField:E,renameFieldByName:w,removeFieldByName:S,setInputs:x,setInput:A,nameValidator:Ow(n),fieldNameValidator:ne,toggleNodeValid:X}}function bn(n){const{getSchema:t}=pt();return e.computed(()=>{if(mn(n))switch(n){case"response":return oL;case"service_request":return rL}try{const o=t().fields.find(u=>El(u,"config"));if(!o)throw new Error("Config field not found in schema.");const a=o.config.fields.find(u=>El(u,"nodes"));if(!a)throw new Error("Nodes field not found in config schema.");const l=a.nodes.elements.subschema_definitions[n];if(!l)throw new Error(`Subschema "${n}" not found in the schema.`);return l}catch(r){throw new Error(`Failed to get subschema "${n}": ${r.message}`)}})}const Kn=e.defineComponent({__name:"NameField",props:{name:{},validate:{type:Function}},emits:["update"],setup(n,{emit:t}){const r=n,o=t,{i18n:{t:i}}=Qe(),a=e.ref(r.name),s=e.computed(()=>{const p=r.validate(a.value.trim());return p===void 0?"":p});let c=a.value.trim();function l(){if(s.value){a.value=c;return}o("update",a.value.trim())}function u(){c=a.value.trim()}return e.watch(()=>r.name,p=>{p!==a.value&&(a.value=p)}),(p,d)=>{const f=e.resolveComponent("KInput");return e.openBlock(),e.createBlock(f,{"model-value":a.value,"onUpdate:modelValue":d[0]||(d[0]=m=>a.value=m),"data-1p-ignore":"",error:!!s.value,"error-message":s.value,label:e.unref(i)("plugins.free-form.datakit.flow_editor.node_properties.name"),required:"",onChange:l,onFocus:u},null,8,["model-value","error","error-message","label"])}}}),dL=e.defineComponent({__name:"NodeFormCall",props:{nodeId:{}},setup(n){const{i18n:{t}}=Qe(),r=e.useTemplateRef("form"),o=bn("call"),{formData:i,setName:a,setConfig:s,inputOptions:c,setInputs:l,setInput:u,inputsFieldNames:p,nameValidator:d,toggleNodeValid:f,fieldNameValidator:m}=_n(n.nodeId,()=>r.value.getValue()),{createFieldHandler:h}=Rr({validationConfig:{url:yn(To({fieldName:"URL"}),Bw("url",{fieldName:"URL"})),timeout:yn(Vi("integer"),$i(0,2147483646))},getValidationData:()=>({url:i.value.url,timeout:i.value.timeout}),toggleNodeValid:f}),y=h("url",()=>s("url")),b=h("timeout",()=>s("timeout"));return(_,k)=>{const C=e.resolveComponent("KLabel");return e.openBlock(),e.createBlock(Zt,{ref:"form",data:e.unref(i),schema:e.unref(o)},{default:e.withCtx(()=>[e.createVNode(Kn,{name:e.unref(i).name,validate:e.unref(d),onUpdate:e.unref(a)},null,8,["name","validate","onUpdate"]),e.createVNode(C,{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(Xe,{error:e.unref(y).error,"error-message":e.unref(y).errorMessage,name:"url",onBlur:e.unref(y).validate,"onUpdate:modelValue":e.unref(y).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(zR,{name:"method",onUpdate:k[0]||(k[0]=N=>e.unref(s)())}),e.createVNode(Ht,{error:e.unref(b).error,"error-message":e.unref(b).errorMessage,name:"timeout",onBlur:e.unref(b).validate,"onUpdate:modelValue":e.unref(b).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(Xe,{name:"ssl_server_name","onUpdate:modelValue":k[1]||(k[1]=N=>e.unref(s)("ssl_server_name"))}),e.createVNode(hn,{name:"ssl_verify","onUpdate:modelValue":k[2]||(k[2]=N=>e.unref(s)("ssl_verify"))}),e.createVNode(tr),e.createVNode(In,{"field-name-validator":e.unref(m),"field-names":e.unref(p),items:e.unref(c),"node-type":"call","onChange:input":e.unref(u),"onChange:inputs":e.unref(l)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"])}}}),fL=e.defineComponent({__name:"NodeFormServiceRequest",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=bn("service_request"),{formData:o,inputOptions:i,setInputs:a,setInput:s,inputsFieldNames:c,fieldNameValidator:l}=_n(n.nodeId,()=>t.value.getValue());return(u,p)=>(e.openBlock(),e.createBlock(Zt,{ref:"form",data:e.unref(o),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(In,{"field-name-validator":e.unref(l),"field-names":e.unref(c),items:e.unref(i),"node-type":"service_request","onChange:input":e.unref(s),"onChange:inputs":e.unref(a)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),pL=e.defineComponent({__name:"NodeFormResponse",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=bn("response"),{formData:o,inputOptions:i,setInputs:a,setInput:s,inputsFieldNames:c,fieldNameValidator:l}=_n(n.nodeId,()=>t.value.getValue());return(u,p)=>(e.openBlock(),e.createBlock(Zt,{ref:"form",data:e.unref(o),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(In,{"field-name-validator":e.unref(l),"field-names":e.unref(c),items:e.unref(i),"node-type":"response","onChange:input":e.unref(s),"onChange:inputs":e.unref(a)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),mL=e.defineComponent({__name:"NodeFormJq",props:{nodeId:{}},setup(n){const{i18n:{t},i18nT:r}=Qe(),o=e.useTemplateRef("form"),i=bn("jq"),{formData:a,setName:s,setConfig:c,inputOptions:l,setInputs:u,setInput:p,addField:d,removeFieldByName:f,renameFieldByName:m,inputsFieldNames:h,nameValidator:y,toggleNodeValid:b,fieldNameValidator:_}=_n(n.nodeId,()=>o.value.getValue());function k(I,U){d("input",I,U)}function C(I){f("input",I)}function N(I,U){m("input",I,U)}const E=t("plugins.free-form.datakit.flow_editor.node_properties.jq.label"),{createFieldHandler:w}=Rr({validationConfig:{jq:yn(To({fieldName:E}),$r(1,10240,{fieldName:E}))},getValidationData:()=>({jq:a.value.jq}),toggleNodeValid:b}),S=w("jq",()=>c("jq"));return(I,U)=>{const x=e.resolveComponent("KLabel"),A=e.resolveComponent("KExternalLink");return e.openBlock(),e.createBlock(Zt,{ref:"form",data:e.unref(a),schema:e.unref(i)},{default:e.withCtx(()=>[e.createVNode(Kn,{name:e.unref(a).name,validate:e.unref(y),onUpdate:e.unref(s)},null,8,["name","validate","onUpdate"]),e.createVNode(x,{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(Xe,{autosize:"",error:e.unref(S).error,"error-message":e.unref(S).errorMessage,label:e.unref(E),"label-attributes":{},multiline:"",name:"jq",resizable:"",onBlur:e.unref(S).validate,"onUpdate:modelValue":e.unref(S).update},{help:e.withCtx(()=>[e.createVNode(e.unref(r),{keypath:"plugins.free-form.datakit.flow_editor.node_properties.jq.help"},{link:e.withCtx(()=>[e.createVNode(A,{"hide-icon":"",href:e.unref(es).jqlang},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(es).jqlang),1)]),_:1},8,["href"])]),_:1})]),_:1},8,["error","error-message","label","onBlur","onUpdate:modelValue"]),e.createVNode(tr),e.createVNode(In,{"field-name-validator":e.unref(_),"field-names":e.unref(h),items:e.unref(l),"node-type":"jq","onAdd:field":k,"onChange:input":e.unref(p),"onChange:inputs":e.unref(u),"onRemove:field":C,"onRename:field":N},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"])}}}),gL=je(e.defineComponent({__name:"OutputValueField",props:{fieldNameValidator:{},keyOrder:{}},emits:["change:value","add:field","rename:field","remove:field"],setup(n,{emit:t}){const r=n,o=t,i=e.ref({}),{value:a,...s}=Ft("values"),{i18n:c}=Qe(),l=e.useTemplateRef("root"),u=e.ref([]),p=e.ref(null);let d="",f=a==null?void 0:a.value;function m(){return Nl("ff-kv-field-")}function h(x,A,T){const V=T.indexOf(x),R=T.indexOf(A);return V===-1&&R===-1?0:V===-1?1:R===-1?-1:V-R}function y(x,A){if(!x)return[];const T=Object.entries(x).map(([V,R])=>({id:m(),key:V,value:R}));return A!=null&&A.length&&T.sort((V,R)=>h(V.key,R.key,A)),T}function b(){const x={id:m(),key:"",value:""};return u.value.push(x),x}function _(x){const A=u.value.findIndex(T=>T.id===x);A!==-1&&u.value.splice(A,1)}u.value=y(a==null?void 0:a.value,r.keyOrder);async function k(x,A="key"){var T;l.value&&(await e.nextTick(),(T=l.value.querySelector(`[data-${A}-input="${x}"]`))==null||T.focus())}function C(){const x=b(),A=u.value.findIndex(({key:T})=>!T);k(A===-1?u.value.length-1:A),p.value=x}function N(x){var A;x.id===((A=p.value)==null?void 0:A.id)&&(p.value=null),_(x.id),x.key.trim()!==""&&o("remove:field",x.key)}function E(x){d=x.key}function w(x){var A;if(I(x)){x.key=d,delete i.value[x.id];return}if(x.id===((A=p.value)==null?void 0:A.id)){if(x.key.trim()==="")return;p.value=null,o("add:field",x.key,x.value)}else o("rename:field",d,x.key);d=x.key}function S(x,A){var V;if(A.id===((V=p.value)==null?void 0:V.id))return;const T=x.target.value.trim();o("change:value",A.key,T)}function I(x){delete i.value[x.id];const A=r.fieldNameValidator("output",d,x.key);if(A)return i.value[x.id]=A,A}function U(x){I(x)}return e.watch(()=>a==null?void 0:a.value,x=>{var Y;if(Xt(x,f))return;f=x;const A=p.value,T=new Map(u.value.filter(ne=>ne.key).map(ne=>[ne.key,ne])),V=[],R=x??{};((Y=r.keyOrder)!=null&&Y.length?Object.keys(R).sort((ne,M)=>h(ne,M,r.keyOrder)):Object.keys(R)).forEach(ne=>{const M=T.get(ne);if(M){M.value=R[ne],V.push(M);return}V.push({id:m(),key:ne,value:R[ne]})}),A&&!V.some(ne=>ne.id===A.id)&&V.push(A),u.value=V},{deep:!0}),(x,A)=>{const T=e.resolveComponent("KAlert"),V=e.resolveComponent("KLabel"),R=e.resolveComponent("KButton"),X=e.resolveComponent("KInput"),Y=e.resolveComponent("KCard");return s.error?(e.openBlock(),e.createBlock(T,{key:0,appearance:"danger",message:s.error.message},null,8,["message"])):(e.openBlock(),e.createElementBlock("div",{key:1,ref_key:"root",ref:l,class:"dk-output-value-field"},[e.createVNode(V,{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c).t("plugins.free-form.datakit.flow_editor.node_properties.output_value.label")),1)]),_:1}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(ne,M)=>(e.openBlock(),e.createBlock(Y,{key:ne.id,class:"dk-output-value-field-entry","data-testid":`ff-kv-container-${s.path.value}.${M}`},{actions:e.withCtx(()=>[e.createVNode(R,{appearance:"none","data-testid":`ff-kv-remove-btn-${s.path.value}.${M}`,icon:"",onClick:te=>N(ne)},{default:e.withCtx(()=>[e.createVNode(e.unref($e.CloseIcon))]),_:1},8,["data-testid","onClick"])]),default:e.withCtx(()=>[e.createVNode(X,{id:`ff-kv-entry-key-${s.path.value}.${M}`,modelValue:ne.key,"onUpdate:modelValue":[te=>ne.key=te,te=>I(ne)],modelModifiers:{trim:!0},class:"ff-kv-field-entry-key","data-key-input":M,"data-testid":`ff-key-${s.path.value}.${M}`,error:!!i.value[ne.id],"error-message":i.value[ne.id],label:e.unref(c).t("plugins.free-form.datakit.flow_editor.node_properties.output_value.value_name"),required:"",onBlur:te=>U(ne),onChange:te=>w(ne),onFocus:te=>E(ne)},null,8,["id","modelValue","onUpdate:modelValue","data-key-input","data-testid","error","error-message","label","onBlur","onChange","onFocus"]),e.createVNode(X,{modelValue:ne.value,"onUpdate:modelValue":te=>ne.value=te,modelModifiers:{trim:!0},class:"ff-kv-field-entry-value","data-testid":`ff-value-${s.path.value}.${M}`,label:e.unref(c).t("plugins.free-form.datakit.flow_editor.node_properties.output_value.value"),onChange:te=>S(te,ne)},null,8,["modelValue","onUpdate:modelValue","data-testid","label","onChange"])]),_:2},1032,["data-testid"]))),128)),e.createVNode(R,{appearance:"tertiary","data-testid":`ff-kv-add-btn-${s.path.value}`,disabled:!!p.value,onClick:C},{default:e.withCtx(()=>[e.createVNode(e.unref($e.AddIcon)),e.createTextVNode(" "+e.toDisplayString(e.unref(c).t("plugins.free-form.datakit.flow_editor.node_properties.output_value.add_button")),1)]),_:1},8,["data-testid","disabled"])],512))}}}),[["__scopeId","data-v-3970c2c0"]]);function hL(n){const t={};for(const[r,o]of Object.entries(n))typeof o=="object"&&o!==null?t[r]=JSON.stringify(o):t[r]=String(o);return t}function bc(n){const t={};for(const[r,o]of Object.entries(n))if(o!=null){t[r]=o;try{o==="null"?t[r]=null:(o==="true"||o==="false"||/^-?\d+(\.\d+)?$/.test(o)||o.startsWith("{")&&o.endsWith("}")||o.startsWith("[")&&o.endsWith("]"))&&(t[r]=JSON.parse(o))}catch{}}return t}function yL(n,t,r){const o={};for(const i of Object.keys(n))i===t?o[r]=n[t]:o[i]=n[i];return o}const _L=e.defineComponent({__name:"NodeFormStatic",props:{nodeId:{}},setup(n){const{renameNode:t,getOutEdgesByNodeId:r,addField:o,renameField:i,removeField:a,replaceConfig:s,getNodeById:c}=$t(),{fieldNameValidator:l}=_n(n.nodeId),u=bn("static"),p=Ow(n.nodeId),d=e.computed(()=>c(n.nodeId)),f=e.computed(()=>{var C;return((C=d.value)==null?void 0:C.fields.output.map(N=>N.name))||[]});function m(C){if(!d.value)throw new Error("No current node");t(d.value.id,C??"")}const h=e.computed(()=>{var U;if(!d.value)return{};const C=((U=d.value.config)==null?void 0:U.values)??{},N={},E=r(d.value.id).map(x=>x.sourceField).filter(Boolean).map(x=>Qr(d.value,"output",x)).map(x=>x==null?void 0:x.name).filter(Boolean),w=d.value.fields.output.map(x=>x.name),S=Object.keys(C);return new Set([...S,...E,...w]).forEach(x=>{if(x in C){N[x]=C[x];return}N[x]=""}),{name:d.value.name,values:hL(N)}});function y(C,N){if(!d.value)throw new Error("No selected node");const E=N!==void 0;if(o(n.nodeId,"output",C,!E),E){const w={values:bc({...h.value.values,[C]:N})};s(n.nodeId,w)}}function b(C,N){if(!d.value)throw new Error("No selected node");const E=Zr(d.value,"output",C);if(!E)throw new Error("No field found to rename");const w={values:bc(yL(h.value.values??{},C,N))};s(n.nodeId,w,!1),i(n.nodeId,E.id,N)}function _(C){var w;if(!d.value)throw new Error("No selected node");const N=Zr(d.value,"output",C);if(!N)throw new Error("No field found to delete");a((w=d.value)==null?void 0:w.id,N.id,!0,!1);const E={values:bc({...h.value.values})};delete E.values[C],s(n.nodeId,E)}function k(C,N){if(!d.value)throw new Error("No selected node");const E={...h.value.values};E[C]=N;const w={values:bc(E)};s(n.nodeId,w)}return(C,N)=>(e.openBlock(),e.createBlock(Zt,{ref:"form",data:h.value,schema:e.unref(u)},{default:e.withCtx(()=>{var E;return[e.createVNode(Kn,{name:((E=d.value)==null?void 0:E.name)??"",validate:e.unref(p),onUpdate:m},null,8,["name","validate"]),e.createVNode(gL,{"field-name-validator":e.unref(l),"key-order":f.value,"onAdd:field":y,"onChange:value":k,"onRemove:field":_,"onRename:field":b},null,8,["field-name-validator","key-order"])]}),_:1},8,["data","schema"]))}}),bL={class:"dk-kong-property-item"},wL={class:"property-type"},kL={class:"property-badges"},CL=je(e.defineComponent({__name:"PropertiesField",props:{validators:{}},emits:["update:model-value","update:property-key"],setup(n,{emit:t}){const{i18n:{t:r}}=Qe(),o=n,i=t,{formData:a}=pt(),s=e.ref(Ta(a.property)),c=e.computed(()=>Oa(a.property)),l=e.ref(Hd(a.property)),u=e.computed(()=>a.property??""),p=e.computed(()=>Object.entries(bo).map(([m])=>{var b;const h=Oa(m)?(b=a.property)==null?void 0:b.startsWith(m.replace(ri,"")):a.property===m;return{label:h&&l.value?m.replace(ri,l.value):m,value:m,selected:h}}));function d(m){const h=Sl.find(y=>{var b;return(b=a.property)==null?void 0:b.startsWith(y)});h&&(a.property=h+m,o.validators.key.handleChange(a.property),i("update:property-key",a.property))}function f(m){s.value!==Ta(m==null?void 0:m.value)&&(a.property=(m==null?void 0:m.value)||null,s.value=Ta(a.property),o.validators.property.handleBlur(()=>a.property),i("update:model-value",a.property))}return e.watch(()=>a.property,m=>{l.value=Hd(m),s.value=Ta(m)}),(m,h)=>{const y=e.resolveComponent("KBadge"),b=e.resolveComponent("KSelect"),_=e.resolveComponent("KInput");return e.openBlock(),e.createElementBlock(e.Fragment,null,[(e.openBlock(),e.createBlock(b,{key:u.value,"enable-filtering":"",error:!n.validators.property.isValid.value,help:n.validators.property.error.value,items:p.value,label:"Property","label-attributes":{maxWidth:"300px",placement:"top",info:"The property name to get/set"},required:"",onBlur:h[0]||(h[0]=k=>n.validators.property.handleBlur(()=>e.unref(a).property)),onChange:f},{"item-template":e.withCtx(({item:k})=>[e.createElementVNode("div",bL,[e.createElementVNode("div",null,[e.createElementVNode("div",null,e.toDisplayString(k.label),1),e.createElementVNode("div",wL,e.toDisplayString(e.unref(bo)[k.value].dataType),1)]),e.createElementVNode("div",kL,[e.unref(bo)[k.value].readable?(e.openBlock(),e.createBlock(y,{key:0,appearance:"info"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("plugins.free-form.datakit.flow_editor.node_properties.property.get")),1)]),_:1})):e.createCommentVNode("",!0),e.unref(bo)[k.value].writable?(e.openBlock(),e.createBlock(y,{key:1,appearance:"warning"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("plugins.free-form.datakit.flow_editor.node_properties.property.set")),1)]),_:1})):e.createCommentVNode("",!0)])])]),_:1},8,["error","help","items"])),c.value?(e.openBlock(),e.createBlock(_,{key:0,"model-value":l.value,"onUpdate:modelValue":[h[1]||(h[1]=k=>l.value=k),d],error:!n.validators.key.isValid.value,"error-message":n.validators.key.error.value,label:"key",required:"",onBlur:h[2]||(h[2]=k=>n.validators.key.handleBlur(()=>e.unref(a).property))},null,8,["model-value","error","error-message"])):e.createCommentVNode("",!0)],64)}}}),[["__scopeId","data-v-3e7fee25"]]),EL=e.defineComponent({__name:"NodeFormProperty",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),{selectedNode:r,disconnectInEdges:o,disconnectOutEdges:i}=$t(),a=bn("property"),{formData:s,setName:c,setConfig:l,inputOptions:u,setInputs:p,setInput:d,inputsFieldNames:f,nameValidator:m,toggleNodeValid:h,fieldNameValidator:y}=_n(n.nodeId,()=>t.value.getValue()),b=e.computed(()=>Wd(s.value.property));function _(C){var E;const N=(E=r.value)==null?void 0:E.id;if(!N)throw new Error("Expected selectedNode to be defined");zd(C)||i(N,!1),Wd(C)||o(N,!1),l()}const{fields:k}=Rr({validationConfig:()=>({property:To({fieldName:"Property"}),key:Oa(s.value.property)?To({fieldName:"Key"}):()=>{}}),getValidationData:()=>({property:s.value.property,key:Hd(s.value.property)}),toggleNodeValid:h});return(C,N)=>(e.openBlock(),e.createBlock(Zt,{ref:"form",data:e.unref(s),schema:e.unref(a)},{default:e.withCtx(()=>[e.createVNode(Kn,{name:e.unref(s).name,validate:e.unref(m),onUpdate:e.unref(c)},null,8,["name","validate","onUpdate"]),e.createVNode(Dt,{name:"content_type",onUpdate:N[0]||(N[0]=E=>e.unref(l)())}),e.createVNode(CL,{validators:e.unref(k),"onUpdate:modelValue":_,"onUpdate:propertyKey":N[1]||(N[1]=E=>e.unref(l)("property-key"))},null,8,["validators"]),e.createVNode(hn,{name:"non_nil","onUpdate:modelValue":N[2]||(N[2]=E=>e.unref(l)("non_nil"))}),b.value?(e.openBlock(),e.createBlock(tr,{key:0})):e.createCommentVNode("",!0),b.value?(e.openBlock(),e.createBlock(In,{key:1,"field-name-validator":e.unref(y),"field-names":e.unref(f),items:e.unref(u),"node-type":"property","onChange:input":e.unref(d),"onChange:inputs":e.unref(p)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])):e.createCommentVNode("",!0)]),_:1},8,["data","schema"]))}}),NL=e.defineComponent({__name:"NodeFormExit",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=bn("exit"),{formData:o,setName:i,setConfig:a,inputOptions:s,setInputs:c,setInput:l,inputsFieldNames:u,nameValidator:p,toggleNodeValid:d,fieldNameValidator:f}=_n(n.nodeId,()=>t.value.getValue()),{createFieldHandler:m}=Rr({validationConfig:{status:yn(Vi("integer",{fieldName:"Status"}),$i(200,599,{fieldName:"Status"}))},getValidationData:()=>({status:o.value.status}),toggleNodeValid:d}),h=m("status",()=>a("status"));return(y,b)=>(e.openBlock(),e.createBlock(Zt,{ref:"form",data:e.unref(o),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Kn,{name:e.unref(o).name,validate:e.unref(p),onUpdate:e.unref(i)},null,8,["name","validate","onUpdate"]),e.createVNode(Ht,{error:e.unref(h).error,"error-message":e.unref(h).errorMessage,name:"status",onBlur:e.unref(h).validate,"onUpdate:modelValue":e.unref(h).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(hn,{name:"warn_headers_sent","onUpdate:modelValue":b[0]||(b[0]=_=>e.unref(a)())}),e.createVNode(tr),e.createVNode(In,{"field-name-validator":e.unref(f),"field-names":e.unref(u),items:e.unref(s),"node-type":"exit","onChange:input":e.unref(l),"onChange:inputs":e.unref(c)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}});function SL(n){const t=_n(n),{state:r,getNodeById:o,branchGroups:i,commit:a}=$t(),{i18n:{t:s}}=Qe(),c=r_(),l=Jd(),u=e.computed(()=>{var C;const _={...t.formData.value},k=$a(((C=t.currentNode.value)==null?void 0:C.type)||"branch");for(const N of k)(!(N in _)||_[N]==null)&&(_[N]=[]);return _});function p(_,k,C){const N=o(_),E=o(C),w=N?`${N.name}.${k}`:`${_}.${k}`,S=E?E.name:C;return[w,S]}function d(_){return(_==null?[]:Array.isArray(_)?_:[_]).filter(k=>nf(k))}function f(_,k){return i.wouldCreateCycle(_,k)?(l({message:s("plugins.free-form.datakit.flow_editor.error.branch_cycle"),appearance:"danger"}),!0):!1}function m(_,k,C){const N=[],E=[],w=[];for(const S of C){const I=i.findMembership(S);if(!I||I.ownerId===_&&I.branch===k)continue;const U=i.getMembers(I.ownerId,I.branch).filter(x=>x!==S);w.push({ownerId:I.ownerId,branch:I.branch,members:U}),N.push(p(_,k,S)),E.push(p(I.ownerId,I.branch,S))}return{conflictUpdates:w,addedAssignments:N,removedAssignments:E}}function h(_,k,C,N){let E=!1;for(const w of N)E=i.setMembers(w.ownerId,w.branch,w.members,{commit:!1})||E;return E=i.setMembers(_,k,C,{commit:!1})||E,E}async function y(_,k){const C=t.currentNode.value,N=d(k),E=i.prepareMembers(C.id,_,N),w=i.getMembers(C.id,_);if(rf(w,E))return!0;const S=E.filter(T=>!w.includes(T));for(const T of S)if(f(C.id,T))return!1;const{conflictUpdates:I,addedAssignments:U,removedAssignments:x}=m(C.id,_,S);return I.length>0&&!await c(s("plugins.free-form.datakit.flow_editor.confirm.message.branch_replace"),U,x)?!1:(h(C.id,_,E,I)&&a(),!0)}const b=e.computed(()=>{const _=t.currentNode.value;return!_||!i?[]:r.value.nodes.filter(k=>k.id!==n&&!mn(k.type)&&k.phase===_.phase&&!i.wouldCreateCycle(_.id,k.id)).map(k=>({value:k.id,label:k.name,type:k.type}))});return{...t,formData:u,branchOptions:b,updateBranchMembers:y}}const xL=e.defineComponent({__name:"NodeFormBranch",props:{nodeId:{}},setup(n){const{i18n:{t}}=Qe(),r=bn("branch"),o=e.ref(0),{formData:i,setName:a,inputOptions:s,branchOptions:c,nameValidator:l,setInput:u,setInputs:p,inputsFieldNames:d,fieldNameValidator:f,updateBranchMembers:m}=SL(n.nodeId);async function h(y,b){await m(y,b)||(o.value+=1)}return(y,b)=>(e.openBlock(),e.createBlock(Zt,{key:o.value,data:e.unref(i),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Kn,{name:e.unref(i).name,validate:e.unref(l),onUpdate:e.unref(a)},null,8,["name","validate","onUpdate"]),e.createVNode(e.unref(Fe.KLabel),{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(Dt,{"enable-filtering":"",items:e.unref(c),multiple:"",name:"then",onUpdate:b[0]||(b[0]=_=>h("then",_))},{"item-label":e.withCtx(_=>[e.createVNode(_c,{item:_},null,8,["item"])]),_:1},8,["items"]),e.createVNode(Dt,{"enable-filtering":"",items:e.unref(c),multiple:"",name:"else",onUpdate:b[1]||(b[1]=_=>h("else",_))},{"item-label":e.withCtx(_=>[e.createVNode(_c,{item:_},null,8,["item"])]),_:1},8,["items"]),e.createVNode(tr),e.createVNode(In,{"field-name-validator":e.unref(f),"field-names":e.unref(d),items:e.unref(s),"node-type":"branch","onChange:input":e.unref(u),"onChange:inputs":e.unref(p)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),AL=e.defineComponent({__name:"NodeFormCache",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=bn("cache"),{i18n:{t:o}}=Qe(),{formData:i,setName:a,setConfig:s,inputOptions:c,setInputs:l,setInput:u,inputsFieldNames:p,nameValidator:d,toggleNodeValid:f,fieldNameValidator:m}=_n(n.nodeId,()=>t.value.getValue()),{createFieldHandler:h}=Rr({validationConfig:()=>({ttl:yn(Vi("integer",{fieldName:"TTL"}),$i(1,1/0,{fieldName:"TTL"}))}),getValidationData:()=>({ttl:i.value.ttl}),toggleNodeValid:f}),y=h("ttl",()=>s("ttl"));return(b,_)=>(e.openBlock(),e.createBlock(Zt,{ref:"form",data:e.unref(i),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Kn,{name:e.unref(i).name,validate:e.unref(d),onUpdate:e.unref(a)},null,8,["name","validate","onUpdate"]),e.createVNode(e.unref(Fe.KLabel),{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(hn,{name:"bypass_on_error","onUpdate:modelValue":_[0]||(_[0]=k=>e.unref(s)("bypass_on_error"))}),e.createVNode(Ht,{error:e.unref(y).error,"error-message":e.unref(y).errorMessage,name:"ttl",onBlur:e.unref(y).validate,"onUpdate:modelValue":e.unref(y).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(tr),e.createVNode(In,{"field-name-validator":e.unref(m),"field-names":e.unref(p),items:e.unref(c),"node-type":"cache","onChange:input":e.unref(u),"onChange:inputs":e.unref(l)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),vL=e.defineComponent({__name:"NodeFormXmlToJson",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=bn("xml_to_json"),{i18n:{t:o}}=Qe(),{formData:i,setName:a,setConfig:s,inputOptions:c,setInputs:l,setInput:u,inputsFieldNames:p,nameValidator:d,toggleNodeValid:f,fieldNameValidator:m}=_n(n.nodeId,()=>t.value.getValue()),h=o("plugins.free-form.datakit.flow_editor.node_properties.errors.attributes_required"),y=()=>!!(i.value.attributes_block_name||i.value.attributes_name_prefix),{createFieldHandler:b}=Rr({validationConfig:()=>({attributes_block_name:yn(()=>y()?void 0:h,I=>{if(I)return $r(1,32,{fieldName:"Attributes block name"})(I)}),attributes_name_prefix:yn(()=>y()?void 0:h,I=>{if(I)return $r(1,32,{fieldName:"Attributes name prefix"})(I)}),text_block_name:$r(1,32,{fieldName:"Text block name"}),xpath:$r(1,256,{fieldName:"XPath"})}),getValidationData:()=>({attributes_block_name:i.value.attributes_block_name,attributes_name_prefix:i.value.attributes_name_prefix,text_block_name:i.value.text_block_name,xpath:i.value.xpath}),toggleNodeValid:f}),_=b("attributes_block_name",()=>s("attributes_block_name")),k=b("attributes_name_prefix",()=>s("attributes_name_prefix")),C=b("text_block_name",()=>s("text_block_name")),N=b("xpath",()=>s("xpath")),E=()=>{_.value.validate(),k.value.validate()},w=()=>{_.value.update(),k.value.validate()},S=()=>{k.value.update(),_.value.validate()};return(I,U)=>(e.openBlock(),e.createBlock(Zt,{ref:"form",data:e.unref(i),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Kn,{name:e.unref(i).name,validate:e.unref(d),onUpdate:e.unref(a)},null,8,["name","validate","onUpdate"]),e.createVNode(e.unref(Fe.KLabel),{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(hn,{name:"recognize_type","onUpdate:modelValue":U[0]||(U[0]=x=>e.unref(s)("recognize_type"))}),e.createVNode(Xe,{error:e.unref(_).error,"error-message":e.unref(_).errorMessage,name:"attributes_block_name",onBlur:E,"onUpdate:modelValue":w},null,8,["error","error-message"]),e.createVNode(Xe,{error:e.unref(k).error,"error-message":e.unref(k).errorMessage,name:"attributes_name_prefix",onBlur:E,"onUpdate:modelValue":S},null,8,["error","error-message"]),e.createVNode(Xe,{error:e.unref(C).error,"error-message":e.unref(C).errorMessage,name:"text_block_name",onBlur:e.unref(C).validate,"onUpdate:modelValue":e.unref(C).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(hn,{name:"text_as_property","onUpdate:modelValue":U[1]||(U[1]=x=>e.unref(s)("text_as_property"))}),e.createVNode(Xe,{error:e.unref(N).error,"error-message":e.unref(N).errorMessage,name:"xpath",onBlur:e.unref(N).validate,"onUpdate:modelValue":e.unref(N).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(tr),e.createVNode(In,{"field-name-validator":e.unref(m),"field-names":e.unref(p),items:e.unref(c),"node-type":"xml_to_json","onChange:input":e.unref(u),"onChange:inputs":e.unref(l)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),IL=e.defineComponent({__name:"NodeFormJsonToXml",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=bn("json_to_xml"),{i18n:{t:o}}=Qe(),{formData:i,setName:a,setConfig:s,inputOptions:c,setInputs:l,setInput:u,addField:p,removeFieldByName:d,renameFieldByName:f,inputsFieldNames:m,nameValidator:h,toggleNodeValid:y,fieldNameValidator:b}=_n(n.nodeId,()=>t.value.getValue()),_=o("plugins.free-form.datakit.flow_editor.node_properties.errors.attributes_required"),k=()=>!!(i.value.attributes_block_name||i.value.attributes_name_prefix),{createFieldHandler:C}=Rr({validationConfig:{attributes_block_name:yn(()=>k()?void 0:_,$r(1,32,{fieldName:"Attributes block name"})),attributes_name_prefix:yn(()=>k()?void 0:_,$r(1,32,{fieldName:"Attributes name prefix"})),root_element_name:$r(1,64,{fieldName:"Root element name"}),text_block_name:$r(1,32,{fieldName:"Text block name"})},getValidationData:()=>({attributes_block_name:i.value.attributes_block_name,attributes_name_prefix:i.value.attributes_name_prefix,root_element_name:i.value.root_element_name,text_block_name:i.value.text_block_name}),toggleNodeValid:y}),N=C("attributes_block_name",()=>s("attributes_block_name")),E=C("attributes_name_prefix",()=>s("attributes_name_prefix")),w=C("root_element_name",()=>s("root_element_name")),S=C("text_block_name",()=>s("text_block_name"));function I(){N.value.validate(),E.value.validate()}function U(){N.value.update(),E.value.validate()}function x(){E.value.update(),N.value.validate()}function A(R,X){p("input",R,X)}function T(R){d("input",R)}function V(R,X){f("input",R,X)}return(R,X)=>(e.openBlock(),e.createBlock(Zt,{ref:"form",data:e.unref(i),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Kn,{name:e.unref(i).name,validate:e.unref(h),onUpdate:e.unref(a)},null,8,["name","validate","onUpdate"]),e.createVNode(e.unref(Fe.KLabel),{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(Xe,{error:e.unref(N).error,"error-message":e.unref(N).errorMessage,name:"attributes_block_name",onBlur:I,"onUpdate:modelValue":U},null,8,["error","error-message"]),e.createVNode(Xe,{error:e.unref(E).error,"error-message":e.unref(E).errorMessage,name:"attributes_name_prefix",onBlur:I,"onUpdate:modelValue":x},null,8,["error","error-message"]),e.createVNode(Xe,{error:e.unref(w).error,"error-message":e.unref(w).errorMessage,name:"root_element_name",onBlur:e.unref(w).validate,"onUpdate:modelValue":e.unref(w).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(Xe,{error:e.unref(S).error,"error-message":e.unref(S).errorMessage,name:"text_block_name",onBlur:e.unref(S).validate,"onUpdate:modelValue":e.unref(S).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(tr),e.createVNode(In,{"field-name-validator":e.unref(b),"field-names":e.unref(m),items:e.unref(c),"node-type":"json_to_xml","onAdd:field":A,"onChange:input":e.unref(u),"onChange:inputs":e.unref(l),"onRemove:field":T,"onRename:field":V},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),BL=e.defineComponent({__name:"NodeFormJwtDecode",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=bn("jwt_decode"),{formData:o,setName:i,inputOptions:a,setInputs:s,setInput:c,inputsFieldNames:l,nameValidator:u,fieldNameValidator:p}=_n(n.nodeId,()=>t.value.getValue());return(d,f)=>(e.openBlock(),e.createBlock(Zt,{ref:"form",data:e.unref(o),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Kn,{name:e.unref(o).name,validate:e.unref(u),onUpdate:e.unref(i)},null,8,["name","validate","onUpdate"]),e.createVNode(tr),e.createVNode(In,{"field-name-validator":e.unref(p),"field-names":e.unref(l),items:e.unref(a),"node-type":"jwt_decode","onChange:input":e.unref(c),"onChange:inputs":e.unref(s)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),TL=e.defineComponent({__name:"NodeFormJwtSign",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=bn("jwt_sign"),{i18n:{t:o}}=Qe(),{formData:i,setName:a,setConfig:s,inputOptions:c,setInputs:l,setInput:u,inputsFieldNames:p,nameValidator:d,toggleNodeValid:f,fieldNameValidator:m}=_n(n.nodeId,()=>{const k={...t.value.getValue()};return(!k.static_claims||Object.keys(k.static_claims).length===0)&&delete k.static_claims,k}),{createFieldHandler:h}=Rr({validationConfig:{algorithm:To({fieldName:"Algorithm"}),expires_in:yn(Vi("integer",{fieldName:"Expires in"}),$i(1,1/0,{fieldName:"Expires in"})),not_before:yn(Vi("integer",{fieldName:"Not before"}),$i(0,1/0,{fieldName:"Not before"}))},getValidationData:()=>({algorithm:i.value.algorithm,expires_in:i.value.expires_in,not_before:i.value.not_before}),toggleNodeValid:f}),y=h("algorithm",()=>s("algorithm")),b=h("expires_in",()=>s("expires_in")),_=h("not_before",()=>s("not_before"));return(k,C)=>(e.openBlock(),e.createBlock(Zt,{ref:"form",data:e.unref(i),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Kn,{name:e.unref(i).name,validate:e.unref(d),onUpdate:e.unref(a)},null,8,["name","validate","onUpdate"]),e.createVNode(e.unref(Fe.KLabel),{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(Dt,{"enable-filtering":"",name:"algorithm",onUpdate:e.unref(y).update},null,8,["onUpdate"]),e.createVNode(Ht,{error:e.unref(b).error,"error-message":e.unref(b).errorMessage,name:"expires_in",onBlur:e.unref(b).validate,"onUpdate:modelValue":e.unref(b).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(Ht,{error:e.unref(_).error,"error-message":e.unref(_).errorMessage,name:"not_before",onBlur:e.unref(_).validate,"onUpdate:modelValue":e.unref(_).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(Xe,{name:"kid","onUpdate:modelValue":C[0]||(C[0]=N=>e.unref(s)("kid"))}),e.createVNode(Xe,{name:"typ","onUpdate:modelValue":C[1]||(C[1]=N=>e.unref(s)("typ"))}),e.createVNode(pr,{label:e.unref(o)("plugins.free-form.datakit.flow_editor.node_properties.jwt.static_claims.label"),name:"static_claims",onLegacyValueChange:C[2]||(C[2]=N=>e.unref(s)("static_claims"))},null,8,["label"]),e.createVNode(tr),e.createVNode(In,{"field-name-validator":e.unref(m),"field-names":e.unref(p),items:e.unref(c),"node-type":"jwt_sign","onChange:input":e.unref(u),"onChange:inputs":e.unref(l)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),OL=e.defineComponent({__name:"NodeFormJwtVerify",props:{nodeId:{}},setup(n){const t=e.useTemplateRef("form"),r=bn("jwt_verify"),{i18n:{t:o}}=Qe(),{formData:i,setName:a,setConfig:s,inputOptions:c,setInputs:l,setInput:u,inputsFieldNames:p,nameValidator:d,toggleNodeValid:f,fieldNameValidator:m}=_n(n.nodeId,()=>t.value.getValue()),{createFieldHandler:h}=Rr({validationConfig:{leeway:yn(Vi("integer",{fieldName:"Leeway"}),$i(0,1/0,{fieldName:"Leeway"}))},getValidationData:()=>({leeway:i.value.leeway}),toggleNodeValid:f}),y=h("leeway",()=>s("leeway"));return(b,_)=>(e.openBlock(),e.createBlock(Zt,{ref:"form",data:e.unref(i),schema:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(Kn,{name:e.unref(i).name,validate:e.unref(d),onUpdate:e.unref(a)},null,8,["name","validate","onUpdate"]),e.createVNode(e.unref(Fe.KLabel),{class:"dk-node-configuration-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.datakit.flow_editor.node_properties.configuration")),1)]),_:1}),e.createVNode(Dt,{"enable-filtering":"",multiple:"",name:"allowed_algorithms",onUpdate:_[0]||(_[0]=k=>e.unref(s)("allowed_algorithms"))}),e.createVNode(zt,{name:"issuers",onAdd:_[2]||(_[2]=k=>e.unref(s)("issuers")),onRemove:_[3]||(_[3]=k=>e.unref(s)("issuers"))},{item:e.withCtx(({fieldName:k,autofocus:C})=>[e.createVNode(Xe,{autofocus:C,name:k,"onUpdate:modelValue":_[1]||(_[1]=N=>e.unref(s)("issuers"))},null,8,["autofocus","name"])]),_:1}),e.createVNode(zt,{name:"audiences",onAdd:_[5]||(_[5]=k=>e.unref(s)("audiences")),onRemove:_[6]||(_[6]=k=>e.unref(s)("audiences"))},{item:e.withCtx(({fieldName:k,autofocus:C})=>[e.createVNode(Xe,{autofocus:C,name:k,"onUpdate:modelValue":_[4]||(_[4]=N=>e.unref(s)("audiences"))},null,8,["autofocus","name"])]),_:1}),e.createVNode(zt,{name:"required_claims",onAdd:_[8]||(_[8]=k=>e.unref(s)("required_claims")),onRemove:_[9]||(_[9]=k=>e.unref(s)("required_claims"))},{item:e.withCtx(({fieldName:k,autofocus:C})=>[e.createVNode(Xe,{autofocus:C,name:k,"onUpdate:modelValue":_[7]||(_[7]=N=>e.unref(s)("required_claims"))},null,8,["autofocus","name"])]),_:1}),e.createVNode(Ht,{error:e.unref(y).error,"error-message":e.unref(y).errorMessage,name:"leeway",onBlur:e.unref(y).validate,"onUpdate:modelValue":e.unref(y).update},null,8,["error","error-message","onBlur","onUpdate:modelValue"]),e.createVNode(hn,{name:"validate_exp","onUpdate:modelValue":_[10]||(_[10]=k=>e.unref(s)("validate_exp"))}),e.createVNode(hn,{name:"validate_nbf","onUpdate:modelValue":_[11]||(_[11]=k=>e.unref(s)("validate_nbf"))}),e.createVNode(tr),e.createVNode(In,{"field-name-validator":e.unref(m),"field-names":e.unref(p),items:e.unref(c),"node-type":"jwt_verify","onChange:input":e.unref(u),"onChange:inputs":e.unref(l)},null,8,["field-name-validator","field-names","items","onChange:input","onChange:inputs"])]),_:1},8,["data","schema"]))}}),PL=["innerHTML"],VL={key:1,class:"branch-note"},$L={class:"branch-label"},RL={class:"branch-text"},LL=e.defineComponent({__name:"NodePropertiesPanel",props:{maxWidth:{default:`${th}px`},offsetTop:{default:`${q1}px`},visible:{type:Boolean},nodeId:{}},emits:["close"],setup(n){const{t}=jt.createI18n("en-us",Jt),{getNodeById:r,branchGroups:o}=$t(),i=e.computed(()=>n.nodeId&&r(n.nodeId)),a=e.computed(()=>{if(n.nodeId)return o.findMembership(n.nodeId)}),s=e.computed(()=>{if(!a.value)return"";const u=r(a.value.ownerId);return u?`${u.name}.${a.value.branch}`:""});function c(){n.nodeId&&o.removeMember(n.nodeId)}const l=e.computed(()=>{var u;switch((u=i.value)==null?void 0:u.type){case"call":return dL;case"service_request":return fL;case"response":return pL;case"jq":return mL;case"static":return _L;case"property":return EL;case"exit":return NL;case"branch":return xL;case"cache":return AL;case"xml_to_json":return vL;case"json_to_xml":return IL;case"jwt_decode":return BL;case"jwt_sign":return TL;case"jwt_verify":return OL;default:return null}});return(u,p)=>(e.openBlock(),e.createBlock(e.unref(Fe.KSlideout),{class:"dk-node-properties-panel","close-on-blur":!1,"has-overlay":!1,"max-width":n.maxWidth,"offset-top":n.offsetTop,visible:n.visible,"z-index":e.unref(K1),onClose:p[0]||(p[0]=d=>u.$emit("close"))},e.createSlots({default:e.withCtx(()=>[i.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"dk-node-properties-panel-desc",innerHTML:e.unref(si)(i.value.type)},null,8,PL)):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createElementBlock("div",VL,[e.createElementVNode("span",$L,[e.createVNode(e.unref($e.ArrowSplitIcon),{color:`var(--kui-color-text-neutral, ${e.unref(cr)})`,size:`var(--kui-icon-size-40, ${e.unref(_a)})`},null,8,["color","size"]),e.createElementVNode("span",RL,e.toDisplayString(s.value),1)]),e.createVNode(e.unref(Fe.KTooltip),{placement:"top",text:e.unref(t)("plugins.free-form.datakit.flow_editor.actions.remove_from_branch")},{default:e.withCtx(()=>[e.createVNode(e.unref(Fe.KButton),{appearance:"none","aria-label":e.unref(t)("plugins.free-form.datakit.flow_editor.actions.remove_from_branch"),class:"remove-branch",icon:"",size:"small",onClick:c},{default:e.withCtx(()=>[e.createVNode(e.unref($e.TrashIcon))]),_:1},8,["aria-label"])]),_:1},8,["text"])])):e.createCommentVNode("",!0),l.value?(e.openBlock(),e.createBlock(e.unref(l),{key:n.nodeId,class:"dk-node-properties-panel-form","node-id":n.nodeId},null,8,["node-id"])):e.createCommentVNode("",!0)]),_:2},[i.value?{name:"title",fn:e.withCtx(()=>[e.createVNode(ff,{type:i.value.type},null,8,["type"])]),key:"0"}:void 0]),1032,["max-width","offset-top","visible","z-index"]))}}),DL=je(LL,[["__scopeId","data-v-32602117"]]),ML={class:"dk-editor-content"},jL={class:"main"},FL=je(e.defineComponent({__name:"EditorContent",setup(n){const{propertiesPanelOpen:t,selectedNode:r}=$t();function o(){t.value=!1}e.watch(r,a=>{a||o()});const i=e.ref(!1);return e.onMounted(()=>{i.value=!0}),(a,s)=>{var c;return e.openBlock(),e.createElementBlock("div",ML,[e.createVNode(e.unref(HR)),e.createElementVNode("div",jL,[e.createVNode(nR)]),e.createVNode(DL,{"node-id":(c=e.unref(r))==null?void 0:c.id,visible:e.unref(t),onClose:o},null,8,["node-id","visible"])])}}}),[["__scopeId","data-v-66331c5c"]]),UL={key:0,class:"dk-editor-modal"},KL=je(e.defineComponent({__name:"EditorModal",props:{open:{type:Boolean},openModifiers:{}},emits:["update:open"],setup(n){e.useCssVars(c=>({v0a30a280:`${e.unref(U1)}px`,aee7cc1c:`${e.unref(eh)}px`}));const t=e.useModel(n,"open"),r=e.ref(!1),o=e.useTemplateRef("confirm-modal"),{clear:i}=$t();xB(async(...c)=>{r.value=!0;const l=await o.value.open(...c);return r.value=!1,l});const a=Pt.useScrollLock(document);e.watch(t,c=>{a.value=!!c,c||i()},{immediate:!0});function s(){t.value=!1}return(c,l)=>t.value?(e.openBlock(),e.createElementBlock("div",UL,[e.createVNode(J$,{class:"nav",onBack:s}),e.createVNode(FL,{ref:"content",class:"content",tabindex:"0"},null,512),e.createVNode(H$,{ref:"confirm-modal"},null,512)])):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-82b03578"]]),qL={class:"dk-flow-editor"},GL={class:"flow-panels-container"},HL={class:"overlay"},zL=je(e.defineComponent({__name:"FlowEditor",props:{isEditing:{type:Boolean}},emits:["change","error"],setup(n,{emit:t}){const{t:r}=jt.createI18n("en-us",Jt),{formData:o,setValue:i,getValue:a}=pt(),s=t;function c(p,d,f,m){const h={...o.config,nodes:p};f!==void 0&&(h.resources=f);const y={...o.__ui_data,...d},b={...o,config:h,__ui_data:y};m!=null?b.partials=[{id:m}]:b.partials&&(b.partials=null),i(b),s("change",h,y)}const{modalOpen:l,setPendingFitView:u}=uf(a(),{onChange:c,isEditing:n.isEditing});return e.watch(l,()=>{u(!0)},{flush:"post"}),D$({enabled:l}),(p,d)=>{const f=e.resolveComponent("KButton");return e.openBlock(),e.createElementBlock("div",qL,[e.createElementVNode("div",GL,[e.createVNode(up,{inactive:e.unref(l),mode:"preview"},null,8,["inactive"]),e.createElementVNode("div",HL,[e.createVNode(f,{appearance:"secondary",class:"button-open-editor",onClick:d[0]||(d[0]=m=>l.value=!0)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("plugins.free-form.datakit.flow_editor.cta"))+" ",1),e.createVNode(e.unref($e.ExpandIcon))]),_:1})])]),e.createVNode(KL,{open:e.unref(l),"onUpdate:open":d[1]||(d[1]=m=>e.isRef(l)?l.value=m:null)},null,8,["open"])])}}}),[["__scopeId","data-v-575018ff"]]),WL=["innerHTML"],YL={class:"dk-option-label"},JL=["innerHTML"],XL=Ke({component:je(e.defineComponent({inheritAttrs:!1,__name:"DatakitForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},configSections:{},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const{t}=jt.createI18n("en-us",Jt),r=n,o=e.useAttrs(),i=e.inject(et.FORMS_CONFIG),a=e.ref(!1);e.onMounted(()=>{a.value=!!document.querySelector("#plugin-form-page-actions")});const{editorMode:s}=hc(),c=e.computed(()=>i.app!=="konnect"||p.value===!1?"code":s.value),l=e.computed(()=>i.app==="kongManager"?"code":c.value==="flow"?"form":"code"),u={flow:$e.DesignIcon,code:$e.CodeblockIcon},p=e.ref(!0),d=e.ref(""),f=e.computed(()=>{const E=[{label:t("plugins.free-form.datakit.flow_editor.mode"),value:"flow"},{label:t("plugins.free-form.datakit.code_editor.mode"),value:"code"}];return E[0].disabled=!p.value,E}),m=e.computed(()=>{switch(c.value){case"code":return t("plugins.free-form.datakit.description_code");case"flow":return t("plugins.free-form.datakit.description_flow");default:return""}}),h=e.computed(()=>p.value?"":t("plugins.free-form.datakit.flow_editor.disabled_tooltip",{reason:d.value,code:E=>`<code>${Xv(E)}</code>`}));e.watch(c,()=>{var E;(E=r.onValidityChange)==null||E.call(r,{model:"config",valid:!0})});function y(){var E;(E=r.onValidityChange)==null||E.call(r,{model:"config",valid:!0})}function b(){y()}function _(E){return E.map(w=>typeof w=="number"?`[${w}]`:E.length&&typeof w=="string"&&w.includes(".")?`["${w}"]`:`.${w}`).join("").replace(/^\./,"")}function k(E){return E.issues.map(w=>`${_(w.path)} - ${w.message}`).join("; ")}function C(E){if(y(),i.app!=="konnect")return;const w=E==null?void 0:E.config,{success:S,error:I}=vw.safeParse(w);d.value=S||!I?"":k(I),p.value=S}function N(E){var w;d.value=E,p.value=!1,(w=r.onValidityChange)==null||w.call(r,{model:"config",valid:!1,error:E})}return(E,w)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(i).app==="konnect"?(e.openBlock(),e.createBlock(e.Teleport,{key:0,disabled:!a.value,to:"#plugin-form-page-actions"},[e.createVNode(e.unref(Fe.KSegmentedControl),{"data-testid":"datakit-editor-mode-switcher","model-value":c.value,options:f.value,"onUpdate:modelValue":w[0]||(w[0]=S=>s.value=S)},{"option-label":e.withCtx(({option:S})=>[e.createVNode(e.unref(Fe.KTooltip),{disabled:p.value||S.value!=="flow"},{content:e.withCtx(()=>[e.createElementVNode("div",{innerHTML:h.value},null,8,WL)]),default:e.withCtx(()=>[e.createElementVNode("div",YL,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u[S.value]))),e.createTextVNode(" "+e.toDisplayString(S.label),1)])]),_:2},1032,["disabled"])]),_:1},8,["model-value","options"])],8,["disabled"])):e.createCommentVNode("",!0),e.createVNode(er,e.mergeProps({...e.unref(o),...r},{class:"dk-form","editor-mode":l.value,"hide-editor-mode-switcher":""}),{"code-editor":e.withCtx(()=>[e.createVNode(R$,{class:"code-editor",editing:r.isEditing,onChange:C,onError:N},null,8,["editing"])]),"plugin-config-title":e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("plugins.free-form.datakit.flow_editor.mode")),1)]),"plugin-config-description":e.withCtx(()=>[e.createElementVNode("span",{innerHTML:m.value},null,8,JL)]),default:e.withCtx(()=>[c.value==="flow"?(e.openBlock(),e.createBlock(zL,{key:0,"is-editing":r.isEditing,onChange:b},null,8,["is-editing"])):e.createCommentVNode("",!0)]),_:1},16,["editor-mode"])],64))}}),[["__scopeId","data-v-99d4e7f0"]])}),ZL=Ke({experimental:!0,fieldRenderers:[{match:({genericPath:n})=>n==="config.functions.*",component:Xe,propsOverrides:n=>({...n,multiline:!0,rows:3})}]}),QL=Ke({experimental:!0,fieldRenderers:[{match:"config.custom_fields_by_lua",component:pr,propsOverrides:{appearance:{string:{multiline:!0}}}}]}),eD=Ke({experimental:!0}),tD=Ke({experimental:!0,renderRules:{bundles:[["config.strategy","config.redis"]],dependencies:{"config.redis":["config.strategy","redis"]}}}),nD=Ke({experimental:!0,fieldRenderers:[{match:"config.consumer_by",component:Dt,propsOverrides:{multiple:!0}}]}),rD=Ke({experimental:!0,fieldRenderers:[{match:"config.custom_fields_by_lua",component:pr,propsOverrides:{appearance:{string:{multiline:!0}}}}]}),oD=Ke({experimental:!0}),iD=Ke({experimental:!0}),Pw=e.defineComponent({inheritAttrs:!1,__name:"KeysetField",props:{name:{},scope:{}},setup(n){const t=n,{i18n:{t:r}}=Qe(),o=e.inject(et.FORMS_CONFIG),i=e.computed(()=>(o==null?void 0:o.app)==="konnect"),{formData:a,config:s}=pt();function c(f){const m=`config.${f}`,h=Gl(f);return s.value.transformLabel?s.value.transformLabel(h,m):h}function l(f){if(typeof f!="string"||!f)return!1;try{const m=new URL(f);return(m.protocol==="http:"||m.protocol==="https:")&&!!m.host}catch{return!1}}const u=e.computed(()=>{if(!i.value)return{hasError:!1,message:""};const f=a.config,m=f==null?void 0:f[`${t.scope}_token_signing`],h=f==null?void 0:f[`${t.scope}_token_upstream_header`];if(!m)return{hasError:!1,message:""};if(typeof h!="string"||h==="")return{hasError:!1,message:""};const y=f==null?void 0:f[`${t.scope}_token_keyset`];return l(y)?{hasError:!1,message:""}:{hasError:!0,message:r("plugins.free-form.jwt-signer.keyset_url_required",{signingField:c(`${t.scope}_token_signing`),headerField:c(`${t.scope}_token_upstream_header`)})}}),p=e.computed(()=>u.value.hasError),d=e.computed(()=>u.value.message);return(f,m)=>(e.openBlock(),e.createBlock(Xe,e.mergeProps(f.$attrs,{error:p.value,"error-message":d.value,name:n.name}),null,16,["error","error-message","name"]))}}),aD=Ke({component:e.defineComponent({__name:"JwtSignerForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},configSections:{},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const t=n,r={bundles:[["config.access_token_signing","config.access_token_upstream_header","config.access_token_keyset"],["config.channel_token_signing","config.channel_token_upstream_header","config.channel_token_keyset"]]},o=e.useSlots();return e.provide(et.AUTOFILL_SLOT,o==null?void 0:o[et.AUTOFILL_SLOT_NAME]),(i,a)=>(e.openBlock(),e.createBlock(er,e.mergeProps(t,{"render-rules":r}),{"field-renderers":e.withCtx(()=>[e.createVNode(Rt,{match:({path:s})=>s==="config.access_token_keyset"},{default:e.withCtx(s=>[e.createVNode(Pw,e.mergeProps(s,{scope:"access"}),null,16)]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:s})=>s==="config.channel_token_keyset"},{default:e.withCtx(s=>[e.createVNode(Pw,e.mergeProps(s,{scope:"channel"}),null,16)]),_:1},8,["match"])]),default:e.withCtx(()=>[e.createVNode(iw)]),_:1},16))}})}),sD=Ke({experimental:!0}),lD=Ke({experimental:!0,fieldRenderers:[{match:({genericPath:n})=>n==="config.message_by_lua_functions.*",component:Xe,propsOverrides:{multiline:!0,rows:3}}]}),cD=Ke({experimental:!0,fieldRenderers:[{match:"config.custom_fields_by_lua",component:pr,propsOverrides:{appearance:{string:{multiline:!0}}}}]}),uD=Ke({experimental:!0,fieldRenderers:[{match:({genericPath:n})=>n==="config.message_by_lua_functions.*",component:Xe,propsOverrides:{multiline:!0,rows:3}}]}),dD=Ke({experimental:!0,component:dw,fieldRenderers:[{match:({path:n})=>n==="config.identity_realms",component:cw},{match:"config.anonymous",component:Xe,propsOverrides:{placeholder:"e.g., 00000000-0000-0000-0000-000000000001"}},{match:"config.realm",component:Xe,propsOverrides:{placeholder:"e.g., my-api"}}]}),fD={class:"ff-collapsible-section"},pD={class:"ff-collapsible-section-header"},mD={class:"ff-collapsible-section-header-toggle"},gD={key:0,class:"ff-collapsible-section-content"},hD={key:0,class:"ff-collapsible-section-indent-guide"},mp=je(e.defineComponent({__name:"CollapsibleSection",props:e.mergeModels({label:{}},{expanded:{type:Boolean,default:!0},expandedModifiers:{}}),emits:["update:expanded"],setup(n){const t=e.useModel(n,"expanded");return(r,o)=>(e.openBlock(),e.createElementBlock("div",fD,[e.createElementVNode("header",pD,[e.createElementVNode("div",mD,[e.createElementVNode("button",{class:"ff-collapsible-section-toggle-btn",type:"button",onClick:o[0]||(o[0]=e.withModifiers(i=>t.value=!t.value,["prevent","stop"]))},[e.createVNode(e.unref($e.ChevronRightIcon),{class:e.normalizeClass(["ff-collapsible-section-toggle-btn-trigger-icon",{"collapse-expanded":t.value}]),decorative:"",size:`var(--kui-icon-size-30, ${e.unref(Yn)})`},null,8,["class","size"])]),e.createVNode(e.unref(Fe.KLabel),{class:"ff-collapsible-section-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.label),1)]),_:1})])]),e.createVNode(zl,null,{default:e.withCtx(()=>[t.value?(e.openBlock(),e.createElementBlock("div",gD,[e.renderSlot(r.$slots,"default",{},void 0,!0)])):e.createCommentVNode("",!0)]),_:3}),t.value?(e.openBlock(),e.createElementBlock("div",hD)):e.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-39f2a44b"]]),yD={class:"ff-mb-subject"},_D={class:"ff-mb-attributes"},bD={class:"ff-metering-billing-inline-row"},wD={class:"ff-mb-queue"},kD=Ke({experimental:!0,component:je(e.defineComponent({__name:"MeteringAndBillingForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},configSections:{},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const t=n,r=e.useSlots();e.provide(et.AUTOFILL_SLOT,r==null?void 0:r[et.AUTOFILL_SLOT_NAME]);const{i18n:{t:o}}=Qe(),i=e.inject(et.FORMS_CONFIG),a=e.computed(()=>{const p=i==null?void 0:i.geoApiServerUrl,d=p?new URL(p).hostname.split(".")[0]:null;return d?`https://${d}.api.konghq.com/v3/openmeter/events`:"https://{{region}}.api.konghq.com/v3/openmeter/events"}),s={hasValue:p=>!!p&&Object.keys(p).length>0,prepareFormData:p=>{var d;return t.isEditing?p:(i==null?void 0:i.app)==="konnect"&&!((d=p==null?void 0:p.config)!=null&&d.ingest_endpoint)?{...p,config:{...p==null?void 0:p.config,ingest_endpoint:a.value}}:p}},c=e.ref(!0),l=e.ref(!0),u=e.ref(!0);return(p,d)=>(e.openBlock(),e.createBlock(er,e.mergeProps(t,{"form-config":s,"plugin-config-description":e.unref(o)("plugins.free-form.metering-and-billing.sections.plugin_config.description")}),{"field-renderers":e.withCtx(()=>[e.createVNode(Rt,{match:({path:f})=>f==="config.meter_api_requests"},{default:e.withCtx(f=>[e.createVNode(hn,e.mergeProps(f,{description:e.unref(o)("plugins.free-form.metering-and-billing.fields.meter_api_requests.description")}),null,16,["description"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:f})=>f==="config.meter_ai_token_usage"},{default:e.withCtx(f=>[e.createVNode(hn,e.mergeProps(f,{description:e.unref(o)("plugins.free-form.metering-and-billing.fields.meter_ai_token_usage.description")}),null,16,["description"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:f})=>f==="config.ssl_verify"},{default:e.withCtx(f=>[e.createVNode(hn,e.mergeProps(f,{description:e.unref(o)("plugins.free-form.metering-and-billing.fields.ssl_verify.description"),label:e.unref(o)("plugins.free-form.metering-and-billing.fields.ssl_verify.label")}),null,16,["description","label"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:f})=>f==="config.subject.look_up_value_in"},{default:e.withCtx(f=>[e.createVNode(Dt,e.mergeProps(f,{help:e.unref(o)("plugins.free-form.metering-and-billing.fields.look_up_value_in.help"),label:e.unref(o)("plugins.free-form.metering-and-billing.fields.look_up_value_in.label")}),null,16,["help","label"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:f})=>f==="config.subject.field"},{default:e.withCtx(f=>[e.createVNode(Xe,e.mergeProps(f,{help:e.unref(o)("plugins.free-form.metering-and-billing.fields.subject_field.help"),label:e.unref(o)("plugins.free-form.metering-and-billing.fields.subject_field.label"),placeholder:e.unref(o)("plugins.free-form.metering-and-billing.fields.subject_field.placeholder")}),null,16,["help","label","placeholder"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:f})=>f==="config.timeout"},{default:e.withCtx(f=>[e.createVNode(Ht,e.mergeProps(f,{label:e.unref(o)("plugins.free-form.metering-and-billing.fields.timeout.label")}),null,16,["label"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:f})=>f==="config.keepalive"},{default:e.withCtx(f=>[e.createVNode(Ht,e.mergeProps(f,{label:e.unref(o)("plugins.free-form.metering-and-billing.fields.keepalive.label")}),null,16,["label"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:f})=>f==="config.queue.max_coalescing_delay"},{default:e.withCtx(f=>[e.createVNode(Ht,e.mergeProps(f,{label:e.unref(o)("plugins.free-form.metering-and-billing.fields.queue.max_coalescing_delay.label")}),null,16,["label"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:f})=>f==="config.queue.initial_retry_delay"},{default:e.withCtx(f=>[e.createVNode(Ht,e.mergeProps(f,{label:e.unref(o)("plugins.free-form.metering-and-billing.fields.queue.initial_retry_delay.label")}),null,16,["label"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:f})=>f==="config.queue.max_retry_delay"},{default:e.withCtx(f=>[e.createVNode(Ht,e.mergeProps(f,{label:e.unref(o)("plugins.free-form.metering-and-billing.fields.queue.max_retry_delay.label")}),null,16,["label"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:f})=>f==="config.queue.max_retry_time"},{default:e.withCtx(f=>[e.createVNode(Ht,e.mergeProps(f,{label:e.unref(o)("plugins.free-form.metering-and-billing.fields.queue.max_retry_time.label")}),null,16,["label"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:f})=>f.startsWith("config.attributes.")&&f.endsWith(".look_up_value_in")},{default:e.withCtx(f=>[e.createVNode(Xe,e.mergeProps(f,{placeholder:e.unref(o)("plugins.free-form.metering-and-billing.fields.attributes.look_up_value_in.placeholder")}),null,16,["placeholder"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:f})=>f.startsWith("config.attributes.")&&f.endsWith(".event_property_name")},{default:e.withCtx(f=>[e.createVNode(Xe,e.mergeProps(f,{placeholder:e.unref(o)("plugins.free-form.metering-and-billing.fields.attributes.event_property_name.placeholder")}),null,16,["placeholder"])]),_:1},8,["match"])]),default:e.withCtx(()=>[e.createVNode(mp,{expanded:c.value,"onUpdate:expanded":d[0]||(d[0]=f=>c.value=f),label:e.unref(o)("plugins.free-form.metering-and-billing.sections.metering.title")},{default:e.withCtx(()=>[e.createVNode(it,{name:"config.meter_api_requests"}),e.createVNode(it,{name:"config.meter_ai_token_usage"})]),_:1},8,["expanded","label"]),e.createElementVNode("div",yD,[e.createVNode(Ut,{label:e.unref(o)("plugins.free-form.metering-and-billing.sections.subject.title"),name:"config.subject","render-rules":{dependencies:{field:["look_up_value_in",["query","header"]]}},"reset-label-path":"reset"},null,8,["label"])]),e.createVNode(mp,{expanded:l.value,"onUpdate:expanded":d[1]||(d[1]=f=>l.value=f),label:e.unref(o)("plugins.free-form.metering-and-billing.fields.attributes.title")},{default:e.withCtx(()=>[e.createElementVNode("div",_D,[e.createVNode(zt,{"hide-label":"",name:"config.attributes"})])]),_:1},8,["expanded","label"]),e.createVNode(mp,{expanded:u.value,"onUpdate:expanded":d[2]||(d[2]=f=>u.value=f),label:e.unref(o)("plugins.free-form.metering-and-billing.sections.ingestion.title")},{default:e.withCtx(()=>[e.createVNode(Xe,{help:e.unref(o)("plugins.free-form.metering-and-billing.fields.ingest_endpoint.help"),name:"config.ingest_endpoint"},null,8,["help"]),e.createVNode(it,{name:"config.api_token"}),e.createVNode(it,{name:"config.ssl_verify"}),e.createElementVNode("div",bD,[e.createVNode(it,{name:"config.timeout"}),e.createVNode(it,{name:"config.keepalive"})])]),_:1},8,["expanded","label"]),e.createVNode(ts,{class:"ff-advanced-fields-container","data-testid":"ff-advanced-fields-container","hide-general-fields":""},{default:e.withCtx(()=>[e.createElementVNode("div",wD,[e.createVNode(e.unref(Fe.KLabel),{class:"ff-mb-queue-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.free-form.metering-and-billing.sections.queue.title")),1)]),_:1}),e.createVNode(Ut,{"as-child":"",name:"config.queue","reset-label-path":"reset"})])]),_:1})]),_:1},16,["plugin-config-description"]))}}),[["__scopeId","data-v-78972733"]])}),CD=Ke({experimental:!0,fieldRenderers:[{match:"config.api_specification",component:Xe,propsOverrides:{multiline:!0,rows:15}}]}),ED=Ke({experimental:!0,fieldRenderers:[{match:"config.consumer_by",component:Dt,propsOverrides:{multiple:!0}}]}),ND=Ke({experimental:!0,fieldRenderers:[{match:"config.api_spec",component:Xe,propsOverrides:{multiline:!0,rows:15}}]}),SD=Ke({experimental:!0}),xD=Ke({experimental:!0,fieldRenderers:[{match:"config.access_logs.custom_attributes_by_lua",component:pr,propsOverrides:{appearance:{string:{multiline:!0}}}}]}),AD=Ke({experimental:!0,fieldRenderers:[{match:({genericPath:n})=>["config.access.*","config.body_filter.*","config.header_filter.*","config.certificate.*","config.functions.*","config.log.*","config.rewrite.*","config.ws_handshake.*","config.ws_client_frame.*","config.ws_upstream_frame.*","config.ws_close.*"].includes(n),component:Xe,propsOverrides:{multiline:!0,rows:3}}]}),vD=Ke({experimental:!0,fieldRenderers:[{match:({genericPath:n})=>["config.access.*","config.body_filter.*","config.header_filter.*","config.certificate.*","config.functions.*","config.log.*","config.rewrite.*","config.ws_handshake.*","config.ws_client_frame.*","config.ws_upstream_frame.*","config.ws_close.*"].includes(n),component:Xe,propsOverrides:{multiline:!0,rows:3}}]}),ID=Ke({experimental:!0}),BD=Ke({experimental:!0,renderRules:{bundles:[["config.strategy","config.redis"]],dependencies:{"config.redis":["config.strategy","redis"]}},fieldRenderers:[{match:({path:n})=>n==="config.methods"||n==="config.request_method",component:Dt,propsOverrides:{multiple:!0}}]}),TD=Ke({experimental:!0,fieldRenderers:[{match:({path:n})=>n==="config.methods"||n==="config.request_method",component:Dt,propsOverrides:{multiple:!0}}]}),OD={class:"rla-form-request-limits-subtitle"},PD={class:"rla-form-request-limits-content"},VD={class:"rla-form-window-type"},$D={class:"rla-form-request-limits-items"},RD={class:"rla-form-request-limits-row"},LD=["id"],DD={class:"rla-form-request-limits-actions"},MD={key:0,class:"rla-form-request-limits-examples"},jD={class:"rla-form-request-limits-examples-badges"},gp="config.window_type",FD=je(e.defineComponent({__name:"RequestLimitsForm",setup(n){var b;const{i18n:{t}}=Qe(),{formData:r,getSelectItems:o,getSchema:i}=pt(),a=e.computed(()=>{var k,C;const _=(C=(k=r.config)==null?void 0:k.limit)==null?void 0:C.map((N,E)=>{var w,S;return{limit:N,windowSize:(S=(w=r.config)==null?void 0:w.window_size)==null?void 0:S[E]}});return!Array.isArray(_)||_.length===0?[{limit:null,windowSize:null}]:_}),{getKey:s}=ql("request-limits",a),c=_=>{var k,C;f.value=void 0,r.config&&((k=r.config.limit)!=null&&k.length||(r.config.limit=[null]),(C=r.config.window_size)!=null&&C.length||(r.config.window_size=[null]),r.config.limit.splice(_+1,0,null),r.config.window_size.splice(_+1,0,null))},l=_=>{r.config&&(r.config.limit.splice(_,1),r.config.window_size.splice(_,1))},u=(b=i(gp))==null?void 0:b.default,p=e.computed(()=>Aa(r,gp)),d=e.computed(()=>o(gp).sort((_,k)=>_.value===u?-1:k.value===u?1:0)),f=e.ref(),m={fixed:[{label:t("sp.use_cases.fixed.hourly_500.label"),description:t("sp.use_cases.fixed.hourly_500.description"),config:{limit:500,window_size:3600}},{label:t("sp.use_cases.fixed.half_hourly_200.label"),description:t("sp.use_cases.fixed.half_hourly_200.description"),config:{limit:200,window_size:1800}},{label:t("sp.use_cases.fixed.daily_500.label"),description:t("sp.use_cases.fixed.daily_500.description"),config:{limit:500,window_size:86400}}],sliding:[{label:t("sp.use_cases.sliding.hourly_100.label"),description:t("sp.use_cases.sliding.hourly_100.description"),config:{limit:100,window_size:3600}},{label:t("sp.use_cases.sliding.half_hourly_300.label"),description:t("sp.use_cases.sliding.half_hourly_300.description"),config:{limit:300,window_size:1800}},{label:t("sp.use_cases.sliding.hourly_500.label"),description:t("sp.use_cases.sliding.hourly_500.description"),config:{limit:500,window_size:3600}}]},h=e.computed(()=>Object.prototype.hasOwnProperty.call(m,p.value)?m[p.value]:[]),y=(_,k)=>{if(k===f.value){e.nextTick(()=>{f.value=void 0}),r.config.limit=[],r.config.window_size=[];return}e.nextTick(()=>{f.value=k}),r.config.limit=[_.config.limit],r.config.window_size=[_.config.window_size]};return(_,k)=>{const C=e.resolveComponent("KLabel"),N=e.resolveComponent("KButton"),E=e.resolveComponent("KBadge"),w=e.resolveComponent("KTooltip"),S=e.resolveComponent("KCard");return e.openBlock(),e.createBlock(S,{class:"rla-form-request-limits"},{title:e.withCtx(()=>[e.createVNode(C,{class:"rla-form-request-limits-title",for:"rla-form-request-limits-legend",required:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("sp.request_limits.title")),1)]),_:1}),e.createElementVNode("div",OD,e.toDisplayString(e.unref(t)("sp.request_limits.subtitle")),1)]),default:e.withCtx(()=>[e.createElementVNode("div",PD,[e.createElementVNode("div",VD,[e.createVNode(dp,{items:d.value,label:e.unref(t)("sp.window_type.label"),name:"window_type","onUpdate:modelValue":k[0]||(k[0]=I=>f.value=void 0)},null,8,["items","label"])]),e.createElementVNode("div",$D,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(I,U)=>(e.openBlock(),e.createElementBlock("div",{key:e.unref(s)(I,U)},[e.createVNode(C,{for:`rla-form-request-limits-item-${U}-legend`},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("sp.request_limits.label_index",{index:U+1})),1)]),_:2},1032,["for"]),e.createElementVNode("div",RD,[e.createElementVNode("legend",{id:`rla-form-request-limits-item-${U}-legend`,class:"rla-form-request-limits-inputs"},[e.createVNode(Ht,{name:`$.config.limit.${U}`,placeholder:e.unref(t)("sp.request_limits.request_number")},null,8,["name","placeholder"]),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.interval_determiner")),1),e.createVNode(Ht,{name:`$.config.window_size.${U}`,placeholder:e.unref(t)("sp.request_limits.time_interval")},null,8,["name","placeholder"]),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.seconds")),1)],8,LD),e.createElementVNode("div",DD,[e.createVNode(N,{appearance:"tertiary",disabled:a.value.length<=1,onClick:()=>l(U)},{default:e.withCtx(()=>[e.createVNode(e.unref($e.RemoveIcon))]),_:1},8,["disabled","onClick"]),e.createVNode(N,{appearance:"tertiary",onClick:()=>c(U)},{default:e.withCtx(()=>[e.createVNode(e.unref($e.AddIcon))]),_:1},8,["onClick"])])])]))),128))]),h.value.length>0?(e.openBlock(),e.createElementBlock("div",MD,[e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.start_with_a_use_case")),1),e.createElementVNode("div",jD,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(I,U)=>(e.openBlock(),e.createBlock(w,{key:`use-case-${U}`,"max-width":"300"},{content:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(I.description),1),k[1]||(k[1]=e.createElementVNode("br",null,null,-1)),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.label"))+": "+e.toDisplayString(I.config.limit),1),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.time_interval"))+": "+e.toDisplayString(I.config.window_size),1)]),default:e.withCtx(()=>[e.createVNode(E,{appearance:f.value===`${p.value}-${U}`?"info":"decorative",class:"rla-form-request-limits-examples-badge",onClick:()=>y(I,`${p.value}-${U}`)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(I.label),1)]),_:2},1032,["appearance","onClick"])]),_:2},1024))),128))])])):e.createCommentVNode("",!0)])]),_:1})}}}),[["__scopeId","data-v-1fac872b"]]),UD={id:"rla-form-error-legend",class:"rla-form-error-inputs"},KD=je(e.defineComponent({__name:"ErrorMessageForm",setup(n){const{i18n:{t}}=Qe();return(r,o)=>{const i=e.resolveComponent("KLabel");return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(i,{for:"rla-form-error-legend",info:e.unref(t)("sp.error_message.help"),required:"","tooltip-attributes":{maxWidth:"300",placement:"top"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("sp.error_message.label")),1)]),_:1},8,["info"]),e.createElementVNode("legend",UD,[e.createVNode(Ht,{class:"input-error-code",label:"",name:"error_code",placeholder:e.unref(t)("sp.error_message.code_placeholder")},null,8,["placeholder"]),o[0]||(o[0]=e.createElementVNode("div",null,":",-1)),e.createVNode(Xe,{class:"input-error-message",label:"",name:"error_message",placeholder:e.unref(t)("sp.error_message.message_placeholder")},null,8,["placeholder"])])])}}}),[["__scopeId","data-v-7b36f1f7"]]),qD=e.defineComponent({__name:"RedisField",setup(n){const{formData:t}=pt(),r=e.inject(et.FORMS_CONFIG),o=e.inject(Pi),i=(o==null?void 0:o.isEditing)||!1,a=e.computed(()=>{if((r==null?void 0:r.app)!=="konnect")return!1;const s=r;return!!s.isKonnectManagedRedisEnabled&&s.isCloudGateway===!0});return e.watchEffect(()=>{t.config&&t.config.strategy!=="redis"&&(t.partials=i?null:void 0)}),(s,c)=>(e.openBlock(),e.createBlock(zl,null,{default:e.withCtx(()=>{var l;return[((l=e.unref(t).config)==null?void 0:l.strategy)==="redis"?(e.openBlock(),e.createBlock(ap,{key:0,"is-konnect-managed-redis-enabled":a.value},null,8,["is-konnect-managed-redis-enabled"])):e.createCommentVNode("",!0)]}),_:1}))}}),GD=e.defineComponent({__name:"ConfigForm",setup(n){const{getSchema:t}=pt();return(r,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(Ut,{"as-child":"",name:"config","reset-label-path":"reset"},{default:e.withCtx(()=>[e.createVNode(it,{name:"identifier"}),e.createVNode(FD),e.createVNode(KD)]),_:1}),e.createVNode(ts,{"hide-general-fields":""},{default:e.withCtx(()=>[e.createVNode(Dt,{multiple:!0,name:"config.compound_identifier"}),e.unref(t)("config.counter_key")?(e.openBlock(),e.createBlock(it,{key:0,name:"config.counter_key"})):e.createCommentVNode("",!0),e.createVNode(it,{name:"config.sync_rate"}),e.createVNode(it,{name:"config.namespace"}),e.createVNode(it,{name:"config.strategy"}),e.createVNode(qD),e.createVNode(it,{name:"config.dictionary_name"}),e.createVNode(it,{name:"config.lock_dictionary_name"}),e.createVNode(it,{name:"config.hide_client_headers"}),e.createVNode(it,{name:"config.retry_after_jitter_max"}),e.createVNode(it,{name:"config.header_name"}),e.createVNode(it,{name:"config.path"}),e.createVNode(it,{name:"config.throttling"}),e.createVNode(it,{name:"config.enforce_consumer_groups"}),e.createVNode(it,{name:"config.consumer_groups"}),e.createVNode(it,{name:"config.disable_penalty"})]),_:1})],64))}}),HD=Ke({experimental:!0,component:e.defineComponent({__name:"RateLimitingAdvancedForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},configSections:{},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const t=n,r=e.useSlots();e.provide(et.AUTOFILL_SLOT,r==null?void 0:r[et.AUTOFILL_SLOT_NAME]);function o(i,a){var s;((s=i.config)==null?void 0:s.namespace)===null&&delete i.config.namespace,t.onFormChange(i,a)}return(i,a)=>(e.openBlock(),e.createBlock(er,e.mergeProps(t,{"on-form-change":o}),{default:e.withCtx(()=>[e.createVNode(GD)]),_:1},16))}})}),zD=Ke({experimental:!0,renderRules:{bundles:[["config.policy","config.redis"]],dependencies:{"config.redis":["config.policy","redis"]}}}),WD=Ke({experimental:!0}),YD="__request_callout_";function Vw(){return Nl(YD)}const rs="_callout_id",JD=e.defineComponent({__name:"CalloutForm",props:{index:{},fieldName:{}},setup(n){const t=n,{formData:r}=pt(),o=e.computed(()=>{const{callouts:s}=r.config;return s==null?[]:s.filter(({name:c})=>{var l;return c&&c!==((l=s[t.index])==null?void 0:l.name)})}),i=e.computed(()=>o.value.map(({[rs]:s,name:c})=>({value:s,label:c}))),a=e.computed(()=>r.config.callouts[t.index]);return e.watch(i,()=>{a.value.depends_on=a.value.depends_on.filter(s=>i.value.some(c=>c.value===s))}),(s,c)=>(e.openBlock(),e.createBlock(Ut,{name:n.fieldName},{depends_on:e.withCtx(l=>[e.createVNode(Dt,e.mergeProps(l,{items:i.value,multiple:"",required:!1}),null,16,["items"])]),request:e.withCtx(l=>[e.createVNode(Ut,e.mergeProps(l,{"fields-order":["url","method","headers","query","body","http_opts","error","by_lua"]}),{method:e.withCtx(u=>[e.createVNode(Dt,e.mergeProps(u,{items:e.unref(gf)(["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS","CONNECT","TRACE"])}),null,16,["items"])]),_:1},16)]),_:1},8,["name"]))}}),XD=e.defineComponent({__name:"CalloutsForm",setup(n){const{formData:t}=pt();function r(){const o=t.config.callouts[t.config.callouts.length-1];o&&(o[rs]=Vw())}return(o,i)=>(e.openBlock(),e.createBlock(zt,{appearance:"tabs","item-label":a=>a.name||"New callout",name:"callouts",required:"","sticky-tabs":"",onAdd:r},{item:e.withCtx(({index:a,fieldName:s})=>[e.createVNode(JD,{"field-name":s,index:a},null,8,["field-name","index"])]),_:1},8,["item-label"]))}}),ZD=e.defineComponent({__name:"ConfigForm",setup(n){return(t,r)=>(e.openBlock(),e.createBlock(Ut,{"as-child":"",name:"config","reset-label-path":"reset"},{default:e.withCtx(()=>[e.createVNode(XD),e.createVNode(Ut,{appearance:"card","fields-order":["headers","query","body","by_lua"],name:"upstream"}),e.createVNode(Ut,{appearance:"card",name:"cache"},{redis:e.withCtx(o=>[e.createVNode(Ut,e.mergeProps(o,{"fields-order":["host","port","connection_is_proxied","database","username","password","sentinel_master","sentinel_role","sentinel_nodes","sentinel_username","sentinel_password","cluster_nodes","cluster_max_redirections","ssl","ssl_verify","server_name","keepalive_backlog","keepalive_pool_size","read_timeout","send_timeout","connect_timeout"]}),null,16)]),_:2},1024)]),_:1}))}}),QD=Ke({component:je(e.defineComponent({__name:"RequestCalloutForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},configSections:{},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const t=n,r=e.useSlots();e.provide(et.AUTOFILL_SLOT,r==null?void 0:r[et.AUTOFILL_SLOT_NAME]);const{i18n:{t:o}}=Qe();function i(l,u=!1){return l.reduce((p,{[rs]:d,name:f})=>(u?p[f]=d:p[d]=f,p),{})}function a(l){var p;const u=Ia(l);if((p=u.config)!=null&&p.callouts){const{callouts:d}=u.config;d.forEach(m=>{m.request.body.custom=m.request.body.custom??{},m[rs]=Vw()});const f=i(d,!0);d.forEach(m=>{m.depends_on=m.depends_on.map(h=>f[h])})}return u}const s={hasValue:l=>!!l&&Object.keys(l).length>0,prepareFormData:a};function c(l,u){var f;if(!l)return;const p=Ia(l);if(!((f=p.config)!=null&&f.callouts)){t.onFormChange(p,u);return}const d=i(p.config.callouts);p.config.callouts=p.config.callouts.map(m=>{const{[rs]:h,depends_on:y,...b}=m;return{depends_on:y.map(_=>d[_]).filter(_=>_!=null),...b}}),t.onFormChange(p,u)}return(l,u)=>(e.openBlock(),e.createBlock(er,e.mergeProps(t,{"form-config":s,"on-form-change":c}),{"field-renderers":e.withCtx(()=>[e.createVNode(Rt,{match:({path:p})=>p.endsWith("by_lua")},{default:e.withCtx(p=>[e.createVNode(Xe,e.mergeProps(p,{autosize:"",class:"rc-code",multiline:"",placeholder:e.unref(o)("plugins.free-form.request-callout.by_lua_placeholder")}),null,16,["placeholder"])]),_:1},8,["match"]),e.createVNode(Rt,{match:({path:p})=>["cluster_nodes","sentinel_nodes"].some(d=>p.endsWith(d))},{default:e.withCtx(p=>[e.createVNode(zt,e.mergeProps(p,{appearance:"card"}),null,16)]),_:1},8,["match"])]),default:e.withCtx(()=>[e.createVNode(ZD)]),_:1},16))}}),[["__scopeId","data-v-dc955662"]])}),eM=Ke({experimental:!0}),tM=Ke({experimental:!0}),nM=Ke({experimental:!0}),rM=Ke({experimental:!0}),oM=Ke({experimental:!0,fieldRenderers:[{match:"config.parameter_schema",component:zt,propsOverrides:{appearance:"tabs",itemLabel:(n,t)=>`#${t+1} Parameter schema`}},{match:"config.body_schema",component:Xe,propsOverrides:{multiline:!0,rows:4}},{match:"config.parameter_schema.*.schema",component:Xe,propsOverrides:{multiline:!0,rows:4}}]}),iM=Ke({experimental:!0,renderRules:{bundles:[["config.policy","config.redis"]],dependencies:{"config.redis":["config.policy","redis"]}}}),aM=Ke({experimental:!0,fieldRenderers:[{match:({path:n,genericPath:t})=>n==="config.replace.body"||t==="config.transform.functions.*"||t.endsWith(".json.*"),component:Xe,propsOverrides:{multiline:!0,rows:3}}]}),sM=Ke({experimental:!0,fieldRenderers:[{match:({genericPath:n})=>n.endsWith(".json.*"),component:Xe,propsOverrides:{multiline:!0,rows:3}}]}),lM=Ke({experimental:!0,fieldRenderers:[{match:"config.rules",component:zt,propsOverrides:{appearance:"tabs",itemLabel:(n,t)=>`#${t+1} Rule`}}]}),cM=Ke({experimental:!0}),uM={class:"sp-form-request-limits-subtitle"},dM={class:"sp-form-request-limits-content"},fM={class:"sp-form-window-type"},pM={class:"sp-form-request-limits-items"},mM={class:"sp-form-request-limits-row"},gM=["id"],hM={class:"sp-form-request-limits-actions"},yM={key:0,class:"sp-form-request-limits-examples"},_M={class:"sp-form-request-limits-examples-badges"},hp="config.window_type",bM=je(e.defineComponent({__name:"RequestLimitsForm",setup(n){var b;const{t}=jt.createI18n("en-us",Jt),{formData:r,getSelectItems:o,getSchema:i}=pt(),a=e.computed(()=>{var k,C;const _=(C=(k=r.config)==null?void 0:k.limit)==null?void 0:C.map((N,E)=>{var w,S;return{limit:N,windowSize:(S=(w=r.config)==null?void 0:w.window_size)==null?void 0:S[E]}});return!Array.isArray(_)||_.length===0?[{limit:null,windowSize:null}]:_}),{getKey:s}=ql("request-limits",a),c=_=>{var k,C;f.value=void 0,r.config&&((k=r.config.limit)!=null&&k.length||(r.config.limit=[null]),(C=r.config.window_size)!=null&&C.length||(r.config.window_size=[null]),r.config.limit.splice(_+1,0,null),r.config.window_size.splice(_+1,0,null))},l=_=>{r.config&&(r.config.limit.splice(_,1),r.config.window_size.splice(_,1))},u=(b=i(hp))==null?void 0:b.default,p=e.computed(()=>Aa(r,hp)),d=e.computed(()=>o(hp).sort((_,k)=>_.value===u?-1:k.value===u?1:0)),f=e.ref(),m={fixed:[{label:t("sp.use_cases.fixed.hourly_500.label"),description:t("sp.use_cases.fixed.hourly_500.description"),config:{limit:500,window_size:3600}},{label:t("sp.use_cases.fixed.half_hourly_200.label"),description:t("sp.use_cases.fixed.half_hourly_200.description"),config:{limit:200,window_size:1800}},{label:t("sp.use_cases.fixed.daily_500.label"),description:t("sp.use_cases.fixed.daily_500.description"),config:{limit:500,window_size:86400}}],sliding:[{label:t("sp.use_cases.sliding.hourly_100.label"),description:t("sp.use_cases.sliding.hourly_100.description"),config:{limit:100,window_size:3600}},{label:t("sp.use_cases.sliding.half_hourly_300.label"),description:t("sp.use_cases.sliding.half_hourly_300.description"),config:{limit:300,window_size:1800}},{label:t("sp.use_cases.sliding.hourly_500.label"),description:t("sp.use_cases.sliding.hourly_500.description"),config:{limit:500,window_size:3600}}]},h=e.computed(()=>Object.prototype.hasOwnProperty.call(m,p.value)?m[p.value]:[]),y=(_,k)=>{if(k===f.value){e.nextTick(()=>{f.value=void 0}),r.config.limit=[],r.config.window_size=[];return}e.nextTick(()=>{f.value=k}),r.config.limit=[_.config.limit],r.config.window_size=[_.config.window_size]};return(_,k)=>{const C=e.resolveComponent("KLabel"),N=e.resolveComponent("KButton"),E=e.resolveComponent("KBadge"),w=e.resolveComponent("KTooltip"),S=e.resolveComponent("KCard");return e.openBlock(),e.createBlock(S,{class:"sp-form-request-limits"},{title:e.withCtx(()=>[e.createVNode(C,{class:"sp-form-request-limits-title",for:"sp-form-request-limits-legend",required:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("sp.request_limits.title")),1)]),_:1}),e.createElementVNode("div",uM,e.toDisplayString(e.unref(t)("sp.request_limits.subtitle")),1)]),default:e.withCtx(()=>[e.createElementVNode("div",dM,[e.createElementVNode("div",fM,[e.createVNode(dp,{items:d.value,label:e.unref(t)("sp.window_type.label"),name:"window_type","onUpdate:modelValue":k[0]||(k[0]=I=>f.value=void 0)},null,8,["items","label"])]),e.createElementVNode("div",pM,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(I,U)=>(e.openBlock(),e.createElementBlock("div",{key:e.unref(s)(I,U)},[e.createVNode(C,{for:`sp-form-request-limits-item-${U}-legend`},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("sp.request_limits.label_index",{index:U+1})),1)]),_:2},1032,["for"]),e.createElementVNode("div",mM,[e.createElementVNode("legend",{id:`sp-form-request-limits-item-${U}-legend`,class:"sp-form-request-limits-inputs"},[e.createVNode(Ht,{name:`$.config.limit.${U}`,placeholder:e.unref(t)("sp.request_limits.request_number")},null,8,["name","placeholder"]),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.interval_determiner")),1),e.createVNode(Ht,{name:`$.config.window_size.${U}`,placeholder:e.unref(t)("sp.request_limits.time_interval")},null,8,["name","placeholder"]),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.seconds")),1)],8,gM),e.createElementVNode("div",hM,[e.createVNode(N,{appearance:"tertiary",disabled:a.value.length<=1,onClick:()=>l(U)},{default:e.withCtx(()=>[e.createVNode(e.unref($e.RemoveIcon))]),_:1},8,["disabled","onClick"]),e.createVNode(N,{appearance:"tertiary",onClick:()=>c(U)},{default:e.withCtx(()=>[e.createVNode(e.unref($e.AddIcon))]),_:1},8,["onClick"])])])]))),128))]),h.value.length>0?(e.openBlock(),e.createElementBlock("div",yM,[e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.start_with_a_use_case")),1),e.createElementVNode("div",_M,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(I,U)=>(e.openBlock(),e.createBlock(w,{key:`use-case-${U}`,"max-width":"300"},{content:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(I.description),1),k[1]||(k[1]=e.createElementVNode("br",null,null,-1)),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.label"))+": "+e.toDisplayString(I.config.limit),1),e.createElementVNode("div",null,e.toDisplayString(e.unref(t)("sp.request_limits.time_interval"))+": "+e.toDisplayString(I.config.window_size),1)]),default:e.withCtx(()=>[e.createVNode(E,{appearance:f.value===`${p.value}-${U}`?"info":"decorative",class:"sp-form-request-limits-examples-badge",onClick:()=>y(I,`${p.value}-${U}`)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(I.label),1)]),_:2},1032,["appearance","onClick"])]),_:2},1024))),128))])])):e.createCommentVNode("",!0)])]),_:1})}}}),[["__scopeId","data-v-e12d9c9f"]]),wM={id:"sp-form-error-legend",class:"sp-form-error-inputs"},kM=je(e.defineComponent({__name:"ErrorMessageForm",setup(n){const{t}=jt.createI18n("en-us",Jt);return(r,o)=>{const i=e.resolveComponent("KLabel");return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(i,{for:"sp-form-error-legend",info:e.unref(t)("sp.error_message.help"),required:"","tooltip-attributes":{maxWidth:"300",placement:"top"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t)("sp.error_message.label")),1)]),_:1},8,["info"]),e.createElementVNode("legend",wM,[e.createVNode(Ht,{class:"input-error-code",label:"",name:"error_code",placeholder:e.unref(t)("sp.error_message.code_placeholder")},null,8,["placeholder"]),o[0]||(o[0]=e.createElementVNode("div",null,":",-1)),e.createVNode(Xe,{class:"input-error-message",label:"",name:"error_message",placeholder:e.unref(t)("sp.error_message.message_placeholder")},null,8,["placeholder"])])])}}}),[["__scopeId","data-v-0796e152"]]),CM=e.defineComponent({__name:"RedisField",setup(n){const{formData:t}=pt(),r=e.inject(et.FORMS_CONFIG),o=e.inject(Pi),i=(o==null?void 0:o.isEditing)||!1,a=e.computed(()=>{if((r==null?void 0:r.app)!=="konnect")return!1;const s=r;return!!s.isKonnectManagedRedisEnabled&&s.isCloudGateway===!0});return e.watchEffect(()=>{t.config&&t.config.strategy!=="redis"&&(t.partials=i?null:void 0)}),(s,c)=>(e.openBlock(),e.createBlock(zl,null,{default:e.withCtx(()=>{var l;return[((l=e.unref(t).config)==null?void 0:l.strategy)==="redis"?(e.openBlock(),e.createBlock(ap,{key:0,"is-konnect-managed-redis-enabled":a.value},null,8,["is-konnect-managed-redis-enabled"])):e.createCommentVNode("",!0)]}),_:1}))}}),EM=e.defineComponent({__name:"ConfigForm",setup(n){return(t,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(Ut,{"as-child":"",name:"config","reset-label-path":"reset"},{default:e.withCtx(()=>[e.createVNode(bM),e.createVNode(kM)]),_:1}),e.createVNode(ts,{"hide-general-fields":""},{default:e.withCtx(()=>[e.createVNode(it,{name:"config.dictionary_name"}),e.createVNode(it,{name:"config.lock_dictionary_name"}),e.createVNode(it,{name:"config.strategy"}),e.createVNode(CM),e.createVNode(it,{name:"config.namespace"}),e.createVNode(it,{name:"config.hide_client_headers"}),e.createVNode(it,{name:"config.disable_penalty"}),e.createVNode(it,{name:"config.retry_after_jitter_max"}),e.createVNode(it,{name:"config.sync_rate"})]),_:1})],64))}}),NM=Ke({experimental:!0,component:e.defineComponent({__name:"ServiceProtectionForm",props:{schema:{},model:{},onFormChange:{type:Function},formConfig:{},renderRules:{},fieldRenderers:{},pluginName:{},isKonnectManagedRedisEnabled:{type:Boolean},onValidityChange:{type:Function},isEditing:{type:Boolean},configSections:{},hideEditorModeSwitcher:{type:Boolean},developer:{type:Boolean},generalInfoTitle:{},generalInfoDescription:{},pluginConfigTitle:{},pluginConfigDescription:{}},setup(n){const t=n,r=e.useSlots();e.provide(et.AUTOFILL_SLOT,r==null?void 0:r[et.AUTOFILL_SLOT_NAME]);function o(i,a){var s;((s=i.config)==null?void 0:s.namespace)===null&&delete i.config.namespace,t.onFormChange(i,a)}return(i,a)=>(e.openBlock(),e.createBlock(er,e.mergeProps(t,{"on-form-change":o}),{default:e.withCtx(()=>[e.createVNode(EM)]),_:1},16))}})}),SM=Ke({experimental:!0}),xM=Ke({experimental:!0,fieldRenderers:[{match:({genericPath:n})=>n==="config.flow.functions.*",component:Xe,propsOverrides:{multiline:!0,rows:3}}]}),AM=Ke({experimental:!0,fieldRenderers:[{match:"config.message.custom_fields_by_lua",component:pr,propsOverrides:{appearance:{string:{multiline:!0}}}}]}),vM=Ke({experimental:!0,fieldRenderers:[{match:"config.message.functions.*",component:Xe,propsOverrides:{multiline:!0,rows:3}}]}),IM=Ke({experimental:!0,renderRules:{bundles:[["config.cache.strategy","config.cache.redis"]],dependencies:{"config.cache.redis":["config.cache.strategy","redis"]}},fieldRenderers:[{match:"config.behavior.idp_error_response_body_template",component:Xe,propsOverrides:{multiline:!0,rows:4}}]}),BM=Ke({experimental:!0}),TM=Ke({experimental:!0}),OM=Ke({experimental:!0,fieldRenderers:[{match:({path:n})=>/^config\.(client|upstream)\.(text|binary)\.schema$/.test(n),component:Xe,propsOverrides:{multiline:!0,rows:4}}]}),PM=Ke({experimental:!0}),VM=Object.assign({"../plugins/acl/index.ts":t$,"../plugins/ai-custom-guardrail.ts":n$,"../plugins/ai-mcp-proxy/index.ts":r$,"../plugins/ai-prompt-decorator.ts":o$,"../plugins/ai-prompt-guard.ts":i$,"../plugins/ai-prompt-template.ts":a$,"../plugins/ai-proxy-advanced.ts":s$,"../plugins/ai-proxy.ts":l$,"../plugins/ai-rate-limiting-advanced.ts":c$,"../plugins/ai-request-transformer.ts":u$,"../plugins/ai-response-transformer.ts":d$,"../plugins/ai-semantic-cache.ts":f$,"../plugins/ai-semantic-prompt-guard.ts":p$,"../plugins/aws-lambda.ts":m$,"../plugins/basic-auth/index.ts":x$,"../plugins/bot-detection.ts":A$,"../plugins/canary.ts":v$,"../plugins/confluent-consume.ts":I$,"../plugins/confluent.ts":B$,"../plugins/correlation-id.ts":T$,"../plugins/cors.ts":O$,"../plugins/datakit/index.ts":XL,"../plugins/exit-transformer.ts":ZL,"../plugins/file-log.ts":QL,"../plugins/forward-proxy.ts":eD,"../plugins/graphql-rate-limiting-advanced.ts":tD,"../plugins/header-cert-auth.ts":nD,"../plugins/http-log.ts":rD,"../plugins/ip-restriction.ts":oD,"../plugins/jwe-decrypt.ts":iD,"../plugins/jwt-signer/index.ts":aD,"../plugins/jwt.ts":sD,"../plugins/kafka-consume.ts":lD,"../plugins/kafka-log.ts":cD,"../plugins/kafka-upstream.ts":uD,"../plugins/key-auth/index.ts":dD,"../plugins/metering-and-billing/index.ts":kD,"../plugins/mocking.ts":CD,"../plugins/mtls-auth.ts":ED,"../plugins/oas-validation.ts":ND,"../plugins/oauth2.ts":SD,"../plugins/opentelemetry.ts":xD,"../plugins/post-function.ts":AD,"../plugins/pre-function.ts":vD,"../plugins/prometheus.ts":ID,"../plugins/proxy-cache-advanced.ts":BD,"../plugins/proxy-cache.ts":TD,"../plugins/rate-limiting-advanced/index.ts":HD,"../plugins/rate-limiting.ts":zD,"../plugins/redirect.ts":WD,"../plugins/request-callout/index.ts":QD,"../plugins/request-size-limiting.ts":eM,"../plugins/request-termination.ts":tM,"../plugins/request-transformer-advanced.ts":nM,"../plugins/request-transformer.ts":rM,"../plugins/request-validator.ts":oM,"../plugins/response-ratelimiting.ts":iM,"../plugins/response-transformer-advanced.ts":aM,"../plugins/response-transformer.ts":sM,"../plugins/route-by-header.ts":lM,"../plugins/route-transformer-advanced.ts":cM,"../plugins/service-protection/index.ts":NM,"../plugins/session.ts":SM,"../plugins/solace-consume.ts":xM,"../plugins/solace-log.ts":AM,"../plugins/solace-upstream.ts":vM,"../plugins/upstream-oauth.ts":IM,"../plugins/upstream-timeout.ts":BM,"../plugins/websocket-size-limit.ts":TM,"../plugins/websocket-validator.ts":OM,"../plugins/xml-threat-protection.ts":PM});function $M(n){const t=n.match(/\.\.\/plugins\/(.+?)(?:\/index)?\.ts$/);if(!t)throw new Error(`Unable to derive plugin name from path: ${n}`);const[,r]=t;return r}function RM(n){const t={},r=new Map;for(const[o,i]of Object.entries(n)){const a=$M(o);if(r.has(a))throw new Error(`Duplicate plugin config for "${a}": ${r.get(a)} and ${o}`);r.set(a,o),t[a]={...i,component:i.component,experimental:i.experimental??!1,fieldRenderers:i.fieldRenderers??[]}}return t}const yp=RM(VM);function $w(n){return yp[n]}function Rw(n,t){const r=$w(n);if(r&&!(r.experimental&&!t.includes(n)))return r.component}function Lw(n,t,r){return r==="freeform"?!0:r==="vfg"?!1:!!Rw(n,t)}function LM(){return Object.entries(yp).filter(([,n])=>n.experimental).map(([n])=>n).sort((n,t)=>n.localeCompare(t))}function _p(){return e.inject(Yd,[])}function DM(n){const t=new Set(LM()),r=n.filter(i=>t.has(i)),o=n.filter(i=>!t.has(i));return o.length>0&&console.warn(`[entities-plugins] Ignoring unknown experimental free-form plugins: ${o.join(", ")}`),r}function MM(n){e.provide(Yd,DM(n))}function jM(){const n=_p();return{shouldUseFreeForm:(t,r)=>Lw(t,n,r),getFreeFormComponent:t=>Rw(t,n)}}function Dw(n){var o,i;if(!n)return;if(!n.token_exchange)return n;if((Array.isArray((o=n.token_exchange.request)==null?void 0:o.audience)&&n.token_exchange.request.audience.length===0||n.token_exchange.request&&!n.token_exchange.request.audience)&&(n.token_exchange.request.audience=null),(Array.isArray((i=n.token_exchange.request)==null?void 0:i.scopes)&&n.token_exchange.request.scopes.length===0||n.token_exchange.request&&!n.token_exchange.request.scopes)&&(n.token_exchange.request.scopes=null),[{cache:{enabled:!0},request:{audience:null,scopes:null,empty_audience:!1,empty_scopes:!1},subject_token_issuers:null},{cache:{enabled:!0},request:{audience:null,scopes:null,empty_audience:!1,empty_scopes:!1}},{cache:{},request:{audience:null,scopes:null}}].some(a=>Xt(n.token_exchange,a)))return n.token_exchange=null,n;const r=n.token_exchange.subject_token_issuers;return r&&r.forEach(a=>{Xt(a.conditions,{})&&(a.conditions=null),a.conditions&&Object.values(a.conditions).every(s=>Array.isArray(s)&&s.length===0)&&(a.conditions=null)}),n}const Mw=n=>{const t=n==null?void 0:n.proof_of_possession_mtls_from_header;if(!t)return;if(!Array.isArray(t.ca_certificates)||t.ca_certificates.length===0){n.proof_of_possession_mtls_from_header=null;return}Xt(t,{allow_partial_chain:!1,cert_cache_ttl:6e4,certificate_header_format:"url_encoded",http_timeout:3e4,revocation_check_mode:"IGNORE_CA_ERROR",secure_source:!0,ssl_verify:!0})&&(n.proof_of_possession_mtls_from_header=null)},jw=n=>{const t=n==null?void 0:n.protected_resource_metadata;if(!t)return;if(!Array.isArray(t.authorization_servers)||t.authorization_servers.length===0){n.protected_resource_metadata=null;return}if(Xt(t,{authorization_servers:null,scopes_supported:null})){n.protected_resource_metadata=null;return}},FM={shamefullyTransformPayload(n){return Dw(n.payload.config),Mw(n.payload.config),jw(n.payload.config),n}},UM={shamefullyTransformPayload(n){var t,r,o,i,a;if(!((r=(t=n.payload.config)==null?void 0:t.access_logs)!=null&&r.custom_attributes_by_lua))return n;if(Xt((i=(o=n.payload.config)==null?void 0:o.access_logs)==null?void 0:i.custom_attributes_by_lua,{})){const s=(a=n.payload.config)==null?void 0:a.access_logs;s&&(s.custom_attributes_by_lua=null)}return n}},KM={shamefullyTransformPayload(n){var r,o;const t=(o=(r=n.payload.config)==null?void 0:r.v2_strategies)==null?void 0:o.openid_connect;return Array.isArray(t)&&t.forEach(i=>{Dw(i.config),Mw(i.config),jw(i.config)}),n}},qM={shamefullyTransformPayload(n){var r;return!n.payload.config||!((r=n.payload.config)!=null&&r.token_exchange)||[{cache:{enabled:!0,ttl:3600},client_auth:"client_secret_basic",enabled:!1,request:{actor_token_source:"none",actor_token_type:"urn:ietf:params:oauth:token-type:access_token",audience:null,requested_token_type:"urn:ietf:params:oauth:token-type:access_token",scopes:null,subject_token_type:"urn:ietf:params:oauth:token-type:access_token"}}].some(o=>{var i;return Xt((i=n.payload.config)==null?void 0:i.token_exchange,o)})&&(n.payload.config.token_exchange=null),n}},GM=(n,t)=>{const r=n.model.startsWith("config-"),o=t.model.startsWith("config-");return r&&!o?1:!r&&o?-1:0},Fw=(n,t)=>(n.order??0)-(t.order??0),Uw=(n,t)=>GM(n,t)||Fw(n,t)||n.model.localeCompare(t.model),HM=n=>{const{capitalize:t}=Ie.useStringHelpers(),{convertToDotNotation:r}=l_(),{i18n:{t:o}}=Qe(),i=_p(),a={"application-registration":{overwriteDefault:!0,formSchema:{...bT}},datadog:{...wT},"exit-transformer":{...kT},"upstream-tls":{"config-trusted_certificates":{type:"textArea",valueType:"array",rows:4,help:"A comma separated list of certificate values"}},statsd:{...VT},"statsd-advanced":{...$T},"route-by-header":{...BT},"ai-prompt-decorator":{...mT},"ai-prompt-template":{...gT},"ai-proxy-advanced":{...hT},"ai-rag-injector":{...yT},"ai-llm-as-judge":{..._T},"vault-auth":{...LT},"oas-validation":{...ST},mocking:{...NT},"rate-limiting":{...Ul},"rate-limiting-advanced":(n==null?void 0:n.app)==="kongManager"?{"config-consumer_groups":Ul["config-consumer_groups"]}:{...Ul},"graphql-rate-limiting-advanced":{...CT},"injection-protection":{...ET},"response-ratelimiting":{...Ul},"pre-function":{...__},"post-function":{...__},"request-transformer-advanced":{...vT},"response-transformer":{...b_},"response-transformer-advanced":{...IT},zipkin:{...HT},"upstream-oauth":{...RT},saml:{...TT},"kafka-upstream":{...FT},"solace-consume":{...OT},"solace-upstream":{...PT},"key-auth":iT(n),"key-auth-enc":dT(n),confluent:{...UT},"confluent-consume":{...KT},"kafka-consume":{...qT},"kafka-log":{...GT},"openid-connect":{...FM},opentelemetry:{...UM},"konnect-application-auth":{...KM},"ai-mcp-oauth2":{...qM}},s=()=>["created_at","updated_at","id","_isCustomPlugin","_sourcePlugin","_supported_redis_partial_type","_redis_partial_path"],c=(w,S,I,U)=>{let x={};(S||w)&&(x=S||(w.fields?w.fields:w));const A=s().concat(w.blacklist?w.blacklist:[]),T=Object.keys(x).filter(Z=>!A.includes(Z)),V=T.indexOf("comparator");V>-1&&T.splice(V,1);let R={fields:[]};const X={};T.forEach(Z=>{u(x[Z],Z,x,X,R,I)});const Y=X.name,ne=w._sourcePlugin||Y,M=Rn[ne],te=[],$=Z=>{const F=["cluster-cache"];for(const J of F)if(Z.model.includes(J))return!1;return new RegExp("(?<=-redis-).*").test(Z.model)};if(R._supported_redis_partial_type=w._supported_redis_partial_type,R._redis_partial_path=w._redis_partial_path,et.getSharedFormName(ne)||Lw(ne,i,U)||M!=null&&M.useLegacyForm||n!=null&&n.credential){if(M!=null&&M.useLegacyForm&&(n!=null&&n.enableRedisPartial)&&w._supported_redis_partial_type){for(const Z of R.fields)if($(Z)){te.push(Z);continue}R.fields=R.fields.filter(Z=>!$(Z)),te.length&&R.fields.push({id:"_redis",fields:te,model:"__redis_partial",pluginType:w._isCustomPlugin?"custom":"bundled",redisType:w._supported_redis_partial_type,redisPath:w._redis_partial_path})}R.fields.sort((Z,F)=>(Z.order=Z.order||0,F.order=F.order||0,Z.order-F.order))}else{const Z=[],F=[],J=[],G=[],v={};if(M!=null&&M.fieldRules){const oe=[...M.fieldRules.atLeastOneOf??[],...M.fieldRules.onlyOneOf??[],...M.fieldRules.mutuallyRequired??[]];if(M.fieldRules.onlyOneOfMutuallyRequired)for(const ke of M.fieldRules.onlyOneOfMutuallyRequired)oe.push(...ke);for(const ke of oe)for(const ye of ke)v[ye.replace(/-/g,"_").replace(/\./g,"-")]=!1}for(const oe of R.fields){if(n!=null&&n.enableRedisPartial&&w._supported_redis_partial_type&&$(oe)){G.push(oe);continue}if(oe.pinned){Z.push(oe);continue}if(oe.required||v[oe.model]!==void 0){v[oe.model]===!1&&(v[oe.model]=!0),F.push(oe);continue}J.push(oe)}G.length&&J.push({id:"_redis",fields:G,model:"__redis_partial",pluginType:w._isCustomPlugin?"custom":"bundled",redisType:w._supported_redis_partial_type,redisPath:w._redis_partial_path,order:-1});const q=Object.entries(v).filter(([,oe])=>!oe).map(([oe])=>oe.replace(/-/g,".").replace(/_/g,"-"));q.length>0&&console.warn(`Unknown checked fields for plugin ${Y}: ${q.join(", ")}`);const ie=[];Z.length>0&&ie.push({fields:Z.sort(Fw)}),(F.length>0||J.length>0)&&ie.push({fields:F.sort(Uw),collapsible:{title:o("plugins.form.grouping.plugin_configuration.title"),description:o("plugins.form.grouping.plugin_configuration.description"),nestedCollapsible:{fields:J.sort(Uw),triggerLabel:{expand:o("plugins.form.grouping.advanced_parameters.view"),collapse:o("plugins.form.grouping.advanced_parameters.hide")}}},slots:{beforeContent:"plugin-config-before-content",emptyState:"plugin-config-empty-state"}}),R={groups:ie}}return{schema:R,model:X,options:{noneSelectedText:"Nothing Selected...",helpAsHtml:!0}}},l=w=>Array.isArray(w.default)||w.default!=null&&typeof w.default!="object"&&w.default!=="function",u=(w,S,I,U,x,A)=>{const T=l(w);return U[S]=T?w.default:null,w.id=S,w.model=S,w.fields&&w.type==="record"?d(w,S,I,U,x,A):(I[S]=w,N(w,U),A&&A[S]&&p(I[S],A[S]),x.fields.push(w)),I},p=(w,S)=>(S&&(Object.assign(w,S),S.label&&(w.label=S.label)),w),d=(w,S,I,U,x,A)=>{w.fields.forEach(T=>{Object.keys(T).forEach(V=>{const R=T[V];I=u(R,S+"-"+V,I,U,x,A)})})},f=(w,S)=>{w.type="input",w.inputType="hidden",w.styleClasses="kong-form-hidden-field-wrapper";const I=n==null?void 0:n.entityId;S[w.model]=I?{id:I}:null},m=w=>{w.type="input",w.inputType="number",w.between&&w.between.length===2&&(w.min=w.between[0],w.max=w.between[1])},h=w=>{Object.prototype.hasOwnProperty.call(w,"one_of")?(w.type="select",w.values=w.one_of,w.selectOptions={hideNoneSelectedText:!0}):(w.type="input",w.inputType="text")},y=w=>{w.type="checkbox",w.default=!0,w.required=!1},b=w=>{if(w.type="object-advanced",w.values.type==="array"){const{type:S}=w.values.elements||{};w.schema={fields:[{schema:{fields:[{...ft,model:w.model,valueArrayType:S==="integer"?"number":S||"string",inputAttributes:{...ft.inputAttributes,type:S==="integer"?"number":"text",inputMode:S==="integer"?"numeric":"text"}}]}}]}}else w.values.fields&&(w.schema={fields:[{type:"object",model:"object",schema:{fields:w.values.fields.map(S=>{const I=Object.keys(S)[0];return{model:I,type:"input",label:t(I),placeholder:I,inputType:S[I].type}})}}]})},_=w=>w.fields.reduce((S,I)=>(I.fields&&I.fields.forEach(U=>{S[U.model]=U}),I.model&&(S[I.model]=I),S),{}),k=(w,S)=>{if(!et.customFields.includes(w.model))return;const I=_(w);et.customFields.forEach(U=>{Object.keys(I).forEach(x=>{const A=l(I[x]);S[x]=A?I[x].default:null}),delete S[U]})},C=(w,S)=>w.inputType==="hidden"?"":r(w.label||S.replace(/_/g," ")),N=(w,S)=>{switch(k(w,S),w.type){case"foreign":f(w,S);break;case"number":m(w),w.attributes={step:"any"};break;case"integer":m(w);break;case"string":h(w);break;case"boolean":y(w);break;case"map":b(w);break}w.inputType==="foreign"&&f(w,S),w.label=C(w,w.model)};function E(w,S){if(S==null||S.type&&S.type!=="record"||typeof w!="object"||w==null)return w;const I={};for(const U of S.fields){const x=Object.keys(U)[0],A=U[x];A.type==="record"?I[x]=E(w[x],A):A.type==="array"&&Array.isArray(w[x])&&A.elements.type==="record"?I[x]=w[x].map(T=>E(T,A.elements)):I[x]=w[x]}return I}return{buildFormSchema:u,parseSchema:c,customSchemas:a,typedefs:di,pruneRecord:E}},wc=Symbol("customPluginType"),zM=1e3,WM=20,Kw=5e3,qw=(n,t=zM)=>{const r=/^[a-z][a-z\d+.-]*:/i.test(n),o=new URL(n,"http://localhost");return o.searchParams.has("size")||o.searchParams.set("size",`${t}`),r?o.toString():`${o.pathname}${o.search}${o.hash}`},kc=async(n,t,r)=>{const o=[];let i=qw(t),a=null,s=0;for(;i&&s<WM&&o.length<Kw&&i!==a;){a=i;const l=(await n.get(i,{signal:r})).data;Array.isArray(l==null?void 0:l.data)&&o.push(...l.data),i=l!=null&&l.next?qw(l.next):null,s+=1}return o.slice(0,Kw)};function YM(n){const{axiosInstance:t,apiBaseUrl:r}=n,o=()=>{if(n.app!=="konnect")throw new Error("Installed custom plugin APIs are only available for Konnect")},i=(b,_)=>{let k=`${r}${b}`;return n.app==="konnect"&&(k=k.replace(/{controlPlaneId}/gi,n.controlPlaneId)),k=k.replace(/{pluginId}/gi,_??"").replace(/\/{workspace}/gi,n.workspace?`/${n.workspace}`:""),k},a=async b=>{o();const _=i(tt.customPlugin.konnect.installed.edit,b),{data:k}=await t.get(_);return k},s=async b=>{o();const _=i(tt.customPlugin.konnect.installed.create),{data:k}=await t.post(_,b);return k},c=async(b,_)=>{o();const k=i(tt.customPlugin.konnect.installed.edit,b),{data:C}=await t.put(k,_);return C},l=async b=>{const _=i(tt.customPlugin[n.app].streamed.edit,b),{data:k}=await t.get(_);return k},u=async b=>{const _=i(tt.customPlugin[n.app].streamed.create),{data:k}=await t.post(_,b);return k},p=async(b,_)=>{const k=i(tt.customPlugin[n.app].streamed.edit,b),C=n.app==="konnect"?"put":"patch",{data:N}=await t[C](k,_);return N},d=async b=>{const{aliasName:_,priority:k,sourcePlugin:C}=b,N=i(tt.customPlugin[n.app].cloned.create),{data:E}=await t.post(N,{name:_,ref:C,priority:k});return E},f=async(b,_)=>{const{aliasName:k,priority:C,sourcePlugin:N}=_,E=i(tt.customPlugin[n.app].cloned.edit,b),w=n.app==="konnect"?"put":"patch",{data:S}=await t[w](E,{ref:N,priority:C,name:k});return S},m=async b=>{const _=i(tt.customPlugin[n.app].cloned.edit,b),{data:k}=await t.get(_);return k};return{getInstalledPlugin:a,createInstalledPlugin:s,updateInstalledPlugin:c,getStreamedPlugin:l,createStreamedPlugin:u,updateStreamedPlugin:p,getPluginByUnknownType:async b=>{var _,k,C;if(n.app==="konnect")try{const N=await a(b);return Object.assign(N,{[wc]:"installed"})}catch(N){if(Zo.isAxiosError(N)&&((_=N.response)==null?void 0:_.status)!==404)throw N}try{const N=await l(b);return Object.assign(N,{[wc]:"streamed"})}catch(N){if(Zo.isAxiosError(N)&&((k=N.response)==null?void 0:k.status)!==404)throw N}try{const N=await m(b);return Object.assign(N,{[wc]:"cloned"})}catch(N){if(Zo.isAxiosError(N)&&((C=N.response)==null?void 0:C.status)!==404)throw N}return null},getPluginType:b=>b[wc],getClonedPlugin:m,createClonedPlugin:d,updateClonedPlugin:f}}const st={useI18n:Qe,usePluginMetaData:h_,usePluginHelpers:l_,useSchemas:HM,useExperimentalFreeForms:_p,useProvideExperimentalFreeForms:MM,useFreeFormResolver:jM,useCustomPluginApi:YM},Gw=n=>{var r,o,i,a;const t=n==null?void 0:n.response;return(t==null?void 0:t.status)===400&&(((o=(r=t.data)==null?void 0:r.message)==null?void 0:o.includes("plugin schema is currently in use"))||((i=t.data)==null?void 0:i.code)===19||((a=t.data)==null?void 0:a.name)==="referenced by others")},JM={class:"kong-ui-entities-custom-plugin-form"},XM={class:"plugin-type-radios"},ZM={class:"compare-table-wrapper"},QM={class:"compare-table"},ej={key:0,scope:"col"},tj={key:1,scope:"col"},nj={key:2,scope:"col"},rj={scope:"row"},oj={key:0},ij={key:1},aj={key:2},sj={scope:"row"},lj={key:0},cj={class:"compare-list"},uj={key:1},dj={class:"compare-list"},fj={key:2},pj={scope:"row"},mj={key:0},gj={key:1},hj={key:2},yj={scope:"row"},_j={key:0},bj={key:1},wj={key:2},kj={scope:"row"},Cj={key:0},Ej={key:1},Nj={key:2},Sj={class:"plugin-modules-section"},xj={class:"plugin-select-item"},Aj={class:"plugin-select-item"},vj={key:1},Ij=1*1024*1024,Bj=je(e.defineComponent({__name:"CustomPluginForm",props:{config:{type:Object,required:!0,validator:n=>!(!n||!n.app||n.app==="konnect"&&!n.controlPlaneId||n.app==="kongManager"&&!n.workspace||!n.cancelRoute||!n.successRoute)},pluginName:{type:String,default:""},unsupportedTypes:{type:Array,default:()=>[]}},emits:["update","error","loading"],setup(n,{emit:t}){var ye;const r=["acl","datakit","file-log","http-log","ip-restriction","key-auth","opa","openid-connect","post-function","pre-function","request-transformer-advanced","request-transformer","response-transformer-advanced","response-transformer","route-by-header","tcp-log"],o=["installed","streamed","cloned"],i=n,a=t,{i18n:{t:s},i18nT:c}=st.useI18n(),l=Ar.useRouter(),{getMessageFromError:u}=Ie.useErrors(),{axiosInstance:p}=Ie.useAxios((ye=i.config)==null?void 0:ye.axiosRequestConfig),{createInstalledPlugin:d,updateInstalledPlugin:f,createStreamedPlugin:m,updateStreamedPlugin:h,getPluginType:y,getPluginByUnknownType:b,createClonedPlugin:_,updateClonedPlugin:k}=st.useCustomPluginApi({axiosInstance:p,apiBaseUrl:i.config.apiBaseUrl,controlPlaneId:i.config.controlPlaneId,app:i.config.app,workspace:i.config.workspace});e.provide(Ie.PLUGIN_FORM_LAYOUT_STATE,e.ref(!0));const C=e.ref(null),N=(ce,he)=>{const Oe=i.config.workspace??"",De=i.config.app==="konnect"?i.config.controlPlaneId:"";return`${i.config.apiBaseUrl}${ce}`.replace(/{controlPlaneId}/gi,De).replace(/{pluginId}/gi,he??"").replace(/\/\{workspace\}/gi,Oe?`/${Oe}`:"")},E=e.computed(()=>{const ce=$.fields.pluginType;if(!ce)return"";const he=U.value?i.pluginName:void 0,Oe=he?"edit":"create";if(i.config.app==="konnect"){if(ce==="installed")return N(tt.customPlugin.konnect.installed[Oe],he);if(ce==="streamed")return N(tt.customPlugin.konnect.streamed[Oe],he);if(ce==="cloned")return N(tt.customPlugin.konnect.cloned[Oe],he)}else{if(ce==="streamed")return N(tt.customPlugin.kongManager.streamed[Oe],he);if(ce==="cloned")return N(tt.customPlugin.kongManager.cloned[Oe],he)}return""}),w=e.computed(()=>U.value?$.fields.pluginType==="cloned"?i.config.app==="konnect"?"put":"patch":i.config.app==="kongManager"&&$.fields.pluginType==="streamed"?"patch":"put":"post"),S=e.computed(()=>{switch($.fields.pluginType){case"installed":return Ie.SupportedEntityType.PluginSchema;case"streamed":return Ie.SupportedEntityType.CustomPlugin;case"cloned":return Ie.SupportedEntityType.ClonedPlugin;default:return Ie.SupportedEntityType.Plugin}}),I=e.computed(()=>{switch($.fields.pluginType){case"installed":return{lua_schema:$.fields.schemaContent};case"streamed":return{name:$.fields.name,schema:$.fields.schemaContent,handler:$.fields.handlerContent};case"cloned":return{ref:$.fields.sourcePlugin,name:$.fields.aliasName,...$.fields.priority?{priority:parseInt($.fields.priority,10)}:{}};default:return{}}}),U=e.computed(()=>!!i.pluginName),x=e.ref(!1),A=e.ref(""),T=e.computed(()=>new Set(i.unsupportedTypes)),V=e.computed(()=>o.filter(ce=>!T.value.has(ce))),R=e.computed(()=>!U.value&&V.value.length===0),X=e.computed(()=>!U.value&&V.value.length>1),Y=()=>V.value[0]??null,ne=ce=>V.value.includes(ce),M=ce=>{if(U.value||!X.value){const he=ce-1;return($.fields.pluginType==="installed"?1:2)>1?he:void 0}return ce},te=e.ref(!0),$=e.reactive({fields:{pluginType:Y(),schemaContent:"",handlerContent:"",name:"",sourcePlugin:"",aliasName:"",priority:""},readonly:!1,errorMessage:""});let Z="";e.watch(V,ce=>{U.value||(!$.fields.pluginType||!ce.includes($.fields.pluginType))&&($.fields.pluginType=ce[0]??null)},{immediate:!0}),e.watch(()=>$.fields.pluginType,()=>{U.value||($.fields.schemaContent="",$.fields.handlerContent="",$.fields.name="",$.fields.sourcePlugin="",$.fields.aliasName="",$.fields.priority="")});const{getDisplayName:F}=h_(),J=e.computed(()=>{var De;const ce=((De=i.config)==null?void 0:De.clonablePlugins)??r;if(ce.length===0)return[];const he={};ce.forEach(Be=>{const Ge=Rn[Be],We=Ge==null?void 0:Ge.group;We?(he[We]||(he[We]=[]),he[We].push({label:F(Be),value:Be})):console.warn(`Plugin ${Be} is missing metadata group and will be shown without grouping.`)});const Oe=[];return Object.keys(he).sort().forEach(Be=>{Oe.push({label:Be,items:he[Be]})}),Oe}),G=e.computed(()=>{if(R.value||!$.fields.pluginType)return!1;switch($.fields.pluginType){case"installed":return $.fields.schemaContent.length>0;case"streamed":return $.fields.schemaContent.length>0&&$.fields.handlerContent.length>0&&$.fields.name.trim().length>0;case"cloned":return!!$.fields.sourcePlugin&&$.fields.aliasName.trim().length>0;default:return!1}}),v=ce=>new Promise((he,Oe)=>{const De=new FileReader;De.onload=Be=>{var We;const Ge=(We=Be.target)==null?void 0:We.result;typeof Ge=="string"?he(Ge):Oe(new Error("Failed to read file as text"))},De.onerror=Oe,De.readAsText(ce)}),q=async(ce,he)=>{const Oe=he[0];if(Oe){if(Oe.size>Ij){$.errorMessage=s("custom_plugin_form.errors.file_too_large");return}try{const De=await v(Oe);ce==="schema"?$.fields.schemaContent=De:$.fields.handlerContent=De}catch{$.errorMessage=s("custom_plugin_form.errors.file_read_error"),ce==="schema"?$.fields.schemaContent="":$.fields.handlerContent=""}}},ie=ce=>{ce==="schema"?$.fields.schemaContent="":$.fields.handlerContent=""},oe=()=>{l.push(i.config.cancelRoute)};e.onMounted(async()=>{if(i.pluginName){x.value=!0,a("loading",!0);try{const ce=await b(i.pluginName);if(!ce){A.value=s("custom_plugin_form.errors.plugin_not_found"),a("error",new Error(A.value));return}const he=y(ce);if($.fields.pluginType=he,he==="installed")$.fields.schemaContent=ce.item.lua_schema;else if(he==="streamed"){const{name:Oe,schema:De,handler:Be}=ce;$.fields.name=Oe,$.fields.schemaContent=De,$.fields.handlerContent=Be}else if(he==="cloned"){const{ref:Oe,name:De,priority:Be}=ce;$.fields.aliasName=De,$.fields.sourcePlugin=Oe,$.fields.priority=Be!==null?String(Be):"",Z=De}else A.value=s("custom_plugin_form.errors.unsupported_plugin_type",{type:he}),a("error",new Error(A.value))}catch(ce){A.value=u(ce),a("error",ce)}finally{x.value=!1,a("loading",!1)}}});const ke=async()=>{$.errorMessage="",$.readonly=!0;try{const ce=$.fields.pluginType;if(!ce)return;if(ce==="installed"){const he={lua_schema:$.fields.schemaContent},Oe=U.value?await f(i.pluginName,he):await d(he);a("update",Oe)}else if(ce==="streamed"){const he={name:$.fields.name,schema:$.fields.schemaContent,handler:$.fields.handlerContent},Oe=U.value?await h(i.pluginName,he):await m(he);a("update",Oe)}else{const he=U.value?await k(Z,{aliasName:$.fields.aliasName,sourcePlugin:$.fields.sourcePlugin,priority:$.fields.priority?parseInt($.fields.priority,10):void 0}):await _({aliasName:$.fields.aliasName,sourcePlugin:$.fields.sourcePlugin,priority:$.fields.priority?parseInt($.fields.priority,10):void 0});a("update",{pluginType:"cloned",sourcePlugin:he.ref,aliasName:he.name,priority:he.priority??void 0})}l.push(i.config.successRoute)}catch(ce){$.errorMessage=Gw(ce)?s("delete.plugin_schema_in_use_message"):u(ce),a("error",ce)}finally{$.readonly=!1}};return(ce,he)=>{const Oe=e.resolveComponent("KSkeleton"),De=e.resolveComponent("KEmptyState"),Be=e.resolveComponent("KRadio"),Ge=e.resolveComponent("KCollapse"),We=e.resolveComponent("KFileUpload"),nt=e.resolveComponent("KLabel"),lt=e.resolveComponent("KAlert"),Re=e.resolveComponent("KSelect"),Ce=e.resolveComponent("KInput"),se=e.resolveComponent("KButton");return e.openBlock(),e.createElementBlock("div",JM,[e.createVNode(e.unref(Ie.EntityBaseForm),{ref_key:"entityBaseFormRef",ref:C,"can-submit":G.value,config:n.config,"entity-type":e.unref(Ie.SupportedEntityType).Plugin,"error-message":$.errorMessage,"form-fields":I.value,"is-readonly":$.readonly,"slideout-deck-entity-type":S.value,"slideout-fetch-url":E.value,"slideout-request-method":w.value,onCancel:oe,onSubmit:ke},{"form-actions":e.withCtx(()=>[x.value||A.value||R.value?(e.openBlock(),e.createElementBlock("span",vj)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(se,{appearance:"primary","data-testid":"custom-plugin-form-submit",disabled:!G.value||$.readonly,type:"submit"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("actions.save")),1)]),_:1},8,["disabled"]),e.createVNode(se,{appearance:"secondary","data-testid":"custom-plugin-form-cancel",disabled:$.readonly,onClick:oe},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("actions.cancel")),1)]),_:1},8,["disabled"]),e.createVNode(se,{appearance:"tertiary","data-testid":"custom-plugin-form-view-configuration",onClick:he[14]||(he[14]=re=>{var Q;return(Q=C.value)==null?void 0:Q.viewConfig()})},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("actions.view_configuration")),1)]),_:1})],64))]),default:e.withCtx(()=>[x.value?(e.openBlock(),e.createBlock(Oe,{key:0,type:"form"})):A.value?(e.openBlock(),e.createBlock(De,{key:1,"action-button-visible":!1,"data-testid":"custom-plugin-form-fetch-error","icon-variant":"error"},{default:e.withCtx(()=>[e.createElementVNode("h3",null,e.toDisplayString(A.value),1)]),_:1})):R.value?(e.openBlock(),e.createBlock(De,{key:2,"action-button-visible":!1,"data-testid":"custom-plugin-form-unsupported-types-error","icon-variant":"error"},{default:e.withCtx(()=>[e.createElementVNode("h3",null,e.toDisplayString(e.unref(s)("custom_plugin_form.errors.no_supported_types")),1)]),_:1})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[X.value?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:0,class:"custom-plugin-form-steps",step:1,title:e.unref(s)("custom_plugin_form.step1.title")},{default:e.withCtx(()=>[e.createElementVNode("div",XM,[ne("installed")?(e.openBlock(),e.createBlock(Be,{key:0,modelValue:$.fields.pluginType,"onUpdate:modelValue":he[0]||(he[0]=re=>$.fields.pluginType=re),card:"","card-orientation":"horizontal","data-testid":"custom-plugin-type-installed",description:e.unref(s)("custom_plugin_form.step1.types.installed.description"),label:e.unref(s)("custom_plugin_form.step1.types.installed.label"),"selected-value":"installed"},null,8,["modelValue","description","label"])):e.createCommentVNode("",!0),ne("streamed")?(e.openBlock(),e.createBlock(Be,{key:1,modelValue:$.fields.pluginType,"onUpdate:modelValue":he[1]||(he[1]=re=>$.fields.pluginType=re),card:"","card-orientation":"horizontal","data-testid":"custom-plugin-type-streamed",description:e.unref(s)("custom_plugin_form.step1.types.streamed.description"),label:e.unref(s)("custom_plugin_form.step1.types.streamed.label"),"selected-value":"streamed"},null,8,["modelValue","description","label"])):e.createCommentVNode("",!0),ne("cloned")?(e.openBlock(),e.createBlock(Be,{key:2,modelValue:$.fields.pluginType,"onUpdate:modelValue":he[2]||(he[2]=re=>$.fields.pluginType=re),card:"","card-orientation":"horizontal","data-testid":"custom-plugin-type-cloned",description:e.unref(s)("custom_plugin_form.step1.types.cloned.description"),label:e.unref(s)("custom_plugin_form.step1.types.cloned.label"),"selected-value":"cloned"},null,8,["modelValue","description","label"])):e.createCommentVNode("",!0)]),e.createVNode(Ge,{modelValue:te.value,"onUpdate:modelValue":he[3]||(he[3]=re=>te.value=re),class:"custom-plugin-form-compare-collapse","data-testid":"compare-deployment-options","trigger-alignment":"leading","trigger-label":e.unref(s)("custom_plugin_form.step1.compare_trigger")},{default:e.withCtx(()=>[e.createElementVNode("div",ZM,[e.createElementVNode("table",QM,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[he[15]||(he[15]=e.createElementVNode("th",{scope:"col"},null,-1)),ne("installed")?(e.openBlock(),e.createElementBlock("th",ej,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.columns.installed")),1)):e.createCommentVNode("",!0),ne("streamed")?(e.openBlock(),e.createElementBlock("th",tj,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.columns.streamed")),1)):e.createCommentVNode("",!0),ne("cloned")?(e.openBlock(),e.createElementBlock("th",nj,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.columns.cloned")),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("tbody",null,[e.createElementVNode("tr",null,[e.createElementVNode("th",rj,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.main_use_case.header")),1),ne("installed")?(e.openBlock(),e.createElementBlock("td",oj,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.main_use_case.installed")),1)):e.createCommentVNode("",!0),ne("streamed")?(e.openBlock(),e.createElementBlock("td",ij,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.main_use_case.streamed")),1)):e.createCommentVNode("",!0),ne("cloned")?(e.openBlock(),e.createElementBlock("td",aj,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.main_use_case.cloned")),1)):e.createCommentVNode("",!0)]),e.createElementVNode("tr",null,[e.createElementVNode("th",sj,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.file_supplied.header")),1),ne("installed")?(e.openBlock(),e.createElementBlock("td",lj,[e.createElementVNode("ul",cj,[e.createElementVNode("li",null,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.file_supplied.installed.handler")),1),e.createElementVNode("li",null,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.file_supplied.installed.schema")),1),e.createElementVNode("li",null,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.file_supplied.installed.additional")),1)])])):e.createCommentVNode("",!0),ne("streamed")?(e.openBlock(),e.createElementBlock("td",uj,[e.createElementVNode("ul",dj,[e.createElementVNode("li",null,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.file_supplied.streamed.handler")),1),e.createElementVNode("li",null,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.file_supplied.streamed.schema")),1)])])):e.createCommentVNode("",!0),ne("cloned")?(e.openBlock(),e.createElementBlock("td",fj,[e.createVNode(e.unref($e.ClearIcon),{color:`var(--kui-color-text-neutral, ${e.unref(cr)})`,size:`var(--kui-icon-size-30, ${e.unref(Yn)})`},null,8,["color","size"])])):e.createCommentVNode("",!0)]),e.createElementVNode("tr",null,[e.createElementVNode("th",pj,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.how_installed.header")),1),ne("installed")?(e.openBlock(),e.createElementBlock("td",mj,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.how_installed.installed")),1)):e.createCommentVNode("",!0),ne("streamed")?(e.openBlock(),e.createElementBlock("td",gj,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.how_installed.streamed")),1)):e.createCommentVNode("",!0),ne("cloned")?(e.openBlock(),e.createElementBlock("td",hj,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.how_installed.cloned")),1)):e.createCommentVNode("",!0)]),e.createElementVNode("tr",null,[e.createElementVNode("th",yj,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.sandboxing.header")),1),ne("installed")?(e.openBlock(),e.createElementBlock("td",_j,[e.createVNode(e.unref($e.ClearIcon),{color:`var(--kui-color-text-neutral, ${e.unref(cr)})`,size:`var(--kui-icon-size-30, ${e.unref(Yn)})`},null,8,["color","size"])])):e.createCommentVNode("",!0),ne("streamed")?(e.openBlock(),e.createElementBlock("td",bj,[e.createVNode(e.unref(c),{keypath:"custom_plugin_form.step1.compare_table.rows.sandboxing.streamed"},{link:e.withCtx(()=>[e.createVNode(e.unref(Fe.KExternalLink),{"hide-icon":"",href:e.unref(es).customPluginSandboxing},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.sandboxing.streamed_link")),1)]),_:1},8,["href"])]),_:1})])):e.createCommentVNode("",!0),ne("cloned")?(e.openBlock(),e.createElementBlock("td",wj,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.sandboxing.cloned")),1)):e.createCommentVNode("",!0)]),e.createElementVNode("tr",null,[e.createElementVNode("th",kj,e.toDisplayString(e.unref(s)("custom_plugin_form.step1.compare_table.rows.data_plane_reload.header")),1),ne("installed")?(e.openBlock(),e.createElementBlock("td",Cj,[e.createVNode(e.unref($e.CheckCircleIcon),{color:`var(--kui-color-text-success, ${e.unref(Zg)})`,size:`var(--kui-icon-size-30, ${e.unref(Yn)})`},null,8,["color","size"])])):e.createCommentVNode("",!0),ne("streamed")?(e.openBlock(),e.createElementBlock("td",Ej,[e.createVNode(e.unref($e.ClearIcon),{color:`var(--kui-color-text-neutral, ${e.unref(cr)})`,size:`var(--kui-icon-size-30, ${e.unref(Yn)})`},null,8,["color","size"])])):e.createCommentVNode("",!0),ne("cloned")?(e.openBlock(),e.createElementBlock("td",Nj,[e.createVNode(e.unref($e.ClearIcon),{color:`var(--kui-color-text-neutral, ${e.unref(cr)})`,size:`var(--kui-icon-size-30, ${e.unref(Yn)})`},null,8,["color","size"])])):e.createCommentVNode("",!0)])])])])]),_:1},8,["modelValue","trigger-label"])]),_:1},8,["title"])):e.createCommentVNode("",!0),$.fields.pluginType==="installed"?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:1,class:"custom-plugin-form-steps",step:M(2),title:e.unref(s)("custom_plugin_form.step2_files.title")},{default:e.withCtx(()=>[e.createVNode(We,{accept:[".lua"],"button-text":e.unref(s)("custom_plugin_form.step2_files.schema_file.button_text"),"data-testid":"custom-plugin-schema-upload",help:e.unref(s)("custom_plugin_form.step2_files.schema_file.help"),label:e.unref(s)("custom_plugin_form.step2_files.schema_file.label"),placeholder:U.value&&$.fields.schemaContent?e.unref(s)("custom_plugin_form.step2_files.schema_file.placeholder_edit"):e.unref(s)("custom_plugin_form.step2_files.schema_file.placeholder"),required:!U.value,onFileAdded:he[4]||(he[4]=re=>q("schema",re)),onFileRemoved:he[5]||(he[5]=re=>ie("schema"))},null,8,["button-text","help","label","placeholder","required"]),e.createElementVNode("div",Sj,[e.createVNode(nt,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("custom_plugin_form.step2_files.plugin_modules.label")),1)]),_:1}),e.createVNode(lt,{appearance:"warning",message:e.unref(s)("custom_plugin_form.step2_files.plugin_modules.alert")},null,8,["message"])])]),_:1},8,["step","title"])):e.createCommentVNode("",!0),$.fields.pluginType==="streamed"?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:2,class:"custom-plugin-form-steps",step:M(2),title:e.unref(s)("custom_plugin_form.step2_files.title")},{default:e.withCtx(()=>[e.createVNode(We,{accept:[".lua"],"button-text":e.unref(s)("custom_plugin_form.step2_files.schema_file.button_text"),"data-testid":"custom-plugin-schema-upload",help:e.unref(s)("custom_plugin_form.step2_files.schema_file.help"),label:e.unref(s)("custom_plugin_form.step2_files.schema_file.label"),placeholder:U.value&&$.fields.schemaContent?e.unref(s)("custom_plugin_form.step2_files.schema_file.placeholder_edit"):e.unref(s)("custom_plugin_form.step2_files.schema_file.placeholder"),required:!U.value,onFileAdded:he[6]||(he[6]=re=>q("schema",re)),onFileRemoved:he[7]||(he[7]=re=>ie("schema"))},null,8,["button-text","help","label","placeholder","required"]),e.createVNode(We,{accept:[".lua"],"button-text":e.unref(s)("custom_plugin_form.step2_files.handler_file.button_text"),"data-testid":"custom-plugin-handler-upload",help:e.unref(s)("custom_plugin_form.step2_files.handler_file.help"),label:e.unref(s)("custom_plugin_form.step2_files.handler_file.label"),placeholder:U.value&&$.fields.handlerContent?e.unref(s)("custom_plugin_form.step2_files.handler_file.placeholder_edit"):e.unref(s)("custom_plugin_form.step2_files.handler_file.placeholder"),required:!U.value,onFileAdded:he[8]||(he[8]=re=>q("handler",re)),onFileRemoved:he[9]||(he[9]=re=>ie("handler"))},null,8,["button-text","help","label","placeholder","required"])]),_:1},8,["step","title"])):e.createCommentVNode("",!0),$.fields.pluginType==="cloned"?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:3,class:"custom-plugin-form-steps",step:M(2),title:e.unref(s)("custom_plugin_form.step2_clone.title")},{default:e.withCtx(()=>[e.createVNode(Re,{modelValue:$.fields.sourcePlugin,"onUpdate:modelValue":he[10]||(he[10]=re=>$.fields.sourcePlugin=re),"data-testid":"custom-plugin-clone-select","enable-filtering":"",items:J.value,label:e.unref(s)("custom_plugin_form.step2_clone.select_plugin.label"),placeholder:e.unref(s)("custom_plugin_form.step2_clone.select_plugin.placeholder"),required:""},{"item-template":e.withCtx(({item:re})=>[e.createElementVNode("div",xj,[e.createVNode(e.unref(xr.PluginIcon),{name:String(re.value),size:20},null,8,["name"]),e.createElementVNode("span",null,e.toDisplayString(re.label),1)])]),"selected-item-template":e.withCtx(({item:re})=>[e.createElementVNode("div",Aj,[e.createVNode(e.unref(xr.PluginIcon),{name:String(re.value),size:20},null,8,["name"]),e.createElementVNode("span",null,e.toDisplayString(re.label),1)])]),_:1},8,["modelValue","items","label","placeholder"])]),_:1},8,["step","title"])):e.createCommentVNode("",!0),$.fields.pluginType==="streamed"?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:4,class:"custom-plugin-form-steps",description:e.unref(s)("custom_plugin_form.step3.description"),step:M(3),title:e.unref(s)("custom_plugin_form.step3.title")},{default:e.withCtx(()=>[e.createVNode(Ce,{modelValue:$.fields.name,"onUpdate:modelValue":he[11]||(he[11]=re=>$.fields.name=re),modelModifiers:{trim:!0},"data-testid":"custom-plugin-name",help:e.unref(s)("custom_plugin_form.step3.name.help"),label:e.unref(s)("custom_plugin_form.step3.name.label"),placeholder:e.unref(s)("custom_plugin_form.step3.name.placeholder"),readonly:$.readonly,required:"",type:"text"},null,8,["modelValue","help","label","placeholder","readonly"])]),_:1},8,["description","step","title"])):e.createCommentVNode("",!0),$.fields.pluginType==="cloned"?(e.openBlock(),e.createBlock(e.unref(Ie.EntityFormBlock),{key:5,class:"custom-plugin-form-steps",description:e.unref(s)("custom_plugin_form.step3.description"),step:M(3),title:e.unref(s)("custom_plugin_form.step3.title")},{default:e.withCtx(()=>[e.createVNode(Ce,{modelValue:$.fields.aliasName,"onUpdate:modelValue":he[12]||(he[12]=re=>$.fields.aliasName=re),modelModifiers:{trim:!0},"data-testid":"custom-plugin-alias-name",help:e.unref(s)("custom_plugin_form.step3.alias_name.help"),label:e.unref(s)("custom_plugin_form.step3.alias_name.label"),placeholder:e.unref(s)("custom_plugin_form.step3.alias_name.placeholder"),readonly:$.readonly,required:"",type:"text"},null,8,["modelValue","help","label","placeholder","readonly"]),e.createVNode(Ce,{modelValue:$.fields.priority,"onUpdate:modelValue":he[13]||(he[13]=re=>$.fields.priority=re),modelModifiers:{trim:!0},"data-testid":"custom-plugin-priority",label:e.unref(s)("custom_plugin_form.step3.priority.label"),"label-attributes":{info:e.unref(s)("custom_plugin_form.step3.priority.tooltip")},readonly:$.readonly,type:"number"},{help:e.withCtx(()=>[e.createVNode(e.unref(c),{keypath:"custom_plugin_form.step3.priority.help.text"},{link:e.withCtx(()=>[e.createVNode(e.unref(Fe.KExternalLink),{"hide-icon":"",href:e.unref(es).pluginPriority},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("custom_plugin_form.step3.priority.help.link")),1)]),_:1},8,["href"])]),_:1})]),_:1},8,["modelValue","label","label-attributes","readonly"])]),_:1},8,["description","step","title"])):e.createCommentVNode("",!0)],64))]),_:1},8,["can-submit","config","entity-type","error-message","form-fields","is-readonly","slideout-deck-entity-type","slideout-fetch-url","slideout-request-method"])])}}}),[["__scopeId","data-v-0c1e017a"]]),Tj=(n,t)=>({type:"array",valueType:"string",valueArrayType:"array",itemContainerComponent:"FieldArrayItem",fieldClasses:"kong-form-array-field",fieldItemsClasses:"kong-form-array-field-item",validator:"array",styleClasses:"kong-form-field-wrapper",newElementButtonLabel:"+ Add",newElementButtonLabelClasses:"kong-form-new-element-button-label",items:{type:"select",values:n,selectOptions:{hideNoneSelectedText:!0},...(t==null?void 0:t[0])!=null?{default:t[0]}:{}}}),Oj={class:"referable-field-item"},Pj=24,Hw=je(e.defineComponent({__name:"ReferableFieldItem",props:{field:{},isLast:{type:Boolean}},setup(n){const t=n,{formatPluginFieldLabel:r}=st.usePluginHelpers(),o=e.computed(()=>t.field.replace(/\./g,"-")),i=e.computed(()=>t.field.replace(/^[cC]onfig\./,"").split(".").map(s=>r(s)).join(".")),a=()=>{if(!o.value)return;const s=`label[for="${o.value}"]`,c=document.querySelector(s)||document.getElementById(o.value);if(!c)return;const l=Math.max(0,c.getBoundingClientRect().top+window.scrollY-Pj),u=()=>{var p;(p=c.click)==null||p.call(c)};window.addEventListener("scrollend",u,{once:!0}),window.scrollTo({top:l,behavior:"smooth"})};return(s,c)=>(e.openBlock(),e.createElementBlock("span",Oj,[e.createElementVNode("span",{class:"referable-field-link",role:"button",tabindex:"0",onClick:a},e.toDisplayString(i.value),1),n.isLast?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(", ")],64))]))}}),[["__scopeId","data-v-949a9ea1"]]),Vj={key:0},$j=je(e.defineComponent({__name:"PluginFieldRuleAlerts",props:{rules:{}},setup(n){const t=n,{i18n:{t:r},i18nT:o}=st.useI18n(),i=e.computed(()=>{const a=[];if(t.rules.atLeastOneOf)for(const s of t.rules.atLeastOneOf)a.push({key:"plugins.form.field_rules.at_least_one_of",fields:s});if(t.rules.onlyOneOf)for(const s of t.rules.onlyOneOf)a.push({key:"plugins.form.field_rules.only_one_of",fields:s});if(t.rules.mutuallyRequired)for(const s of t.rules.mutuallyRequired)a.push({key:"plugins.form.field_rules.mutually_required",fields:s});return a});return(a,s)=>{const c=e.resolveComponent("KAlert");return e.openBlock(),e.createBlock(c,{class:"plugin-field-rule-alerts"},{default:e.withCtx(()=>[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,({key:l,fields:u},p)=>(e.openBlock(),e.createElementBlock("li",{key:`simple-alert-${p}`},[e.createVNode(e.unref(o),{keypath:l},{parameters:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u,(d,f)=>(e.openBlock(),e.createBlock(Hw,{key:`alert-field-${d}`,field:d,"is-last":f===u.length-1},null,8,["field","is-last"]))),128))]),_:2},1032,["keypath"])]))),128)),t.rules.onlyOneOfMutuallyRequired&&t.rules.onlyOneOfMutuallyRequired.length>0?(e.openBlock(),e.createElementBlock("li",Vj,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.rules.onlyOneOfMutuallyRequired,(l,u)=>(e.openBlock(),e.createElementBlock("div",{key:`only-one-mutually-alert-${u}`},[e.createElementVNode("div",null,e.toDisplayString(e.unref(r)("plugins.form.field_rules.only_one_of_mutually_required")),1),e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l,(p,d)=>(e.openBlock(),e.createElementBlock("li",{key:`only-one-mutually-alert-${u}-combination-${d}`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p,(f,m)=>(e.openBlock(),e.createBlock(Hw,{key:`only-one-mutually-field-${f}`,field:f,"is-last":m===p.length-1},null,8,["field","is-last"]))),128))]))),128))])]))),128))])):e.createCommentVNode("",!0)])]),_:1})}}}),[["__scopeId","data-v-5f9ff453"]]);function Rj(n){if(n.length===0)return"";if(n.length===1){const i=gn(n[0]);return yt(...i.slice(0,-1))}const t=n.map(i=>gn(i)),r=Math.min(...t.map(i=>i.length)),o=[];for(let i=0;i<r-1;i++){const a=t[0][i];if(t.every(s=>s[i]===a))o.push(a);else break}return yt(...o)}function bp(n){return"at_least_one_of"in n?n.at_least_one_of:"mutually_required"in n?n.mutually_required:"mutually_exclusive"in n?n.mutually_exclusive:null}function Lj(n,t){if(!t)return n;const r=t+Ma;return n.map(o=>o.startsWith(r)?o.slice(r.length):o)}function Dj(n,t){const r=bp(n),o=Lj(r,t);return"at_least_one_of"in n?{at_least_one_of:o}:"mutually_required"in n?{mutually_required:o}:{mutually_exclusive:o}}function Mj(n){const t=[],r=new Map;for(const o of n){const i=bp(o);if(!i){t.push(o);continue}const a=Rj(i);if(!a){t.push(o);continue}const s=Dj(o,a);r.has(a)||r.set(a,[]),r.get(a).push(s)}return{keep:t,move:r}}function jj(n,t,r){const o=gn(t);let i=n;for(const a of o){const s=i.fields.find(l=>Object.keys(l)[0]===a);if(!s)return;const c=s[a];if(c.type!=="record")return;i=c}i.entity_checks=[...i.entity_checks||[],...r]}function zw(n){var t;if((t=n.entity_checks)!=null&&t.length){const{keep:r,move:o}=Mj(n.entity_checks);n.entity_checks=r.length?r:void 0;for(const[i,a]of o)jj(n,i,a)}for(const r of n.fields){const o=Object.values(r)[0];o.type==="record"&&zw(o)}}function Fj(n){const t=JSON.parse(JSON.stringify(n)),r={fields:t.fields};return zw(r),t.fields=r.fields,t}function Uj(n,t){const r=Rn[n];if(!r||!r.fieldRules)return t;const o=Kj(r.fieldRules),i={...t};return i.fields=i.fields.map(a=>{if(Object.keys(a)[0]==="config"){const c=a.config.entity_checks||[],l=d=>{const m=[...bp(d)??[]].slice().sort();return`${Object.keys(d)[0]}:${m.join(",")}`},u=new Set(c.map(l)),p=o.filter(d=>{const f=l(d);return u.has(f)?!1:(u.add(f),!0)});return{config:{...a.config,entity_checks:[...c,...p]}}}return a}),i}function Kj(n){const t=[],r=o=>o.startsWith("config.")?o.substring(7):o;return n.atLeastOneOf&&n.atLeastOneOf.forEach(o=>{t.push({at_least_one_of:o.map(r)})}),n.onlyOneOf&&n.onlyOneOf.forEach(o=>{t.push({mutually_exclusive:o.map(r)})}),n.mutuallyRequired&&n.mutuallyRequired.forEach(o=>{t.push({mutually_required:o.map(r)})}),n.onlyOneOfMutuallyRequired&&n.onlyOneOfMutuallyRequired.forEach(o=>{if(o.forEach(i=>{t.push({mutually_required:i.map(r)})}),o.length>1)for(let i=0;i<o.length;i++)for(let a=i+1;a<o.length;a++){const s=o[i].map(r),c=o[a].map(r);s.forEach(l=>{c.forEach(u=>{t.push({mutually_exclusive:[l,u]})})})}}),t}const qj={class:"kong-ui-entities-plugin-form"},Gj={key:1,class:"entity-form"},Hj={class:"plugin-config-empty-state"},zj=je(e.defineComponent({__name:"PluginEntityForm",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||n.app==="konnect"&&!n.controlPlaneId||n.app==="kongManager"&&typeof n.workspace!="string")},entityMap:{type:Object,default:()=>({})},record:{type:Object,default:()=>({})},schema:{type:Object,default:()=>({})},rawSchema:{type:Object,default:()=>({})},editing:{type:Boolean,default:!1},credential:{type:Boolean,default:!1},enableVaultSecretPicker:{type:Boolean,default:!1},enableRedisPartial:{type:Boolean,default:!1},engine:{type:String,required:!1,default:void 0},developer:{type:Boolean,default:!1}},emits:["loading","model-updated","showNewPartialModal","globalAction","click:learn-more","click:create-entity","validity-change"],setup(n,{emit:t}){var lt,Re;const r=t,o=n,i=e.computed(()=>{if(o.config.app!=="konnect")return!1;const Ce=o.config;return!!Ce.isKonnectManagedRedisEnabled&&Ce.isCloudGateway===!0}),a=e.inject(fr.KM_2306_CONDITION_FIELD_314,!1),s=e.inject(fr.KHCP_20393_IDENTITY_PRINCIPALS_UI,!1),{axiosInstance:c}=Ie.useAxios((lt=o.config)==null?void 0:lt.axiosRequestConfig),{parseSchema:l}=st.useSchemas({entityId:((Re=o.entityMap.focusedEntity)==null?void 0:Re.id)||void 0,credential:o.credential,enableRedisPartial:o.enableRedisPartial,experimentalRenders:o.config.app==="konnect"?o.config.experimentalRenders:void 0}),{convertToDotNotation:u,unFlattenObject:p,dismissField:d,isObjectEmpty:f,unsetNullForeignKey:m}=st.usePluginHelpers(),{shouldUseFreeForm:h,getFreeFormComponent:y}=st.useFreeFormResolver(),b=e.inject(Ie.PLUGIN_FORM_LAYOUT_STATE),_=Ce=>{b&&(b.value=Ce)},{objectsAreEqual:k}=Ie.useHelpers(),{i18n:{t:C}}=Qe(),N=Ce=>{let se=Ce;return o.config.app==="konnect"&&(se=se.replace(/{controlPlaneId}/gi,o.config.controlPlaneId||"")),se.replace(/\/{workspace}/gi,o.config.workspace?`/${o.config.workspace}`:"")},E=(Ce,se)=>{let re=`${o.config.apiBaseUrl}${tt.form[o.config.app].entityGetOne}`;return re=N(re),re=re.replace(/{entity}/gi,Ce),re=re.replace(/{id}/gi,se),re},w=Ce=>{let se=`${o.config.apiBaseUrl}${tt.form[o.config.app].entityGetAll}`;return se=N(se),se=se.replace(/{entity}/gi,Ce),se},S=(Ce,se,re)=>{const Q=E(Ce,se);return c.get(Q,re)},I=(Ce,se)=>{const re=w(Ce);return o.config.app==="konnect"?c.get(re).then(Q=>{const{data:{data:le}}=Q;if(delete se.size,delete se.offset,le.length&&Object.keys(se).length===1){const de=Object.keys(se)[0],_e=le.filter(xe=>xe[de]?!!xe[de].toLowerCase().includes(se[de].toLowerCase()):!1);Q.data.data=_e}return Q}):c.get(re,{params:se})},U=(Ce,se,re)=>{const Q=w(Ce);if(o.config.app==="konnect"){const{size:le,offset:de,..._e}=se;if(Ce==="consumer_groups")return c.get(Q,{params:{size:1e3},signal:re}).then(Ne=>{const{data:{data:g}}=Ne;if(g.length&&Object.keys(_e).length===1){const O=Object.keys(_e)[0],j=g.filter(W=>W[O]?!!W[O].toLowerCase().includes(_e[O].toLowerCase()):!1);Ne.data.data=j}return Ne});const xe={size:le,offset:de};for(const Ne of Object.keys(_e))xe.filter={[Ne]:{contains:_e[Ne]}};return c.get(Q,{params:xe,signal:re})}return c.get(Q,{params:se,signal:re})},x=(Ce,se=50)=>{const re=w(Ce);return c.get(re,{params:{size:se}})};e.provide(et.FORMS_API_KEY,{getOne:S,getAll:I,getAllV2:U,peek:x});const A=e.shallowReactive({...o.config});e.watch(()=>o.config,Ce=>{Object.assign(A,Ce)}),e.provide(et.FORMS_CONFIG,A);const T=e.ref(""),V=e.ref(),R=e.shallowRef(),X=e.ref(null),Y=e.ref({}),ne=e.reactive({}),M=e.reactive({}),te=e.computed(()=>{var Ce;return(Ce=X.value)==null?void 0:Ce.options}),$=e.computed(()=>{const Ce=Uj(M.name,o.rawSchema);return Fj(Ce)}),Z=e.ref(!1),F=e.ref(),J=(Ce,se)=>{Z.value=Ce??"",F.value=se},G=Ce=>{var se;(se=F.value)==null||se.call(F,Ce),Z.value=!1},v=Ce=>{var re;if(!Ce){V.value=void 0,R.value=void 0,T.value="",_(!1);return}const se=((re=o.schema)==null?void 0:re._sourcePlugin)||Ce;V.value=$w(se),R.value=h(se,o.engine)?y(se)??sp:void 0,T.value=et.getSharedFormName(se),_(!!R.value)},q=Ce=>{var xe,Ne;const se={...o.schema},re=M,Q=ne,le=Object.keys(re),de={};if(!f(Y.value))for(let g=0;g<((Ne=(xe=Y.value)==null?void 0:xe.fields)==null?void 0:Ne.length);g++)se[Y.value.fields[g].model]=Y.value.fields[g];et.customFields.forEach(g=>{se[g]&&(se[g].fields.forEach(O=>{O.fields&&O.fields.forEach(j=>{se[j.model]=j}),O.model&&(se[O.model]=O)}),delete se[g])}),le.forEach(g=>{var ue;if(!se[g]){g==="partials"&&(de[g]=re[g]);return}const O=se[g];let j=re[g];const W=Q[g],ae=Array.isArray(j)?"array":typeof j,be=O?O.valueType:null,L=O?O.valueArrayType:null,ge=O?O.transform:null;if(j==null&&W==null&&!O.submitWhenNull)return;if(O){if(be&&ae!==be)switch(be){case"array":ae==="string"&&j.length&&(j=j.split(",").map(P=>{if(P=P.trim(),L==="string")return String(P);if(L==="number")return Number(P);if(L==="boolean"){if(typeof P=="string")return P.toLowerCase()==="true"||P==="1";if(typeof P=="number")return P===1}return P})),(!j||!j.length)&&(j=O.submitWhenNull?null:[]);break;case"number":O.referenceable!==!0&&(j=Number(j));break;case"boolean":ae==="string"&&(j=j.toLowerCase()==="true"||j==="1"),ae==="number"&&(j=j===1);break;case"string":j=j==null?"":String(j);break}else be==="array"&&(!j||!j.length?j=O.submitWhenNull?null:[]:((ue=O.inputAttributes)==null?void 0:ue.type)==="number"&&(j=j.map(P=>Number(P))));if(O.type==="array"&&O.nestedFields){const P=z=>{Object.keys(z).forEach(D=>{z[D]&&typeof z[D]=="object"&&!Array.isArray(z[D])&&z[D]!==null?P(z[D]):(z[D]===void 0||z[D]===null||typeof z[D]=="number"&&isNaN(z[D])||typeof z[D]=="string"&&z[D].trim().length===0)&&delete z[D]})};j&&typeof j=="object"&&P(j)}O.type==="object-advanced"&&O.fields&&j!==null&&(Object.entries(j).length===0?j=null:Object.keys(j).forEach(P=>{Array.isArray(j[P])||(j[P]=j[P].split(","))}))}let Ee=u(g);if(O.fieldNameHasDashes){const[P,...z]=Ee.split(".").reverse();Ee=[P.replace(/_/g,"-"),...z].reverse().join(".")}if(be==="object-expand"){let P;[Ee,P]=Ee.split(".");let z={};de[Ee]&&(z=de[Ee]),z[P]=j,j=z}W!==void 0&&j===""&&j!==W?de[Ee]=be==="object"?{}:null:O.type==="checklist"&&j===""?de[Ee]=[]:j!==""&&(de[Ee]=j),de[Ee]=ge?ge(j):de[Ee],m(Ee,de)});const _e=p(de);if(R.value){if(Ce&&Ce.length)for(const g of Ce)delete _e[g];Object.assign(_e,Be.value)}return _e},ie=(Ce,se={})=>{d(M,se,Ce,o.editing),r("model-updated",{model:M,originalModel:ne,data:q()})},oe=(Ce,se)=>{var le;const re={[se]:Ce};typeof((le=o.schema[se])==null?void 0:le.modelTransformer)=="function"&&(re[se]=o.schema[se].modelTransformer(Ce));const Q=Object.assign({},M,re);Object.assign(M,Q),r("model-updated",{model:M,originalModel:ne,data:q()})},ke=Ce=>{r("validity-change",Ce)},ye=(Ce,se)=>{Object.keys(Ce).forEach(re=>{var xe,Ne;let Q=se?`${se}-${re}`:re,le=o.schema[Q];if(!le){const g=se?`${se}-${re.replace(/-/g,"_")}`:re.replace(/-/g,"_");(xe=o.schema[g])!=null&&xe.fieldNameHasDashes&&(Q=g,le=o.schema[Q]),se&&((Ne=o.schema[se])==null?void 0:Ne.keyFromObject)===re&&(Q=se,le=o.schema[Q])}const de=Ce[re],_e=typeof de;if(le&&le.type==="object-advanced"&&!de){M[Q]={},ne[Q]={};return}if(Array.isArray(de)){M[Q]=JSON.parse(JSON.stringify(de)),ne[Q]=JSON.parse(JSON.stringify(de));return}if(_e==="object"&&de&&!de.length)return ye(de,Q);if(_e==="object"&&de&&de.length&&le.type==="input"){M[Q]=de.join(", "),ne[Q]=de.join(", ");return}M[Q]=de,ne[Q]=de}),r("model-updated",{model:M,originalModel:ne,data:q()})},ce=(Ce,se)=>{if(!se)return Ce;if(Array.isArray(Ce)){const le=se.elements;return le?Ce.map(de=>ce(de,le)):Ce}if(!Ce||typeof Ce!="object")return Ce;if(se.type==="map"&&se.values){const le=se.values,de={};for(const _e of Object.keys(Ce))de[_e]=ce(Ce[_e],le);return de}if(!Array.isArray(se.fields))return Ce;const re=new Map;for(const le of se.fields){const de=le&&Object.keys(le)[0];de&&re.set(de,le[de])}const Q={};for(const le of Object.keys(Ce)){const de=re.get(le);de&&(Q[le]=ce(Ce[le],de))}return Q},he=()=>{var re;const Ce=(re=o.rawSchema)==null?void 0:re.fields;if(!Array.isArray(Ce))return;const se=Ce.find(Q=>Q==null?void 0:Q.config);return se==null?void 0:se.config},Oe=new Set(["datakit"]),De=e.computed(()=>{var Ce;return((Ce=o.schema)==null?void 0:Ce._sourcePlugin)||M.name}),Be=e.shallowRef(o.record),Ge=(Ce,se)=>{const re=Oe.has(De.value)?Ce:{...Ce,config:ce(Ce.config,he())};Be.value=re;const Q={...M};for(const le of se||[])delete Q[le];r("model-updated",{model:{...Q,...re},originalModel:ne,data:q(se)})},We=e.ref(!0),nt=()=>{var Ce;if(o.record&&o.schema&&(ye({enabled:o.record.enabled??!0,...o.record.instance_name&&{instance_name:o.record.instance_name||""},...a&&o.record.condition!=null&&{condition:o.record.condition},...o.record.protocols&&{protocols:o.record.protocols},...o.record.tags&&{tags:o.record.tags}}),o.credential?((o.record.consumer_id||o.record.consumer)&&ye({consumer_id:o.record.consumer_id||o.record.consumer}),ye(o.record)):o.record.config&&((o.record.consumer_id||o.record.consumer||o.record.service_id||o.record.service||o.record.route_id||o.record.route||o.record.consumer_group_id||o.record.consumer_group)&&ye({service_id:o.record.service_id||o.record.service,route_id:o.record.route_id||o.record.route,consumer_id:o.record.consumer_id||o.record.consumer,consumer_group_id:o.record.consumer_group_id||o.record.consumer_group}),o.record.partials&&ie("redis",{partials:o.record.partials}),R.value?Ge(o.record):ye(o.record.config,"config"))),Object.keys(o.entityMap).length&&!o.entityMap.global&&o.schema){const se={};for(const re in o.entityMap){const Q=o.entityMap[re].id,le=o.entityMap[re].idField,de=le==="consumer_group_id"?"consumer_group-id":JSON.parse(JSON.stringify(le).replace("_","-"));Object.prototype.hasOwnProperty.call(M,de)&&(se[de]=Q)}ye(se)}if((Ce=o.entityMap.consumer)!=null&&Ce.id&&o.schema&&o.credential){const se={};Object.prototype.hasOwnProperty.call(M,"consumer")&&(se.consumer=o.entityMap.consumer.id),ye(se)}We.value=!1};return e.watch(We,Ce=>{r("loading",Ce)}),e.watch(()=>o.schema,(Ce,se)=>{var Q,le;if(k(Ce||{},se||{}))return;const re=l(Ce,void 0,void 0,o.engine);Object.assign(M,re.model),Y.value={fields:(le=(Q=Y.value)==null?void 0:Q.fields)==null?void 0:le.map(de=>({...de,disabled:de.disabled||!1}))},Object.assign(ne,JSON.parse(JSON.stringify(re.model))),v(re.model.name),nt()},{immediate:!0,deep:!0}),e.onBeforeMount(()=>{var Ce,se,re,Q;X.value=l(o.schema,void 0,void 0,o.engine),Object.assign(M,((Ce=X.value)==null?void 0:Ce.model)||{}),Y.value=((se=X.value)==null?void 0:se.schema)||{},v((Q=(re=X.value)==null?void 0:re.model)==null?void 0:Q.name),nt()}),e.onBeforeUnmount(()=>{_(!1)}),(Ce,se)=>{var Q,le,de;const re=e.resolveComponent("KSkeleton");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",qj,[We.value?(e.openBlock(),e.createBlock(re,{key:0,type:"form"})):M.id&&n.editing||!n.editing?(e.openBlock(),e.createElementBlock("div",Gj,[R.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(R.value),{key:0,developer:n.developer,"field-renderers":(Q=V.value)==null?void 0:Q.fieldRenderers,"form-model":M,"form-schema":Y.value,"is-editing":n.editing,"is-konnect-managed-redis-enabled":i.value,model:n.record,"on-form-change":Ge,"on-validity-change":ke,"plugin-name":M.name,"render-rules":(le=V.value)==null?void 0:le.renderRules,schema:$.value,"onClick:createEntity":se[0]||(se[0]=_e=>Ce.$emit("click:create-entity",_e)),"onClick:learnMore":se[1]||(se[1]=_e=>Ce.$emit("click:learn-more",_e)),onGlobalAction:se[2]||(se[2]=(_e,xe)=>Ce.$emit("globalAction",_e,xe))},e.createSlots({_:2},[n.enableVaultSecretPicker?{name:e.unref(et.AUTOFILL_SLOT_NAME),fn:e.withCtx(_e=>[_e.schema.referenceable?(e.openBlock(),e.createBlock(e.unref(ya.VaultSecretPickerProvider),e.mergeProps({key:0},_e,{onOpen:J}),null,16)):e.createCommentVNode("",!0)]),key:"0"}:void 0]),1064,["developer","field-renderers","form-model","form-schema","is-editing","is-konnect-managed-redis-enabled","model","plugin-name","render-rules","schema"])):T.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(et.sharedForms)[T.value]),{key:1,"enable-redis-partial":n.enableRedisPartial,"form-model":M,"form-options":te.value,"form-schema":Y.value,"identity-principals-ui-enabled":e.unref(s),"is-editing":n.editing,"is-konnect-managed-redis-enabled":i.value,"on-model-updated":oe,"on-partial-toggled":ie,"show-new-partial-modal":_e=>Ce.$emit("showNewPartialModal",_e),"onClick:createEntity":se[3]||(se[3]=_e=>Ce.$emit("click:create-entity",_e)),"onClick:learnMore":se[4]||(se[4]=_e=>Ce.$emit("click:learn-more",_e))},e.createSlots({_:2},[n.enableVaultSecretPicker?{name:e.unref(et.AUTOFILL_SLOT_NAME),fn:e.withCtx(_e=>[_e.schema.referenceable?(e.openBlock(),e.createBlock(e.unref(ya.VaultSecretPickerProvider),e.mergeProps({key:0},_e,{onOpen:J}),null,16)):e.createCommentVNode("",!0)]),key:"0"}:void 0]),1064,["enable-redis-partial","form-model","form-options","form-schema","identity-principals-ui-enabled","is-editing","is-konnect-managed-redis-enabled","show-new-partial-modal"])):(e.openBlock(),e.createBlock(e.unref(et.VueFormGenerator),{key:2,"enable-redis-partial":n.enableRedisPartial,"is-editing":n.editing,"is-konnect-managed-redis-enabled":i.value,model:M,options:te.value,schema:Y.value,onModelUpdated:oe,onPartialToggled:ie,onRefreshModel:q,onShowNewPartialModal:se[5]||(se[5]=_e=>Ce.$emit("showNewPartialModal",_e))},e.createSlots({"plugin-config-empty-state":e.withCtx(()=>[e.createElementVNode("div",Hj,e.toDisplayString(e.unref(C)("plugins.form.grouping.plugin_configuration.empty")),1)]),_:2},[(de=e.unref(Rn)[M.name])!=null&&de.fieldRules&&(o.config.isNewOtelSchema||M.name!=="opentelemetry")?{name:"plugin-config-before-content",fn:e.withCtx(()=>[e.createVNode($j,{rules:e.unref(Rn)[M.name].fieldRules},null,8,["rules"])]),key:"0"}:void 0,n.enableVaultSecretPicker?{name:e.unref(et.AUTOFILL_SLOT_NAME),fn:e.withCtx(_e=>[_e.schema.referenceable?(e.openBlock(),e.createBlock(e.unref(ya.VaultSecretPickerProvider),e.mergeProps({key:0},_e,{onOpen:J}),null,16)):e.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["enable-redis-partial","is-editing","is-konnect-managed-redis-enabled","model","options","schema"]))])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(ya.VaultSecretPicker),{config:o.config,setup:Z.value,onCancel:se[6]||(se[6]=()=>Z.value=!1),onProceed:G},null,8,["config","setup"])],64)}}}),[["__scopeId","data-v-7f30f062"]]),Wj={key:1},Yj=e.defineComponent({__name:"PluginFormActionsWrapper",props:{teleportTarget:{type:String,default:""}},setup(n){return(t,r)=>n.teleportTarget?(e.openBlock(),e.createBlock(e.Teleport,{key:0,to:n.teleportTarget},[e.renderSlot(t.$slots,"default")],8,["to"])):(e.openBlock(),e.createElementBlock("div",Wj,[e.renderSlot(t.$slots,"default")]))}}),Jj={key:0},Xj={class:"plugin-form-actions"},Zj={key:0,class:"button-customize-deck-wrapper"},Qj=je(e.defineComponent({__name:"PluginForm",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||n.app==="konnect"&&!n.controlPlaneId||n.app==="kongManager"&&typeof n.workspace!="string")},pluginType:{type:String,required:!0},pluginId:{type:String,default:null},hideScopeSelection:{type:Boolean,default:!1},disableScopeSelection:{type:Boolean,default:!1},credential:{type:Boolean,default:!1},developer:{type:Boolean,default:!1},isWizardStep:{type:Boolean,default:!1},actionsTeleportTarget:{type:String,default:""},noCardWrapper:{type:Boolean,default:!1},hideViewConfigAction:{type:Boolean,default:!1},enableVaultSecretPicker:{type:Boolean,default:!1},schema:{type:Object,default:null},enableRedisPartial:{type:Boolean,default:!1},scopedEntitiesPermissions:{type:Object,default:null},engine:{type:String,required:!1,default:void 0}},emits:["cancel","error:fetch-schema","error","loading","update","model-updated","showNewPartialModal","globalAction","click:create-entity","click:learn-more"],setup(n,{emit:t}){var Ee,ue;const r=e.inject(fr.KM_2306_CONDITION_FIELD_314,!1),o=e.inject(fr.KM_2485_CLONED_PLUGINS,!1),i=e.ref(!1);e.provide(Ie.PLUGIN_FORM_LAYOUT_STATE,i);const a=t,s=n,c=Ar.useRouter(),{i18n:{t:l}}=st.useI18n(),{customSchemas:u,typedefs:p}=st.useSchemas({app:s.config.app,credential:s.credential,experimentalRenders:s.config.app==="konnect"?s.config.experimentalRenders:void 0}),{formatPluginFieldLabel:d}=st.usePluginHelpers(),{shouldUseFreeForm:f}=st.useFreeFormResolver(),{getMessageFromError:m}=Ie.useErrors(),{capitalize:h}=Ie.useStringHelpers(),{objectsAreEqual:y}=Ie.useHelpers(),{axiosInstance:b}=Ie.useAxios((Ee=s.config)==null?void 0:Ee.axiosRequestConfig),{getClonedPlugin:_}=st.useCustomPluginApi({axiosInstance:Ie.useAxios({...((ue=s.config)==null?void 0:ue.axiosRequestConfig)??{},konnect:{bypassGlobal404Handler:!0}}).axiosInstance,apiBaseUrl:s.config.apiBaseUrl,app:s.config.app,workspace:s.config.workspace,controlPlaneId:s.config.controlPlaneId}),k=e.ref(!1),C=e.computed(()=>!!s.pluginId),N=e.computed(()=>s.pluginId?Ie.EntityBaseFormType.Edit:Ie.EntityBaseFormType.Create),E=e.ref(void 0),w=e.ref(void 0),S=e.computed(()=>!!(s.credential&&s.config.entityId)),I=e.ref(void 0),U=e.ref({}),x=e.ref(),A=e.ref(),T=e.inject(fr.KM_2503_CUSTOM_PLUGIN_FREEFORM,!1),V=e.ref(null),R=e.computed(()=>V.value!==null),X=e.computed(()=>R.value&&V.value?V.value:s.pluginType),Y=e.computed(()=>{if(s.engine)return s.engine;if(!(!T||!Ne.value))return R.value&&V.value?f(V.value)?"freeform":"vfg":"freeform"}),ne=e.computed(()=>f(s.pluginType,Y.value));e.provide(Pi,{redisType:x,redisPath:A,isEditing:C.value});const M=[];e.provide(uw,P=>(M.push(P),()=>{const z=M.indexOf(P);z!==-1&&M.splice(z,1)}));const te=e.ref(!1),{isDeckEnabled:$,deckCustomizationOptions:Z,deckCalloutPreferenceKey:F}=Ie.useBaseFormDeckOptions(()=>s.config,Ie.SupportedEntityType.Plugin),J=e.ref(!1),G=e.reactive({enabled:!0,protocols:[],tags:[]}),v=e.reactive({fields:{enabled:!0,protocols:[],tags:[]},isReadonly:!1,clientErrorMessage:"",serverErrorMessage:""}),q=e.ref([{title:l("view_configuration.json"),hash:"#json"},{title:l("view_configuration.yaml"),hash:"#yaml"}]);s.config.app==="konnect"&&q.value.splice(1,0,{title:l("view_configuration.terraform"),hash:"#terraform"}),$.value&&q.value.push({title:l("view_configuration.deck"),hash:"#deck"});const ie=e.ref(q.value[0].hash),oe=e.ref(""),ke=e.computed(()=>{var z;if(S.value){let D=tt.form[s.config.app].credential[N.value];return D=D.replace(/{resourceEndpoint}/gi,Oe.value),D}let P;return s.config.entityType&&s.config.entityId?P=tt.form[s.config.app].edit.forEntity.replace(/{entityType}/gi,s.config.entityType).replace(/{entityId}/gi,s.config.entityId):P=tt.form[s.config.app].edit.all,s.config.app==="konnect"&&((z=Rn[s.pluginType])!=null&&z.useUIData)?`${P}?__ui_data=true`:P}),ye=()=>{k.value=!k.value},ce=e.computed(()=>{var Se,Ve,Me,Ze,Ye,Te,Ae,bt;const P=s.config.entityType==="consumers"&&s.config.entityId||((Ve=(Se=I.value)==null?void 0:Se.consumer)==null?void 0:Ve.id),z=s.config.entityType==="consumer_groups"&&s.config.entityId||((Ze=(Me=I.value)==null?void 0:Me.consumer_group)==null?void 0:Ze.id),D=s.config.entityType==="services"&&s.config.entityId||((Te=(Ye=I.value)==null?void 0:Ye.service)==null?void 0:Te.id),pe=s.config.entityType==="routes"&&s.config.entityId||((bt=(Ae=I.value)==null?void 0:Ae.route)==null?void 0:bt.id);if(!(P||z||D||pe))return{global:{entity:fe.PluginScope.GLOBAL,entityEndpoint:"plugins"}};const we={};return D&&(we.service={entity:fe.PluginScope.SERVICE,entityEndpoint:"services",id:D,idField:wo.SERVICE}),pe&&(we.route={entity:fe.PluginScope.ROUTE,entityEndpoint:"routes",id:pe,idField:wo.ROUTE}),P&&(we.consumer={entity:fe.PluginScope.CONSUMER,entityEndpoint:"consumers",id:P,idField:wo.CONSUMER}),z&&(we.consumer_group={entity:fe.PluginScope.CONSUMER_GROUP,entityEndpoint:"consumer_groups",id:z,idField:wo.CONSUMER_GROUP}),s.config.entityType&&(we.focusedEntity={entity:fe.PluginScope[s.config.entityType.substring(0,s.config.entityType.length-1).toUpperCase()],entityEndpoint:s.config.entityType,id:s.config.entityId,idField:wo[s.config.entityType.substring(0,s.config.entityType.length-1).toUpperCase()]}),we}),he=e.reactive({name:{default:s.pluginType,type:"input",inputType:"hidden",styleClasses:"d-none hidden-field",pinned:!0},enabled:{type:"switch",model:"enabled",label:l("plugins.form.fields.enabled.label"),textOn:l("plugins.form.fields.enabled.on_text"),textOff:l("plugins.form.fields.enabled.off_text"),styleClasses:"field-switch hide-label",default:!0,pinned:!0},selectionGroup:{type:s.hideScopeSelection&&(s.hideScopeSelection||N.value===Ie.EntityBaseFormType.Create&&s.config.entityId)?"foreign":"selectionGroup",disabled:s.disableScopeSelection,inputType:"hidden",styleClasses:"hide-label",fields:[{label:l("plugins.form.scoping.global.label"),description:l("plugins.form.scoping.global.help")}],pinned:!0},protocols:{id:"protocols",default:[],help:l("plugins.form.fields.protocols.help"),label:l("plugins.form.fields.protocols.label"),required:!0,styleClasses:"plugin-protocols-select",type:"multiselect",values:[{label:"grpc",value:"grpc"},{label:"grpcs",value:"grpcs"},{label:"http",value:"http"},{label:"https",value:"https"},{label:"tcp",value:"tcp"},{label:"tls",value:"tls"},{label:"tls_passthrough",value:"tls_passthrough"},{label:"udp",value:"udp"},{label:"ws",value:"ws"},{label:"wss",value:"wss"}]},instance_name:{default:"",type:"input",label:l("plugins.form.fields.instance_name.label"),inputType:"text",help:l("plugins.form.fields.instance_name.help")},tags:p.tags,...r?{condition:{default:"",type:"input",label:l("plugins.form.fields.condition.label"),inputType:"text",help:l("plugins.form.fields.condition.tooltip"),placeholder:l("plugins.form.fields.condition.placeholder")}}:{}}),Oe=e.computed(()=>{var D;const P=s.developer?"developers":"consumers",z=((D=fi[s.pluginType])==null?void 0:D.endpoint)||"/plugins";return`${P}/${s.config.entityId}${s.developer?"/credentials":""}${z}`}),De=P=>{const z=Array.from(new Set(P.map(D=>typeof D)));return z.length>1?"string":z[0]},Be=(P,z,D,pe)=>{var Me,Ze;let we=z&&z.fields||[];const Se=u[X.value],Ve=(Ze=(Me=fi[s.pluginType])==null?void 0:Me.schema)==null?void 0:Ze.fields;return Array.isArray(we)&&(we=we.reduce((Ye,Te)=>{const Ae=Object.keys(Te)[0];return Ae.match(/-/g)?Ye[Ae.replace(/-/g,"_")]={...Te[Ae],fieldNameHasDashes:!0}:Ye[Ae]=Te[Ae],Ye},{})),Object.keys(we).sort().forEach(Ye=>{var lr,vt,en,il,al,sl,ll;const Te=we[Ye];Te.type==="set"&&!(ne.value&&Te.elements.one_of)&&(Te.type="array");const Ae=P?`${P}-${Ye}`:`${Ye}`;if((lr=Se==null?void 0:Se.fieldsToDelete)!=null&&lr.includes(Ae)){$y(D,Ae);return}if(Object.prototype.hasOwnProperty.call(Te,"overwrite")||Te.hidden)return;if(Te.type==="table")return Be(Ae,Te.schema,D);if(Te.fields)return pe&&Te.type==="record"?(D[Ae]={type:"object",model:Ye,schema:{fields:Object.values(Be(Ae,Te,{},!0))}},D):Be(Ae,Te,D);if(D[Ae]={id:Ae,model:Ye},D[Ae].type=Te.type==="boolean"?"checkbox":"input",D[Ae].required=Te.required,D[Ae].referenceable=Te.referenceable,Ae.startsWith("config-"))if(!pe&&Te.type==="array"&&(oe.value=Ae),pe&&oe.value&&Ae.startsWith(oe.value)){const dt=Ae.slice(oe.value.length+1);D[Ae].label=dt.split("-").map(d).join(".")}else D[Ae].label=d(Ae);if((P==="config"||P.startsWith("config-"))&&(vt=we[Ye])!=null&&vt.description&&(D[Ae].help=cl.marked.parse(we[Ye].description,{mangle:!1,headerIds:!1})),Te.type==="map"){if(D[Ae].type="object-advanced",D[Ae].values=Te.values,Te.values.type==="array"){const{type:dt}=Te.values.elements||{};D[Ae].schema={fields:[{schema:{fields:[{...ft,model:Ae,valueArrayType:dt==="integer"?"number":dt||"string",inputAttributes:{...ft.inputAttributes,type:dt==="integer"?"number":"text",inputMode:dt==="integer"?"numeric":"text"}}]}}]}}else Te.values.fields&&(D[Ae].schema={fields:[{type:"object",model:"object",schema:{fields:Te.values.fields.map(dt=>{const tn=Object.keys(dt)[0];return{model:tn,type:"input",label:h(tn),placeholder:tn,inputType:dt[tn].type}})}}]});return D}if(Te.enum&&Te.type==="array"&&(D[Ae].type="checklist",D[Ae].values=Te.enum,D[Ae].multi=!0,D[Ae].multiSelect=!0),Te.one_of&&Te.type!=="array"&&(D[Ae].type="select",D[Ae].values=Te.one_of,D[Ae].selectOptions={noneSelectedText:l("plugins.form.no_selection")}),Te.elements&&Te.type==="array"){const dt=Te.elements;if(D[Ae].referenceable=dt.referenceable,D[Ae].elements=dt,["string","integer","number"].includes(dt.type)&&!dt.one_of){const{id:tn,help:It,label:ht,hint:ct,values:Nt,referenceable:wt,model:Pn}=D[Ae],{inputAttributes:Wn,...qg}=JSON.parse(JSON.stringify(ft));Wn.type=dt.type==="string"?"text":"number",D[Ae]={id:tn,help:It,label:ht,hint:ct,values:Nt,referenceable:wt,model:Pn,inputAttributes:Wn,...qg}}else if(["string","integer","number"].includes(dt.type)&&dt.one_of){if(pe){const{id:tn,help:It,label:ht,hint:ct,values:Nt,referenceable:wt,model:Pn}=D[Ae];D[Ae]={id:tn,help:It,label:ht,hint:ct,values:Nt,referenceable:wt,model:Pn,...Tj(dt.one_of,Te.default)}}}else if(dt.type==="array"){const{id:tn,help:It,label:ht,hint:ct,values:Nt,referenceable:wt,model:Pn,elements:Wn}=D[Ae],{inputAttributes:qg,...JK}=JSON.parse(JSON.stringify(ft));D[Ae]={id:tn,help:It,label:ht,hint:ct,values:Nt,referenceable:wt,model:Pn,elements:Wn,inputAttributes:qg,...JK}}}if(Te.hint&&(D[Ae].hint=Te.hint),Se&&!Se.overwriteDefault&&Object.keys(Se).forEach(dt=>{if(dt===Ae){const{help:tn,label:It,hint:ht,values:ct,referenceable:Nt,elements:wt}=D[Ae],{help:Pn,...Wn}=Se[dt];D[Ae]={help:tn,label:It,hint:ht,values:ct,referenceable:Nt,elements:wt,...Wn},typeof Pn=="string"&&(D[Ae].help=cl.marked.parse(Pn,{mangle:!1,headerIds:!1}))}}),Te.type==="array"&&((en=Te.elements)==null?void 0:en.type)==="record"&&Array.isArray(Te.elements.fields)){let dt={};for(const It of Te.elements.fields)dt={...dt,...It};const tn=(sl=(al=(il=D[Ae])==null?void 0:il.items)==null?void 0:al.schema)==null?void 0:sl.fields;if(Array.isArray(tn))for(const It of D[Ae].items.schema.fields){const ht=(ll=dt[It.model])==null?void 0:ll.description;It.help===void 0&&typeof ht=="string"&&(It.help=cl.marked.parse(ht,{mangle:!1,headerIds:!1}))}if(tn||(D[Ae].type="array",D[Ae].newElementButtonLabelClasses="kong-form-new-element-button-label",D[Ae].fieldClasses="array-card-container-wrapper",D[Ae].itemContainerComponent="FieldArrayCardContainer",D[Ae].items={type:"object",schema:{fields:Object.values(Be(Ae,Te.elements,{},!0))}},D[Ae].items.schema.fields.forEach(It=>{var ht,ct;for(const Nt of Te.elements.fields){const wt=Object.keys(Nt)[0],Pn=((ct=(ht=It.id)==null?void 0:ht.split)==null?void 0:ct.call(ht,"-"))??[];if(Pn[Pn.length-1]===wt){It.model=wt,It.label=d(wt);break}}}),Te.elements.type==="record"&&(D[Ae].nestedFields=!0)),!D[Ae].nestedFields)D[Ae].items.default=()=>Te.elements.fields.reduce((It,ht)=>{const ct=Object.keys(ht)[0];return It[ct]=ht[ct].default,It},{});else{const It=(ht,ct)=>{if(ht.type==="object"){ht.model&&(ct[ht.model]={});for(const Nt of ht.schema.fields)It(Nt,ht.model?ct[ht.model]:ct)}else ht.model&&(ct[ht.model]=ht.default)};D[Ae].items.default=()=>{const ht={};return It(D[Ae].items,ht),ht}}}if(S.value&&Ve){for(let dt=0;dt<Ve.length;dt++)if(Ve[dt][Ae]){D[Ae]={...D[Ae],...Ve[dt][Ae]};break}}if(Te.required&&Te.type!=="boolean"&&(D[Ae].required=!0,D[Ae].selectOptions={hideNoneSelectedText:!0}),Te.required&&Te.type==="boolean"&&(D[Ae].default=Te.default??!1),Te.default!=null&&typeof Te.default!="object"&&Te.default!=="function"&&(D[Ae].default=Te.default),D[Ae].type==="input"){["string","number"].includes(typeof D[Ae].default)&&s.config.app==="konnect"&&(D[Ae].placeholder=`Default: ${D[Ae].default===""?"<empty string>":D[Ae].default}`);const{type:dt}=Te.elements||{};dt&&(D[Ae].valueArrayType=dt==="integer"?"number":dt),D[Ae].inputType=Te.type==="array"||Te.type==="string"?Te.encrypted?"password":"text":Te.type}let bt="string";Te.enum?bt=De(Te.enum):Te.type==="boolean"?bt="boolean":Te.type==="number"||Te.type==="integer"?(bt="number",D[Ae].inputType="number"):Te.type==="array"?(bt="array",D[Ae].default=Te.default,Te.len_min>0&&(D[Ae].submitWhenNull=!0)):Te.type==="foreign"?bt="object":Te.default&&Array.isArray(Te.default)?(bt="array",D[Ae].valueArrayType=De(Te.default)):Te.default&&(bt=typeof Te.default),D[Ae].valueType=bt,Te.fieldNameHasDashes&&(D[Ae].fieldNameHasDashes=!0)}),D},Ge=()=>{var bt,lr,vt,en,il,al,sl,ll,dt,tn,It,ht;const P=R.value&&V.value?V.value:s.pluginType,z=((bt=Rn[P])==null?void 0:bt.scope.includes(fe.PluginScope.SERVICE))??!0,D=((lr=Rn[P])==null?void 0:lr.scope.includes(fe.PluginScope.ROUTE))??!0,pe=((vt=Rn[P])==null?void 0:vt.scope.includes(fe.PluginScope.CONSUMER))??!0,we=s.config.disableConsumerGroupScope?!1:((en=Rn[P])==null?void 0:en.scope.includes(fe.PluginScope.CONSUMER_GROUP))??!0,Se=s.config.entityType==="consumers"&&!!s.config.entityId||!!((al=(il=I.value)==null?void 0:il.consumer)!=null&&al.id),Ve=s.config.entityType==="consumer_groups"&&!!s.config.entityId||!!((ll=(sl=I.value)==null?void 0:sl.consumer_group)!=null&&ll.id),Me=s.config.entityType==="services"&&!!s.config.entityId||!!((tn=(dt=I.value)==null?void 0:dt.service)!=null&&tn.id),Ze=s.config.entityType==="routes"&&!!s.config.entityId||!!((ht=(It=I.value)==null?void 0:It.route)!=null&&ht.id),Ye=[],Te=(ct,Nt,wt)=>ct?l("plugins.form.disable_source_scope_change",{scope:wt}):Nt?l("plugins.form.disable_data_retrieving",{scope:wt}):"",Ae=ct=>{var Nt,wt;return((wt=(Nt=s.scopedEntitiesPermissions)==null?void 0:Nt[ct])==null?void 0:wt.canRetrieve)===!1};if(z){const ct=Ae("service"),Nt="services",wt=Me&&s.disableScopeSelection;Ye.push({id:"service-id",model:"service-id",label:l("plugins.form.scoping.gateway_service.label"),placeholder:l("plugins.form.scoping.placeholder"),type:"AutoSuggest",labelField:"name",entity:Nt,inputValues:{fields:["name","id"]},help:l("plugins.form.scoping.gateway_service.help"),disabled:wt||ct,disabledTooltip:Te(wt,ct,Nt)})}if(D){const ct=Ae("route"),Nt="routes",wt=Ze&&s.disableScopeSelection;Ye.push({id:"route-id",model:"route-id",label:l("plugins.form.scoping.route.label"),placeholder:l("plugins.form.scoping.placeholder"),type:"AutoSuggest",entity:Nt,labelField:"name",inputValues:{fields:["name","id"],primaryField:"id"},help:l("plugins.form.scoping.route.help"),disabled:wt||ct,disabledTooltip:Te(wt,ct,Nt)})}if(pe){const ct=Ae("consumer"),Nt="consumers",wt=Se&&s.disableScopeSelection;Ye.push({model:"consumer-id",label:l("plugins.form.scoping.consumer.label"),placeholder:l("plugins.form.scoping.placeholder"),type:"AutoSuggest",entity:Nt,labelField:"username",inputValues:{fields:["username","custom_id","id"],primaryField:"username"},help:l("plugins.form.scoping.consumer.help"),disabled:wt||ct,disabledTooltip:Te(wt,ct,Nt)})}if(we){const ct=Ae("consumer_group"),Nt="consumer_groups",wt=Ve&&s.disableScopeSelection;Ye.push({model:"consumer_group-id",label:l("plugins.form.scoping.consumer_group.label"),placeholder:l("plugins.form.scoping.placeholder"),type:"AutoSuggest",entity:Nt,entityDataKey:"consumer_group",labelField:"name",inputValues:{fields:["name","id"],primaryField:"name"},help:l("plugins.form.scoping.consumer_group.help"),disabled:wt||ct,disabledTooltip:Te(wt,ct,Nt)})}if(Ye.length){const ct=[...z?["service"]:[],...D?["route"]:[],...pe?["consumer"]:[],...we?["consumer_group"]:[]],wt=ct.splice(ct.length-2,2).map(Wn=>l(Wn==="service"?"plugins.form.scoping.gateway_service.plural":`plugins.form.scoping.${Wn}.plural`)).join(`${ct.length>0?",":""} and/or `),Pn=["Specific",[...ct.length>0?[ct.map(Wn=>l(Wn==="service"?"plugins.form.scoping.gateway_service.plural":`plugins.form.scoping.${Wn}.plural`)).join(", ")]:[],wt].join(", ")].join(" ");he.selectionGroup.fields.push({label:l("plugins.form.scoping.label"),description:Pn,fields:[]}),he.selectionGroup.fields[1].fields=Ye}u[X.value]&&u[X.value].overwriteDefault&&Object.hasOwnProperty.call(u[X.value],"formSchema")&&Object.assign(he,u[X.value].formSchema)},We=e.computed(()=>!y(v.fields,G,!0)),nt=e.computed(()=>!be.value&&!J.value&&(N.value===Ie.EntityBaseFormType.Create||We.value)),lt=e.ref(!1),Re=e.ref(),Ce=P=>{s.credential&&P.password&&(P.password=""),v.fields.id=(P==null?void 0:P.id)||void 0,Re.value=P==null?void 0:P.ordering,Object.assign(G,v.fields),I.value=P,lt.value=!0},se=e.ref({}),re=P=>{var z;v.fields=P.model,v.fields.id=((z=I.value)==null?void 0:z.id)||void 0,Object.assign(G,P.originalModel),se.value=P.data,s.isWizardStep&&a("model-updated",{model:v.fields,data:P.data,resourceEndpoint:Oe.value})},Q=e.ref(new Map),le=e.computed(()=>[v.clientErrorMessage,v.serverErrorMessage].filter(Boolean).join("; ")),de=P=>{P.valid?Q.value.delete(P.model):Q.value.set(P.model,P.error),v.clientErrorMessage=[...Q.value.entries()].map(([z,D])=>`${z}: ${typeof D=="string"?D:m(D)}`).join("; "),v.clientErrorMessage&&(v.serverErrorMessage="")};e.watch([ce,lt],(P,z)=>{const D=P[0]!==z[0],pe=P[1],we=z[1];if(!S.value&&N.value===Ie.EntityBaseFormType.Edit&&(D||pe&&pe!==we)){const Se=Be("config",U.value,he);Ne.value&&(Se._isCustomPlugin=!0),R.value&&V.value&&(Se._sourcePlugin=V.value),x.value&&(Se._supported_redis_partial_type=x.value),w.value=Se}},{deep:!0});const _e=()=>{s.config.cancelRoute?c.push(s.config.cancelRoute):a("cancel")},xe=e.computed(()=>{const P=s.config.entityType&&s.config.entityId&&!s.developer,z=S.value?tt.form[s.config.app].credential[N.value]:tt.form[s.config.app][N.value][P?"forEntity":"all"];let D=`${s.config.apiBaseUrl}${z}`;return s.config.app==="konnect"&&(D=D.replace(/{controlPlaneId}/gi,s.config.controlPlaneId||"")),D=D.replace(/\/{workspace}/gi,s.config.workspace?`/${s.config.workspace}`:""),D=D.replace(/{resourceEndpoint}/gi,Oe.value),D=D.replace(/{id}/gi,s.pluginId??""),D=D.replace(/{entityType}/gi,s.config.entityType||""),D=D.replace(/{entityId}/gi,s.config.entityId||""),D}),Ne=e.computed(()=>!Object.keys(Rn).includes(s.pluginType)),g=e.computed(()=>{const P=se.value;if(S.value){for(const z in fe.PluginScope){const D=fe.PluginScope[z];P[D]&&!P[D].id&&(P[D]={id:s.config.entityId})}delete P.created_at}return se.value.partials&&A.value&&$y(P,A.value),P}),O=e.computed(()=>{const{__ui_data:P,...z}={...g.value};return z}),j=async()=>{if(M.every(P=>P())&&!v.clientErrorMessage&&!s.isWizardStep)try{v.isReadonly=!0;let P;const z=JSON.parse(JSON.stringify(g.value)),D=u[X.value];!ne.value&&typeof(D==null?void 0:D.shamefullyTransformPayload)=="function"&&D.shamefullyTransformPayload({originalModel:G,model:v.fields,payload:z,schema:w.value}),N.value==="create"?P=await b.post(xe.value,z):N.value==="edit"&&(P=s.config.app==="konnect"||x.value&&z.partials?await b.put(xe.value,Object.assign({ordering:Re.value},z)):await b.patch(xe.value,z)),Object.assign(G,v.fields),a("update",P==null?void 0:P.data)}catch(P){v.serverErrorMessage=m(P),a("error",P)}finally{v.isReadonly=!1}},W=e.computed(()=>{var pe;const P=S.value?(pe=fi[s.pluginType])==null?void 0:pe.schemaEndpoint:s.pluginType,z=S.value?tt.form[s.config.app].credentialSchema:tt.form[s.config.app].pluginSchema;let D=`${s.config.apiBaseUrl}${z}`;return s.config.app==="konnect"&&(D=D.replace(/{controlPlaneId}/gi,s.config.controlPlaneId||"")),D.replace(/\/{workspace}/gi,s.config.workspace?`/${s.config.workspace}`:"").replace(/{plugin}/gi,P)}),ae=e.ref(""),be=e.ref(!1),L=e.ref("");e.onBeforeMount(async()=>{var P,z,D,pe;be.value=!0;try{if(S.value&&s.config.app==="konnect"){const we=(P=fi[s.pluginType])==null?void 0:P.schemaEndpoint,Se=pT[we];ae.value=we,w.value=Be("",Se,{}),be.value=!1}else{const we=o&&Ne.value,Se=s.schema?Promise.resolve(s.schema):b.get(W.value).then(Me=>Me.data),[Ve]=await Promise.all([Se,we?ge(s.pluginType):Promise.resolve()]);if(E.value=Ve,Ve)if(S.value)w.value=Be("",Ve,{}),be.value=!1;else{const Me=Ve.fields.find(Ye=>Ye.config);U.value=Me?Me.config:Ve,Ve.supported_partials&&(x.value=Object.keys(Ve.supported_partials).find(Ye=>[Dl.REDIS_CE,Dl.REDIS_EE].includes(Ye)),A.value=(z=Ve.supported_partials[x.value])==null?void 0:z[0]),Ge();const Ze=(D=Ve.fields.find(Ye=>Ye.protocols))==null?void 0:D.protocols;if(Ze){const{default:Ye=[],elements:Te={}}=Ze;he.protocols.default=Ye,he.protocols.placeholder=s.config.app==="konnect"?l("plugins.form.fields.protocols.placeholderWithDefaultValues",{protocols:Ye.join(", ")}):l("plugins.form.fields.protocols.placeholder"),(pe=Te.one_of)!=null&&pe.length&&(he.protocols.values=Te.one_of.map(Ae=>({label:Ae,value:Ae})))}if(lt.value||N.value===Ie.EntityBaseFormType.Create){const Ye=Be("config",U.value,he);x.value&&(Ye._supported_redis_partial_type=x.value),Ne.value&&(Ye._isCustomPlugin=!0),R.value&&V.value&&(Ye._sourcePlugin=V.value),w.value=Ye}}}}catch(we){console.error(we),L.value=m(we),a("error:fetch-schema",we)}finally{be.value=!1}});async function ge(P){var z;try{const D=await _(P);V.value=(D==null?void 0:D.ref)??null}catch(D){if(Zo.isAxiosError(D)&&((z=D.response)==null?void 0:z.status)===404)return;throw D}}return(P,z)=>{const D=e.resolveComponent("KSkeleton"),pe=e.resolveComponent("KEmptyState"),we=e.resolveComponent("KButton"),Se=e.resolveComponent("KTabs"),Ve=e.resolveComponent("KSlideout");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["kong-ui-entities-plugin-form-container",{"new-form-layout":i.value}])},[be.value?(e.openBlock(),e.createBlock(D,{key:0,type:"form"})):L.value?(e.openBlock(),e.createBlock(pe,{key:1,"action-button-visible":!1,"data-testid":"plugin-form-schema-error","icon-variant":"error"},{default:e.withCtx(()=>[e.createElementVNode("h3",null,e.toDisplayString(e.unref(l)("errors.load_schema")),1)]),_:1})):(e.openBlock(),e.createBlock(e.unref(Ie.EntityBaseForm),{key:2,"can-submit":nt.value,config:n.config,"edit-id":n.pluginId,"entity-type":e.unref(Ie.SupportedEntityType).Plugin,"error-message":le.value,"fetch-url":ke.value,"form-fields":g.value,"is-readonly":v.isReadonly,"no-validate":"","wrapper-component":n.noCardWrapper?"div":void 0,onCancel:_e,"onFetch:error":z[6]||(z[6]=Me=>P.$emit("error",Me)),"onFetch:success":Ce,onLoading:z[7]||(z[7]=Me=>P.$emit("loading",Me))},{"form-actions":e.withCtx(()=>[n.isWizardStep?(e.openBlock(),e.createElementBlock("div",Jj)):(e.openBlock(),e.createBlock(Yj,{key:1,"teleport-target":n.actionsTeleportTarget},{default:e.withCtx(()=>[e.createElementVNode("div",Xj,[n.hideViewConfigAction?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(we,{key:0,appearance:"tertiary","data-testid":`plugin-${C.value?"edit":"create"}-form-view-configuration`,onClick:z[5]||(z[5]=Me=>ye())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)("actions.view_configuration")),1)]),_:1},8,["data-testid"])),e.createVNode(we,{appearance:"secondary",class:"form-action-button","data-testid":`plugin-${C.value?"edit":"create"}-form-cancel`,disabled:v.isReadonly,onClick:_e},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)("actions.cancel")),1)]),_:1},8,["data-testid","disabled"]),e.createVNode(we,{appearance:"primary","data-testid":`plugin-${C.value?"edit":"create"}-form-submit`,disabled:!nt.value||v.isReadonly,type:"submit",onClick:j},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)("actions.save")),1)]),_:1},8,["data-testid","disabled"])])]),_:1},8,["teleport-target"]))]),default:e.withCtx(()=>[e.createElementVNode("form",{hidden:"",onSubmit:j},null,32),e.createVNode(zj,{config:n.config,credential:S.value,developer:n.developer,editing:N.value===e.unref(Ie.EntityBaseFormType).Edit,"enable-redis-partial":n.enableRedisPartial,"enable-vault-secret-picker":s.enableVaultSecretPicker,engine:Y.value,"entity-map":ce.value,"raw-schema":E.value,record:I.value,schema:w.value,"onClick:createEntity":z[0]||(z[0]=Me=>P.$emit("click:create-entity",Me)),"onClick:learnMore":z[1]||(z[1]=Me=>P.$emit("click:learn-more",Me)),onGlobalAction:z[2]||(z[2]=(Me,Ze)=>P.$emit("globalAction",Me,Ze)),onLoading:z[3]||(z[3]=Me=>J.value=Me),onModelUpdated:re,onShowNewPartialModal:z[4]||(z[4]=Me=>P.$emit("showNewPartialModal",Me)),onValidityChange:de},null,8,["config","credential","developer","editing","enable-redis-partial","enable-vault-secret-picker","engine","entity-map","raw-schema","record","schema"])]),_:1},8,["can-submit","config","edit-id","entity-type","error-message","fetch-url","form-fields","is-readonly","wrapper-component"])),e.createVNode(Ve,{"close-on-blur":!1,"data-testid":"form-view-configuration-slideout","has-overlay":!1,"offset-top":60,title:e.unref(l)("view_configuration.title"),visible:k.value,onClose:ye},{default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(e.unref(l)("view_configuration.message")),1),e.createVNode(Se,{modelValue:ie.value,"onUpdate:modelValue":z[11]||(z[11]=Me=>ie.value=Me),"data-testid":"form-view-configuration-slideout-tabs",tabs:q.value},{json:e.withCtx(()=>[e.createVNode(e.unref(Ie.JsonCodeBlock),{config:n.config,"entity-record":O.value,"fetcher-url":xe.value,"request-method":s.pluginId?"put":"post"},null,8,["config","entity-record","fetcher-url","request-method"])]),yaml:e.withCtx(()=>[e.createVNode(e.unref(Ie.YamlCodeBlock),{"deck-callout-preference-key":e.unref($)?e.unref(F):void 0,"entity-record":O.value,"onDeckCallout:clickCta":z[8]||(z[8]=Me=>ie.value="#deck")},null,8,["deck-callout-preference-key","entity-record"])]),terraform:e.withCtx(()=>[e.createVNode(e.unref(Ie.TerraformCodeBlock),{"credential-type":ae.value,"entity-record":O.value,"entity-type":e.unref(Ie.SupportedEntityType).Plugin},null,8,["credential-type","entity-record","entity-type"])]),deck:e.withCtx(()=>[e.unref(Z)?(e.openBlock(),e.createElementBlock("div",Zj,[e.createVNode(we,{appearance:"secondary",class:"button-customize-deck",onClick:z[9]||(z[9]=Me=>te.value=!0)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)("plugins.form.button_deck_customize")),1)]),_:1})])):e.createCommentVNode("",!0),e.createVNode(e.unref(Ie.DeckCodeBlock),{app:n.config.app,"control-plane-name":n.config.app==="konnect"?n.config.controlPlaneName:void 0,"customization-options":e.unref(Z),"entity-record":O.value,"entity-type":e.unref(Ie.SupportedEntityType).Plugin,"geo-api-server-url":n.config.app==="konnect"?n.config.geoApiServerUrl:void 0,"is-customization-modal-visible":te.value,"kong-admin-api-url":n.config.app==="kongManager"?n.config.apiBaseUrl:void 0,workspace:n.config.workspace||void 0,onCustomizationClose:z[10]||(z[10]=Me=>te.value=!1)},null,8,["app","control-plane-name","customization-options","entity-record","entity-type","geo-api-server-url","is-customization-modal-visible","kong-admin-api-url","workspace"])]),_:1},8,["modelValue","tabs"])]),_:1},8,["title","visible"])],2)}}}),[["__scopeId","data-v-cd2d48f0"]]),eF={class:"kong-ui-entities-plugins-list"},tF={class:"button-row"},nF={class:"name-cell-wrapper"},rF={class:"info-wrapper"},oF={key:0,class:"info-name"},iF={key:1,class:"info-name"},aF={key:2,class:"info-type"},sF={key:1},lF=je(e.defineComponent({__name:"PluginList",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||!n.createRoute||!n.getViewRoute||!n.getEditRoute||!n.getConfigureDynamicOrderingRoute||n.app==="kongManager"&&!n.isExactMatch&&!n.filterSchema)},cacheIdentifier:{type:String,default:""},canCreate:{type:Function,required:!1,default:async()=>!0},canDelete:{type:Function,required:!1,default:async()=>!0},canEdit:{type:Function,required:!1,default:async()=>!0},canToggle:{type:Function,required:!1,default:async()=>!0},canRetrieve:{type:Function,required:!1,default:async()=>!0},canRetrieveScopedEntity:{type:Function,required:!1,default:async()=>!0},canConfigureDynamicOrdering:{type:Function,required:!1,default:async()=>!0},title:{type:String,default:""},titleTag:{type:String,default:"h2"},useActionOutside:{type:Boolean,default:!1}},emits:["error","click:learn-more","copy:success","copy:error","delete:success","toggle-enabled"],setup(n,{emit:t}){var nt,lt;const r=st.usePluginMetaData(),o=t,i=n,{i18n:{t:a,formatUnixTimeStamp:s}}=st.useI18n(),c=Ar.useRouter(),{axiosInstance:l}=Ie.useAxios((nt=i.config)==null?void 0:nt.axiosRequestConfig),{hasRecords:u,handleStateChange:p}=Ie.useTableState(()=>N.value),d=e.computed(()=>u.value&&i.config.app==="konnect"),f=e.computed(()=>!!i.config.entityId),m=e.computed(()=>{var Re;return((Re=i.config)==null?void 0:Re.entityType)==="consumers"}),h=e.computed(()=>{var Re;return((Re=i.config)==null?void 0:Re.entityType)==="consumer_groups"}),y=i.config.app==="konnect"||Ie.useGatewayFeatureSupported({gatewayInfo:i.config.gatewayInfo,supportedRange:{enterprise:["3.0"]}}),b=e.computed(()=>i.config.app!=="kongManager"||!!i.config.disableSorting),_={name:{label:a("plugins.list.table_headers.name"),searchable:!0,sortable:!0,hidable:!1}};(lt=i.config)!=null&&lt.entityId||(_.appliedTo={label:a("plugins.list.table_headers.applied_to"),sortable:!1}),_.enabled={label:a("plugins.list.table_headers.enabled"),searchable:!0,sortable:!0},y&&(_.ordering={label:a("plugins.list.table_headers.ordering"),sortable:!0}),_.tags={label:a("plugins.list.table_headers.tags"),sortable:!1},_.updated_at={label:a("plugins.list.table_headers.updated_at"),sortable:!0};const k=_,C=e.computed(()=>{var Ce,se,re,Q;let Re=i.config.entityType?`${i.config.apiBaseUrl}${tt.list[i.config.app].forEntity}`:`${i.config.apiBaseUrl}${tt.list[i.config.app].all}`;return i.config.app==="konnect"&&(Re=Re.replace(/{controlPlaneId}/gi,((Ce=i.config)==null?void 0:Ce.controlPlaneId)||"")),Re.replace(/\/{workspace}/gi,(se=i.config)!=null&&se.workspace?`/${i.config.workspace}`:"").replace(/{entityType}/gi,((re=i.config)==null?void 0:re.entityType)||"").replace(/{entityId}/gi,((Q=i.config)==null?void 0:Q.entityId)||"")}),N=e.ref(""),E=e.computed(()=>i.config.app==="konnect"||i.config.isExactMatch?{isExactMatch:!0,fields:{name:_.name,id:{label:a("plugins.list.table_headers.id"),sortable:!0}},placeholder:a(`search.placeholder.${i.config.isExactMatch?"exact":i.config.app}`)}:{isExactMatch:!1,fields:{enabled:{..._.enabled,label:a("search.filter.field.enabled")},name:_.name,instance_name:{label:a("plugins.list.table_headers.instance_name"),searchable:!0}},schema:i.config.filterSchema}),{fetcher:w,fetcherState:S,fetcherCacheKey:I}=Ie.useFetcher(e.computed(()=>({...i.config,cacheIdentifier:i.cacheIdentifier})),C),U=()=>{N.value=""},x=()=>{I.value++},A=e.ref(null),T=Re=>{var se,re,Q,le;const Ce=[];return((se=Re.route)!=null&&se.id||Re.route_id)&&Ce.push({type:"route",badgeText:a("plugins.list.table_headers.applied_to_badges.route")}),((re=Re.service)!=null&&re.id||Re.service_id)&&Ce.push({type:"service",badgeText:a("plugins.list.table_headers.applied_to_badges.service")}),((Q=Re.consumer)!=null&&Q.id||Re.consumer_id)&&Ce.push({type:"consumer",badgeText:a("plugins.list.table_headers.applied_to_badges.consumer")}),((le=Re.consumer_group)!=null&&le.id||Re.consumer_group_id)&&Ce.push({type:"consumer_group",badgeText:a("plugins.list.table_headers.applied_to_badges.consumer_group")}),Ce.length?Ce:[{type:null,badgeText:a("plugins.list.table_headers.applied_to_badges.global")}]},V=async(Re,Ce)=>{var se;return Re===null?!1:await((se=i.canRetrieveScopedEntity)==null?void 0:se.call(i,Re,Ce.id))},R=(Re,Ce)=>{var re,Q,le,de,_e;let se=null;switch(Re){case"route":se=(re=Ce.route)==null?void 0:re.id;break;case"service":se=(Q=Ce.service)==null?void 0:Q.id;break;case"consumer":se=(le=Ce.consumer)==null?void 0:le.id;break;case"consumer_group":se=(de=Ce.consumer_group)==null?void 0:de.id;break}se&&((_e=i.config)!=null&&_e.getScopedEntityViewRoute)&&c.push(i.config.getScopedEntityViewRoute(Re,se))},X=e.ref(!1),Y=e.ref(null),ne=e.computed(()=>{const Re={action:"disable",id:"",name:""};if(Y.value){const{enabled:Ce,id:se,name:re}=Y.value;Re.action=Ce?"disable":"enable",Re.id=se,Re.name=r.getDisplayName(re)||se}return Re}),M=Re=>{X.value=!0,Y.value=Re},te=()=>{X.value=!1,Y.value=null},$=async()=>{var re,Q,le,de,_e,xe,Ne,g;if(!await((re=i.canEdit)==null?void 0:re.call(i,Y.value))||!Y.value)return;let Ce=`${i.config.apiBaseUrl}${(_e=tt.item[i.config.app])==null?void 0:_e[(Q=i.config)!=null&&Q.entityType?"forEntity":"all"].replace(/{entityType}/gi,((le=i.config)==null?void 0:le.entityType)||"").replace(/{entityId}/gi,((de=i.config)==null?void 0:de.entityId)||"")}`.replace(/{id}/gi,Y.value.id||"");i.config.app==="konnect"&&(Ce=Ce.replace(/{controlPlaneId}/gi,((xe=i.config)==null?void 0:xe.controlPlaneId)||"")),Ce=Ce.replace(/\/{workspace}/gi,(Ne=i.config)!=null&&Ne.workspace?`/${i.config.workspace}`:"");const se=!Y.value.enabled;try{const O=(g=i.config)==null?void 0:g.app;let j;N.value&&O==="konnect"&&(j=await l.get(Ce));const{data:W}=O==="konnect"?await l.put(Ce,{...(j==null?void 0:j.data)||Y.value,enabled:se},{timeout:12e4}):await l.patch(Ce,{...Y.value,enabled:se},{timeout:12e4});o("toggle-enabled",se,W),Y.value.enabled=se}catch(O){o("error",O)}},Z=async(Re,Ce)=>{const se=Re.id;if(!await Ce(se)){o("copy:error",{entity:Re,field:"id",message:a("errors.copy")});return}o("copy:success",{entity:Re,field:"id",message:a("copy.success",{val:se})})},F=async(Re,Ce)=>{const se=JSON.stringify(Re);if(!await Ce(se)){o("copy:error",{entity:Re,message:a("errors.copy")});return}o("copy:success",{entity:Re,message:a("copy.success_brief")})},J=async Re=>{var se;await((se=i.canRetrieve)==null?void 0:se.call(i,Re))&&c.push(i.config.getViewRoute(Re))},G=Re=>({label:a("actions.view"),to:i.config.getViewRoute(Re)}),v=Re=>({label:a("actions.edit"),to:i.config.getEditRoute(Re)}),q=Re=>({label:a("actions.configure_dynamic_ordering"),to:i.config.getConfigureDynamicOrderingRoute(Re)}),ie=e.ref(void 0),oe=e.ref(!1),ke=e.ref(!1),ye=e.ref(""),ce=Ie.useDeleteUrlBuilder(i.config,C.value),he=Re=>{ie.value=Re,oe.value=!0},Oe=()=>{oe.value=!1},De=async()=>{var Re,Ce,se;if((Re=ie.value)!=null&&Re.id){ke.value=!0;try{await l.delete(ce(ie.value.id)),ke.value=!1,oe.value=!1,I.value++,o("delete:success",ie.value)}catch(re){ye.value=((se=(Ce=re.response)==null?void 0:Ce.data)==null?void 0:se.message)||re.message||a("errors.delete"),o("error",re)}finally{ke.value=!1}}},Be=()=>{c.push(i.config.createRoute)};e.watch(S,Re=>{var Ce,se,re;if(Re.status===Ie.FetcherStatus.Error){A.value={title:a("errors.general")},(re=(se=(Ce=Re.error)==null?void 0:Ce.response)==null?void 0:se.data)!=null&&re.message&&(A.value.message=Re.error.response.data.message),o("error",Re.error);return}A.value=null});const Ge=e.ref({ctaPath:i.config.createRoute,ctaText:void 0,message:`${a("plugins.list.empty_state.description")}${i.config.additionMessageForEmptyState?` ${i.config.additionMessageForEmptyState}`:""}`,title:a("plugins.title")}),We=e.ref(!1);return e.onBeforeMount(async()=>{We.value=await i.canCreate(),We.value&&(Ge.value.title=a("plugins.list.empty_state.title"),Ge.value.ctaText=a("actions.create"))}),(Re,Ce)=>{const se=e.resolveComponent("KButton"),re=e.resolveComponent("KEmptyState"),Q=e.resolveComponent("KBadge"),le=e.resolveComponent("KTruncate"),de=e.resolveComponent("KInputSwitch"),_e=e.resolveComponent("KDropdownItem"),xe=e.resolveComponent("KClipboardProvider");return e.openBlock(),e.createElementBlock("div",eF,[e.createVNode(e.unref(Ie.EntityBaseTable),{"cache-identifier":n.cacheIdentifier,"disable-sorting":b.value,"empty-state-options":Ge.value,"enable-entity-actions":"","error-message":A.value,fetcher:e.unref(w),"fetcher-cache-key":e.unref(I),"pagination-type":"offset","preferences-storage-key":"kong-ui-entities-plugins-list",query:N.value,"table-headers":e.unref(k),title:n.title,"title-tag":n.titleTag,onClearSearchInput:U,"onClick:row":Ce[4]||(Ce[4]=Ne=>J(Ne)),onSort:x,onState:e.unref(p)},e.createSlots({"toolbar-filter":e.withCtx(()=>[e.createVNode(e.unref(Ie.EntityFilter),{modelValue:N.value,"onUpdate:modelValue":Ce[0]||(Ce[0]=Ne=>N.value=Ne),config:E.value},null,8,["modelValue","config"])]),"toolbar-button":e.withCtx(()=>[(e.openBlock(),e.createBlock(e.Teleport,{disabled:!n.useActionOutside,to:"#kong-ui-app-page-header-action-button"},[e.createElementVNode("div",tF,[!f.value&&d.value?(e.openBlock(),e.createBlock(se,{key:0,appearance:"secondary",class:"open-learning-hub","data-testid":"plugins-learn-more-button",icon:"",onClick:Ce[1]||(Ce[1]=Ne=>Re.$emit("click:learn-more"))},{default:e.withCtx(()=>[e.createVNode(e.unref($e.BookIcon),{decorative:""})]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(Ie.PermissionsWrapper),{"auth-function":()=>n.canCreate()},{default:e.withCtx(()=>[e.createVNode(se,{appearance:"primary","data-testid":"toolbar-add-plugin",size:n.useActionOutside?"medium":"large",to:n.config.createRoute},{default:e.withCtx(()=>[e.createVNode(e.unref($e.AddIcon)),e.createTextVNode(" "+e.toDisplayString(e.unref(a)("plugins.list.toolbar_actions.new_plugin")),1)]),_:1},8,["size","to"])]),_:1},8,["auth-function"])])],8,["disabled"]))]),name:e.withCtx(({row:Ne})=>[e.createElementVNode("div",nF,[e.createVNode(e.unref(xr.PluginIcon),{class:"plugin-icon",name:Ne.name,size:24},null,8,["name"]),e.createElementVNode("div",rF,[Ne.instance_name?(e.openBlock(),e.createElementBlock("span",oF,e.toDisplayString(Ne.instance_name),1)):(e.openBlock(),e.createElementBlock("span",iF,e.toDisplayString(e.unref(r).getDisplayName(Ne.name)),1)),Ne.instance_name?(e.openBlock(),e.createElementBlock("span",aF,e.toDisplayString(e.unref(r).getDisplayName(Ne.name)),1)):e.createCommentVNode("",!0)])])]),appliedTo:e.withCtx(({row:Ne})=>[T(Ne).length>0?(e.openBlock(),e.createBlock(le,{key:0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T(Ne),g=>(e.openBlock(),e.createBlock(e.unref(Ie.PermissionsWrapper),{key:g.badgeText,"auth-function":()=>V(g.type,Ne),"force-show":""},{default:e.withCtx(({isAllowed:O})=>[e.createVNode(Q,{class:e.normalizeClass(O||"disabled"),onClick:e.withModifiers(j=>O&&g.type&&R(g.type,Ne),["stop"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(g.badgeText),1)]),_:2},1032,["class","onClick"])]),_:2},1032,["auth-function"]))),128))]),_:2},1024)):(e.openBlock(),e.createElementBlock("span",sF,"-"))]),enabled:e.withCtx(({row:Ne})=>[e.createVNode(e.unref(Ie.PermissionsWrapper),{"auth-function":async()=>!!(await n.canEdit(Ne)&&await n.canToggle(Ne)),"force-show":""},{default:e.withCtx(({isAllowed:g})=>{var O,j;return[e.createElementVNode("div",{onClick:Ce[3]||(Ce[3]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(de,{disabled:!g,"disabled-tooltip-text":!g&&((j=(O=n.config).getToggleDisabledTooltip)==null?void 0:j.call(O,Ne))||void 0,"model-value":Ne.enabled,onClick:e.withModifiers(W=>g&&M(Ne),["stop","prevent"])},null,8,["disabled","disabled-tooltip-text","model-value","onClick"])])]}),_:2},1032,["auth-function"])]),ordering:e.withCtx(({rowValue:Ne})=>[e.createVNode(Q,{appearance:e.unref(Ty)(Ne)?"info":"warning"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(Ty)(Ne)?e.unref(a)("plugins.list.table_headers.ordering_badge.static"):e.unref(a)("plugins.list.table_headers.ordering_badge.dynamic")),1)]),_:2},1032,["appearance"])]),tags:e.withCtx(({rowValue:Ne})=>[e.createVNode(e.unref(Ie.TableTags),{tags:Ne},null,8,["tags"])]),updated_at:e.withCtx(({row:Ne,rowValue:g})=>[e.createTextVNode(e.toDisplayString(e.unref(s)(g??Ne.created_at)),1)]),actions:e.withCtx(({row:Ne})=>[e.createVNode(xe,null,{default:e.withCtx(({copyToClipboard:g})=>[e.createVNode(_e,{"data-testid":"action-entity-copy-id",onClick:O=>Z(Ne,g)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("actions.copy_id")),1)]),_:1},8,["onClick"])]),_:2},1024),e.createVNode(xe,null,{default:e.withCtx(({copyToClipboard:g})=>[e.createVNode(_e,{"data-testid":"action-entity-copy-json",onClick:O=>F(Ne,g)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("actions.copy_json")),1)]),_:1},8,["onClick"])]),_:2},1024),e.createVNode(e.unref(Ie.PermissionsWrapper),{"auth-function":()=>n.canRetrieve(Ne)},{default:e.withCtx(()=>[e.createVNode(_e,{"data-testid":"action-entity-view","has-divider":"",item:G(Ne)},null,8,["item"])]),_:2},1032,["auth-function"]),e.createVNode(e.unref(Ie.PermissionsWrapper),{"auth-function":()=>n.canEdit(Ne)},{default:e.withCtx(()=>[e.createVNode(_e,{"data-testid":"action-entity-edit",item:v(Ne)},null,8,["item"])]),_:2},1032,["auth-function"]),!m.value&&!h.value&&e.unref(y)?(e.openBlock(),e.createBlock(e.unref(Ie.PermissionsWrapper),{key:0,"auth-function":()=>n.canConfigureDynamicOrdering(Ne)},{default:e.withCtx(()=>[q(Ne)?(e.openBlock(),e.createBlock(_e,{key:0,"data-testid":"action-entity-config-dyn-order",item:q(Ne)},null,8,["item"])):e.createCommentVNode("",!0)]),_:2},1032,["auth-function"])):e.createCommentVNode("",!0),e.createVNode(e.unref(Ie.PermissionsWrapper),{"auth-function":()=>n.canDelete(Ne)},{default:e.withCtx(()=>[e.createVNode(_e,{danger:"","data-testid":"action-entity-delete","has-divider":"",onClick:g=>he(Ne)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("actions.delete")),1)]),_:1},8,["onClick"])]),_:2},1032,["auth-function"])]),_:2},[!N.value&&n.config.app==="konnect"?{name:"empty-state",fn:e.withCtx(()=>{var Ne;return[e.createVNode(re,{"data-testid":n.config.entityId?"nested-plugins-entity-empty-state":"plugins-entity-empty-state","icon-background":"",message:e.unref(a)("plugins.list.empty_state_v2.description"),title:e.unref(a)("plugins.list.empty_state_v2.title")},e.createSlots({icon:e.withCtx(()=>[e.createVNode(e.unref($e.PlugIcon),{decorative:""})]),action:e.withCtx(()=>[We.value?(e.openBlock(),e.createBlock(se,{key:0,"data-testid":"entity-create-button",onClick:Be},{default:e.withCtx(()=>[e.createVNode(e.unref($e.AddIcon),{decorative:""}),e.createTextVNode(" "+e.toDisplayString(e.unref(a)("plugins.list.empty_state_v2.create_cta")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(se,{appearance:"secondary","data-testid":"entity-learn-more-button",onClick:Ce[2]||(Ce[2]=g=>Re.$emit("click:learn-more"))},{default:e.withCtx(()=>[e.createVNode(e.unref($e.BookIcon),{decorative:""}),e.createTextVNode(" "+e.toDisplayString(e.unref(a)("plugins.list.empty_state_v2.learn_more")),1)]),_:1})]),_:2},[(Ne=n.config)!=null&&Ne.isControlPlaneGroup?{name:"default",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("plugins.list.empty_state_v2.group")),1)]),key:"0"}:void 0]),1032,["data-testid","message","title"])]}),key:"0"}:void 0]),1032,["cache-identifier","disable-sorting","empty-state-options","error-message","fetcher","fetcher-cache-key","query","table-headers","title","title-tag","onState"]),e.createVNode(e.unref(Ie.EntityToggleModal),{action:ne.value.action,"entity-id":ne.value.id,"entity-name":ne.value.name,"entity-type":e.unref(a)("glossary.plugin"),"on-confirm":$,visible:X.value,onCancel:te,onProceed:te},null,8,["action","entity-id","entity-name","entity-type","visible"]),e.createVNode(e.unref(Ie.EntityDeleteModal),{"action-pending":ke.value,description:e.unref(a)("delete.description"),"entity-name":ie.value&&(ie.value.instance_name||ie.value.name||ie.value.id),"entity-type":e.unref(Ie.EntityTypes).Plugin,error:ye.value,title:e.unref(a)("delete.title"),visible:oe.value,onCancel:Oe,onProceed:De},null,8,["action-pending","description","entity-name","entity-type","error","title","visible"])])}}}),[["__scopeId","data-v-bb7d2cdb"]]),cF={class:"plugin-select-card-wrapper"},uF=["data-testid"],dF={class:"plugin-card-header"},fF={class:"plugin-card-title"},pF={key:0,class:"plugin-card-actions"},mF=["data-testid","title"],gF={key:0,class:"plugin-card-text"},hF={key:0,class:"custom-plugin-badges"},yF=["title"],wp=je(e.defineComponent({__name:"PluginSelectCard",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||!n.getCreateRoute)},canDeleteCustomPlugin:{type:Boolean,default:!1},canDeleteClonedPlugin:{type:Boolean,default:!1},canEditCustomPlugin:{type:Boolean,default:!1},canEditClonedPlugin:{type:Boolean,default:!1},plugin:{type:Object,required:!0},navigateOnClick:{type:Boolean,default:!0}},emits:["plugin-clicked","custom-plugin-delete"],setup(n,{emit:t}){const r=t,o=n,i=Ar.useRouter(),{i18n:{t:a}}=st.useI18n(),s=e.computed(()=>o.plugin.customPluginType==="cloned"&&o.plugin.clonedFromRef?o.plugin.clonedFromRef:o.plugin.id),c=e.computed(()=>!E.value||N.value?[]:o.plugin.customPluginType==="cloned"&&o.plugin.clonedFromRef?[a("plugins.select.cloned_from_badge",{link:o.plugin.clonedFromRef})]:o.plugin.customPluginType==="streaming"?[a("plugins.select.streamed_custom_badge")]:[a("plugins.select.installed_custom_badge")]),l=e.computed(()=>!!(!o.plugin.available||o.plugin.disabledMessage)),u=e.computed(()=>typeof o.config.getCustomEditRoute=="function"),p=e.computed(()=>o.plugin.customPluginType==="cloned"),d=e.computed(()=>p.value?o.canDeleteClonedPlugin:o.canDeleteCustomPlugin),f=e.computed(()=>p.value?o.canEditClonedPlugin:o.canEditCustomPlugin),m=e.computed(()=>!(o.config.app==="kongManager"&&o.plugin.customPluginType==="schema")),h=e.computed(()=>f.value&&u.value),y=e.computed(()=>d.value),b=e.computed(()=>!!(E.value&&!N.value&&m.value&&o.navigateOnClick&&(y.value||h.value))),_=()=>{i.push(o.config.getCreateRoute(o.plugin.id))},k=()=>{o.navigateOnClick?_():C()},C=()=>{r("plugin-clicked",o.plugin)},N=e.computed(()=>o.plugin.id==="custom-plugin-create"),E=e.computed(()=>o.plugin.group===fe.PluginGroup.CUSTOM_PLUGINS),w=()=>{E.value&&r("custom-plugin-delete")},S=(U,x)=>{const A=o.config;typeof A.getCustomEditRoute=="function"&&i.push(A.getCustomEditRoute(U,x))},I=()=>{if(!l.value&&E.value){const U=o.config;N.value&&U.createCustomRoute?i.push(U.createCustomRoute):E.value&&_()}};return(U,x)=>{const A=e.resolveComponent("KButton"),T=e.resolveComponent("KDropdownItem"),V=e.resolveComponent("KDropdownMenu"),R=e.resolveComponent("KBadge"),X=e.resolveComponent("KTooltip");return e.openBlock(),e.createElementBlock("div",cF,[e.createVNode(X,{text:n.plugin.disabledMessage},{default:e.withCtx(()=>[e.createElementVNode("a",{class:e.normalizeClass(["plugin-select-card",{disabled:l.value}]),"data-testid":`${n.plugin.id}-card`,role:"button",onClick:x[1]||(x[1]=Y=>l.value||E.value?void 0:k())},[e.createElementVNode("div",dF,[e.createElementVNode("div",fF,[e.createElementVNode("span",{class:e.normalizeClass({"non-custom-title":!E.value})},e.toDisplayString(n.plugin.name),3)]),b.value?(e.openBlock(),e.createElementBlock("div",pF,[e.createVNode(V,{"data-testid":"custom-plugin-actions","kpop-attributes":{placement:"bottom-end"},width:"150"},{default:e.withCtx(()=>[e.createVNode(A,{appearance:"tertiary",class:"actions-trigger","data-testid":"overflow-actions-button",icon:"",size:"small"},{default:e.withCtx(()=>[e.createVNode(e.unref($e.MoreIcon),{size:`var(--kui-icon-size-30, ${e.unref(Yn)})`},null,8,["size"])]),_:1})]),items:e.withCtx(()=>[h.value?(e.openBlock(),e.createBlock(T,{key:0,"data-testid":"edit-plugin-schema",onClick:x[0]||(x[0]=e.withModifiers(Y=>S(n.plugin.name,n.plugin.customPluginType),["stop"]))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("actions.edit")),1)]),_:1})):e.createCommentVNode("",!0),y.value?(e.openBlock(),e.createBlock(T,{key:1,danger:"","data-testid":"delete-plugin-schema","has-divider":h.value,onClick:e.withModifiers(w,["stop"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("actions.delete")),1)]),_:1},8,["has-divider"])):e.createCommentVNode("",!0)]),_:1})])):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:e.normalizeClass(["plugin-card-body",{"custom-plugin":E.value}]),"data-testid":n.plugin.name,title:n.plugin.available?n.plugin.name:e.unref(a)("plugins.select.unavailable_tooltip"),onClick:I},[e.createVNode(e.unref(xr.PluginIcon),{alt:n.plugin.name,class:"plugin-card-icon",name:s.value,size:55},null,8,["alt","name"]),n.plugin.description||c.value.length?(e.openBlock(),e.createElementBlock("div",gF,[c.value.length?(e.openBlock(),e.createElementBlock("div",hF,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,Y=>(e.openBlock(),e.createBlock(R,{key:Y,appearance:"info"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(Y),1)]),_:2},1024))),128))])):e.createCommentVNode("",!0),n.plugin.description?(e.openBlock(),e.createElementBlock("p",{key:1,class:"plugin-card-text",title:n.plugin.description},e.toDisplayString(n.plugin.description),9,yF)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],10,mF),e.createElementVNode("div",{class:"plugin-card-footer",onClick:I},e.toDisplayString(N.value?e.unref(a)("actions.create_custom"):n.plugin.exists?e.unref(a)("actions.enabled"):e.unref(a)("actions.enable")),1)],10,uF)]),_:1},8,["text"])])}}}),[["__scopeId","data-v-eb0977c9"]]),Cc=je(e.defineComponent({__name:"DeleteCustomPluginSchemaModal",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app))},plugin:{type:Object,required:!0}},emits:["closed","proceed"],setup(n,{emit:t}){var m;const r=n,o=t,{i18n:{t:i}}=st.useI18n(),{getMessageFromError:a}=Ie.useErrors(),{axiosInstance:s}=Ie.useAxios((m=r.config)==null?void 0:m.axiosRequestConfig),c=e.computed(()=>{var h;return p.value?i("delete.plugin_schema_in_use_title"):i("delete.title",{name:((h=r.plugin)==null?void 0:h.name)||i("delete.custom_plugin")})}),l=e.ref(!1),u=e.ref(""),p=e.ref(!1),d=e.computed(()=>{const h=r.plugin.customPluginType;if(r.config.app==="konnect"){const y=h==="streaming"?tt.select[r.config.app].streamingCustomPluginItem:h==="cloned"?tt.customPlugin[r.config.app].cloned.edit:tt.select[r.config.app].schemaCustomPluginItem;return`${r.config.apiBaseUrl}${y}`.replace(/{controlPlaneId}/gi,r.config.controlPlaneId||"").replace(/{pluginId}/gi,r.plugin.id)}if(r.config.app==="kongManager"&&h&&h!=="schema"){const y=h==="cloned"?tt.customPlugin[r.config.app].cloned.edit:tt.customPlugin[r.config.app].streamed.edit;return`${r.config.apiBaseUrl}${y}`.replace(/\/{workspace}/gi,r.config.workspace?`/${r.config.workspace}`:"").replace(/{pluginId}/gi,r.plugin.id)}return null}),f=async()=>{var h;if(l.value=!0,u.value="",!((h=r.plugin)!=null&&h.name)){l.value=!1;return}try{d.value&&await s.delete(d.value),o("proceed")}catch(y){Gw(y)?p.value=!0:u.value=a(y)}finally{l.value=!1}};return(h,y)=>{const b=e.resolveComponent("KAlert"),_=e.resolveComponent("KButton"),k=e.resolveComponent("KModal");return!p.value&&n.plugin?(e.openBlock(),e.createBlock(e.unref(Ie.EntityDeleteModal),{key:0,"action-pending":l.value,class:"delete-custom-plugin-schema-modal","data-testid":"delete-custom-plugin-schema-modal",description:e.unref(i)("delete.description_custom"),"entity-name":n.plugin.name,"entity-type":e.unref(Ie.EntityTypes).Plugin,error:u.value,"need-confirm":"",title:c.value,visible:"",onCancel:y[0]||(y[0]=C=>h.$emit("closed")),onProceed:f},null,8,["action-pending","description","entity-name","entity-type","error","title"])):n.plugin?(e.openBlock(),e.createBlock(k,{key:1,"action-button-disabled":l.value,class:"delete-custom-plugin-schema-modal","data-testid":"delete-custom-plugin-schema-modal",title:c.value,visible:"",onCancel:y[2]||(y[2]=C=>h.$emit("closed"))},{default:e.withCtx(()=>[e.createVNode(b,{appearance:"danger",message:e.unref(i)("delete.plugin_schema_in_use_message")},null,8,["message"])]),"footer-actions":e.withCtx(()=>[e.createElementVNode("div",null,[e.createVNode(_,{appearance:"tertiary",class:"cancel-button","data-testid":"delete-custom-plugin-form-cancel",onClick:y[1]||(y[1]=C=>h.$emit("closed"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)("actions.cancel")),1)]),_:1})])]),_:1},8,["action-button-disabled","title"])):e.createCommentVNode("",!0)}}}),[["__scopeId","data-v-9514182c"]]),_F={class:"custom-plugins-grid"},bF={class:"empty-state-title"},wF={class:"empty-state-description"},kp=310,kF=je(e.defineComponent({__name:"PluginCustomGrid",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||!n.getCreateRoute)},canCreateCustomPlugin:{type:Boolean,default:!1},canDeleteCustomPlugin:{type:Boolean,default:!1},canDeleteClonedPlugin:{type:Boolean,default:!1},canEditCustomPlugin:{type:Boolean,default:!1},canEditClonedPlugin:{type:Boolean,default:!1},pluginList:{type:Object,default:()=>({})},navigateOnClick:{type:Boolean,default:!0}},emits:["plugin-clicked","revalidate","delete:success"],setup(n,{emit:t}){const r=n,o=t,{i18n:{t:i}}=st.useI18n(),{getTallestPluginCardHeight:a,getToggleVisibility:s}=st.usePluginHelpers(),c=e.ref(!0),l=E=>{o("plugin-clicked",E)},u=e.computed(()=>{const E=JSON.parse(JSON.stringify(r.pluginList))[fe.PluginGroup.CUSTOM_PLUGINS]||[];return r.canCreateCustomPlugin&&r.navigateOnClick&&r.config.createCustomRoute?[{id:"custom-plugin-create",name:i("plugins.select.tabs.custom.create.name"),available:!0,group:fe.PluginGroup.CUSTOM_PLUGINS,description:i("plugins.select.tabs.custom.create.description")}].concat(E):E}),p=e.ref(!1),d=e.ref(null),f=E=>{p.value=!0,d.value={id:E.id,name:E.name,customPluginType:E.customPluginType}},m=E=>{var w;E&&(o("revalidate"),o("delete:success",((w=d.value)==null?void 0:w.name)||"")),p.value=!1,d.value=null},h=e.ref(kp),y=e.ref(null),b=e.ref(null),_=e.computed(()=>c.value?{overflowY:"hidden",maxHeight:`${h.value}px`}:{}),k=e.ref(!1),C=()=>{h.value=Math.max(a(b.value),kp),N()},N=()=>{var E,w;(E=b.value)!=null&&E.length&&(k.value=s(y.value,(w=b.value)==null?void 0:w.length))};return e.onMounted(async()=>{await e.nextTick(),h.value=Math.max(a(b.value),kp),N(),window==null||window.addEventListener("resize",C)}),e.onUnmounted(()=>{window==null||window.removeEventListener("resize",C)}),(E,w)=>{const S=e.resolveComponent("KEmptyState"),I=e.resolveComponent("KCollapse");return e.openBlock(),e.createElementBlock("div",_F,[u.value.length?(e.openBlock(),e.createBlock(I,{key:1,modelValue:c.value,"onUpdate:modelValue":w[0]||(w[0]=U=>c.value=U),class:"custom-plugins-collapse","data-testid":`${e.unref(fe.PluginGroup).CUSTOM_PLUGINS}-collapse`,title:e.unref(fe.PluginGroup).CUSTOM_PLUGINS,"trigger-label":c.value?e.unref(i)("plugins.select.view_more"):e.unref(i)("plugins.select.view_less")},e.createSlots({"visible-content":e.withCtx(()=>[e.createElementVNode("div",{ref_key:"pluginCardContainerRef",ref:y,class:"plugin-card-container",style:e.normalizeStyle(_.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(U,x)=>(e.openBlock(),e.createBlock(wp,{key:`plugin-card-${x}`,ref_for:!0,ref_key:"pluginCardRef",ref:b,"can-delete-cloned-plugin":n.canDeleteClonedPlugin,"can-delete-custom-plugin":n.canDeleteCustomPlugin,"can-edit-cloned-plugin":n.canEditClonedPlugin,"can-edit-custom-plugin":n.canEditCustomPlugin,config:n.config,"navigate-on-click":n.navigateOnClick,plugin:U,onCustomPluginDelete:A=>f(U),onPluginClicked:l},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","navigate-on-click","plugin","onCustomPluginDelete"]))),128))],4)]),_:2},[k.value?void 0:{name:"trigger",fn:e.withCtx(()=>[w[2]||(w[2]=e.createTextVNode("   ",-1))]),key:"0"}]),1032,["modelValue","data-testid","title","trigger-label"])):(e.openBlock(),e.createBlock(S,{key:0,"action-button-visible":!1,class:"custom-plugins-empty-state","icon-variant":"kong"},{title:e.withCtx(()=>[e.createElementVNode("span",bF,e.toDisplayString(e.unref(i)("plugins.select.tabs.custom.empty_title")),1)]),default:e.withCtx(()=>[e.createElementVNode("span",wF,e.toDisplayString(e.unref(i)("plugins.select.tabs.custom.empty_description")),1)]),_:1})),p.value&&d.value?(e.openBlock(),e.createBlock(Cc,{key:2,config:n.config,plugin:d.value,onClosed:m,onProceed:w[1]||(w[1]=U=>m(!0))},null,8,["config","plugin"])):e.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-909f4d5f"]]),Cp=310,Ww=je(e.defineComponent({__name:"PluginSelectGroup",props:e.mergeModels({config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||!n.getCreateRoute)},name:{type:String,required:!0},plugins:{type:Array,required:!0},navigateOnClick:{type:Boolean,default:!0},canDeleteCustomPlugin:{type:Boolean,default:!1},canDeleteClonedPlugin:{type:Boolean,default:!1},canEditCustomPlugin:{type:Boolean,default:!1},canEditClonedPlugin:{type:Boolean,default:!1}},{modelValue:{type:Boolean,required:!0},modelModifiers:{}}),emits:e.mergeModels(["plugin-clicked","delete:success"],["update:modelValue"]),setup(n,{emit:t}){const r=e.useModel(n,"modelValue"),o=n,i=t,{i18n:{t:a}}=st.useI18n(),{getTallestPluginCardHeight:s,getToggleVisibility:c}=st.usePluginHelpers(),l=e.ref(Cp),u=e.ref(null),p=e.ref(null),d=e.computed(()=>r.value?{overflowY:"hidden",maxHeight:`${l.value}px`}:{}),f=e.ref(!1),m=e.ref(!1),h=e.ref(null),y=C=>{m.value=!0,h.value={id:C.id,name:C.name,customPluginType:C.customPluginType}},b=C=>{var N;C&&i("delete:success",((N=h.value)==null?void 0:N.name)||""),m.value=!1,h.value=null},_=()=>{l.value=Math.max(s(p.value),Cp),k()},k=()=>{var C,N;(C=p.value)!=null&&C.length&&(f.value=c(u.value,(N=p.value)==null?void 0:N.length))};return e.onMounted(async()=>{await e.nextTick(),l.value=Math.max(s(p.value),Cp),k(),window==null||window.addEventListener("resize",_)}),e.onUnmounted(()=>{window==null||window.removeEventListener("resize",_)}),(C,N)=>{const E=e.resolveComponent("KCollapse");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(E,{modelValue:r.value,"onUpdate:modelValue":N[0]||(N[0]=w=>r.value=w),class:"plugins-collapse","data-testid":`${o.name}-collapse`,title:o.name,"trigger-label":r.value?e.unref(a)("plugins.select.view_more"):e.unref(a)("plugins.select.view_less")},e.createSlots({"visible-content":e.withCtx(()=>[e.createElementVNode("div",{ref_key:"pluginCardContainerRef",ref:u,class:"plugin-card-container",style:e.normalizeStyle(d.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.plugins,w=>(e.openBlock(),e.createBlock(wp,{key:`plugin-card-${w.id}`,ref_for:!0,ref_key:"pluginCardRef",ref:p,"can-delete-cloned-plugin":n.canDeleteClonedPlugin,"can-delete-custom-plugin":n.canDeleteCustomPlugin,"can-edit-cloned-plugin":n.canEditClonedPlugin,"can-edit-custom-plugin":n.canEditCustomPlugin,config:n.config,"navigate-on-click":n.navigateOnClick,plugin:w,onCustomPluginDelete:S=>y(w),onPluginClicked:S=>i("plugin-clicked",w)},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","navigate-on-click","plugin","onCustomPluginDelete","onPluginClicked"]))),128))],4)]),_:2},[f.value?void 0:{name:"trigger",fn:e.withCtx(()=>[N[2]||(N[2]=e.createTextVNode("   ",-1))]),key:"0"}]),1032,["modelValue","data-testid","title","trigger-label"]),m.value&&h.value?(e.openBlock(),e.createBlock(Cc,{key:0,config:n.config,plugin:h.value,onClosed:b,onProceed:N[1]||(N[1]=w=>b(!0))},null,8,["config","plugin"])):e.createCommentVNode("",!0)],64)}}}),[["__scopeId","data-v-7f683497"]]),CF={class:"plugin-select-grid"},EF={class:"empty-state-title"},NF={class:"empty-state-description"},Ep=e.defineComponent({__name:"PluginSelectGrid",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||!n.getCreateRoute)},pluginList:{type:Object,default:()=>({})},navigateOnClick:{type:Boolean,default:!0},canDeleteCustomPlugin:{type:Boolean,default:!1},canDeleteClonedPlugin:{type:Boolean,default:!1},canEditCustomPlugin:{type:Boolean,default:!1},canEditClonedPlugin:{type:Boolean,default:!1},highlightedPlugins:{type:Array,default:()=>[]},highlightedPluginsTitle:{type:String,default:""},hideHighlightedPlugins:{type:Boolean,default:!1}},emits:["plugin-clicked","delete:success"],setup(n,{emit:t}){const r=n,o=t,{i18n:{t:i}}=st.useI18n(),a=e.ref(!1),s=e.ref(mf.reduce((u,p)=>(u[p]=!1,u),{})),c=u=>{o("plugin-clicked",u)},l=e.computed(()=>{const u=JSON.parse(JSON.stringify(r.pluginList));return r.config.app==="konnect"&&delete u[fe.PluginGroup.CUSTOM_PLUGINS],u});return(u,p)=>{const d=e.resolveComponent("KEmptyState");return e.openBlock(),e.createElementBlock("div",CF,[Object.keys(l.value).length?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(d,{key:0,"action-button-visible":!1,class:"plugins-empty-state","data-testid":"plugins-empty-state","icon-variant":"kong"},{title:e.withCtx(()=>[e.createElementVNode("span",EF,e.toDisplayString(e.unref(i)("plugins.select.tabs.kong.empty_title")),1)]),default:e.withCtx(()=>[e.createElementVNode("span",NF,e.toDisplayString(e.unref(i)("plugins.select.tabs.kong.empty_description")),1)]),_:1})),!r.hideHighlightedPlugins&&r.highlightedPlugins.length>0?(e.openBlock(),e.createBlock(Ww,{key:1,modelValue:a.value,"onUpdate:modelValue":p[0]||(p[0]=f=>a.value=f),"can-delete-cloned-plugin":n.canDeleteClonedPlugin,"can-delete-custom-plugin":n.canDeleteCustomPlugin,"can-edit-cloned-plugin":n.canEditClonedPlugin,"can-edit-custom-plugin":n.canEditCustomPlugin,config:n.config,name:r.highlightedPluginsTitle||e.unref(i)("plugins.select.highlighted_plugins.title"),"navigate-on-click":n.navigateOnClick,plugins:r.highlightedPlugins,"onDelete:success":p[1]||(p[1]=f=>o("delete:success",f)),onPluginClicked:p[2]||(p[2]=f=>c(f))},null,8,["modelValue","can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","name","navigate-on-click","plugins"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(mf),f=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[l.value[f]?(e.openBlock(),e.createElementBlock("div",{key:f},[e.createVNode(Ww,{modelValue:s.value[f],"onUpdate:modelValue":m=>s.value[f]=m,"can-delete-cloned-plugin":n.canDeleteClonedPlugin,"can-delete-custom-plugin":n.canDeleteCustomPlugin,"can-edit-cloned-plugin":n.canEditClonedPlugin,"can-edit-custom-plugin":n.canEditCustomPlugin,config:n.config,name:f,"navigate-on-click":n.navigateOnClick,plugins:l.value[f]||[],"onDelete:success":p[3]||(p[3]=m=>o("delete:success",m)),onPluginClicked:p[4]||(p[4]=m=>c(m))},null,8,["modelValue","onUpdate:modelValue","can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","name","navigate-on-click","plugins"])])):e.createCommentVNode("",!0)],64))),256))])}}}),SF={class:"kong-ui-entities-plugin-select-form"},xF={class:"plugins-filter-input-container"},AF={key:0},vF={key:3,"aria-live":"polite",class:"plugins-results-container"},IF={"data-testid":"kong-tab"},BF={class:"tab-description"},TF={"data-testid":"custom-tab"},OF={class:"tab-description"},PF={key:1},VF=je(e.defineComponent({__name:"PluginSelect",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||n.app==="kongManager"&&!n.workspace||n.app==="konnect"&&(!n.controlPlaneId||n.workspace)||!n.getCreateRoute)},customPluginSupport:{type:[String,Array],default:"none"},canCreateCustomPlugin:{type:Function,required:!1,default:async()=>!0},canDeleteCustomPlugin:{type:Function,required:!1,default:async()=>!0},canReadCustomPlugin:{type:Function,required:!1,default:async()=>!0},canDeleteClonedPlugin:{type:Function,required:!1},canReadClonedPlugin:{type:Function,required:!1,default:async()=>!0},canEditCustomPlugin:{type:Function,required:!1,default:async()=>!0},canEditClonedPlugin:{type:Function,required:!1},navigateOnClick:{type:Boolean,default:!0},availableOnServer:{type:Boolean,default:!0},ignoredPlugins:{type:Array,default:()=>[]},disabledPlugins:{type:Object,default:()=>({})},highlightedPluginIds:{type:Array,default:()=>[]},highlightedPluginsTitle:{type:String,default:""}},emits:["loading","plugin-clicked","delete-custom:success"],setup(n,{emit:t}){var se;const r=n,o=t,i=Ar.useRoute(),a=Ar.useRouter(),{i18n:{t:s}}=st.useI18n(),{pluginMetaData:c}=st.usePluginMetaData(),{getMessageFromError:l}=Ie.useErrors(),{sortAlpha:u,objectsAreEqual:p}=Ie.useHelpers(),d=e.ref(""),f=e.ref(!0),m=e.ref(!1),h=e.ref(""),y=e.ref(""),b=e.ref([]),_=e.ref([]),k=e.ref([]),C=e.ref({}),N=e.ref([]),E=e.ref(null),w=e.ref(!1),{axiosInstance:S}=Ie.useAxios((se=r.config)==null?void 0:se.axiosRequestConfig),I=re=>re==="none"||re==="disabled"?new Set:new Set(Array.isArray(re)?re:[re]),U=e.computed(()=>I(r.customPluginSupport)),x=e.computed(()=>[...U.value].sort().join("|")),A=e.computed(()=>r.customPluginSupport==="disabled"),T=e.computed(()=>A.value||U.value.size>0),V=e.computed(()=>U.value.has("streaming")),R=e.computed(()=>U.value.has("cloned")),X=re=>Zo.isAxiosError(re)&&re.code==="ERR_CANCELED",Y=re=>l(re).toLowerCase().includes("requires a license"),ne=e.computed(()=>C.value?Object.entries(C.value).filter(([re])=>re!==fe.PluginGroup.CUSTOM_PLUGINS).reduce((re,[,Q])=>{for(const le of Q??[])re[le.id]=le;return re},{}):{}),M=e.computed(()=>{var le;if(!C.value)return{};const re=d.value.toLowerCase(),Q=JSON.parse(JSON.stringify(C.value));for(const de in C.value){const _e=((le=C.value[de])==null?void 0:le.filter(xe=>{var Ne,g;return xe.name.toLowerCase().includes(re)||xe.id.toLowerCase().includes(re)||xe.group.toLowerCase().includes(re)||((Ne=xe.clonedFromRef)==null?void 0:Ne.toLowerCase().includes(re))||((g=xe.customPluginType)==null?void 0:g.toLowerCase().includes(re))}))||[];_e.length?Q[de]=_e:delete Q[de]}return Q}),te=e.computed(()=>r.highlightedPluginIds.reduce((re,Q)=>{const le=ne.value[Q];return le&&re.push(le),re},[])),$=e.computed(()=>Object.keys(M.value).length>0),Z=e.computed(()=>Object.keys(C.value).length>0&&!$.value),F=e.computed(()=>r.config.app!=="konnect"||!T.value?[]:[{hash:"#kong",title:s("plugins.select.tabs.kong.title")},{hash:"#custom",title:s("plugins.select.tabs.custom.title"),disabled:A.value}]),J=e.computed(()=>{var Q;let re=F.value.length&&((i==null?void 0:i.hash)||((Q=F.value[0])==null?void 0:Q.hash))||"";return re==="#custom"&&A.value&&(re="#kong"),re}),G=()=>{const re=new Map(k.value.map(de=>[de.name,de])),Q=new Set(_.value.map(de=>de.name)),le=new Set([...Q,...re.keys()]);return[...new Set([...Object.keys({...r.availableOnServer?{}:c}),...b.value,...le])].filter(de=>!r.ignoredPlugins.includes(de)).filter(de=>{if(!r.config.entityType)return de;const _e=re.has(de)?re.get(de).ref:de;return r.config.entityType==="services"&&c[_e]&&!c[_e].scope.includes(fe.PluginScope.SERVICE)||r.config.entityType==="routes"&&c[_e]&&!c[_e].scope.includes(fe.PluginScope.ROUTE)||r.config.entityType==="consumer_groups"&&c[_e]&&!c[_e].scope.includes(fe.PluginScope.CONSUMER_GROUP)||r.config.entityType==="consumers"&&c[_e]&&!c[_e].scope.includes(fe.PluginScope.CONSUMER)?!1:de}).reduce((de,_e)=>{var ae;const xe=c[_e]&&c[_e].name||_e,Ne=re.get(_e),g=Q.has(_e),O={...c[_e],id:_e,name:xe,available:b.value.includes(_e)||!!Ne||g,disabledMessage:"",group:((ae=c[_e])==null?void 0:ae.group)||fe.PluginGroup.CUSTOM_PLUGINS};O.group===fe.PluginGroup.CUSTOM_PLUGINS&&(Ne?(O.customPluginType="cloned",O.clonedFromRef=Ne.ref):g?O.customPluginType="streaming":O.customPluginType="schema"),r.disabledPlugins&&(O.disabledMessage=r.disabledPlugins[_e]);const j=O.group||s("plugins.select.misc_plugins");let W=de[j];return W||(W=[]),W.push(O),W.sort(u("name")),de[j]=W,de},{})},v=e.computed(()=>{var Q;let re=`${r.config.apiBaseUrl}${tt.select[r.config.app].availablePlugins}`;if(r.config.app==="konnect")re=re.replace(/{controlPlaneId}/gi,r.config.controlPlaneId||"");else if(r.config.app==="kongManager"&&((Q=r.config.gatewayInfo)==null?void 0:Q.edition)==="community")return`${r.config.apiBaseUrl}${tt.select[r.config.app].availablePluginsForOss}`;return re.replace(/\/{workspace}/gi,r.config.workspace?`/${r.config.workspace}`:"")}),q=e.computed(()=>{if(V.value){let re=`${r.config.apiBaseUrl}${tt.select[r.config.app].streamingCustomPlugins}`;return r.config.app==="konnect"?re.replace(/{controlPlaneId}/gi,r.config.controlPlaneId||""):re.replace(/\/{workspace}/gi,r.config.workspace?`/${r.config.workspace}`:"")}return null}),ie=e.computed(()=>{if(R.value){let re=`${r.config.apiBaseUrl}${tt.select[r.config.app].clonedPlugins}`;return r.config.app==="konnect"?re.replace(/{controlPlaneId}/gi,r.config.controlPlaneId||""):re.replace(/\/{workspace}/gi,r.config.workspace?`/${r.config.workspace}`:"")}return null}),oe=e.computed(()=>{if(r.config.entityType&&r.config.entityId){let re=`${r.config.apiBaseUrl}${tt.list[r.config.app].forEntity}`;return r.config.app==="konnect"&&(re=re.replace(/{controlPlaneId}/gi,r.config.controlPlaneId||"")),re.replace(/\/{workspace}/gi,r.config.workspace?`/${r.config.workspace}`:"").replace(/{entityType}/gi,r.config.entityType||"").replace(/{entityId}/gi,r.config.entityId||"")}return""}),ke=re=>{a.replace({hash:re,query:i.query})};e.watch(()=>r.disabledPlugins,(re,Q)=>{!p(re,Q)&&!f.value&&(C.value=G())}),e.watch(()=>r.ignoredPlugins,(re,Q)=>{!p(re,Q)&&!f.value&&(C.value=G())}),e.watch(f,re=>{o("loading",re)});const ye=async re=>{if(!oe.value){N.value=[];return}try{const{data:{data:Q}}=await S.get(oe.value,{signal:re});Q!=null&&Q.length&&(N.value=Q.reduce((le,de)=>(de.name&&le.push(de.name),le),[]))}catch(Q){X(Q)||(N.value=[])}},ce=async re=>{const Q=[];q.value&&Ge.value&&Q.push(kc(S,q.value,re).then(le=>{_.value=le}).catch(le=>{X(le)||y.value||(y.value=l(le)??s("plugins.select.tabs.custom.fetch_error"))})),ie.value&&lt.value&&Q.push(kc(S,ie.value,re).then(le=>{k.value=le}).catch(le=>{if(X(le))return;const de=Y(le);(de||!y.value)&&(y.value=de?s("plugins.select.tabs.custom.license_required"):l(le)??s("plugins.select.tabs.custom.fetch_error"))})),Q.push(ye(re)),await Promise.allSettled(Q)},he=async()=>{var re,Q;(re=E.value)==null||re.abort(),E.value=new AbortController,f.value=!0,m.value=!1,h.value="",y.value="",b.value=[],_.value=[],k.value=[],N.value=[];try{const{data:le}=await S.get(v.value,{signal:E.value.signal});if(r.config.app==="konnect"){const{names:de}=le;b.value=de||[]}else if(r.config.app==="kongManager"){const{plugins:{available_on_server:de}}=le;b.value=de?Object.keys(de):[]}await ce(E.value.signal),C.value=G()}catch(le){X(le)||(m.value=!0,h.value=l(le))}finally{(Q=E.value)!=null&&Q.signal.aborted||(f.value=!1)}},Oe=e.ref(!1),De=e.ref(!1),Be=e.ref(!1),Ge=e.ref(!1),We=e.ref(!1),nt=e.ref(!1),lt=e.ref(!1),Re=re=>{_.value=_.value.filter(Q=>Q.name!==re),k.value=k.value.filter(Q=>Q.name!==re),C.value=G(),o("delete-custom:success",re)};e.onBeforeMount(async()=>{const[re,Q,le,de,_e,xe,Ne]=await Promise.all([r.canCreateCustomPlugin(),r.canEditCustomPlugin(),r.canDeleteCustomPlugin(),r.canReadCustomPlugin(),r.canEditClonedPlugin?r.canEditClonedPlugin():Promise.resolve(null),r.canDeleteClonedPlugin?r.canDeleteClonedPlugin():Promise.resolve(null),r.canReadClonedPlugin()]);Oe.value=re,De.value=Q,Be.value=le,Ge.value=de,We.value=_e??Q,nt.value=xe??le,lt.value=Ne});const Ce=e.useTemplateRef("filter-input");return e.onMounted(async()=>{var re,Q;w.value=!0,(Q=(re=Ce.value)==null?void 0:re.input)==null||Q.focus(),await he()}),e.watch(()=>{var re;return[r.config.app==="konnect"?r.config.controlPlaneId:void 0,r.config.workspace,r.config.entityType,r.config.entityId,r.config.app==="kongManager"?(re=r.config.gatewayInfo)==null?void 0:re.edition:void 0,x.value,A.value]},async()=>{w.value&&await he()}),e.onBeforeUnmount(()=>{var re;(re=E.value)==null||re.abort()}),(re,Q)=>{const le=e.resolveComponent("KInput"),de=e.resolveComponent("KSkeletonBox"),_e=e.resolveComponent("KSkeleton"),xe=e.resolveComponent("KEmptyState"),Ne=e.resolveComponent("KTooltip"),g=e.resolveComponent("KAlert"),O=e.resolveComponent("KTabs");return e.openBlock(),e.createElementBlock("div",SF,[e.createElementVNode("div",xF,[e.createVNode(le,{ref:"filter-input",modelValue:d.value,"onUpdate:modelValue":Q[0]||(Q[0]=j=>d.value=j),modelModifiers:{trim:!0},class:"plugins-filter-input","data-testid":"plugins-filter",placeholder:e.unref(s)("search.placeholder.select"),type:"search"},null,8,["modelValue","placeholder"])]),f.value?(e.openBlock(),e.createElementBlock("section",AF,[e.createVNode(de,{class:"plugins-skeleton-title",width:"10"}),e.createVNode(_e,{"card-count":8,class:"plugins-skeleton-cards",type:"card"})])):m.value?(e.openBlock(),e.createBlock(xe,{key:1,"action-button-visible":!1,"data-testid":"plugins-fetch-error","icon-variant":"error"},{default:e.withCtx(()=>[e.createElementVNode("h3",null,e.toDisplayString(h.value),1)]),_:1})):Z.value&&d.value?(e.openBlock(),e.createBlock(xe,{key:2,"action-button-visible":!1,"data-testid":"plugins-empty-state","icon-variant":"search"},{default:e.withCtx(()=>[e.createElementVNode("h5",null,e.toDisplayString(e.unref(s)("search.no_results",{filter:d.value})),1)]),_:1})):(e.openBlock(),e.createElementBlock("section",vF,[F.value.length?(e.openBlock(),e.createBlock(O,{key:0,modelValue:J.value,"onUpdate:modelValue":Q[3]||(Q[3]=j=>J.value=j),"data-testid":"plugins-tabs",tabs:F.value,onChange:ke},e.createSlots({kong:e.withCtx(()=>[e.createElementVNode("div",IF,[e.createElementVNode("p",BF,e.toDisplayString(e.unref(s)("plugins.select.tabs.kong.description")),1),e.createVNode(Ep,{"can-delete-cloned-plugin":nt.value,"can-delete-custom-plugin":Be.value,"can-edit-cloned-plugin":We.value,"can-edit-custom-plugin":De.value,config:n.config,"hide-highlighted-plugins":d.value.length>0,"highlighted-plugins":te.value,"highlighted-plugins-title":r.highlightedPluginsTitle,"navigate-on-click":n.navigateOnClick,"plugin-list":M.value,"onDelete:success":Re,onPluginClicked:Q[1]||(Q[1]=j=>re.$emit("plugin-clicked",j))},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","hide-highlighted-plugins","highlighted-plugins","highlighted-plugins-title","navigate-on-click","plugin-list"])])]),custom:e.withCtx(()=>[e.createElementVNode("div",TF,[e.renderSlot(re.$slots,"before-custom-tab-content",{},void 0,!0),e.createElementVNode("p",OF,e.toDisplayString(e.unref(s)("plugins.select.tabs.custom.description")),1),y.value?(e.openBlock(),e.createBlock(g,{key:0,appearance:"warning",class:"custom-plugins-warning",message:y.value},null,8,["message"])):e.createCommentVNode("",!0),e.createVNode(kF,{"can-create-custom-plugin":Oe.value,"can-delete-cloned-plugin":nt.value,"can-delete-custom-plugin":Be.value,"can-edit-cloned-plugin":We.value,"can-edit-custom-plugin":De.value,config:n.config,"navigate-on-click":n.navigateOnClick,"plugin-list":M.value,"onDelete:success":Re,onPluginClicked:Q[2]||(Q[2]=j=>re.$emit("plugin-clicked",j))},null,8,["can-create-custom-plugin","can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","navigate-on-click","plugin-list"])])]),_:2},[A.value?{name:"custom-anchor",fn:e.withCtx(()=>[e.createVNode(Ne,{"max-width":"300",text:e.unref(s)("plugins.select.tabs.custom.disabled_tooltip")},{default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(e.unref(s)("plugins.select.tabs.custom.title")),1)]),_:1},8,["text"])]),key:"0"}:void 0]),1032,["modelValue","tabs"])):(e.openBlock(),e.createElementBlock("div",PF,[y.value?(e.openBlock(),e.createBlock(g,{key:0,appearance:"warning",class:"custom-plugins-warning",message:y.value},null,8,["message"])):e.createCommentVNode("",!0),e.createVNode(Ep,{"can-delete-cloned-plugin":nt.value,"can-delete-custom-plugin":Be.value,"can-edit-cloned-plugin":We.value,"can-edit-custom-plugin":De.value,config:n.config,"hide-highlighted-plugins":d.value.length>0,"highlighted-plugins":te.value,"highlighted-plugins-title":r.highlightedPluginsTitle,"navigate-on-click":n.navigateOnClick,"plugin-list":M.value,"onDelete:success":Re,onPluginClicked:Q[4]||(Q[4]=j=>re.$emit("plugin-clicked",j))},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","hide-highlighted-plugins","highlighted-plugins","highlighted-plugins-title","navigate-on-click","plugin-list"])]))]))])}}}),[["__scopeId","data-v-40b228cd"]]),$F={class:"plugin-select-card-wrapper","data-testid":"plugin-catalog-card-wrapper"},RF={class:"plugin-card-header"},LF={class:"plugin-card-title"},DF={key:0,class:"plugin-card-actions"},MF=["data-testid","title"],jF={key:0},FF=["title"],UF={class:"plugin-card-footer"},KF={class:"plugin-card-footer-extra"},qF={key:0,class:"custom-plugin-badges"},GF=je(e.defineComponent({__name:"PluginCatalogCard",props:{config:{},plugin:{},canDeleteCustomPlugin:{type:Boolean},canDeleteClonedPlugin:{type:Boolean},canEditCustomPlugin:{type:Boolean},canEditClonedPlugin:{type:Boolean}},emits:["plugin-clicked","custom-plugin-delete"],setup(n,{emit:t}){const r=t,o=n,i=Ar.useRouter(),{i18n:{t:a}}=st.useI18n(),s=e.computed(()=>o.plugin.customPluginType==="cloned"&&o.plugin.clonedFromRef?o.plugin.clonedFromRef:o.plugin.id),c=e.computed(()=>!C.value||k.value?[]:o.plugin.customPluginType==="cloned"&&o.plugin.clonedFromRef?[a("plugins.select.cloned_from_badge",{link:o.plugin.clonedFromRef})]:o.plugin.customPluginType==="streaming"?[a("plugins.select.streamed_custom_badge")]:[a("plugins.select.installed_custom_badge")]),l=e.computed(()=>!!(!o.plugin.available||o.plugin.disabledMessage)),u=e.computed(()=>typeof o.config.getCustomEditRoute=="function"),p=e.computed(()=>o.plugin.customPluginType==="cloned"),d=e.computed(()=>p.value?!!o.canDeleteClonedPlugin:!!o.canDeleteCustomPlugin),f=e.computed(()=>p.value?!!o.canEditClonedPlugin:!!o.canEditCustomPlugin),m=e.computed(()=>!(o.config.app==="kongManager"&&o.plugin.customPluginType==="schema")),h=e.computed(()=>f.value&&u.value),y=e.computed(()=>d.value),b=e.computed(()=>!!(C.value&&!k.value&&m.value&&(y.value||h.value))),_=e.computed(()=>l.value?{}:C.value&&k.value&&o.config.createCustomRoute?o.config.createCustomRoute:o.config.getCreateRoute(o.plugin.id)),k=e.computed(()=>o.plugin.id==="custom-plugin-create"),C=e.computed(()=>o.plugin.group===fe.PluginGroup.CUSTOM_PLUGINS),N=()=>{C.value&&r("custom-plugin-delete")},E=(w,S)=>{typeof o.config.getCustomEditRoute=="function"&&i.push(o.config.getCustomEditRoute(w,S))};return(w,S)=>{const I=e.resolveComponent("KButton"),U=e.resolveComponent("KDropdownItem"),x=e.resolveComponent("KDropdownMenu"),A=e.resolveComponent("KBadge"),T=e.resolveComponent("RouterLink"),V=e.resolveComponent("KTooltip");return e.openBlock(),e.createElementBlock("div",$F,[e.createVNode(V,{text:n.plugin.disabledMessage},{default:e.withCtx(()=>[e.createVNode(T,{class:e.normalizeClass(["plugin-select-card",{disabled:l.value}]),"data-testid":`${n.plugin.id}-card`,to:_.value},{default:e.withCtx(()=>[e.createElementVNode("div",RF,[e.createElementVNode("div",LF,[e.createVNode(e.unref(xr.PluginIcon),{alt:n.plugin.name,class:"plugin-card-icon",name:s.value,size:55},null,8,["alt","name"]),e.createElementVNode("span",{class:e.normalizeClass({"non-custom-title":!C.value})},e.toDisplayString(n.plugin.name),3)]),b.value?(e.openBlock(),e.createElementBlock("div",DF,[e.createVNode(x,{"data-testid":"custom-plugin-actions","kpop-attributes":{placement:"bottom-end"},width:"150",onClick:S[1]||(S[1]=e.withModifiers(()=>{},["stop","prevent"]))},{default:e.withCtx(()=>[e.createVNode(I,{appearance:"tertiary",class:"actions-trigger","data-testid":"overflow-actions-button",icon:"",size:"small"},{default:e.withCtx(()=>[e.createVNode(e.unref($e.MoreIcon),{size:`var(--kui-icon-size-30, ${e.unref(Yn)})`},null,8,["size"])]),_:1})]),items:e.withCtx(()=>[h.value?(e.openBlock(),e.createBlock(U,{key:0,"data-testid":"edit-plugin-schema",onClick:S[0]||(S[0]=e.withModifiers(R=>E(n.plugin.name,n.plugin.customPluginType),["stop","prevent"]))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("actions.edit")),1)]),_:1})):e.createCommentVNode("",!0),y.value?(e.openBlock(),e.createBlock(U,{key:1,danger:"","data-testid":"delete-plugin-schema","has-divider":h.value,onClick:e.withModifiers(N,["stop","prevent"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("actions.delete")),1)]),_:1},8,["has-divider"])):e.createCommentVNode("",!0)]),_:1})])):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:"plugin-card-body","data-testid":`${n.plugin.id}-card-body`,title:n.plugin.available?n.plugin.name:e.unref(a)("plugins.select.unavailable_tooltip")},[n.plugin.description?(e.openBlock(),e.createElementBlock("div",jF,[e.createElementVNode("div",{title:n.plugin.description},e.toDisplayString(n.plugin.description),9,FF)])):e.createCommentVNode("",!0)],8,MF),e.createElementVNode("div",UF,[e.createElementVNode("div",null,e.toDisplayString(k.value?e.unref(a)("actions.create_custom"):e.unref(a)("actions.configure")),1),e.createElementVNode("div",KF,[c.value.length?(e.openBlock(),e.createElementBlock("div",qF,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,R=>(e.openBlock(),e.createBlock(A,{key:R,appearance:"info"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(R),1)]),_:2},1024))),128))])):e.createCommentVNode("",!0),e.renderSlot(w.$slots,"footer-extra",{},void 0,!0)])])]),_:3},8,["class","data-testid","to"])]),_:3},8,["text"])])}}}),[["__scopeId","data-v-cabcdb98"]]),HF=["data-testid"],zF={class:"group-icon-wrapper"},WF={class:"group-title-text"},YF=["data-testid"],JF=["data-testid"],Yw=je(e.defineComponent({__name:"PluginCatalogGroup",props:{config:{},name:{},plugins:{},canDeleteCustomPlugin:{type:Boolean},canDeleteClonedPlugin:{type:Boolean},canEditCustomPlugin:{type:Boolean},canEditClonedPlugin:{type:Boolean},showAllCard:{type:Boolean}},emits:["plugin-clicked","revalidate","delete:success"],setup(n,{emit:t}){const r=n,o=e.computed(()=>{switch(r.name){case fe.PluginGroup.FEATURED:return $e.PopularIcon;case fe.PluginGroup.AI:return $e.BotIcon;case fe.PluginGroup.ANALYTICS_AND_MONITORING:return $e.AnalyticsIcon;case fe.PluginGroup.AUTHENTICATION:return $e.LockIcon;case fe.PluginGroup.LOGGING:return $e.ServiceDocumentIcon;case fe.PluginGroup.MONETIZATION:return $e.MoneyIcon;case fe.PluginGroup.SECURITY:return $e.SecurityIcon;case fe.PluginGroup.SERVERLESS:return $e.RuntimeServerlessIcon;case fe.PluginGroup.TRAFFIC_CONTROL:return $e.TrafficIcon;case fe.PluginGroup.TRANSFORMATIONS:return $e.TransformationIcon;case fe.PluginGroup.DEPLOYMENT:return $e.DeployIcon;case fe.PluginGroup.CUSTOM_PLUGINS:return $e.CodeblockIcon;default:return null}}),i=t,{i18n:{t:a}}=st.useI18n(),s=e.ref(!1),c=e.computed(()=>r.showAllCard?r.plugins:!s.value&&r.plugins.length>9?r.plugins.slice(0,8):r.plugins),l=e.computed(()=>!r.showAllCard&&!s.value&&r.plugins.length>9);function u(){s.value=!0}const p=e.ref(!1),d=e.ref(null),f=h=>{p.value=!0,d.value={id:h.id,name:h.name,group:h.group,customPluginType:h.customPluginType}},m=h=>{var y,b,_;h&&(i("revalidate"),i("delete:success",{name:((y=d.value)==null?void 0:y.name)||"",group:(b=d.value)==null?void 0:b.group,customPluginType:(_=d.value)==null?void 0:_.customPluginType})),p.value=!1,d.value=null};return(h,y)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[n.name?(e.openBlock(),e.createElementBlock("div",{key:0,class:"group-title","data-testid":`plugin-group-${n.name}-title`},[e.createElementVNode("div",zF,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.value),{color:`var(--kui-color-text-decorative-purple, ${e.unref(Jg)})`},null,8,["color"]))]),e.createElementVNode("span",WF,e.toDisplayString(n.name),1)],8,HF)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"plugin-card-container","data-testid":`plugin-group-${n.name}`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,b=>(e.openBlock(),e.createBlock(GF,{key:`plugin-card-${b.id}`,"can-delete-cloned-plugin":n.canDeleteClonedPlugin,"can-delete-custom-plugin":n.canDeleteCustomPlugin,"can-edit-cloned-plugin":n.canEditClonedPlugin,"can-edit-custom-plugin":n.canEditCustomPlugin,config:n.config,plugin:b,onCustomPluginDelete:_=>f(b),onPluginClicked:_=>i("plugin-clicked",b)},e.createSlots({_:2},[b.gatewayVersion&&e.unref(jT)(e.unref(fe.GATEWAY_VERSION_TIMESTAMP_MAP)[b.gatewayVersion])?{name:"footer-extra",fn:e.withCtx(()=>[e.createElementVNode("span",{class:"plugin-card-new-badge","data-testid":`plugin-card-${b.id}-new-badge`},e.toDisplayString(e.unref(a)("labels.new")),9,JF)]),key:"0"}:void 0]),1032,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","plugin","onCustomPluginDelete","onPluginClicked"]))),128)),l.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"show-all-plugin-card",onClick:u},e.toDisplayString(e.unref(a)("plugins.select.show_all")),1)):e.createCommentVNode("",!0)],8,YF),p.value&&d.value?(e.openBlock(),e.createBlock(Cc,{key:1,config:n.config,plugin:d.value,onClosed:m,onProceed:y[0]||(y[0]=b=>m(!0))},null,8,["config","plugin"])):e.createCommentVNode("",!0)],64))}}),[["__scopeId","data-v-f9a9a47c"]]),XF={class:"plugin-select-grid"},ZF={class:"empty-state-title"},QF={class:"empty-state-description"},eU={key:1},tU=je(e.defineComponent({__name:"PluginCatalogGrid",props:{config:{},pluginList:{},canDeleteCustomPlugin:{type:Boolean},canDeleteClonedPlugin:{type:Boolean},canEditCustomPlugin:{type:Boolean},canEditClonedPlugin:{type:Boolean}},emits:["plugin-clicked","delete:success"],setup(n,{emit:t}){const r=Ml.concat(jl),o=t,{i18n:{t:i}}=st.useI18n(),a=s=>{o("plugin-clicked",s)};return(s,c)=>{var u;const l=e.resolveComponent("KEmptyState");return e.openBlock(),e.createElementBlock("div",XF,[Object.keys(n.pluginList||[]).length?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(l,{key:0,"action-button-visible":!1,class:"plugins-empty-state","data-testid":"plugins-empty-state","icon-variant":"kong"},{title:e.withCtx(()=>[e.createElementVNode("span",ZF,e.toDisplayString(e.unref(i)("plugins.select.tabs.kong.empty_title")),1)]),default:e.withCtx(()=>[e.createElementVNode("span",QF,e.toDisplayString(e.unref(i)("plugins.select.tabs.kong.empty_description")),1)]),_:1})),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r),p=>{var d;return e.openBlock(),e.createElementBlock(e.Fragment,null,[(d=n.pluginList)!=null&&d[p]?(e.openBlock(),e.createElementBlock("div",{key:p},[e.createVNode(Yw,{"can-delete-cloned-plugin":n.canDeleteClonedPlugin,"can-delete-custom-plugin":n.canDeleteCustomPlugin,"can-edit-cloned-plugin":n.canEditClonedPlugin,"can-edit-custom-plugin":n.canEditCustomPlugin,config:n.config,name:p,plugins:n.pluginList[p]||[],"onDelete:success":c[0]||(c[0]=f=>o("delete:success",f)),onPluginClicked:c[1]||(c[1]=f=>a(f))},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","name","plugins"])])):e.createCommentVNode("",!0)],64)}),256)),(u=n.pluginList)!=null&&u["Query Result"]?(e.openBlock(),e.createElementBlock("div",eU,[e.createVNode(Yw,{"can-delete-cloned-plugin":n.canDeleteClonedPlugin,"can-delete-custom-plugin":n.canDeleteCustomPlugin,"can-edit-cloned-plugin":n.canEditClonedPlugin,"can-edit-custom-plugin":n.canEditCustomPlugin,config:n.config,plugins:n.pluginList["Query Result"]||[],"show-all-card":"","onDelete:success":c[2]||(c[2]=p=>o("delete:success",p)),onPluginClicked:c[3]||(c[3]=p=>a(p))},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","plugins"])])):e.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-e3bf3819"]]),nU={class:"plugin-name-cell","data-testid":"plugin-catalog-list-view-name"},rU=["title"],oU=["title"],iU={class:"plugin-action-cell","data-testid":"plugin-catalog-list-view-action"},aU={key:0,class:"plugin-more-action-cell","data-testid":"plugin-catalog-list-view-more-actions"},sU=je(e.defineComponent({__name:"PluginCatalogListView",props:{config:{},pluginList:{},canDeleteCustomPlugin:{type:Boolean},canDeleteClonedPlugin:{type:Boolean},canEditCustomPlugin:{type:Boolean},canEditClonedPlugin:{type:Boolean}},emits:["revalidate","delete:success"],setup(n,{emit:t}){const r=t,o=n,{i18n:{t:i}}=st.useI18n(),a=x=>x.customPluginType==="cloned"&&x.clonedFromRef?i("plugins.select.cloned_from_badge",{link:x.clonedFromRef}):x.customPluginType==="streaming"?i("plugins.select.streamed_custom_badge"):x.customPluginType?i("plugins.select.installed_custom_badge"):"",s=e.computed(()=>w.value.some(x=>C(x.plugin))),c=e.computed(()=>{const x=[{key:"name",label:i("plugins.select.list.table_headers.name"),sortable:!0},{key:"description",label:i("plugins.select.list.table_headers.description")},{key:"action",hideLabel:!0}];return s.value&&x.push({key:"more-actions",hideLabel:!0}),x}),l=e.computed(()=>{if(!o.pluginList)return[];const x=Object.values(o.pluginList).flat();return Array.from(new Map(x.map(T=>[T.id,T])).values()).map(T=>({id:T.id,name:T.name,description:T.description,badge:a(T),plugin:T}))}),u=e.ref(0),p=e.ref(10),d=e.ref(1),f=e.ref(l.value),m=e.ref(!1),h=e.ref(null),y=x=>x.customPluginType==="cloned"&&x.clonedFromRef?x.clonedFromRef:x.id,b=x=>(x==null?void 0:x.customPluginType)==="cloned",_=x=>!(x!=null&&x.customPluginType)||o.config.app==="kongManager"&&x.customPluginType==="schema"?!1:b(x)?!!o.canDeleteClonedPlugin:!!o.canDeleteCustomPlugin,k=x=>!(x!=null&&x.customPluginType)||typeof o.config.getCustomEditRoute!="function"||o.config.app==="kongManager"&&x.customPluginType==="schema"?!1:b(x)?!!o.canEditClonedPlugin:!!o.canEditCustomPlugin,C=x=>_(x)||k(x),N=x=>{m.value=!0,h.value={id:x.id,name:x.name,group:x.group,customPluginType:x.customPluginType}},E=x=>{var A,T,V;x&&(r("revalidate"),r("delete:success",{name:((A=h.value)==null?void 0:A.name)||"",group:(T=h.value)==null?void 0:T.group,customPluginType:(V=h.value)==null?void 0:V.customPluginType})),m.value=!1,h.value=null},w=e.computed(()=>{const x=f.value.length,A=Math.max(1,Math.ceil(x/p.value)),V=(Math.min(d.value,A)-1)*p.value;return f.value.slice(V,V+p.value)});e.watch(l,()=>{f.value=[...l.value],d.value=1,u.value++});const S=({page:x})=>{d.value=x},I=({pageSize:x})=>{p.value=x},U=x=>{const{sortColumnKey:A,sortColumnOrder:T}=x;A==="name"&&(f.value=[...f.value].sort((V,R)=>{const X=(V[A]||"").toLowerCase(),Y=(R[A]||"").toLowerCase();return X<Y?T==="asc"?-1:1:X>Y?T==="asc"?1:-1:0}))};return(x,A)=>{const T=e.resolveComponent("KBadge"),V=e.resolveComponent("KButton"),R=e.resolveComponent("KDropdownItem"),X=e.resolveComponent("KDropdown"),Y=e.resolveComponent("KTableView"),ne=e.resolveComponent("KCard");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(ne,{"data-testid":"plugin-catalog-list-view-card"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(Y,{key:u.value,class:"plugin-catalog-table","client-sort":"",data:w.value,"data-testid":"plugin-catalog-list-view-table",headers:c.value,"pagination-attributes":{totalCount:l.value.length,currentPage:d.value,initialPageSize:p.value,pageSizes:[10,25,50]},"resize-columns":"","row-key":"id",onPageChange:S,onPageSizeChange:I,onSort:U},{name:e.withCtx(({row:M})=>[e.createElementVNode("span",nU,[e.createVNode(e.unref(xr.PluginIcon),{"data-testid":`plugin-catalog-list-view-${M.plugin.id}-icon`,name:y(M.plugin),size:20},null,8,["data-testid","name"]),e.createElementVNode("span",{class:"plugin-name-text","data-testid":"plugin-catalog-list-view-name-text",title:M.name},e.toDisplayString(M.name),9,rU),M.badge?(e.openBlock(),e.createBlock(T,{key:0,appearance:"info",class:"plugin-name-badge","data-testid":"plugin-catalog-list-view-custom-badge"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(M.badge),1)]),_:2},1024)):e.createCommentVNode("",!0)])]),description:e.withCtx(({row:M})=>[e.createElementVNode("span",{class:"plugin-description-cell","data-testid":"plugin-catalog-list-view-description",title:M.description},e.toDisplayString(M.description),9,oU)]),action:e.withCtx(({row:M})=>[e.createElementVNode("div",iU,[e.createVNode(V,{appearance:"tertiary","data-testid":"plugin-catalog-list-view-configure-btn",size:"small",to:o.config.getCreateRoute(M.id)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)("actions.configure")),1)]),_:1},8,["to"])])]),"more-actions":e.withCtx(({row:M})=>[C(M.plugin)?(e.openBlock(),e.createElementBlock("div",aU,[e.createVNode(X,{appearance:"tertiary",class:"actions-trigger","data-testid":"plugin-catalog-list-view-more-actions-button",icon:"",size:"small"},{items:e.withCtx(()=>{var te,$;return[k(M.plugin)?(e.openBlock(),e.createBlock(R,{key:0,"data-testid":"edit-plugin-schema",item:{label:e.unref(i)("actions.edit"),to:($=(te=n.config).getCustomEditRoute)==null?void 0:$.call(te,M.plugin.name,M.plugin.customPluginType)}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)("actions.edit")),1)]),_:1},8,["item"])):e.createCommentVNode("",!0),_(M.plugin)?(e.openBlock(),e.createBlock(R,{key:1,danger:"","data-testid":"delete-plugin-schema","has-divider":k(M.plugin),onClick:()=>N(M.plugin)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)("actions.delete")),1)]),_:1},8,["has-divider","onClick"])):e.createCommentVNode("",!0)]}),default:e.withCtx(()=>[e.createVNode(e.unref($e.MoreIcon),{color:`var(--kui-color-text-neutral, ${e.unref(cr)})`,size:`var(--kui-icon-size-30, ${e.unref(Yn)})`},null,8,["color","size"])]),_:2},1024)])):e.createCommentVNode("",!0)]),_:1},8,["data","headers","pagination-attributes"]))]),_:1}),m.value&&h.value?(e.openBlock(),e.createBlock(Cc,{key:0,config:n.config,plugin:h.value,onClosed:E,onProceed:A[0]||(A[0]=M=>E(!0))},null,8,["config","plugin"])):e.createCommentVNode("",!0)],64)}}}),[["__scopeId","data-v-986d34db"]]),lU={class:"plugin-catalog","data-testid":"plugin-catalog"},cU={class:"plugin-filter","data-testid":"plugin-filter"},uU={class:"plugin-filter-title"},dU={class:"featured-title"},fU={class:"plugin-featured-filter"},pU=["data-testid"],mU={class:"group-title"},gU={class:"plugin-type-filter"},hU=["data-testid"],yU={class:"plugins-container"},_U={class:"plugins-filter-input-container"},bU={class:"icon-container"},wU={key:0},kU={key:3,"aria-live":"polite",class:"plugins-results-container"},CU=je(e.defineComponent({__name:"PluginCatalog",props:{config:{},disabledPlugins:{},highlightedPluginIds:{},customPluginSupport:{default:"none"},availableOnServer:{type:Boolean,default:!0},canDeleteCustomPlugin:{type:Function,default:async()=>!0},canReadCustomPlugin:{type:Function,default:async()=>!0},canEditCustomPlugin:{type:Function,default:async()=>!0},canDeleteClonedPlugin:{},canReadClonedPlugin:{type:Function,default:async()=>!0},canEditClonedPlugin:{}},emits:["loading","plugin-clicked","delete-custom:success"],setup(n,{emit:t}){var Ce;const r=t,{i18n:{t:o}}=st.useI18n(),{pluginMetaData:i}=st.usePluginMetaData(),{getMessageFromError:a}=Ie.useErrors(),{sortAlpha:s,objectsAreEqual:c}=Ie.useHelpers(),l=n,{axiosInstance:u}=Ie.useAxios((Ce=l.config)==null?void 0:Ce.axiosRequestConfig),p=e.useTemplateRef("filter-input"),d=e.ref(""),f=e.ref(!1),m=e.ref(!1),h=e.ref(Object.fromEntries(Ml.concat(jl).map(se=>[se,!1]))),y=e.ref(!0),b=e.ref(!1),_=e.ref(""),k=e.ref(""),C=e.ref([]),N=e.ref([]),E=e.ref([]),w=e.ref({}),S=e.ref([]),I=e.ref(!1),U=e.ref(null),x=e.ref(!1),A=e.computed(()=>I.value?$e.GridIcon:$e.ListIcon),T=e.inject(fr.KM_2485_CLONED_PLUGINS,!1),V=e.computed(()=>e.unref(T)),R=se=>se==="none"||se==="disabled"?new Set:new Set(Array.isArray(se)?se:[se]),X=e.computed(()=>R(l.customPluginSupport)),Y=e.computed(()=>[...X.value].sort().join("|")),ne=e.computed(()=>X.value.has("streaming")),M=e.computed(()=>V.value&&X.value.has("cloned")),te=se=>Zo.isAxiosError(se)&&se.code==="ERR_CANCELED",$=se=>a(se).toLowerCase().includes("requires a license"),Z=e.computed(()=>{var re;let se=`${l.config.apiBaseUrl}${tt.select[l.config.app].availablePlugins}`;if(l.config.app==="konnect")se=se.replace(/{controlPlaneId}/gi,l.config.controlPlaneId||"");else if(l.config.app==="kongManager"&&((re=l.config.gatewayInfo)==null?void 0:re.edition)==="community")return`${l.config.apiBaseUrl}${tt.select[l.config.app].availablePluginsForOss}`;return se.replace(/\/{workspace}/gi,l.config.workspace?`/${l.config.workspace}`:"")}),F=e.computed(()=>{if(ne.value){let se=`${l.config.apiBaseUrl}${tt.select[l.config.app].streamingCustomPlugins}`;return l.config.app==="konnect"?se.replace(/{controlPlaneId}/gi,l.config.controlPlaneId||""):se.replace(/\/{workspace}/gi,l.config.workspace?`/${l.config.workspace}`:"")}return null}),J=e.computed(()=>{if(M.value){let se=`${l.config.apiBaseUrl}${tt.select[l.config.app].clonedPlugins}`;return l.config.app==="konnect"?se.replace(/{controlPlaneId}/gi,l.config.controlPlaneId||""):se.replace(/\/{workspace}/gi,l.config.workspace?`/${l.config.workspace}`:"")}return null}),G=e.computed(()=>{if(l.config.entityType&&l.config.entityId){let se=`${l.config.apiBaseUrl}${tt.list[l.config.app].forEntity}`;return l.config.app==="konnect"&&(se=se.replace(/{controlPlaneId}/gi,l.config.controlPlaneId||"")),se.replace(/\/{workspace}/gi,l.config.workspace?`/${l.config.workspace}`:"").replace(/{entityType}/gi,l.config.entityType||"").replace(/{entityId}/gi,l.config.entityId||"")}return""}),v=e.computed(()=>{var xe;if(!w.value)return{};const se=Object.entries(h.value).filter(([,Ne])=>Ne).map(([Ne])=>Ne);let re={};se.length===0&&(re=w.value),se.forEach(Ne=>{w.value[Ne]&&(re[Ne]=w.value[Ne])});const Q=d.value.toLowerCase();if(!Q)return re;const le=JSON.parse(JSON.stringify(re));for(const Ne in re){const g=((xe=re[Ne])==null?void 0:xe.filter(O=>[O.name.toLowerCase(),O.id.toLowerCase()].some(W=>MT(Q,W).length===Q.length)))||[];g.length?le[Ne]=g:delete le[Ne]}const de=Object.values(le).flat().filter(Ne=>!!Ne),_e=Array.from(de.reduce((Ne,g)=>(Ne.has(g.id)||Ne.set(g.id,g),Ne),new Map).values());return _e.length?{"Query Result":_e}:{}}),q=e.computed(()=>Object.keys(v.value).length>0),ie=e.computed(()=>Object.keys(w.value).length>0&&!q.value),oe=()=>{Object.keys(h.value).forEach(se=>{h.value[se]=!1})},ke=()=>{const se=new Map(E.value.map(de=>[de.name,de])),re=new Set(N.value.map(de=>de.name)),Q=new Set([...re,...se.keys()]),le=[...new Set([...Object.keys({...l.availableOnServer?{}:i}),...C.value,...Q])].filter(de=>{if(!l.config.entityType)return de;const _e=se.has(de)?se.get(de).ref:de;return l.config.entityType==="services"&&i[_e]&&!i[_e].scope.includes(fe.PluginScope.SERVICE)||l.config.entityType==="routes"&&i[_e]&&!i[_e].scope.includes(fe.PluginScope.ROUTE)||l.config.entityType==="consumer_groups"&&i[_e]&&!i[_e].scope.includes(fe.PluginScope.CONSUMER_GROUP)||l.config.entityType==="consumers"&&i[_e]&&!i[_e].scope.includes(fe.PluginScope.CONSUMER)?!1:de}).reduce((de,_e)=>{var ae;const xe=i[_e]&&i[_e].name||_e,Ne=se.get(_e),g=re.has(_e),O={...i[_e],id:_e,name:xe,available:C.value.includes(_e)||!!Ne||g,disabledMessage:"",group:((ae=i[_e])==null?void 0:ae.group)||fe.PluginGroup.CUSTOM_PLUGINS};O.group===fe.PluginGroup.CUSTOM_PLUGINS&&(Ne?(O.customPluginType="cloned",O.clonedFromRef=Ne.ref):g?O.customPluginType="streaming":O.customPluginType="schema"),l.disabledPlugins&&(O.disabledMessage=l.disabledPlugins[_e]);const j=O.group||o("plugins.select.misc_plugins");let W=de[j];return W||(W=[]),W.push(O),W.sort(s("name")),de[j]=W,de},{});if(l.highlightedPluginIds&&l.highlightedPluginIds.length>0){const de=new Set(Object.values(le).flat().map(xe=>xe==null?void 0:xe.id)),_e=l.highlightedPluginIds.flatMap(xe=>{var g;const Ne=i[xe];return!Ne||!de.has(xe)?[]:{...Ne,id:xe,name:Ne.name||xe,available:C.value.includes(xe),disabledMessage:((g=l.disabledPlugins)==null?void 0:g[xe])||"",group:Ne.group||fe.PluginGroup.CUSTOM_PLUGINS}}).filter(Boolean);_e.length>0&&(le[fe.PluginGroup.FEATURED]=_e)}return le};e.watch(()=>l.disabledPlugins,(se,re)=>{!c(se||{},re||{})&&!y.value&&(w.value=ke())}),e.watch(y,se=>{r("loading",se)});const ye=e.ref(!1),ce=e.ref(!1),he=e.ref(!1),Oe=e.ref(!1),De=e.ref(!1),Be=e.ref(!1),Ge=async()=>{try{const[se,re,Q,le,de,_e]=await Promise.all([l.canEditCustomPlugin(),l.canDeleteCustomPlugin(),l.canReadCustomPlugin(),l.canEditClonedPlugin?l.canEditClonedPlugin():Promise.resolve(null),l.canDeleteClonedPlugin?l.canDeleteClonedPlugin():Promise.resolve(null),l.canReadClonedPlugin()]);ye.value=se,ce.value=re,he.value=Q,Oe.value=le??se,De.value=de??re,Be.value=_e}catch{ye.value=!1,ce.value=!1,he.value=!1,Oe.value=!1,De.value=!1,Be.value=!1}},We=async se=>{if(!G.value){S.value=[];return}try{const{data:{data:re}}=await u.get(G.value,{signal:se});re!=null&&re.length&&(S.value=re.reduce((Q,le)=>(le.name&&Q.push(le.name),Q),[]))}catch(re){te(re)||(S.value=[])}},nt=async se=>{const re=[];F.value&&he.value&&re.push(kc(u,F.value,se).then(Q=>{N.value=Q}).catch(Q=>{te(Q)||k.value||(k.value=a(Q)??o("plugins.select.tabs.custom.fetch_error"))})),J.value&&Be.value&&re.push(kc(u,J.value,se).then(Q=>{E.value=Q}).catch(Q=>{if(te(Q))return;const le=$(Q);(le||!k.value)&&(k.value=le?o("plugins.select.tabs.custom.license_required"):a(Q)??o("plugins.select.tabs.custom.fetch_error"))})),re.push(We(se)),await Promise.allSettled(re)},lt=async()=>{var re;(re=U.value)==null||re.abort();const se=new AbortController;U.value=se,y.value=!0,b.value=!1,_.value="",k.value="",C.value=[],N.value=[],E.value=[],S.value=[];try{const{data:Q}=await u.get(Z.value,{signal:se.signal});if(l.config.app==="konnect"){const{names:le}=Q;C.value=le||[]}else if(l.config.app==="kongManager"){const{plugins:{available_on_server:le}}=Q;C.value=le?Object.keys(le):[]}await nt(se.signal),w.value=ke()}catch(Q){te(Q)||(b.value=!0,_.value=a(Q))}finally{U.value===se&&!se.signal.aborted&&(y.value=!1)}},Re=async({name:se})=>{se&&(r("delete-custom:success",se),await lt())};return e.onMounted(async()=>{var se,re;x.value=!0,(re=(se=p.value)==null?void 0:se.input)==null||re.focus(),await Ge(),await lt()}),e.watch(()=>{var se;return[l.config.app==="konnect"?l.config.controlPlaneId:void 0,l.config.workspace,l.config.entityType,l.config.entityId,l.config.app==="kongManager"?(se=l.config.gatewayInfo)==null?void 0:se.edition:void 0,Y.value,V.value]},async()=>{x.value&&(await Ge(),await lt())}),e.onBeforeUnmount(()=>{var se;(se=U.value)==null||se.abort()}),(se,re)=>{const Q=e.resolveComponent("KButton"),le=e.resolveComponent("KCheckbox"),de=e.resolveComponent("KBadge"),_e=e.resolveComponent("KCollapse"),xe=e.resolveComponent("KInput"),Ne=e.resolveComponent("KSkeletonBox"),g=e.resolveComponent("KSkeleton"),O=e.resolveComponent("KEmptyState"),j=e.resolveComponent("KAlert");return e.openBlock(),e.createElementBlock("div",lU,[e.createElementVNode("div",cU,[e.createElementVNode("div",uU,[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.select.filter.title"))+" ",1),e.createVNode(Q,{appearance:"tertiary",class:"clear-selection","data-testid":"clear-filter-selection",disabled:!Object.values(h.value).some(W=>W),onClick:oe},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("plugins.select.filter.clear")),1)]),_:1},8,["disabled"])]),e.createVNode(_e,{modelValue:f.value,"onUpdate:modelValue":re[0]||(re[0]=W=>f.value=W)},{title:e.withCtx(()=>[e.createElementVNode("div",dU,e.toDisplayString(e.unref(o)("plugins.select.filter.featured")),1)]),default:e.withCtx(()=>[e.createElementVNode("div",fU,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(Ml),W=>(e.openBlock(),e.createElementBlock("div",{key:W,class:"plugin-filter-item","data-testid":`plugin-filter-item-${W}`},[e.createVNode(le,{modelValue:h.value[W],"onUpdate:modelValue":ae=>h.value[W]=ae,label:W},null,8,["modelValue","onUpdate:modelValue","label"]),e.createVNode(de,{appearance:"neutral"},{default:e.withCtx(()=>{var ae,be;return[e.createTextVNode(e.toDisplayString(((be=(ae=w.value)==null?void 0:ae[W])==null?void 0:be.length)||0),1)]}),_:2},1024)],8,pU))),128))])]),_:1},8,["modelValue"]),e.createVNode(_e,{modelValue:m.value,"onUpdate:modelValue":re[1]||(re[1]=W=>m.value=W)},{title:e.withCtx(()=>[e.createElementVNode("div",mU,e.toDisplayString(e.unref(o)("plugins.select.filter.type")),1)]),default:e.withCtx(()=>[e.createElementVNode("div",gU,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(jl),W=>(e.openBlock(),e.createElementBlock("div",{key:W,class:"plugin-filter-item","data-testid":`plugin-filter-item-${W}`},[e.createVNode(le,{modelValue:h.value[W],"onUpdate:modelValue":ae=>h.value[W]=ae,"data-testid":`plugin-filter-checkbox-${W}`,label:W},null,8,["modelValue","onUpdate:modelValue","data-testid","label"]),e.createVNode(de,{appearance:"neutral","data-testid":`plugin-filter-count-${W}`},{default:e.withCtx(()=>{var ae,be;return[e.createTextVNode(e.toDisplayString(((be=(ae=w.value)==null?void 0:ae[W])==null?void 0:be.length)||0),1)]}),_:2},1032,["data-testid"])],8,hU))),128))])]),_:1},8,["modelValue"])]),e.createElementVNode("div",yU,[e.createElementVNode("div",_U,[e.createVNode(xe,{ref:"filter-input",modelValue:d.value,"onUpdate:modelValue":re[2]||(re[2]=W=>d.value=W),modelModifiers:{trim:!0},class:"plugins-filter-input","data-testid":"plugins-filter-input",placeholder:e.unref(o)("search.placeholder.search_plugins"),type:"search"},null,8,["modelValue","placeholder"]),e.createElementVNode("div",bU,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(A.value),{class:"plugins-filter-icon",color:`var(--kui-icon-color-primary, ${e.unref(M1)})`,onClick:re[3]||(re[3]=W=>I.value=!I.value)},null,8,["color"]))])]),y.value?(e.openBlock(),e.createElementBlock("section",wU,[e.createVNode(Ne,{class:"plugins-skeleton-title",width:"10"}),e.createVNode(g,{"card-count":8,class:"plugins-skeleton-cards",type:"card"})])):b.value?(e.openBlock(),e.createBlock(O,{key:1,"action-button-visible":!1,"data-testid":"plugins-fetch-error","icon-variant":"error"},{default:e.withCtx(()=>[e.createElementVNode("h3",null,e.toDisplayString(_.value),1)]),_:1})):ie.value&&d.value?(e.openBlock(),e.createBlock(O,{key:2,"action-button-visible":!1,"data-testid":"plugins-empty-state","icon-variant":"search"},{default:e.withCtx(()=>[e.createElementVNode("h5",null,e.toDisplayString(e.unref(o)("search.no_results",{filter:d.value})),1)]),_:1})):(e.openBlock(),e.createElementBlock("section",kU,[k.value?(e.openBlock(),e.createBlock(j,{key:0,appearance:"warning",class:"custom-plugins-warning",message:k.value},null,8,["message"])):e.createCommentVNode("",!0),I.value?(e.openBlock(),e.createBlock(sU,{key:1,"can-delete-cloned-plugin":De.value,"can-delete-custom-plugin":ce.value,"can-edit-cloned-plugin":Oe.value,"can-edit-custom-plugin":ye.value,config:n.config,"plugin-list":v.value,"onDelete:success":Re},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","plugin-list"])):(e.openBlock(),e.createBlock(tU,{key:2,"can-delete-cloned-plugin":De.value,"can-delete-custom-plugin":ce.value,"can-edit-cloned-plugin":Oe.value,"can-edit-custom-plugin":ye.value,config:n.config,"plugin-list":v.value,"onDelete:success":Re,onPluginClicked:re[4]||(re[4]=W=>se.$emit("plugin-clicked",W))},null,8,["can-delete-cloned-plugin","can-delete-custom-plugin","can-edit-cloned-plugin","can-edit-custom-plugin","config","plugin-list"]))]))])])}}}),[["__scopeId","data-v-679e985d"]]),EU={key:1,class:"datakit-config-card-canvas"},NU={class:"config-card-details-label","data-testid":"datakit-configuration-label"},SU={class:"config-card-details-value datakit-canvas-container","data-testid":"datakit-configuration-canvas"},xU={class:"canvas-wrapper"},AU=je(e.defineComponent({__name:"DatakitConfigCardCanvas",props:{pluginData:{},item:{}},setup(n){const t=e.computed(()=>{var r;return vw.safeParse((r=n.pluginData)==null?void 0:r.config).success});return uf(n.pluginData),(r,o)=>{const i=e.resolveComponent("KLabel");return t.value?(e.openBlock(),e.createElementBlock("div",EU,[e.createElementVNode("div",NU,[e.createVNode(i,null,{default:e.withCtx(()=>[...o[0]||(o[0]=[e.createElementVNode("span",{class:"label-content"}," Nodes ",-1)])]),_:1})]),e.createElementVNode("div",SU,[e.createElementVNode("div",xU,[e.createVNode(up,{class:"datakit-flow-panels",mode:"view",resizable:""})])])])):(e.openBlock(),e.createBlock(e.unref(Ie.ConfigCardItem),{key:0,item:n.item},null,8,["item"]))}}}),[["__scopeId","data-v-9a3ef1ac"]]),vU={class:"kong-ui-entity-plugin-config-card"},IU={class:"name-cell-wrapper"},BU={class:"info-name"},TU={key:0},OU={key:0},PU={key:0},VU={key:0},$U={key:0},Np="config",RU=je(e.defineComponent({__name:"PluginConfigCard",props:{config:{type:Object,required:!0,validator:n=>!(!n||!["konnect","kongManager"].includes(n==null?void 0:n.app)||n.app==="konnect"&&!n.controlPlaneId||n.app==="kongManager"&&typeof n.workspace!="string"||!n.entityId||!n.pluginType)},configCardDoc:{type:String,default:"",required:!1},showIdAsLink:{type:Boolean,default:!1},hideTitle:{type:Boolean,default:!1},scopedEntityType:{type:String,required:!1,default:""},scopedEntityId:{type:String,required:!1,default:null},expandPartial:{type:Boolean,default:!0}},emits:["loading","fetch:error","error:fetch-schema","fetch:success","navigation-click"],setup(n,{emit:t}){var N;const r=t,o=n,{i18n:{t:i}}=st.useI18n(),a=st.usePluginMetaData(),{setFieldType:s}=st.usePluginHelpers(),{getPropValue:c}=Ie.useHelpers(),l=e.computed(()=>{var w;let E=(w=tt.item[o.config.app])==null?void 0:w[o.scopedEntityType?"forEntity":"all"].replace(/{entityType}/gi,o.scopedEntityType).replace(/{entityId}/gi,o.scopedEntityId??"").concat(o.expandPartial?"?expand_partials=true":"");if(o.config.app==="konnect"){const S=o.expandPartial?"&":"?";E=E.concat(`${S}__ui_data=true`)}return E}),u=e.computed(()=>{var S,I;const E={},w=((S=_.value)==null?void 0:S.fields)||[];for(let U=0;U<w.length;U++){const x=_.value.fields[U],A=(I=Object.keys(x))==null?void 0:I[0];s(E,A,x[A])}return{...E,instance_name:{section:Ie.ConfigurationSchemaSection.Basic,order:1.5},consumer:{label:i("plugins.fields.consumer"),section:Ie.ConfigurationSchemaSection.Basic,order:6},route:{label:i("plugins.fields.route"),section:Ie.ConfigurationSchemaSection.Basic,order:6},service:{label:i("plugins.fields.service"),section:Ie.ConfigurationSchemaSection.Basic,order:6},consumer_group:{label:i("plugins.fields.consumer_group"),section:Ie.ConfigurationSchemaSection.Basic,order:6},protocols:{type:Ie.ConfigurationSchemaType.BadgeTag,section:Ie.ConfigurationSchemaSection.Basic,order:7}}}),p=e.computed(()=>{var w,S,I;if(!((w=_.value)!=null&&w.fields))return[];const E=(S=_.value.fields)==null?void 0:S.find(U=>{var A;return((A=Object.keys(U))==null?void 0:A[0])===Np});return((I=E==null?void 0:E[Np])==null?void 0:I.fields)||[]}),d=e.computed(()=>{var w,S;const E={};if(!p.value)return E;for(let I=0;I<((w=p.value)==null?void 0:w.length);I++){const U=p.value[I],x=(S=Object.keys(U))==null?void 0:S[0],A=U[x];A.required&&(E[x]={order:1}),s(E,x,A)}return E}),f=E=>{var S;const w=(S=a.pluginMetaData[o.config.pluginType])==null?void 0:S.scope;return w?Object.fromEntries(Object.entries(E).filter(([I,U])=>U?!0:!(I==="service"&&!w.includes(fe.PluginScope.SERVICE)||I==="route"&&!w.includes(fe.PluginScope.ROUTE)||I==="consumer"&&!w.includes(fe.PluginScope.CONSUMER)||I==="consumer_group"&&!w.includes(fe.PluginScope.CONSUMER_GROUP)))):E},m=E=>Xr(E,"__ui_data"),{getMessageFromError:h}=Ie.useErrors(),{axiosInstance:y}=Ie.useAxios((N=o.config)==null?void 0:N.axiosRequestConfig),b=e.computed(()=>{var w,S;let E=`${o.config.apiBaseUrl}${tt.form[o.config.app].pluginSchema}`;return o.config.app==="konnect"&&(E=E.replace(/{controlPlaneId}/gi,((w=o.config)==null?void 0:w.controlPlaneId)||"")),E.replace(/\/{workspace}/gi,(S=o.config)!=null&&S.workspace?`/${o.config.workspace}`:"").replace(/{plugin}/gi,o.config.pluginType)}),_=e.ref({});Ie.useSchemaProvider(_);const k=e.ref(!1),C=e.ref("");return e.onBeforeMount(async()=>{k.value=!0;try{const{data:E}=await y.get(b.value);_.value=E}catch(E){C.value=h(E),r("error:fetch-schema",E)}finally{k.value=!1}}),(E,w)=>{const S=e.resolveComponent("KSkeleton"),I=e.resolveComponent("KEmptyState"),U=e.resolveComponent("KCopy");return e.openBlock(),e.createElementBlock("div",vU,[k.value?(e.openBlock(),e.createBlock(S,{key:0,"data-testid":"plugin-config-card-loader","table-columns":2,type:"table"})):C.value?(e.openBlock(),e.createBlock(I,{key:1,"data-testid":"plugin-config-card-schema-error","icon-variant":"error"},{default:e.withCtx(()=>[e.createElementVNode("h3",null,e.toDisplayString(C.value),1)]),_:1})):(e.openBlock(),e.createBlock(e.unref(Ie.EntityBaseConfigCard),{key:2,"code-block-record-formatter":m,config:n.config,"config-card-doc":n.configCardDoc,"config-schema":u.value,"entity-type":e.unref(Ie.SupportedEntityType).Plugin,"fetch-url":l.value,"hide-title":n.hideTitle,"plugin-config-key":Np,"plugin-config-schema":d.value,"record-resolver":f,"onFetch:error":w[0]||(w[0]=x=>E.$emit("fetch:error",x)),"onFetch:success":w[1]||(w[1]=x=>E.$emit("fetch:success",x)),onLoading:w[2]||(w[2]=x=>E.$emit("loading",x))},e.createSlots({name:e.withCtx(x=>[e.createElementVNode("div",IU,[e.createVNode(e.unref(xr.PluginIcon),{class:"plugin-icon",name:e.unref(c)("rowValue",x),size:24},null,8,["name"]),e.createElementVNode("span",BU,e.toDisplayString(e.unref(a).getDisplayName(e.unref(c)("rowValue",x))),1)])]),consumer:e.withCtx(x=>[e.unref(c)("rowValue",x)?n.showIdAsLink?(e.openBlock(),e.createBlock(e.unref(Ie.InternalLinkItem),{key:1,item:{key:e.unref(c)("rowValue",x).id,value:e.unref(c)("rowValue",x).id,type:e.unref(Ie.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>E.$emit("navigation-click",e.unref(c)("rowValue",x).id,"consumer")},null,8,["item","onNavigationClick"])):(e.openBlock(),e.createBlock(U,{key:2,"copy-tooltip":e.unref(i)("copy.tooltip",{label:e.unref(c)("row",x).label}),"data-testid":"consumer-copy-uuid",text:e.unref(c)("rowValue",x).id},null,8,["copy-tooltip","text"])):(e.openBlock(),e.createElementBlock("span",TU,"–"))]),route:e.withCtx(x=>[e.unref(c)("rowValue",x)?n.showIdAsLink?(e.openBlock(),e.createBlock(e.unref(Ie.InternalLinkItem),{key:1,item:{key:e.unref(c)("rowValue",x).id,value:e.unref(c)("rowValue",x).id,type:e.unref(Ie.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>E.$emit("navigation-click",e.unref(c)("rowValue",x).id,"route")},null,8,["item","onNavigationClick"])):(e.openBlock(),e.createBlock(U,{key:2,"copy-tooltip":e.unref(i)("copy.tooltip",{label:e.unref(c)("row",x).label}),"data-testid":"route-copy-uuid",text:e.unref(c)("rowValue",x).id},null,8,["copy-tooltip","text"])):(e.openBlock(),e.createElementBlock("span",OU,"–"))]),service:e.withCtx(x=>[e.unref(c)("rowValue",x)?n.showIdAsLink?(e.openBlock(),e.createBlock(e.unref(Ie.InternalLinkItem),{key:1,item:{key:e.unref(c)("rowValue",x).id,value:e.unref(c)("rowValue",x).id,type:e.unref(Ie.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>E.$emit("navigation-click",e.unref(c)("rowValue",x).id,"service")},null,8,["item","onNavigationClick"])):(e.openBlock(),e.createBlock(U,{key:2,"copy-tooltip":e.unref(i)("copy.tooltip",{label:e.unref(c)("row",x).label}),"data-testid":"service-copy-uuid",text:e.unref(c)("rowValue",x).id},null,8,["copy-tooltip","text"])):(e.openBlock(),e.createElementBlock("span",PU,"–"))]),consumer_group:e.withCtx(x=>[e.unref(c)("rowValue",x)?n.showIdAsLink?(e.openBlock(),e.createBlock(e.unref(Ie.InternalLinkItem),{key:1,item:{key:e.unref(c)("rowValue",x).id,value:e.unref(c)("rowValue",x).id,type:e.unref(Ie.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>E.$emit("navigation-click",e.unref(c)("rowValue",x).id,"consumer_group")},null,8,["item","onNavigationClick"])):(e.openBlock(),e.createBlock(U,{key:2,"copy-tooltip":e.unref(i)("copy.tooltip",{label:e.unref(c)("row",x).label}),"data-testid":"consumer-group-copy-uuid",text:e.unref(c)("rowValue",x).id},null,8,["copy-tooltip","text"])):(e.openBlock(),e.createElementBlock("span",VU,"–"))]),partials:e.withCtx(x=>{var A,T,V,R,X,Y,ne,M,te;return[e.unref(c)("rowValue",x)?n.showIdAsLink?(e.openBlock(),e.createBlock(e.unref(Ie.InternalLinkItem),{key:1,item:{key:(T=(A=e.unref(c)("rowValue",x))==null?void 0:A[0])==null?void 0:T.id,value:((R=(V=e.unref(c)("rowValue",x))==null?void 0:V[0])==null?void 0:R.id)+((Y=(X=e.unref(c)("rowValue",x))==null?void 0:X[0])!=null&&Y.name?"/"+((M=(ne=e.unref(c)("rowValue",x))==null?void 0:ne[0])==null?void 0:M.name):""),type:e.unref(Ie.ConfigurationSchemaType).LinkInternal},onNavigationClick:()=>{var $,Z;return E.$emit("navigation-click",(Z=($=e.unref(c)("rowValue",x))==null?void 0:$[0])==null?void 0:Z.id,"partial")}},null,8,["item","onNavigationClick"])):(e.openBlock(),e.createBlock(U,{key:2,"copy-tooltip":e.unref(i)("copy.tooltip",{label:e.unref(c)("row",x).label}),"data-testid":"partial-copy-uuid",text:(te=e.unref(c)("rowValue",x))==null?void 0:te[0].id},null,8,["copy-tooltip","text"])):(e.openBlock(),e.createElementBlock("span",$U,"–"))]}),_:2},[n.config.pluginType==="datakit"&&n.config.app==="konnect"?{name:"config-card-item-nodes",fn:e.withCtx(x=>[e.createVNode(AU,{item:x.row,"plugin-data":x.record},null,8,["item","plugin-data"])]),key:"0"}:void 0]),1032,["config","config-card-doc","config-schema","entity-type","fetch-url","hide-title","plugin-config-schema"]))])}}}),[["__scopeId","data-v-03dcf2b4"]]),{usePluginMetaData:LU,useProvideExperimentalFreeForms:DU}=st;function MU(n,t=!1){const r=n.length;let o=0,i="",a=0,s=16,c=0,l=0,u=0,p=0,d=0;function f(C,N){let E=0,w=0;for(;E<C;){let S=n.charCodeAt(o);if(S>=48&&S<=57)w=w*16+S-48;else if(S>=65&&S<=70)w=w*16+S-65+10;else if(S>=97&&S<=102)w=w*16+S-97+10;else break;o++,E++}return E<C&&(w=-1),w}function m(C){o=C,i="",a=0,s=16,d=0}function h(){let C=o;if(n.charCodeAt(o)===48)o++;else for(o++;o<n.length&&Ri(n.charCodeAt(o));)o++;if(o<n.length&&n.charCodeAt(o)===46)if(o++,o<n.length&&Ri(n.charCodeAt(o)))for(o++;o<n.length&&Ri(n.charCodeAt(o));)o++;else return d=3,n.substring(C,o);let N=o;if(o<n.length&&(n.charCodeAt(o)===69||n.charCodeAt(o)===101))if(o++,(o<n.length&&n.charCodeAt(o)===43||n.charCodeAt(o)===45)&&o++,o<n.length&&Ri(n.charCodeAt(o))){for(o++;o<n.length&&Ri(n.charCodeAt(o));)o++;N=o}else d=3;return n.substring(C,N)}function y(){let C="",N=o;for(;;){if(o>=r){C+=n.substring(N,o),d=2;break}const E=n.charCodeAt(o);if(E===34){C+=n.substring(N,o),o++;break}if(E===92){if(C+=n.substring(N,o),o++,o>=r){d=2;break}switch(n.charCodeAt(o++)){case 34:C+='"';break;case 92:C+="\\";break;case 47:C+="/";break;case 98:C+="\b";break;case 102:C+="\f";break;case 110:C+=`
440
440
  `;break;case 114:C+="\r";break;case 116:C+=" ";break;case 117:const w=f(4);w>=0?C+=String.fromCharCode(w):d=4;break;default:d=5}N=o;continue}if(E>=0&&E<=31)if(os(E)){C+=n.substring(N,o),d=2;break}else d=6;o++}return C}function b(){if(i="",d=0,a=o,l=c,p=u,o>=r)return a=r,s=17;let C=n.charCodeAt(o);if(Sp(C)){do o++,i+=String.fromCharCode(C),C=n.charCodeAt(o);while(Sp(C));return s=15}if(os(C))return o++,i+=String.fromCharCode(C),C===13&&n.charCodeAt(o)===10&&(o++,i+=`
441
441
  `),c++,u=o,s=14;switch(C){case 123:return o++,s=1;case 125:return o++,s=2;case 91:return o++,s=3;case 93:return o++,s=4;case 58:return o++,s=6;case 44:return o++,s=5;case 34:return o++,i=y(),s=10;case 47:const N=o-1;if(n.charCodeAt(o+1)===47){for(o+=2;o<r&&!os(n.charCodeAt(o));)o++;return i=n.substring(N,o),s=12}if(n.charCodeAt(o+1)===42){o+=2;const E=r-1;let w=!1;for(;o<E;){const S=n.charCodeAt(o);if(S===42&&n.charCodeAt(o+1)===47){o+=2,w=!0;break}o++,os(S)&&(S===13&&n.charCodeAt(o)===10&&o++,c++,u=o)}return w||(o++,d=1),i=n.substring(N,o),s=13}return i+=String.fromCharCode(C),o++,s=16;case 45:if(i+=String.fromCharCode(C),o++,o===r||!Ri(n.charCodeAt(o)))return s=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=h(),s=11;default:for(;o<r&&_(C);)o++,C=n.charCodeAt(o);if(a!==o){switch(i=n.substring(a,o),i){case"true":return s=8;case"false":return s=9;case"null":return s=7}return s=16}return i+=String.fromCharCode(C),o++,s=16}}function _(C){if(Sp(C)||os(C))return!1;switch(C){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function k(){let C;do C=b();while(C>=12&&C<=15);return C}return{setPosition:m,getPosition:()=>o,scan:t?k:b,getToken:()=>s,getTokenValue:()=>i,getTokenOffset:()=>a,getTokenLength:()=>o-a,getTokenStartLine:()=>l,getTokenStartCharacter:()=>a-p,getTokenError:()=>d}}function Sp(n){return n===32||n===9}function os(n){return n===10||n===13}function Ri(n){return n>=48&&n<=57}var Jw;(function(n){n[n.lineFeed=10]="lineFeed",n[n.carriageReturn=13]="carriageReturn",n[n.space=32]="space",n[n._0=48]="_0",n[n._1=49]="_1",n[n._2=50]="_2",n[n._3=51]="_3",n[n._4=52]="_4",n[n._5=53]="_5",n[n._6=54]="_6",n[n._7=55]="_7",n[n._8=56]="_8",n[n._9=57]="_9",n[n.a=97]="a",n[n.b=98]="b",n[n.c=99]="c",n[n.d=100]="d",n[n.e=101]="e",n[n.f=102]="f",n[n.g=103]="g",n[n.h=104]="h",n[n.i=105]="i",n[n.j=106]="j",n[n.k=107]="k",n[n.l=108]="l",n[n.m=109]="m",n[n.n=110]="n",n[n.o=111]="o",n[n.p=112]="p",n[n.q=113]="q",n[n.r=114]="r",n[n.s=115]="s",n[n.t=116]="t",n[n.u=117]="u",n[n.v=118]="v",n[n.w=119]="w",n[n.x=120]="x",n[n.y=121]="y",n[n.z=122]="z",n[n.A=65]="A",n[n.B=66]="B",n[n.C=67]="C",n[n.D=68]="D",n[n.E=69]="E",n[n.F=70]="F",n[n.G=71]="G",n[n.H=72]="H",n[n.I=73]="I",n[n.J=74]="J",n[n.K=75]="K",n[n.L=76]="L",n[n.M=77]="M",n[n.N=78]="N",n[n.O=79]="O",n[n.P=80]="P",n[n.Q=81]="Q",n[n.R=82]="R",n[n.S=83]="S",n[n.T=84]="T",n[n.U=85]="U",n[n.V=86]="V",n[n.W=87]="W",n[n.X=88]="X",n[n.Y=89]="Y",n[n.Z=90]="Z",n[n.asterisk=42]="asterisk",n[n.backslash=92]="backslash",n[n.closeBrace=125]="closeBrace",n[n.closeBracket=93]="closeBracket",n[n.colon=58]="colon",n[n.comma=44]="comma",n[n.dot=46]="dot",n[n.doubleQuote=34]="doubleQuote",n[n.minus=45]="minus",n[n.openBrace=123]="openBrace",n[n.openBracket=91]="openBracket",n[n.plus=43]="plus",n[n.slash=47]="slash",n[n.formFeed=12]="formFeed",n[n.tab=9]="tab"})(Jw||(Jw={})),new Array(20).fill(0).map((n,t)=>" ".repeat(t));const Li=200;new Array(Li).fill(0).map((n,t)=>`
442
442
  `+" ".repeat(t)),new Array(Li).fill(0).map((n,t)=>"\r"+" ".repeat(t)),new Array(Li).fill(0).map((n,t)=>`\r
443
443
  `+" ".repeat(t)),new Array(Li).fill(0).map((n,t)=>`
444
444
  `+" ".repeat(t)),new Array(Li).fill(0).map((n,t)=>"\r"+" ".repeat(t)),new Array(Li).fill(0).map((n,t)=>`\r
445
- `+" ".repeat(t));var Ec;(function(n){n.DEFAULT={allowTrailingComma:!1}})(Ec||(Ec={}));function $U(n,t=[],r=Ec.DEFAULT){let o={type:"array",offset:-1,length:-1,children:[],parent:void 0};function i(c){o.type==="property"&&(o.length=c-o.offset,o=o.parent)}function a(c){return o.children.push(c),c}RU(n,{onObjectBegin:c=>{o=a({type:"object",offset:c,length:-1,parent:o,children:[]})},onObjectProperty:(c,l,u)=>{o=a({type:"property",offset:l,length:-1,parent:o,children:[]}),o.children.push({type:"string",value:c,offset:l,length:u,parent:o})},onObjectEnd:(c,l)=>{i(c+l),o.length=c+l-o.offset,o=o.parent,i(c+l)},onArrayBegin:(c,l)=>{o=a({type:"array",offset:c,length:-1,parent:o,children:[]})},onArrayEnd:(c,l)=>{o.length=c+l-o.offset,o=o.parent,i(c+l)},onLiteralValue:(c,l,u)=>{a({type:LU(c),offset:l,length:u,parent:o,value:c}),i(l+u)},onSeparator:(c,l,u)=>{o.type==="property"&&(c===":"?o.colonOffset=l:c===","&&i(l))},onError:(c,l,u)=>{t.push({error:c,offset:l,length:u})}},r);const s=o.children[0];return s&&delete s.parent,s}function RU(n,t,r=Ec.DEFAULT){const o=VU(n,!1),i=[];let a=0;function s(R){return R?()=>a===0&&R(o.getTokenOffset(),o.getTokenLength(),o.getTokenStartLine(),o.getTokenStartCharacter()):()=>!0}function c(R){return R?X=>a===0&&R(X,o.getTokenOffset(),o.getTokenLength(),o.getTokenStartLine(),o.getTokenStartCharacter()):()=>!0}function l(R){return R?X=>a===0&&R(X,o.getTokenOffset(),o.getTokenLength(),o.getTokenStartLine(),o.getTokenStartCharacter(),()=>i.slice()):()=>!0}function u(R){return R?()=>{a>0?a++:R(o.getTokenOffset(),o.getTokenLength(),o.getTokenStartLine(),o.getTokenStartCharacter(),()=>i.slice())===!1&&(a=1)}:()=>!0}function p(R){return R?()=>{a>0&&a--,a===0&&R(o.getTokenOffset(),o.getTokenLength(),o.getTokenStartLine(),o.getTokenStartCharacter())}:()=>!0}const d=u(t.onObjectBegin),f=l(t.onObjectProperty),m=p(t.onObjectEnd),h=u(t.onArrayBegin),y=p(t.onArrayEnd),b=l(t.onLiteralValue),_=c(t.onSeparator),k=s(t.onComment),C=c(t.onError),N=r&&r.disallowComments,E=r&&r.allowTrailingComma;function w(){for(;;){const R=o.scan();switch(o.getTokenError()){case 4:S(14);break;case 5:S(15);break;case 3:S(13);break;case 1:N||S(11);break;case 2:S(12);break;case 6:S(16);break}switch(R){case 12:case 13:N?S(10):k();break;case 16:S(1);break;case 15:case 14:break;default:return R}}}function S(R,X=[],Y=[]){if(C(R),X.length+Y.length>0){let ne=o.getToken();for(;ne!==17;){if(X.indexOf(ne)!==-1){w();break}else if(Y.indexOf(ne)!==-1)break;ne=w()}}}function I(R){const X=o.getTokenValue();return R?b(X):(f(X),i.push(X)),w(),!0}function U(){switch(o.getToken()){case 11:const R=o.getTokenValue();let X=Number(R);isNaN(X)&&(S(2),X=0),b(X);break;case 7:b(null);break;case 8:b(!0);break;case 9:b(!1);break;default:return!1}return w(),!0}function x(){return o.getToken()!==10?(S(3,[],[2,5]),!1):(I(!1),o.getToken()===6?(_(":"),w(),V()||S(4,[],[2,5])):S(5,[],[2,5]),i.pop(),!0)}function A(){d(),w();let R=!1;for(;o.getToken()!==2&&o.getToken()!==17;){if(o.getToken()===5){if(R||S(4,[],[]),_(","),w(),o.getToken()===2&&E)break}else R&&S(6,[],[]);x()||S(4,[],[2,5]),R=!0}return m(),o.getToken()!==2?S(7,[2],[]):w(),!0}function T(){h(),w();let R=!0,X=!1;for(;o.getToken()!==4&&o.getToken()!==17;){if(o.getToken()===5){if(X||S(4,[],[]),_(","),w(),o.getToken()===4&&E)break}else X&&S(6,[],[]);R?(i.push(0),R=!1):i[i.length-1]++,V()||S(4,[],[4,5]),X=!0}return y(),R||i.pop(),o.getToken()!==4?S(8,[4],[]):w(),!0}function V(){switch(o.getToken()){case 3:return T();case 1:return A();case 10:return I(!0);default:return U()}}return w(),o.getToken()===17?r.allowEmptyContent?!0:(S(4,[],[]),!1):V()?(o.getToken()!==17&&S(9,[],[]),!0):(S(4,[],[]),!1)}function LU(n){switch(typeof n){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(n){if(Array.isArray(n))return"array"}else return"null";return"object"}default:return"null"}}var Xw;(function(n){n[n.None=0]="None",n[n.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",n[n.UnexpectedEndOfString=2]="UnexpectedEndOfString",n[n.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",n[n.InvalidUnicode=4]="InvalidUnicode",n[n.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",n[n.InvalidCharacter=6]="InvalidCharacter"})(Xw||(Xw={}));var Zw;(function(n){n[n.OpenBraceToken=1]="OpenBraceToken",n[n.CloseBraceToken=2]="CloseBraceToken",n[n.OpenBracketToken=3]="OpenBracketToken",n[n.CloseBracketToken=4]="CloseBracketToken",n[n.CommaToken=5]="CommaToken",n[n.ColonToken=6]="ColonToken",n[n.NullKeyword=7]="NullKeyword",n[n.TrueKeyword=8]="TrueKeyword",n[n.FalseKeyword=9]="FalseKeyword",n[n.StringLiteral=10]="StringLiteral",n[n.NumericLiteral=11]="NumericLiteral",n[n.LineCommentTrivia=12]="LineCommentTrivia",n[n.BlockCommentTrivia=13]="BlockCommentTrivia",n[n.LineBreakTrivia=14]="LineBreakTrivia",n[n.Trivia=15]="Trivia",n[n.Unknown=16]="Unknown",n[n.EOF=17]="EOF"})(Zw||(Zw={}));const DU=$U;var Qw;(function(n){n[n.InvalidSymbol=1]="InvalidSymbol",n[n.InvalidNumberFormat=2]="InvalidNumberFormat",n[n.PropertyNameExpected=3]="PropertyNameExpected",n[n.ValueExpected=4]="ValueExpected",n[n.ColonExpected=5]="ColonExpected",n[n.CommaExpected=6]="CommaExpected",n[n.CloseBraceExpected=7]="CloseBraceExpected",n[n.CloseBracketExpected=8]="CloseBracketExpected",n[n.EndOfFileExpected=9]="EndOfFileExpected",n[n.InvalidCommentToken=10]="InvalidCommentToken",n[n.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",n[n.UnexpectedEndOfString=12]="UnexpectedEndOfString",n[n.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",n[n.InvalidUnicode=14]="InvalidUnicode",n[n.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",n[n.InvalidCharacter=16]="InvalidCharacter"})(Qw||(Qw={}));function MU(n,t){const r=DU(n);return{language:"json",altVersionId:t,root:r}}const jU=Object.freeze(Object.defineProperty({__proto__:null,parseIntoJSONContext:MU},Symbol.toStringTag,{value:"Module"}));var ek=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},tk={};/*! *****************************************************************************
445
+ `+" ".repeat(t));var Ec;(function(n){n.DEFAULT={allowTrailingComma:!1}})(Ec||(Ec={}));function jU(n,t=[],r=Ec.DEFAULT){let o={type:"array",offset:-1,length:-1,children:[],parent:void 0};function i(c){o.type==="property"&&(o.length=c-o.offset,o=o.parent)}function a(c){return o.children.push(c),c}FU(n,{onObjectBegin:c=>{o=a({type:"object",offset:c,length:-1,parent:o,children:[]})},onObjectProperty:(c,l,u)=>{o=a({type:"property",offset:l,length:-1,parent:o,children:[]}),o.children.push({type:"string",value:c,offset:l,length:u,parent:o})},onObjectEnd:(c,l)=>{i(c+l),o.length=c+l-o.offset,o=o.parent,i(c+l)},onArrayBegin:(c,l)=>{o=a({type:"array",offset:c,length:-1,parent:o,children:[]})},onArrayEnd:(c,l)=>{o.length=c+l-o.offset,o=o.parent,i(c+l)},onLiteralValue:(c,l,u)=>{a({type:UU(c),offset:l,length:u,parent:o,value:c}),i(l+u)},onSeparator:(c,l,u)=>{o.type==="property"&&(c===":"?o.colonOffset=l:c===","&&i(l))},onError:(c,l,u)=>{t.push({error:c,offset:l,length:u})}},r);const s=o.children[0];return s&&delete s.parent,s}function FU(n,t,r=Ec.DEFAULT){const o=MU(n,!1),i=[];let a=0;function s(R){return R?()=>a===0&&R(o.getTokenOffset(),o.getTokenLength(),o.getTokenStartLine(),o.getTokenStartCharacter()):()=>!0}function c(R){return R?X=>a===0&&R(X,o.getTokenOffset(),o.getTokenLength(),o.getTokenStartLine(),o.getTokenStartCharacter()):()=>!0}function l(R){return R?X=>a===0&&R(X,o.getTokenOffset(),o.getTokenLength(),o.getTokenStartLine(),o.getTokenStartCharacter(),()=>i.slice()):()=>!0}function u(R){return R?()=>{a>0?a++:R(o.getTokenOffset(),o.getTokenLength(),o.getTokenStartLine(),o.getTokenStartCharacter(),()=>i.slice())===!1&&(a=1)}:()=>!0}function p(R){return R?()=>{a>0&&a--,a===0&&R(o.getTokenOffset(),o.getTokenLength(),o.getTokenStartLine(),o.getTokenStartCharacter())}:()=>!0}const d=u(t.onObjectBegin),f=l(t.onObjectProperty),m=p(t.onObjectEnd),h=u(t.onArrayBegin),y=p(t.onArrayEnd),b=l(t.onLiteralValue),_=c(t.onSeparator),k=s(t.onComment),C=c(t.onError),N=r&&r.disallowComments,E=r&&r.allowTrailingComma;function w(){for(;;){const R=o.scan();switch(o.getTokenError()){case 4:S(14);break;case 5:S(15);break;case 3:S(13);break;case 1:N||S(11);break;case 2:S(12);break;case 6:S(16);break}switch(R){case 12:case 13:N?S(10):k();break;case 16:S(1);break;case 15:case 14:break;default:return R}}}function S(R,X=[],Y=[]){if(C(R),X.length+Y.length>0){let ne=o.getToken();for(;ne!==17;){if(X.indexOf(ne)!==-1){w();break}else if(Y.indexOf(ne)!==-1)break;ne=w()}}}function I(R){const X=o.getTokenValue();return R?b(X):(f(X),i.push(X)),w(),!0}function U(){switch(o.getToken()){case 11:const R=o.getTokenValue();let X=Number(R);isNaN(X)&&(S(2),X=0),b(X);break;case 7:b(null);break;case 8:b(!0);break;case 9:b(!1);break;default:return!1}return w(),!0}function x(){return o.getToken()!==10?(S(3,[],[2,5]),!1):(I(!1),o.getToken()===6?(_(":"),w(),V()||S(4,[],[2,5])):S(5,[],[2,5]),i.pop(),!0)}function A(){d(),w();let R=!1;for(;o.getToken()!==2&&o.getToken()!==17;){if(o.getToken()===5){if(R||S(4,[],[]),_(","),w(),o.getToken()===2&&E)break}else R&&S(6,[],[]);x()||S(4,[],[2,5]),R=!0}return m(),o.getToken()!==2?S(7,[2],[]):w(),!0}function T(){h(),w();let R=!0,X=!1;for(;o.getToken()!==4&&o.getToken()!==17;){if(o.getToken()===5){if(X||S(4,[],[]),_(","),w(),o.getToken()===4&&E)break}else X&&S(6,[],[]);R?(i.push(0),R=!1):i[i.length-1]++,V()||S(4,[],[4,5]),X=!0}return y(),R||i.pop(),o.getToken()!==4?S(8,[4],[]):w(),!0}function V(){switch(o.getToken()){case 3:return T();case 1:return A();case 10:return I(!0);default:return U()}}return w(),o.getToken()===17?r.allowEmptyContent?!0:(S(4,[],[]),!1):V()?(o.getToken()!==17&&S(9,[],[]),!0):(S(4,[],[]),!1)}function UU(n){switch(typeof n){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(n){if(Array.isArray(n))return"array"}else return"null";return"object"}default:return"null"}}var Xw;(function(n){n[n.None=0]="None",n[n.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",n[n.UnexpectedEndOfString=2]="UnexpectedEndOfString",n[n.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",n[n.InvalidUnicode=4]="InvalidUnicode",n[n.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",n[n.InvalidCharacter=6]="InvalidCharacter"})(Xw||(Xw={}));var Zw;(function(n){n[n.OpenBraceToken=1]="OpenBraceToken",n[n.CloseBraceToken=2]="CloseBraceToken",n[n.OpenBracketToken=3]="OpenBracketToken",n[n.CloseBracketToken=4]="CloseBracketToken",n[n.CommaToken=5]="CommaToken",n[n.ColonToken=6]="ColonToken",n[n.NullKeyword=7]="NullKeyword",n[n.TrueKeyword=8]="TrueKeyword",n[n.FalseKeyword=9]="FalseKeyword",n[n.StringLiteral=10]="StringLiteral",n[n.NumericLiteral=11]="NumericLiteral",n[n.LineCommentTrivia=12]="LineCommentTrivia",n[n.BlockCommentTrivia=13]="BlockCommentTrivia",n[n.LineBreakTrivia=14]="LineBreakTrivia",n[n.Trivia=15]="Trivia",n[n.Unknown=16]="Unknown",n[n.EOF=17]="EOF"})(Zw||(Zw={}));const KU=jU;var Qw;(function(n){n[n.InvalidSymbol=1]="InvalidSymbol",n[n.InvalidNumberFormat=2]="InvalidNumberFormat",n[n.PropertyNameExpected=3]="PropertyNameExpected",n[n.ValueExpected=4]="ValueExpected",n[n.ColonExpected=5]="ColonExpected",n[n.CommaExpected=6]="CommaExpected",n[n.CloseBraceExpected=7]="CloseBraceExpected",n[n.CloseBracketExpected=8]="CloseBracketExpected",n[n.EndOfFileExpected=9]="EndOfFileExpected",n[n.InvalidCommentToken=10]="InvalidCommentToken",n[n.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",n[n.UnexpectedEndOfString=12]="UnexpectedEndOfString",n[n.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",n[n.InvalidUnicode=14]="InvalidUnicode",n[n.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",n[n.InvalidCharacter=16]="InvalidCharacter"})(Qw||(Qw={}));function qU(n,t){const r=KU(n);return{language:"json",altVersionId:t,root:r}}const GU=Object.freeze(Object.defineProperty({__proto__:null,parseIntoJSONContext:qU},Symbol.toStringTag,{value:"Module"}));var ek=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},tk={};/*! *****************************************************************************
446
446
  Copyright (C) Microsoft. All rights reserved.
447
447
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
448
448
  this file except in compliance with the License. You may obtain a copy of the
@@ -455,7 +455,7 @@ nodes:
455
455
 
456
456
  See the Apache Version 2.0 License for specific language governing permissions
457
457
  and limitations under the License.
458
- ***************************************************************************** */var nk;(function(n){(function(t){var r=typeof globalThis=="object"?globalThis:typeof ek=="object"?ek:typeof self=="object"?self:typeof this=="object"?this:c(),o=i(n);typeof r.Reflect<"u"&&(o=i(r.Reflect,o)),t(o,r),typeof r.Reflect>"u"&&(r.Reflect=n);function i(l,u){return function(p,d){Object.defineProperty(l,p,{configurable:!0,writable:!0,value:d}),u&&u(p,d)}}function a(){try{return Function("return this;")()}catch{}}function s(){try{return(0,eval)("(function() { return this; })()")}catch{}}function c(){return a()||s()}})(function(t,r){var o=Object.prototype.hasOwnProperty,i=typeof Symbol=="function",a=i&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",s=i&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",c=typeof Object.create=="function",l={__proto__:[]}instanceof Array,u=!c&&!l,p={create:c?function(){return g(Object.create(null))}:l?function(){return g({__proto__:null})}:function(){return g({})},has:u?function(O,j){return o.call(O,j)}:function(O,j){return j in O},get:u?function(O,j){return o.call(O,j)?O[j]:void 0}:function(O,j){return O[j]}},d=Object.getPrototypeOf(Function),f=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:_e(),m=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:xe(),h=typeof WeakMap=="function"?WeakMap:Ne(),y=i?Symbol.for("@reflect-metadata:registry"):void 0,b=re(),_=Q(b);function k(O,j,W,ae){if(F(W)){if(!ce(O))throw new TypeError;if(!Oe(j))throw new TypeError;return T(O,j)}else{if(!ce(O))throw new TypeError;if(!v(j))throw new TypeError;if(!v(ae)&&!F(ae)&&!J(ae))throw new TypeError;return J(ae)&&(ae=void 0),W=ye(W),V(O,j,W,ae)}}t("decorate",k);function C(O,j){function W(ae,be){if(!v(ae))throw new TypeError;if(!F(be)&&!De(be))throw new TypeError;M(O,j,ae,be)}return W}t("metadata",C);function N(O,j,W,ae){if(!v(W))throw new TypeError;return F(ae)||(ae=ye(ae)),M(O,j,W,ae)}t("defineMetadata",N);function E(O,j,W){if(!v(j))throw new TypeError;return F(W)||(W=ye(W)),R(O,j,W)}t("hasMetadata",E);function w(O,j,W){if(!v(j))throw new TypeError;return F(W)||(W=ye(W)),X(O,j,W)}t("hasOwnMetadata",w);function S(O,j,W){if(!v(j))throw new TypeError;return F(W)||(W=ye(W)),Y(O,j,W)}t("getMetadata",S);function I(O,j,W){if(!v(j))throw new TypeError;return F(W)||(W=ye(W)),ne(O,j,W)}t("getOwnMetadata",I);function U(O,j){if(!v(O))throw new TypeError;return F(j)||(j=ye(j)),te(O,j)}t("getMetadataKeys",U);function x(O,j){if(!v(O))throw new TypeError;return F(j)||(j=ye(j)),$(O,j)}t("getOwnMetadataKeys",x);function A(O,j,W){if(!v(j))throw new TypeError;if(F(W)||(W=ye(W)),!v(j))throw new TypeError;F(W)||(W=ye(W));var ae=de(j,W,!1);return F(ae)?!1:ae.OrdinaryDeleteMetadata(O,j,W)}t("deleteMetadata",A);function T(O,j){for(var W=O.length-1;W>=0;--W){var ae=O[W],be=ae(j);if(!F(be)&&!J(be)){if(!Oe(be))throw new TypeError;j=be}}return j}function V(O,j,W,ae){for(var be=O.length-1;be>=0;--be){var L=O[be],ge=L(j,W,ae);if(!F(ge)&&!J(ge)){if(!v(ge))throw new TypeError;ae=ge}}return ae}function R(O,j,W){var ae=X(O,j,W);if(ae)return!0;var be=Ce(j);return J(be)?!1:R(O,be,W)}function X(O,j,W){var ae=de(j,W,!1);return F(ae)?!1:oe(ae.OrdinaryHasOwnMetadata(O,j,W))}function Y(O,j,W){var ae=X(O,j,W);if(ae)return ne(O,j,W);var be=Ce(j);if(!J(be))return Y(O,be,W)}function ne(O,j,W){var ae=de(j,W,!1);if(!F(ae))return ae.OrdinaryGetOwnMetadata(O,j,W)}function M(O,j,W,ae){var be=de(W,ae,!0);be.OrdinaryDefineOwnMetadata(O,j,W,ae)}function te(O,j){var W=$(O,j),ae=Ce(O);if(ae===null)return W;var be=te(ae,j);if(be.length<=0)return W;if(W.length<=0)return be;for(var L=new m,ge=[],Ee=0,ue=W;Ee<ue.length;Ee++){var P=ue[Ee],z=L.has(P);z||(L.add(P),ge.push(P))}for(var D=0,pe=be;D<pe.length;D++){var P=pe[D],z=L.has(P);z||(L.add(P),ge.push(P))}return ge}function $(O,j){var W=de(O,j,!1);return W?W.OrdinaryOwnMetadataKeys(O,j):[]}function Z(O){if(O===null)return 1;switch(typeof O){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return O===null?1:6;default:return 6}}function F(O){return O===void 0}function J(O){return O===null}function G(O){return typeof O=="symbol"}function v(O){return typeof O=="object"?O!==null:typeof O=="function"}function q(O,j){switch(Z(O)){case 0:return O;case 1:return O;case 2:return O;case 3:return O;case 4:return O;case 5:return O}var W="string",ae=qe(O,a);if(ae!==void 0){var be=ae.call(O,W);if(v(be))throw new TypeError;return be}return ie(O)}function ie(O,j){var W,ae;{var be=O.toString;if(he(be)){var ae=be.call(O);if(!v(ae))return ae}var W=O.valueOf;if(he(W)){var ae=W.call(O);if(!v(ae))return ae}}throw new TypeError}function oe(O){return!!O}function ke(O){return""+O}function ye(O){var j=q(O);return G(j)?j:ke(j)}function ce(O){return Array.isArray?Array.isArray(O):O instanceof Object?O instanceof Array:Object.prototype.toString.call(O)==="[object Array]"}function he(O){return typeof O=="function"}function Oe(O){return typeof O=="function"}function De(O){switch(Z(O)){case 3:return!0;case 4:return!0;default:return!1}}function Be(O,j){return O===j||O!==O&&j!==j}function qe(O,j){var W=O[j];if(W!=null){if(!he(W))throw new TypeError;return W}}function We(O){var j=qe(O,s);if(!he(j))throw new TypeError;var W=j.call(O);if(!v(W))throw new TypeError;return W}function nt(O){return O.value}function lt(O){var j=O.next();return j.done?!1:j}function Re(O){var j=O.return;j&&j.call(O)}function Ce(O){var j=Object.getPrototypeOf(O);if(typeof O!="function"||O===d||j!==d)return j;var W=O.prototype,ae=W&&Object.getPrototypeOf(W);if(ae==null||ae===Object.prototype)return j;var be=ae.constructor;return typeof be!="function"||be===O?j:be}function se(){var O;!F(y)&&typeof r.Reflect<"u"&&!(y in r.Reflect)&&typeof r.Reflect.defineMetadata=="function"&&(O=le(r.Reflect));var j,W,ae,be=new h,L={registerProvider:ge,getProvider:ue,setProvider:z};return L;function ge(D){if(!Object.isExtensible(L))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case O===D:break;case F(j):j=D;break;case j===D:break;case F(W):W=D;break;case W===D:break;default:ae===void 0&&(ae=new m),ae.add(D);break}}function Ee(D,pe){if(!F(j)){if(j.isProviderFor(D,pe))return j;if(!F(W)){if(W.isProviderFor(D,pe))return j;if(!F(ae))for(var we=We(ae);;){var Se=lt(we);if(!Se)return;var Ve=nt(Se);if(Ve.isProviderFor(D,pe))return Re(we),Ve}}}if(!F(O)&&O.isProviderFor(D,pe))return O}function ue(D,pe){var we=be.get(D),Se;return F(we)||(Se=we.get(pe)),F(Se)&&(Se=Ee(D,pe),F(Se)||(F(we)&&(we=new f,be.set(D,we)),we.set(pe,Se))),Se}function P(D){if(F(D))throw new TypeError;return j===D||W===D||!F(ae)&&ae.has(D)}function z(D,pe,we){if(!P(we))throw new Error("Metadata provider not registered.");var Se=ue(D,pe);if(Se!==we){if(!F(Se))return!1;var Ve=be.get(D);F(Ve)&&(Ve=new f,be.set(D,Ve)),Ve.set(pe,we)}return!0}}function re(){var O;return!F(y)&&v(r.Reflect)&&Object.isExtensible(r.Reflect)&&(O=r.Reflect[y]),F(O)&&(O=se()),!F(y)&&v(r.Reflect)&&Object.isExtensible(r.Reflect)&&Object.defineProperty(r.Reflect,y,{enumerable:!1,configurable:!1,writable:!1,value:O}),O}function Q(O){var j=new h,W={isProviderFor:function(P,z){var D=j.get(P);return F(D)?!1:D.has(z)},OrdinaryDefineOwnMetadata:ge,OrdinaryHasOwnMetadata:be,OrdinaryGetOwnMetadata:L,OrdinaryOwnMetadataKeys:Ee,OrdinaryDeleteMetadata:ue};return b.registerProvider(W),W;function ae(P,z,D){var pe=j.get(P),we=!1;if(F(pe)){if(!D)return;pe=new f,j.set(P,pe),we=!0}var Se=pe.get(z);if(F(Se)){if(!D)return;if(Se=new f,pe.set(z,Se),!O.setProvider(P,z,W))throw pe.delete(z),we&&j.delete(P),new Error("Wrong provider for target.")}return Se}function be(P,z,D){var pe=ae(z,D,!1);return F(pe)?!1:oe(pe.has(P))}function L(P,z,D){var pe=ae(z,D,!1);if(!F(pe))return pe.get(P)}function ge(P,z,D,pe){var we=ae(D,pe,!0);we.set(P,z)}function Ee(P,z){var D=[],pe=ae(P,z,!1);if(F(pe))return D;for(var we=pe.keys(),Se=We(we),Ve=0;;){var Me=lt(Se);if(!Me)return D.length=Ve,D;var Ze=nt(Me);try{D[Ve]=Ze}catch(Ye){try{Re(Se)}finally{throw Ye}}Ve++}}function ue(P,z,D){var pe=ae(z,D,!1);if(F(pe)||!pe.delete(P))return!1;if(pe.size===0){var we=j.get(z);F(we)||(we.delete(D),we.size===0&&j.delete(we))}return!0}}function le(O){var j=O.defineMetadata,W=O.hasOwnMetadata,ae=O.getOwnMetadata,be=O.getOwnMetadataKeys,L=O.deleteMetadata,ge=new h,Ee={isProviderFor:function(ue,P){var z=ge.get(ue);return!F(z)&&z.has(P)?!0:be(ue,P).length?(F(z)&&(z=new m,ge.set(ue,z)),z.add(P),!0):!1},OrdinaryDefineOwnMetadata:j,OrdinaryHasOwnMetadata:W,OrdinaryGetOwnMetadata:ae,OrdinaryOwnMetadataKeys:be,OrdinaryDeleteMetadata:L};return Ee}function de(O,j,W){var ae=b.getProvider(O,j);if(!F(ae))return ae;if(W){if(b.setProvider(O,j,_))return _;throw new Error("Illegal state.")}}function _e(){var O={},j=[],W=function(){function Ee(ue,P,z){this._index=0,this._keys=ue,this._values=P,this._selector=z}return Ee.prototype["@@iterator"]=function(){return this},Ee.prototype[s]=function(){return this},Ee.prototype.next=function(){var ue=this._index;if(ue>=0&&ue<this._keys.length){var P=this._selector(this._keys[ue],this._values[ue]);return ue+1>=this._keys.length?(this._index=-1,this._keys=j,this._values=j):this._index++,{value:P,done:!1}}return{value:void 0,done:!0}},Ee.prototype.throw=function(ue){throw this._index>=0&&(this._index=-1,this._keys=j,this._values=j),ue},Ee.prototype.return=function(ue){return this._index>=0&&(this._index=-1,this._keys=j,this._values=j),{value:ue,done:!0}},Ee}(),ae=function(){function Ee(){this._keys=[],this._values=[],this._cacheKey=O,this._cacheIndex=-2}return Object.defineProperty(Ee.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),Ee.prototype.has=function(ue){return this._find(ue,!1)>=0},Ee.prototype.get=function(ue){var P=this._find(ue,!1);return P>=0?this._values[P]:void 0},Ee.prototype.set=function(ue,P){var z=this._find(ue,!0);return this._values[z]=P,this},Ee.prototype.delete=function(ue){var P=this._find(ue,!1);if(P>=0){for(var z=this._keys.length,D=P+1;D<z;D++)this._keys[D-1]=this._keys[D],this._values[D-1]=this._values[D];return this._keys.length--,this._values.length--,Be(ue,this._cacheKey)&&(this._cacheKey=O,this._cacheIndex=-2),!0}return!1},Ee.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=O,this._cacheIndex=-2},Ee.prototype.keys=function(){return new W(this._keys,this._values,be)},Ee.prototype.values=function(){return new W(this._keys,this._values,L)},Ee.prototype.entries=function(){return new W(this._keys,this._values,ge)},Ee.prototype["@@iterator"]=function(){return this.entries()},Ee.prototype[s]=function(){return this.entries()},Ee.prototype._find=function(ue,P){if(!Be(this._cacheKey,ue)){this._cacheIndex=-1;for(var z=0;z<this._keys.length;z++)if(Be(this._keys[z],ue)){this._cacheIndex=z;break}}return this._cacheIndex<0&&P&&(this._cacheIndex=this._keys.length,this._keys.push(ue),this._values.push(void 0)),this._cacheIndex},Ee}();return ae;function be(Ee,ue){return Ee}function L(Ee,ue){return ue}function ge(Ee,ue){return[Ee,ue]}}function xe(){var O=function(){function j(){this._map=new f}return Object.defineProperty(j.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),j.prototype.has=function(W){return this._map.has(W)},j.prototype.add=function(W){return this._map.set(W,W),this},j.prototype.delete=function(W){return this._map.delete(W)},j.prototype.clear=function(){this._map.clear()},j.prototype.keys=function(){return this._map.keys()},j.prototype.values=function(){return this._map.keys()},j.prototype.entries=function(){return this._map.entries()},j.prototype["@@iterator"]=function(){return this.keys()},j.prototype[s]=function(){return this.keys()},j}();return O}function Ne(){var O=16,j=p.create(),W=ae();return function(){function ue(){this._key=ae()}return ue.prototype.has=function(P){var z=be(P,!1);return z!==void 0?p.has(z,this._key):!1},ue.prototype.get=function(P){var z=be(P,!1);return z!==void 0?p.get(z,this._key):void 0},ue.prototype.set=function(P,z){var D=be(P,!0);return D[this._key]=z,this},ue.prototype.delete=function(P){var z=be(P,!1);return z!==void 0?delete z[this._key]:!1},ue.prototype.clear=function(){this._key=ae()},ue}();function ae(){var ue;do ue="@@WeakMap@@"+Ee();while(p.has(j,ue));return j[ue]=!0,ue}function be(ue,P){if(!o.call(ue,W)){if(!P)return;Object.defineProperty(ue,W,{value:p.create()})}return ue[W]}function L(ue,P){for(var z=0;z<P;++z)ue[z]=Math.random()*255|0;return ue}function ge(ue){if(typeof Uint8Array=="function"){var P=new Uint8Array(ue);return typeof crypto<"u"?crypto.getRandomValues(P):typeof msCrypto<"u"?msCrypto.getRandomValues(P):L(P,ue),P}return L(new Array(ue),ue)}function Ee(){var ue=ge(O);ue[6]=ue[6]&79|64,ue[8]=ue[8]&191|128;for(var P="",z=0;z<O;++z){var D=ue[z];(z===4||z===6||z===8)&&(P+="-"),D<16&&(P+="0"),P+=D.toString(16).toLowerCase()}return P}}function g(O){return O.__=void 0,delete O.__,O}})})(nk||(nk={}));const FU=w1({__proto__:null,default:tk},[tk]);/*!
458
+ ***************************************************************************** */var nk;(function(n){(function(t){var r=typeof globalThis=="object"?globalThis:typeof ek=="object"?ek:typeof self=="object"?self:typeof this=="object"?this:c(),o=i(n);typeof r.Reflect<"u"&&(o=i(r.Reflect,o)),t(o,r),typeof r.Reflect>"u"&&(r.Reflect=n);function i(l,u){return function(p,d){Object.defineProperty(l,p,{configurable:!0,writable:!0,value:d}),u&&u(p,d)}}function a(){try{return Function("return this;")()}catch{}}function s(){try{return(0,eval)("(function() { return this; })()")}catch{}}function c(){return a()||s()}})(function(t,r){var o=Object.prototype.hasOwnProperty,i=typeof Symbol=="function",a=i&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",s=i&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",c=typeof Object.create=="function",l={__proto__:[]}instanceof Array,u=!c&&!l,p={create:c?function(){return g(Object.create(null))}:l?function(){return g({__proto__:null})}:function(){return g({})},has:u?function(O,j){return o.call(O,j)}:function(O,j){return j in O},get:u?function(O,j){return o.call(O,j)?O[j]:void 0}:function(O,j){return O[j]}},d=Object.getPrototypeOf(Function),f=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:_e(),m=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:xe(),h=typeof WeakMap=="function"?WeakMap:Ne(),y=i?Symbol.for("@reflect-metadata:registry"):void 0,b=re(),_=Q(b);function k(O,j,W,ae){if(F(W)){if(!ce(O))throw new TypeError;if(!Oe(j))throw new TypeError;return T(O,j)}else{if(!ce(O))throw new TypeError;if(!v(j))throw new TypeError;if(!v(ae)&&!F(ae)&&!J(ae))throw new TypeError;return J(ae)&&(ae=void 0),W=ye(W),V(O,j,W,ae)}}t("decorate",k);function C(O,j){function W(ae,be){if(!v(ae))throw new TypeError;if(!F(be)&&!De(be))throw new TypeError;M(O,j,ae,be)}return W}t("metadata",C);function N(O,j,W,ae){if(!v(W))throw new TypeError;return F(ae)||(ae=ye(ae)),M(O,j,W,ae)}t("defineMetadata",N);function E(O,j,W){if(!v(j))throw new TypeError;return F(W)||(W=ye(W)),R(O,j,W)}t("hasMetadata",E);function w(O,j,W){if(!v(j))throw new TypeError;return F(W)||(W=ye(W)),X(O,j,W)}t("hasOwnMetadata",w);function S(O,j,W){if(!v(j))throw new TypeError;return F(W)||(W=ye(W)),Y(O,j,W)}t("getMetadata",S);function I(O,j,W){if(!v(j))throw new TypeError;return F(W)||(W=ye(W)),ne(O,j,W)}t("getOwnMetadata",I);function U(O,j){if(!v(O))throw new TypeError;return F(j)||(j=ye(j)),te(O,j)}t("getMetadataKeys",U);function x(O,j){if(!v(O))throw new TypeError;return F(j)||(j=ye(j)),$(O,j)}t("getOwnMetadataKeys",x);function A(O,j,W){if(!v(j))throw new TypeError;if(F(W)||(W=ye(W)),!v(j))throw new TypeError;F(W)||(W=ye(W));var ae=de(j,W,!1);return F(ae)?!1:ae.OrdinaryDeleteMetadata(O,j,W)}t("deleteMetadata",A);function T(O,j){for(var W=O.length-1;W>=0;--W){var ae=O[W],be=ae(j);if(!F(be)&&!J(be)){if(!Oe(be))throw new TypeError;j=be}}return j}function V(O,j,W,ae){for(var be=O.length-1;be>=0;--be){var L=O[be],ge=L(j,W,ae);if(!F(ge)&&!J(ge)){if(!v(ge))throw new TypeError;ae=ge}}return ae}function R(O,j,W){var ae=X(O,j,W);if(ae)return!0;var be=Ce(j);return J(be)?!1:R(O,be,W)}function X(O,j,W){var ae=de(j,W,!1);return F(ae)?!1:oe(ae.OrdinaryHasOwnMetadata(O,j,W))}function Y(O,j,W){var ae=X(O,j,W);if(ae)return ne(O,j,W);var be=Ce(j);if(!J(be))return Y(O,be,W)}function ne(O,j,W){var ae=de(j,W,!1);if(!F(ae))return ae.OrdinaryGetOwnMetadata(O,j,W)}function M(O,j,W,ae){var be=de(W,ae,!0);be.OrdinaryDefineOwnMetadata(O,j,W,ae)}function te(O,j){var W=$(O,j),ae=Ce(O);if(ae===null)return W;var be=te(ae,j);if(be.length<=0)return W;if(W.length<=0)return be;for(var L=new m,ge=[],Ee=0,ue=W;Ee<ue.length;Ee++){var P=ue[Ee],z=L.has(P);z||(L.add(P),ge.push(P))}for(var D=0,pe=be;D<pe.length;D++){var P=pe[D],z=L.has(P);z||(L.add(P),ge.push(P))}return ge}function $(O,j){var W=de(O,j,!1);return W?W.OrdinaryOwnMetadataKeys(O,j):[]}function Z(O){if(O===null)return 1;switch(typeof O){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return O===null?1:6;default:return 6}}function F(O){return O===void 0}function J(O){return O===null}function G(O){return typeof O=="symbol"}function v(O){return typeof O=="object"?O!==null:typeof O=="function"}function q(O,j){switch(Z(O)){case 0:return O;case 1:return O;case 2:return O;case 3:return O;case 4:return O;case 5:return O}var W="string",ae=Ge(O,a);if(ae!==void 0){var be=ae.call(O,W);if(v(be))throw new TypeError;return be}return ie(O)}function ie(O,j){var W,ae;{var be=O.toString;if(he(be)){var ae=be.call(O);if(!v(ae))return ae}var W=O.valueOf;if(he(W)){var ae=W.call(O);if(!v(ae))return ae}}throw new TypeError}function oe(O){return!!O}function ke(O){return""+O}function ye(O){var j=q(O);return G(j)?j:ke(j)}function ce(O){return Array.isArray?Array.isArray(O):O instanceof Object?O instanceof Array:Object.prototype.toString.call(O)==="[object Array]"}function he(O){return typeof O=="function"}function Oe(O){return typeof O=="function"}function De(O){switch(Z(O)){case 3:return!0;case 4:return!0;default:return!1}}function Be(O,j){return O===j||O!==O&&j!==j}function Ge(O,j){var W=O[j];if(W!=null){if(!he(W))throw new TypeError;return W}}function We(O){var j=Ge(O,s);if(!he(j))throw new TypeError;var W=j.call(O);if(!v(W))throw new TypeError;return W}function nt(O){return O.value}function lt(O){var j=O.next();return j.done?!1:j}function Re(O){var j=O.return;j&&j.call(O)}function Ce(O){var j=Object.getPrototypeOf(O);if(typeof O!="function"||O===d||j!==d)return j;var W=O.prototype,ae=W&&Object.getPrototypeOf(W);if(ae==null||ae===Object.prototype)return j;var be=ae.constructor;return typeof be!="function"||be===O?j:be}function se(){var O;!F(y)&&typeof r.Reflect<"u"&&!(y in r.Reflect)&&typeof r.Reflect.defineMetadata=="function"&&(O=le(r.Reflect));var j,W,ae,be=new h,L={registerProvider:ge,getProvider:ue,setProvider:z};return L;function ge(D){if(!Object.isExtensible(L))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case O===D:break;case F(j):j=D;break;case j===D:break;case F(W):W=D;break;case W===D:break;default:ae===void 0&&(ae=new m),ae.add(D);break}}function Ee(D,pe){if(!F(j)){if(j.isProviderFor(D,pe))return j;if(!F(W)){if(W.isProviderFor(D,pe))return j;if(!F(ae))for(var we=We(ae);;){var Se=lt(we);if(!Se)return;var Ve=nt(Se);if(Ve.isProviderFor(D,pe))return Re(we),Ve}}}if(!F(O)&&O.isProviderFor(D,pe))return O}function ue(D,pe){var we=be.get(D),Se;return F(we)||(Se=we.get(pe)),F(Se)&&(Se=Ee(D,pe),F(Se)||(F(we)&&(we=new f,be.set(D,we)),we.set(pe,Se))),Se}function P(D){if(F(D))throw new TypeError;return j===D||W===D||!F(ae)&&ae.has(D)}function z(D,pe,we){if(!P(we))throw new Error("Metadata provider not registered.");var Se=ue(D,pe);if(Se!==we){if(!F(Se))return!1;var Ve=be.get(D);F(Ve)&&(Ve=new f,be.set(D,Ve)),Ve.set(pe,we)}return!0}}function re(){var O;return!F(y)&&v(r.Reflect)&&Object.isExtensible(r.Reflect)&&(O=r.Reflect[y]),F(O)&&(O=se()),!F(y)&&v(r.Reflect)&&Object.isExtensible(r.Reflect)&&Object.defineProperty(r.Reflect,y,{enumerable:!1,configurable:!1,writable:!1,value:O}),O}function Q(O){var j=new h,W={isProviderFor:function(P,z){var D=j.get(P);return F(D)?!1:D.has(z)},OrdinaryDefineOwnMetadata:ge,OrdinaryHasOwnMetadata:be,OrdinaryGetOwnMetadata:L,OrdinaryOwnMetadataKeys:Ee,OrdinaryDeleteMetadata:ue};return b.registerProvider(W),W;function ae(P,z,D){var pe=j.get(P),we=!1;if(F(pe)){if(!D)return;pe=new f,j.set(P,pe),we=!0}var Se=pe.get(z);if(F(Se)){if(!D)return;if(Se=new f,pe.set(z,Se),!O.setProvider(P,z,W))throw pe.delete(z),we&&j.delete(P),new Error("Wrong provider for target.")}return Se}function be(P,z,D){var pe=ae(z,D,!1);return F(pe)?!1:oe(pe.has(P))}function L(P,z,D){var pe=ae(z,D,!1);if(!F(pe))return pe.get(P)}function ge(P,z,D,pe){var we=ae(D,pe,!0);we.set(P,z)}function Ee(P,z){var D=[],pe=ae(P,z,!1);if(F(pe))return D;for(var we=pe.keys(),Se=We(we),Ve=0;;){var Me=lt(Se);if(!Me)return D.length=Ve,D;var Ze=nt(Me);try{D[Ve]=Ze}catch(Ye){try{Re(Se)}finally{throw Ye}}Ve++}}function ue(P,z,D){var pe=ae(z,D,!1);if(F(pe)||!pe.delete(P))return!1;if(pe.size===0){var we=j.get(z);F(we)||(we.delete(D),we.size===0&&j.delete(we))}return!0}}function le(O){var j=O.defineMetadata,W=O.hasOwnMetadata,ae=O.getOwnMetadata,be=O.getOwnMetadataKeys,L=O.deleteMetadata,ge=new h,Ee={isProviderFor:function(ue,P){var z=ge.get(ue);return!F(z)&&z.has(P)?!0:be(ue,P).length?(F(z)&&(z=new m,ge.set(ue,z)),z.add(P),!0):!1},OrdinaryDefineOwnMetadata:j,OrdinaryHasOwnMetadata:W,OrdinaryGetOwnMetadata:ae,OrdinaryOwnMetadataKeys:be,OrdinaryDeleteMetadata:L};return Ee}function de(O,j,W){var ae=b.getProvider(O,j);if(!F(ae))return ae;if(W){if(b.setProvider(O,j,_))return _;throw new Error("Illegal state.")}}function _e(){var O={},j=[],W=function(){function Ee(ue,P,z){this._index=0,this._keys=ue,this._values=P,this._selector=z}return Ee.prototype["@@iterator"]=function(){return this},Ee.prototype[s]=function(){return this},Ee.prototype.next=function(){var ue=this._index;if(ue>=0&&ue<this._keys.length){var P=this._selector(this._keys[ue],this._values[ue]);return ue+1>=this._keys.length?(this._index=-1,this._keys=j,this._values=j):this._index++,{value:P,done:!1}}return{value:void 0,done:!0}},Ee.prototype.throw=function(ue){throw this._index>=0&&(this._index=-1,this._keys=j,this._values=j),ue},Ee.prototype.return=function(ue){return this._index>=0&&(this._index=-1,this._keys=j,this._values=j),{value:ue,done:!0}},Ee}(),ae=function(){function Ee(){this._keys=[],this._values=[],this._cacheKey=O,this._cacheIndex=-2}return Object.defineProperty(Ee.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),Ee.prototype.has=function(ue){return this._find(ue,!1)>=0},Ee.prototype.get=function(ue){var P=this._find(ue,!1);return P>=0?this._values[P]:void 0},Ee.prototype.set=function(ue,P){var z=this._find(ue,!0);return this._values[z]=P,this},Ee.prototype.delete=function(ue){var P=this._find(ue,!1);if(P>=0){for(var z=this._keys.length,D=P+1;D<z;D++)this._keys[D-1]=this._keys[D],this._values[D-1]=this._values[D];return this._keys.length--,this._values.length--,Be(ue,this._cacheKey)&&(this._cacheKey=O,this._cacheIndex=-2),!0}return!1},Ee.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=O,this._cacheIndex=-2},Ee.prototype.keys=function(){return new W(this._keys,this._values,be)},Ee.prototype.values=function(){return new W(this._keys,this._values,L)},Ee.prototype.entries=function(){return new W(this._keys,this._values,ge)},Ee.prototype["@@iterator"]=function(){return this.entries()},Ee.prototype[s]=function(){return this.entries()},Ee.prototype._find=function(ue,P){if(!Be(this._cacheKey,ue)){this._cacheIndex=-1;for(var z=0;z<this._keys.length;z++)if(Be(this._keys[z],ue)){this._cacheIndex=z;break}}return this._cacheIndex<0&&P&&(this._cacheIndex=this._keys.length,this._keys.push(ue),this._values.push(void 0)),this._cacheIndex},Ee}();return ae;function be(Ee,ue){return Ee}function L(Ee,ue){return ue}function ge(Ee,ue){return[Ee,ue]}}function xe(){var O=function(){function j(){this._map=new f}return Object.defineProperty(j.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),j.prototype.has=function(W){return this._map.has(W)},j.prototype.add=function(W){return this._map.set(W,W),this},j.prototype.delete=function(W){return this._map.delete(W)},j.prototype.clear=function(){this._map.clear()},j.prototype.keys=function(){return this._map.keys()},j.prototype.values=function(){return this._map.keys()},j.prototype.entries=function(){return this._map.entries()},j.prototype["@@iterator"]=function(){return this.keys()},j.prototype[s]=function(){return this.keys()},j}();return O}function Ne(){var O=16,j=p.create(),W=ae();return function(){function ue(){this._key=ae()}return ue.prototype.has=function(P){var z=be(P,!1);return z!==void 0?p.has(z,this._key):!1},ue.prototype.get=function(P){var z=be(P,!1);return z!==void 0?p.get(z,this._key):void 0},ue.prototype.set=function(P,z){var D=be(P,!0);return D[this._key]=z,this},ue.prototype.delete=function(P){var z=be(P,!1);return z!==void 0?delete z[this._key]:!1},ue.prototype.clear=function(){this._key=ae()},ue}();function ae(){var ue;do ue="@@WeakMap@@"+Ee();while(p.has(j,ue));return j[ue]=!0,ue}function be(ue,P){if(!o.call(ue,W)){if(!P)return;Object.defineProperty(ue,W,{value:p.create()})}return ue[W]}function L(ue,P){for(var z=0;z<P;++z)ue[z]=Math.random()*255|0;return ue}function ge(ue){if(typeof Uint8Array=="function"){var P=new Uint8Array(ue);return typeof crypto<"u"?crypto.getRandomValues(P):typeof msCrypto<"u"?msCrypto.getRandomValues(P):L(P,ue),P}return L(new Array(ue),ue)}function Ee(){var ue=ge(O);ue[6]=ue[6]&79|64,ue[8]=ue[8]&191|128;for(var P="",z=0;z<O;++z){var D=ue[z];(z===4||z===6||z===8)&&(P+="-"),D<16&&(P+="0"),P+=D.toString(16).toLowerCase()}return P}}function g(O){return O.__=void 0,delete O.__,O}})})(nk||(nk={}));const HU=w1({__proto__:null,default:tk},[tk]);/*!
459
459
  * MIT License
460
460
  *
461
461
  * Copyright (c) 2017-2024 Peculiar Ventures, LLC
@@ -478,9 +478,9 @@ nodes:
478
478
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
479
479
  * SOFTWARE.
480
480
  *
481
- */const UU="[object ArrayBuffer]";class Ke{static isArrayBuffer(t){return Object.prototype.toString.call(t)===UU}static toArrayBuffer(t){return this.isArrayBuffer(t)?t:t.byteLength===t.buffer.byteLength||t.byteOffset===0&&t.byteLength===t.buffer.byteLength?t.buffer:this.toUint8Array(t.buffer).slice(t.byteOffset,t.byteOffset+t.byteLength).buffer}static toUint8Array(t){return this.toView(t,Uint8Array)}static toView(t,r){if(t.constructor===r)return t;if(this.isArrayBuffer(t))return new r(t);if(this.isArrayBufferView(t))return new r(t.buffer,t.byteOffset,t.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(t){return this.isArrayBufferView(t)||this.isArrayBuffer(t)}static isArrayBufferView(t){return ArrayBuffer.isView(t)||t&&this.isArrayBuffer(t.buffer)}static isEqual(t,r){const o=Ke.toUint8Array(t),i=Ke.toUint8Array(r);if(o.length!==i.byteLength)return!1;for(let a=0;a<o.length;a++)if(o[a]!==i[a])return!1;return!0}static concat(...t){let r;Array.isArray(t[0])&&!(t[1]instanceof Function)||Array.isArray(t[0])&&t[1]instanceof Function?r=t[0]:t[t.length-1]instanceof Function?r=t.slice(0,t.length-1):r=t;let o=0;for(const s of r)o+=s.byteLength;const i=new Uint8Array(o);let a=0;for(const s of r){const c=this.toUint8Array(s);i.set(c,a),a+=c.length}return t[t.length-1]instanceof Function?this.toView(i,t[t.length-1]):i.buffer}}const xp="string",KU=/^[0-9a-f\s]+$/i,qU=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,GU=/^[a-zA-Z0-9-_]+$/;class rk{static fromString(t){const r=unescape(encodeURIComponent(t)),o=new Uint8Array(r.length);for(let i=0;i<r.length;i++)o[i]=r.charCodeAt(i);return o.buffer}static toString(t){const r=Ke.toUint8Array(t);let o="";for(let a=0;a<r.length;a++)o+=String.fromCharCode(r[a]);return decodeURIComponent(escape(o))}}class hr{static toString(t,r=!1){const o=Ke.toArrayBuffer(t),i=new DataView(o);let a="";for(let s=0;s<o.byteLength;s+=2){const c=i.getUint16(s,r);a+=String.fromCharCode(c)}return a}static fromString(t,r=!1){const o=new ArrayBuffer(t.length*2),i=new DataView(o);for(let a=0;a<t.length;a++)i.setUint16(a*2,t.charCodeAt(a),r);return o}}class Je{static isHex(t){return typeof t===xp&&KU.test(t)}static isBase64(t){return typeof t===xp&&qU.test(t)}static isBase64Url(t){return typeof t===xp&&GU.test(t)}static ToString(t,r="utf8"){const o=Ke.toUint8Array(t);switch(r.toLowerCase()){case"utf8":return this.ToUtf8String(o);case"binary":return this.ToBinary(o);case"hex":return this.ToHex(o);case"base64":return this.ToBase64(o);case"base64url":return this.ToBase64Url(o);case"utf16le":return hr.toString(o,!0);case"utf16":case"utf16be":return hr.toString(o);default:throw new Error(`Unknown type of encoding '${r}'`)}}static FromString(t,r="utf8"){if(!t)return new ArrayBuffer(0);switch(r.toLowerCase()){case"utf8":return this.FromUtf8String(t);case"binary":return this.FromBinary(t);case"hex":return this.FromHex(t);case"base64":return this.FromBase64(t);case"base64url":return this.FromBase64Url(t);case"utf16le":return hr.fromString(t,!0);case"utf16":case"utf16be":return hr.fromString(t);default:throw new Error(`Unknown type of encoding '${r}'`)}}static ToBase64(t){const r=Ke.toUint8Array(t);if(typeof btoa<"u"){const o=this.ToString(r,"binary");return btoa(o)}else return Buffer.from(r).toString("base64")}static FromBase64(t){const r=this.formatString(t);if(!r)return new ArrayBuffer(0);if(!Je.isBase64(r))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob<"u"?this.FromBinary(atob(r)):new Uint8Array(Buffer.from(r,"base64")).buffer}static FromBase64Url(t){const r=this.formatString(t);if(!r)return new ArrayBuffer(0);if(!Je.isBase64Url(r))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(r.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(t){return this.ToBase64(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(t,r=Je.DEFAULT_UTF8_ENCODING){switch(r){case"ascii":return this.FromBinary(t);case"utf8":return rk.fromString(t);case"utf16":case"utf16be":return hr.fromString(t);case"utf16le":case"usc2":return hr.fromString(t,!0);default:throw new Error(`Unknown type of encoding '${r}'`)}}static ToUtf8String(t,r=Je.DEFAULT_UTF8_ENCODING){switch(r){case"ascii":return this.ToBinary(t);case"utf8":return rk.toString(t);case"utf16":case"utf16be":return hr.toString(t);case"utf16le":case"usc2":return hr.toString(t,!0);default:throw new Error(`Unknown type of encoding '${r}'`)}}static FromBinary(t){const r=t.length,o=new Uint8Array(r);for(let i=0;i<r;i++)o[i]=t.charCodeAt(i);return o.buffer}static ToBinary(t){const r=Ke.toUint8Array(t);let o="";for(let i=0;i<r.length;i++)o+=String.fromCharCode(r[i]);return o}static ToHex(t){const r=Ke.toUint8Array(t);let o="";const i=r.length;for(let a=0;a<i;a++){const s=r[a];s<16&&(o+="0"),o+=s.toString(16)}return o}static FromHex(t){let r=this.formatString(t);if(!r)return new ArrayBuffer(0);if(!Je.isHex(r))throw new TypeError("Argument 'hexString' is not HEX encoded");r.length%2&&(r=`0${r}`);const o=new Uint8Array(r.length/2);for(let i=0;i<r.length;i=i+2){const a=r.slice(i,i+2);o[i/2]=parseInt(a,16)}return o.buffer}static ToUtf16String(t,r=!1){return hr.toString(t,r)}static FromUtf16String(t,r=!1){return hr.fromString(t,r)}static Base64Padding(t){const r=4-t.length%4;if(r<4)for(let o=0;o<r;o++)t+="=";return t}static formatString(t){return(t==null?void 0:t.replace(/[\n\r\t ]/g,""))||""}}Je.DEFAULT_UTF8_ENCODING="utf8";function HU(...n){const t=n.map(i=>i.byteLength).reduce((i,a)=>i+a),r=new Uint8Array(t);let o=0;return n.map(i=>new Uint8Array(i)).forEach(i=>{for(const a of i)r[o++]=a}),r.buffer}function zU(n,t){if(!(n&&t)||n.byteLength!==t.byteLength)return!1;const r=new Uint8Array(n),o=new Uint8Array(t);for(let i=0;i<n.byteLength;i++)if(r[i]!==o[i])return!1;return!0}/*!
481
+ */const zU="[object ArrayBuffer]";class qe{static isArrayBuffer(t){return Object.prototype.toString.call(t)===zU}static toArrayBuffer(t){return this.isArrayBuffer(t)?t:t.byteLength===t.buffer.byteLength||t.byteOffset===0&&t.byteLength===t.buffer.byteLength?t.buffer:this.toUint8Array(t.buffer).slice(t.byteOffset,t.byteOffset+t.byteLength).buffer}static toUint8Array(t){return this.toView(t,Uint8Array)}static toView(t,r){if(t.constructor===r)return t;if(this.isArrayBuffer(t))return new r(t);if(this.isArrayBufferView(t))return new r(t.buffer,t.byteOffset,t.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(t){return this.isArrayBufferView(t)||this.isArrayBuffer(t)}static isArrayBufferView(t){return ArrayBuffer.isView(t)||t&&this.isArrayBuffer(t.buffer)}static isEqual(t,r){const o=qe.toUint8Array(t),i=qe.toUint8Array(r);if(o.length!==i.byteLength)return!1;for(let a=0;a<o.length;a++)if(o[a]!==i[a])return!1;return!0}static concat(...t){let r;Array.isArray(t[0])&&!(t[1]instanceof Function)||Array.isArray(t[0])&&t[1]instanceof Function?r=t[0]:t[t.length-1]instanceof Function?r=t.slice(0,t.length-1):r=t;let o=0;for(const s of r)o+=s.byteLength;const i=new Uint8Array(o);let a=0;for(const s of r){const c=this.toUint8Array(s);i.set(c,a),a+=c.length}return t[t.length-1]instanceof Function?this.toView(i,t[t.length-1]):i.buffer}}const xp="string",WU=/^[0-9a-f\s]+$/i,YU=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,JU=/^[a-zA-Z0-9-_]+$/;class rk{static fromString(t){const r=unescape(encodeURIComponent(t)),o=new Uint8Array(r.length);for(let i=0;i<r.length;i++)o[i]=r.charCodeAt(i);return o.buffer}static toString(t){const r=qe.toUint8Array(t);let o="";for(let a=0;a<r.length;a++)o+=String.fromCharCode(r[a]);return decodeURIComponent(escape(o))}}class hr{static toString(t,r=!1){const o=qe.toArrayBuffer(t),i=new DataView(o);let a="";for(let s=0;s<o.byteLength;s+=2){const c=i.getUint16(s,r);a+=String.fromCharCode(c)}return a}static fromString(t,r=!1){const o=new ArrayBuffer(t.length*2),i=new DataView(o);for(let a=0;a<t.length;a++)i.setUint16(a*2,t.charCodeAt(a),r);return o}}class Je{static isHex(t){return typeof t===xp&&WU.test(t)}static isBase64(t){return typeof t===xp&&YU.test(t)}static isBase64Url(t){return typeof t===xp&&JU.test(t)}static ToString(t,r="utf8"){const o=qe.toUint8Array(t);switch(r.toLowerCase()){case"utf8":return this.ToUtf8String(o);case"binary":return this.ToBinary(o);case"hex":return this.ToHex(o);case"base64":return this.ToBase64(o);case"base64url":return this.ToBase64Url(o);case"utf16le":return hr.toString(o,!0);case"utf16":case"utf16be":return hr.toString(o);default:throw new Error(`Unknown type of encoding '${r}'`)}}static FromString(t,r="utf8"){if(!t)return new ArrayBuffer(0);switch(r.toLowerCase()){case"utf8":return this.FromUtf8String(t);case"binary":return this.FromBinary(t);case"hex":return this.FromHex(t);case"base64":return this.FromBase64(t);case"base64url":return this.FromBase64Url(t);case"utf16le":return hr.fromString(t,!0);case"utf16":case"utf16be":return hr.fromString(t);default:throw new Error(`Unknown type of encoding '${r}'`)}}static ToBase64(t){const r=qe.toUint8Array(t);if(typeof btoa<"u"){const o=this.ToString(r,"binary");return btoa(o)}else return Buffer.from(r).toString("base64")}static FromBase64(t){const r=this.formatString(t);if(!r)return new ArrayBuffer(0);if(!Je.isBase64(r))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob<"u"?this.FromBinary(atob(r)):new Uint8Array(Buffer.from(r,"base64")).buffer}static FromBase64Url(t){const r=this.formatString(t);if(!r)return new ArrayBuffer(0);if(!Je.isBase64Url(r))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(r.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(t){return this.ToBase64(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(t,r=Je.DEFAULT_UTF8_ENCODING){switch(r){case"ascii":return this.FromBinary(t);case"utf8":return rk.fromString(t);case"utf16":case"utf16be":return hr.fromString(t);case"utf16le":case"usc2":return hr.fromString(t,!0);default:throw new Error(`Unknown type of encoding '${r}'`)}}static ToUtf8String(t,r=Je.DEFAULT_UTF8_ENCODING){switch(r){case"ascii":return this.ToBinary(t);case"utf8":return rk.toString(t);case"utf16":case"utf16be":return hr.toString(t);case"utf16le":case"usc2":return hr.toString(t,!0);default:throw new Error(`Unknown type of encoding '${r}'`)}}static FromBinary(t){const r=t.length,o=new Uint8Array(r);for(let i=0;i<r;i++)o[i]=t.charCodeAt(i);return o.buffer}static ToBinary(t){const r=qe.toUint8Array(t);let o="";for(let i=0;i<r.length;i++)o+=String.fromCharCode(r[i]);return o}static ToHex(t){const r=qe.toUint8Array(t);let o="";const i=r.length;for(let a=0;a<i;a++){const s=r[a];s<16&&(o+="0"),o+=s.toString(16)}return o}static FromHex(t){let r=this.formatString(t);if(!r)return new ArrayBuffer(0);if(!Je.isHex(r))throw new TypeError("Argument 'hexString' is not HEX encoded");r.length%2&&(r=`0${r}`);const o=new Uint8Array(r.length/2);for(let i=0;i<r.length;i=i+2){const a=r.slice(i,i+2);o[i/2]=parseInt(a,16)}return o.buffer}static ToUtf16String(t,r=!1){return hr.toString(t,r)}static FromUtf16String(t,r=!1){return hr.fromString(t,r)}static Base64Padding(t){const r=4-t.length%4;if(r<4)for(let o=0;o<r;o++)t+="=";return t}static formatString(t){return(t==null?void 0:t.replace(/[\n\r\t ]/g,""))||""}}Je.DEFAULT_UTF8_ENCODING="utf8";function XU(...n){const t=n.map(i=>i.byteLength).reduce((i,a)=>i+a),r=new Uint8Array(t);let o=0;return n.map(i=>new Uint8Array(i)).forEach(i=>{for(const a of i)r[o++]=a}),r.buffer}function ZU(n,t){if(!(n&&t)||n.byteLength!==t.byteLength)return!1;const r=new Uint8Array(n),o=new Uint8Array(t);for(let i=0;i<n.byteLength;i++)if(r[i]!==o[i])return!1;return!0}/*!
482
482
  Copyright (c) Peculiar Ventures, LLC
483
- */function Di(n,t){let r=0;if(n.length===1)return n[0];for(let o=n.length-1;o>=0;o--)r+=n[n.length-1-o]*Math.pow(2,t*o);return r}function Oo(n,t,r=-1){const o=r;let i=n,a=0,s=Math.pow(2,t);for(let c=1;c<8;c++){if(n<s){let l;if(o<0)l=new ArrayBuffer(c),a=c;else{if(o<c)return new ArrayBuffer(0);l=new ArrayBuffer(o),a=o}const u=new Uint8Array(l);for(let p=c-1;p>=0;p--){const d=Math.pow(2,p*t);u[a-p-1]=Math.floor(i/d),i-=u[a-p-1]*d}return l}s*=Math.pow(2,t)}return new ArrayBuffer(0)}function Ap(...n){let t=0,r=0;for(const a of n)t+=a.length;const o=new ArrayBuffer(t),i=new Uint8Array(o);for(const a of n)i.set(a,r),r+=a.length;return i}function ok(){const n=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){const c=n[0]===255&&n[1]&128,l=n[0]===0&&(n[1]&128)===0;(c||l)&&this.warnings.push("Needlessly long format")}const t=new ArrayBuffer(this.valueHex.byteLength),r=new Uint8Array(t);for(let c=0;c<this.valueHex.byteLength;c++)r[c]=0;r[0]=n[0]&128;const o=Di(r,8),i=new ArrayBuffer(this.valueHex.byteLength),a=new Uint8Array(i);for(let c=0;c<this.valueHex.byteLength;c++)a[c]=n[c];return a[0]&=127,Di(a,8)-o}function WU(n){const t=n<0?n*-1:n;let r=128;for(let o=1;o<8;o++){if(t<=r){if(n<0){const s=r-t,c=Oo(s,8,o),l=new Uint8Array(c);return l[0]|=128,c}let i=Oo(t,8,o),a=new Uint8Array(i);if(a[0]&128){const s=i.slice(0),c=new Uint8Array(s);i=new ArrayBuffer(i.byteLength+1),a=new Uint8Array(i);for(let l=0;l<s.byteLength;l++)a[l+1]=c[l];a[0]=0}return i}r*=Math.pow(2,8)}return new ArrayBuffer(0)}function YU(n,t){if(n.byteLength!==t.byteLength)return!1;const r=new Uint8Array(n),o=new Uint8Array(t);for(let i=0;i<r.length;i++)if(r[i]!==o[i])return!1;return!0}function Bn(n,t){const r=n.toString(10);if(t<r.length)return"";const o=t-r.length,i=new Array(o);for(let s=0;s<o;s++)i[s]="0";return i.join("").concat(r)}/*!
483
+ */function Di(n,t){let r=0;if(n.length===1)return n[0];for(let o=n.length-1;o>=0;o--)r+=n[n.length-1-o]*Math.pow(2,t*o);return r}function Oo(n,t,r=-1){const o=r;let i=n,a=0,s=Math.pow(2,t);for(let c=1;c<8;c++){if(n<s){let l;if(o<0)l=new ArrayBuffer(c),a=c;else{if(o<c)return new ArrayBuffer(0);l=new ArrayBuffer(o),a=o}const u=new Uint8Array(l);for(let p=c-1;p>=0;p--){const d=Math.pow(2,p*t);u[a-p-1]=Math.floor(i/d),i-=u[a-p-1]*d}return l}s*=Math.pow(2,t)}return new ArrayBuffer(0)}function Ap(...n){let t=0,r=0;for(const a of n)t+=a.length;const o=new ArrayBuffer(t),i=new Uint8Array(o);for(const a of n)i.set(a,r),r+=a.length;return i}function ok(){const n=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){const c=n[0]===255&&n[1]&128,l=n[0]===0&&(n[1]&128)===0;(c||l)&&this.warnings.push("Needlessly long format")}const t=new ArrayBuffer(this.valueHex.byteLength),r=new Uint8Array(t);for(let c=0;c<this.valueHex.byteLength;c++)r[c]=0;r[0]=n[0]&128;const o=Di(r,8),i=new ArrayBuffer(this.valueHex.byteLength),a=new Uint8Array(i);for(let c=0;c<this.valueHex.byteLength;c++)a[c]=n[c];return a[0]&=127,Di(a,8)-o}function QU(n){const t=n<0?n*-1:n;let r=128;for(let o=1;o<8;o++){if(t<=r){if(n<0){const s=r-t,c=Oo(s,8,o),l=new Uint8Array(c);return l[0]|=128,c}let i=Oo(t,8,o),a=new Uint8Array(i);if(a[0]&128){const s=i.slice(0),c=new Uint8Array(s);i=new ArrayBuffer(i.byteLength+1),a=new Uint8Array(i);for(let l=0;l<s.byteLength;l++)a[l+1]=c[l];a[0]=0}return i}r*=Math.pow(2,8)}return new ArrayBuffer(0)}function e8(n,t){if(n.byteLength!==t.byteLength)return!1;const r=new Uint8Array(n),o=new Uint8Array(t);for(let i=0;i<r.length;i++)if(r[i]!==o[i])return!1;return!0}function Bn(n,t){const r=n.toString(10);if(t<r.length)return"";const o=t-r.length,i=new Array(o);for(let s=0;s<o;s++)i[s]="0";return i.join("").concat(r)}/*!
484
484
  * Copyright (c) 2014, GMO GlobalSign
485
485
  * Copyright (c) 2015-2022, Peculiar Ventures
486
486
  * All rights reserved.
@@ -512,12 +512,12 @@ nodes:
512
512
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
513
513
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
514
514
  *
515
- */function Nc(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function vp(n){let t=0,r=0;for(let i=0;i<n.length;i++){const a=n[i];t+=a.byteLength}const o=new Uint8Array(t);for(let i=0;i<n.length;i++){const a=n[i];o.set(new Uint8Array(a),r),r+=a.byteLength}return o.buffer}function Lr(n,t,r,o){return t instanceof Uint8Array?t.byteLength?r<0?(n.error="Wrong parameter: inputOffset less than zero",!1):o<0?(n.error="Wrong parameter: inputLength less than zero",!1):t.byteLength-r-o<0?(n.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(n.error="Wrong parameter: inputBuffer has zero length",!1):(n.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}class Sc{constructor(){this.items=[]}write(t){this.items.push(t)}final(){return vp(this.items)}}const is=[new Uint8Array([1])],ik="0123456789",Ip="name",ak="valueHexView",JU="isHexOnly",XU="idBlock",ZU="tagClass",QU="tagNumber",e8="isConstructed",t8="fromBER",n8="toBER",r8="local",wn="",yr=new ArrayBuffer(0),xc=new Uint8Array(0),as="EndOfContent",sk="OCTET STRING",lk="BIT STRING";function _r(n){var t;return t=class extends n{get valueHex(){return this.valueHexView.slice().buffer}set valueHex(o){this.valueHexView=new Uint8Array(o)}constructor(...o){var i;super(...o);const a=o[0]||{};this.isHexOnly=(i=a.isHexOnly)!==null&&i!==void 0?i:!1,this.valueHexView=a.valueHex?Ke.toUint8Array(a.valueHex):xc}fromBER(o,i,a,s){const c=o instanceof ArrayBuffer?new Uint8Array(o):o;if(!Lr(this,c,i,a))return-1;const l=i+a;return this.valueHexView=c.subarray(i,l),this.valueHexView.length?(this.blockLength=a,l):(this.warnings.push("Zero buffer length"),i)}toBER(o=!1){return this.isHexOnly?o?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",yr)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:Je.ToHex(this.valueHexView)}}},t.NAME="hexBlock",t}class Po{static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(t){this.valueBeforeDecodeView=new Uint8Array(t)}constructor({blockLength:t=0,error:r=wn,warnings:o=[],valueBeforeDecode:i=xc}={}){this.blockLength=t,this.error=r,this.warnings=o,this.valueBeforeDecodeView=Ke.toUint8Array(i)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:Je.ToHex(this.valueBeforeDecodeView)}}}Po.NAME="baseBlock";class an extends Po{fromBER(t,r,o,i){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(t,r){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}}an.NAME="valueBlock";class ck extends _r(Po){constructor({idBlock:t={}}={}){var r,o,i,a;super(),t?(this.isHexOnly=(r=t.isHexOnly)!==null&&r!==void 0?r:!1,this.valueHexView=t.valueHex?Ke.toUint8Array(t.valueHex):xc,this.tagClass=(o=t.tagClass)!==null&&o!==void 0?o:-1,this.tagNumber=(i=t.tagNumber)!==null&&i!==void 0?i:-1,this.isConstructed=(a=t.isConstructed)!==null&&a!==void 0?a:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(t=!1){let r=0;switch(this.tagClass){case 1:r|=0;break;case 2:r|=64;break;case 3:r|=128;break;case 4:r|=192;break;default:return this.error="Unknown tag class",yr}if(this.isConstructed&&(r|=32),this.tagNumber<31&&!this.isHexOnly){const i=new Uint8Array(1);if(!t){let a=this.tagNumber;a&=31,r|=a,i[0]=r}return i.buffer}if(!this.isHexOnly){const i=Oo(this.tagNumber,7),a=new Uint8Array(i),s=i.byteLength,c=new Uint8Array(s+1);if(c[0]=r|31,!t){for(let l=0;l<s-1;l++)c[l+1]=a[l]|128;c[s]=a[s-1]}return c.buffer}const o=new Uint8Array(this.valueHexView.byteLength+1);if(o[0]=r|31,!t){const i=this.valueHexView;for(let a=0;a<i.length-1;a++)o[a+1]=i[a]|128;o[this.valueHexView.byteLength]=i[i.length-1]}return o.buffer}fromBER(t,r,o){const i=Ke.toUint8Array(t);if(!Lr(this,i,r,o))return-1;const a=i.subarray(r,r+o);if(a.length===0)return this.error="Zero buffer length",-1;switch(a[0]&192){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=(a[0]&32)===32,this.isHexOnly=!1;const c=a[0]&31;if(c!==31)this.tagNumber=c,this.blockLength=1;else{let l=0;for(;;){const p=l+1;if(p>=a.length)return this.error="End of input reached before message was fully decoded",-1;if(l++,!(a[p]&128))break}this.blockLength=l+1;const u=this.valueHexView=new Uint8Array(l);for(let p=0;p<l;p++)u[p]=a[p+1]&127;this.blockLength<=9?this.tagNumber=Di(u,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(this.tagClass===1&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return r+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}}ck.NAME="identificationBlock";class uk extends Po{constructor({lenBlock:t={}}={}){var r,o,i;super(),this.isIndefiniteForm=(r=t.isIndefiniteForm)!==null&&r!==void 0?r:!1,this.longFormUsed=(o=t.longFormUsed)!==null&&o!==void 0?o:!1,this.length=(i=t.length)!==null&&i!==void 0?i:0}fromBER(t,r,o){const i=Ke.toUint8Array(t);if(!Lr(this,i,r,o))return-1;const a=i.subarray(r,r+o);if(a.length===0)return this.error="Zero buffer length",-1;if(a[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=a[0]===128,this.isIndefiniteForm)return this.blockLength=1,r+this.blockLength;if(this.longFormUsed=!!(a[0]&128),this.longFormUsed===!1)return this.length=a[0],this.blockLength=1,r+this.blockLength;const s=a[0]&127;if(s>8)return this.error="Too big integer",-1;if(s+1>a.length)return this.error="End of input reached before message was fully decoded",-1;const c=r+1,l=i.subarray(c,c+s);return l[s-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=Di(l,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=s+1,r+this.blockLength}toBER(t=!1){let r,o;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return r=new ArrayBuffer(1),t===!1&&(o=new Uint8Array(r),o[0]=128),r;if(this.longFormUsed){const i=Oo(this.length,8);if(i.byteLength>127)return this.error="Too big length",yr;if(r=new ArrayBuffer(i.byteLength+1),t)return r;const a=new Uint8Array(i);o=new Uint8Array(r),o[0]=i.byteLength|128;for(let s=0;s<i.byteLength;s++)o[s+1]=a[s];return r}return r=new ArrayBuffer(1),t===!1&&(o=new Uint8Array(r),o[0]=this.length),r}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}}uk.NAME="lengthBlock";const He={};class Qt extends Po{constructor({name:t=wn,optional:r=!1,primitiveSchema:o,...i}={},a){super(i),this.name=t,this.optional=r,o&&(this.primitiveSchema=o),this.idBlock=new ck(i),this.lenBlock=new uk(i),this.valueBlock=a?new a(i):new an(i)}fromBER(t,r,o,i){const a=this.valueBlock.fromBER(t,r,this.lenBlock.isIndefiniteForm?o:this.lenBlock.length,i);return a===-1?(this.error=this.valueBlock.error,a):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),a)}toBER(t,r){const o=r||new Sc;r||dk(this);const i=this.idBlock.toBER(t);if(o.write(i),this.lenBlock.isIndefiniteForm)o.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(t,o),o.write(new ArrayBuffer(2));else{const a=this.valueBlock.toBER(t);this.lenBlock.length=a.byteLength;const s=this.lenBlock.toBER(t);o.write(s),o.write(a)}return r?yr:o.final()}toJSON(){const t={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(t.primitiveSchema=this.primitiveSchema.toJSON()),t}toString(t="ascii"){return t==="ascii"?this.onAsciiEncoding():Je.ToHex(this.toBER())}onAsciiEncoding(){const t=this.constructor.NAME,r=Je.ToHex(this.valueBlock.valueBeforeDecodeView);return`${t} : ${r}`}isEqual(t){if(this===t)return!0;if(!(t instanceof this.constructor))return!1;const r=this.toBER(),o=t.toBER();return YU(r,o)}}Qt.NAME="BaseBlock";function dk(n){var t;if(n instanceof He.Constructed)for(const r of n.valueBlock.value)dk(r)&&(n.lenBlock.isIndefiniteForm=!0);return!!(!((t=n.lenBlock)===null||t===void 0)&&t.isIndefiniteForm)}class Bp extends Qt{getValue(){return this.valueBlock.value}setValue(t){this.valueBlock.value=t}constructor({value:t=wn,...r}={},o){super(r,o),t&&this.fromString(t)}fromBER(t,r,o){const i=this.valueBlock.fromBER(t,r,this.lenBlock.isIndefiniteForm?o:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),i)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}}Bp.NAME="BaseStringBlock";class fk extends _r(an){constructor({isHexOnly:t=!0,...r}={}){super(r),this.isHexOnly=t}}fk.NAME="PrimitiveValueBlock";var pk;class ss extends Qt{constructor(t={}){super(t,fk),this.idBlock.isConstructed=!1}}pk=ss,He.Primitive=pk,ss.NAME="PRIMITIVE";const mk=100,gk=1e4,hk=16*1024*1024,o8="Maximum ASN.1 nesting depth exceeded",i8="Maximum ASN.1 node count exceeded",a8="Maximum ASN.1 content length exceeded";function ls(n={}){var t,r,o;return{depth:0,maxDepth:(t=n.maxDepth)!==null&&t!==void 0?t:mk,nodesCount:0,maxNodes:(r=n.maxNodes)!==null&&r!==void 0?r:gk,maxContentLength:(o=n.maxContentLength)!==null&&o!==void 0?o:hk}}function s8(n){const t=new Qt({},an);return t.error=n,{offset:-1,result:t}}function l8(n){if(n.nodesCount+=1,n.nodesCount>n.maxNodes)return i8}function c8(n,t){if(n>t.maxContentLength)return a8}function Tp(n,t,r,o){const i=o.depth+1;if(i>o.maxDepth)return s8(o8);o.depth=i;try{return Ac(n,t,r,o)}finally{o.depth-=1}}function u8(n,t){if(n instanceof t)return n;const r=new t;return r.idBlock=n.idBlock,r.lenBlock=n.lenBlock,r.warnings=n.warnings,r.valueBeforeDecodeView=n.valueBeforeDecodeView,r}function Ac(n,t=0,r=n.length,o=ls()){const i=t;let a=new Qt({},an);const s=new Po;if(!Lr(s,n,t,r))return a.error=s.error,{offset:-1,result:a};if(!n.subarray(t,t+r).length)return a.error="Zero buffer length",{offset:-1,result:a};const l=l8(o);if(l)return a.error=l,{offset:-1,result:a};let u=a.idBlock.fromBER(n,t,r);if(a.idBlock.warnings.length&&a.warnings.concat(a.idBlock.warnings),u===-1)return a.error=a.idBlock.error,{offset:-1,result:a};if(t=u,r-=a.idBlock.blockLength,u=a.lenBlock.fromBER(n,t,r),a.lenBlock.warnings.length&&a.warnings.concat(a.lenBlock.warnings),u===-1)return a.error=a.lenBlock.error,{offset:-1,result:a};t=u,r-=a.lenBlock.blockLength;const p=a.lenBlock.isIndefiniteForm?r:a.lenBlock.length,d=c8(p,o);if(d)return a.error=d,{offset:-1,result:a};if(!a.idBlock.isConstructed&&a.lenBlock.isIndefiniteForm)return a.error="Indefinite length form used for primitive encoding form",{offset:-1,result:a};let f=Qt;switch(a.idBlock.tagClass){case 1:if(a.idBlock.tagNumber>=37&&a.idBlock.isHexOnly===!1)return a.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:a};switch(a.idBlock.tagNumber){case 0:if(a.idBlock.isConstructed&&a.lenBlock.length>0)return a.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:a};f=He.EndOfContent;break;case 1:f=He.Boolean;break;case 2:f=He.Integer;break;case 3:f=He.BitString;break;case 4:f=He.OctetString;break;case 5:f=He.Null;break;case 6:f=He.ObjectIdentifier;break;case 10:f=He.Enumerated;break;case 12:f=He.Utf8String;break;case 13:f=He.RelativeObjectIdentifier;break;case 14:f=He.TIME;break;case 15:return a.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:a};case 16:f=He.Sequence;break;case 17:f=He.Set;break;case 18:f=He.NumericString;break;case 19:f=He.PrintableString;break;case 20:f=He.TeletexString;break;case 21:f=He.VideotexString;break;case 22:f=He.IA5String;break;case 23:f=He.UTCTime;break;case 24:f=He.GeneralizedTime;break;case 25:f=He.GraphicString;break;case 26:f=He.VisibleString;break;case 27:f=He.GeneralString;break;case 28:f=He.UniversalString;break;case 29:f=He.CharacterString;break;case 30:f=He.BmpString;break;case 31:f=He.DATE;break;case 32:f=He.TimeOfDay;break;case 33:f=He.DateTime;break;case 34:f=He.Duration;break;default:{const m=a.idBlock.isConstructed?new He.Constructed:new He.Primitive;m.idBlock=a.idBlock,m.lenBlock=a.lenBlock,m.warnings=a.warnings,a=m}}break;case 2:case 3:case 4:default:f=a.idBlock.isConstructed?He.Constructed:He.Primitive}return a=u8(a,f),u=a.fromBER(n,t,p,o),a.valueBeforeDecodeView=n.subarray(i,i+a.blockLength),{offset:u,result:a}}function Mi(n,t={}){if(!n.byteLength){const r=new Qt({},an);return r.error="Input buffer has zero length",{offset:-1,result:r}}return Ac(Ke.toUint8Array(n).slice(),0,n.byteLength,ls(t))}function d8(n,t){return n?1:t}class ro extends an{constructor({value:t=[],isIndefiniteForm:r=!1,...o}={}){super(o),this.value=t,this.isIndefiniteForm=r}fromBER(t,r,o,i){const a=Ke.toUint8Array(t),s=i??ls();if(!Lr(this,a,r,o))return-1;if(this.valueBeforeDecodeView=a.subarray(r,r+o),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),r;let c=r;for(;d8(this.isIndefiniteForm,o)>0;){const l=Tp(a,c,o,s);if(l.offset===-1)return this.error=l.result.error,this.warnings.concat(l.result.warnings),-1;if(c=l.offset,this.blockLength+=l.result.blockLength,o-=l.result.blockLength,this.value.push(l.result),this.isIndefiniteForm&&l.result.constructor.NAME===as)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===as?this.value.pop():this.warnings.push("No EndOfContent block encoded")),c}toBER(t,r){const o=r||new Sc;for(let i=0;i<this.value.length;i++)this.value[i].toBER(t,o);return r?yr:o.final()}toJSON(){const t={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(const r of this.value)t.value.push(r.toJSON());return t}}ro.NAME="ConstructedValueBlock";var yk;class fn extends Qt{constructor(t={}){super(t,ro),this.idBlock.isConstructed=!0}fromBER(t,r,o,i){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;const a=this.valueBlock.fromBER(t,r,this.lenBlock.isIndefiniteForm?o:this.lenBlock.length,i);return a===-1?(this.error=this.valueBlock.error,a):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),a)}onAsciiEncoding(){const t=[];for(const o of this.valueBlock.value)t.push(o.toString("ascii").split(`
515
+ */function Nc(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function vp(n){let t=0,r=0;for(let i=0;i<n.length;i++){const a=n[i];t+=a.byteLength}const o=new Uint8Array(t);for(let i=0;i<n.length;i++){const a=n[i];o.set(new Uint8Array(a),r),r+=a.byteLength}return o.buffer}function Lr(n,t,r,o){return t instanceof Uint8Array?t.byteLength?r<0?(n.error="Wrong parameter: inputOffset less than zero",!1):o<0?(n.error="Wrong parameter: inputLength less than zero",!1):t.byteLength-r-o<0?(n.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(n.error="Wrong parameter: inputBuffer has zero length",!1):(n.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}class Sc{constructor(){this.items=[]}write(t){this.items.push(t)}final(){return vp(this.items)}}const is=[new Uint8Array([1])],ik="0123456789",Ip="name",ak="valueHexView",t8="isHexOnly",n8="idBlock",r8="tagClass",o8="tagNumber",i8="isConstructed",a8="fromBER",s8="toBER",l8="local",wn="",yr=new ArrayBuffer(0),xc=new Uint8Array(0),as="EndOfContent",sk="OCTET STRING",lk="BIT STRING";function _r(n){var t;return t=class extends n{get valueHex(){return this.valueHexView.slice().buffer}set valueHex(o){this.valueHexView=new Uint8Array(o)}constructor(...o){var i;super(...o);const a=o[0]||{};this.isHexOnly=(i=a.isHexOnly)!==null&&i!==void 0?i:!1,this.valueHexView=a.valueHex?qe.toUint8Array(a.valueHex):xc}fromBER(o,i,a,s){const c=o instanceof ArrayBuffer?new Uint8Array(o):o;if(!Lr(this,c,i,a))return-1;const l=i+a;return this.valueHexView=c.subarray(i,l),this.valueHexView.length?(this.blockLength=a,l):(this.warnings.push("Zero buffer length"),i)}toBER(o=!1){return this.isHexOnly?o?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",yr)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:Je.ToHex(this.valueHexView)}}},t.NAME="hexBlock",t}class Po{static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(t){this.valueBeforeDecodeView=new Uint8Array(t)}constructor({blockLength:t=0,error:r=wn,warnings:o=[],valueBeforeDecode:i=xc}={}){this.blockLength=t,this.error=r,this.warnings=o,this.valueBeforeDecodeView=qe.toUint8Array(i)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:Je.ToHex(this.valueBeforeDecodeView)}}}Po.NAME="baseBlock";class an extends Po{fromBER(t,r,o,i){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(t,r){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}}an.NAME="valueBlock";class ck extends _r(Po){constructor({idBlock:t={}}={}){var r,o,i,a;super(),t?(this.isHexOnly=(r=t.isHexOnly)!==null&&r!==void 0?r:!1,this.valueHexView=t.valueHex?qe.toUint8Array(t.valueHex):xc,this.tagClass=(o=t.tagClass)!==null&&o!==void 0?o:-1,this.tagNumber=(i=t.tagNumber)!==null&&i!==void 0?i:-1,this.isConstructed=(a=t.isConstructed)!==null&&a!==void 0?a:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(t=!1){let r=0;switch(this.tagClass){case 1:r|=0;break;case 2:r|=64;break;case 3:r|=128;break;case 4:r|=192;break;default:return this.error="Unknown tag class",yr}if(this.isConstructed&&(r|=32),this.tagNumber<31&&!this.isHexOnly){const i=new Uint8Array(1);if(!t){let a=this.tagNumber;a&=31,r|=a,i[0]=r}return i.buffer}if(!this.isHexOnly){const i=Oo(this.tagNumber,7),a=new Uint8Array(i),s=i.byteLength,c=new Uint8Array(s+1);if(c[0]=r|31,!t){for(let l=0;l<s-1;l++)c[l+1]=a[l]|128;c[s]=a[s-1]}return c.buffer}const o=new Uint8Array(this.valueHexView.byteLength+1);if(o[0]=r|31,!t){const i=this.valueHexView;for(let a=0;a<i.length-1;a++)o[a+1]=i[a]|128;o[this.valueHexView.byteLength]=i[i.length-1]}return o.buffer}fromBER(t,r,o){const i=qe.toUint8Array(t);if(!Lr(this,i,r,o))return-1;const a=i.subarray(r,r+o);if(a.length===0)return this.error="Zero buffer length",-1;switch(a[0]&192){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=(a[0]&32)===32,this.isHexOnly=!1;const c=a[0]&31;if(c!==31)this.tagNumber=c,this.blockLength=1;else{let l=0;for(;;){const p=l+1;if(p>=a.length)return this.error="End of input reached before message was fully decoded",-1;if(l++,!(a[p]&128))break}this.blockLength=l+1;const u=this.valueHexView=new Uint8Array(l);for(let p=0;p<l;p++)u[p]=a[p+1]&127;this.blockLength<=9?this.tagNumber=Di(u,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(this.tagClass===1&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return r+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}}ck.NAME="identificationBlock";class uk extends Po{constructor({lenBlock:t={}}={}){var r,o,i;super(),this.isIndefiniteForm=(r=t.isIndefiniteForm)!==null&&r!==void 0?r:!1,this.longFormUsed=(o=t.longFormUsed)!==null&&o!==void 0?o:!1,this.length=(i=t.length)!==null&&i!==void 0?i:0}fromBER(t,r,o){const i=qe.toUint8Array(t);if(!Lr(this,i,r,o))return-1;const a=i.subarray(r,r+o);if(a.length===0)return this.error="Zero buffer length",-1;if(a[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=a[0]===128,this.isIndefiniteForm)return this.blockLength=1,r+this.blockLength;if(this.longFormUsed=!!(a[0]&128),this.longFormUsed===!1)return this.length=a[0],this.blockLength=1,r+this.blockLength;const s=a[0]&127;if(s>8)return this.error="Too big integer",-1;if(s+1>a.length)return this.error="End of input reached before message was fully decoded",-1;const c=r+1,l=i.subarray(c,c+s);return l[s-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=Di(l,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=s+1,r+this.blockLength}toBER(t=!1){let r,o;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return r=new ArrayBuffer(1),t===!1&&(o=new Uint8Array(r),o[0]=128),r;if(this.longFormUsed){const i=Oo(this.length,8);if(i.byteLength>127)return this.error="Too big length",yr;if(r=new ArrayBuffer(i.byteLength+1),t)return r;const a=new Uint8Array(i);o=new Uint8Array(r),o[0]=i.byteLength|128;for(let s=0;s<i.byteLength;s++)o[s+1]=a[s];return r}return r=new ArrayBuffer(1),t===!1&&(o=new Uint8Array(r),o[0]=this.length),r}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}}uk.NAME="lengthBlock";const ze={};class Qt extends Po{constructor({name:t=wn,optional:r=!1,primitiveSchema:o,...i}={},a){super(i),this.name=t,this.optional=r,o&&(this.primitiveSchema=o),this.idBlock=new ck(i),this.lenBlock=new uk(i),this.valueBlock=a?new a(i):new an(i)}fromBER(t,r,o,i){const a=this.valueBlock.fromBER(t,r,this.lenBlock.isIndefiniteForm?o:this.lenBlock.length,i);return a===-1?(this.error=this.valueBlock.error,a):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),a)}toBER(t,r){const o=r||new Sc;r||dk(this);const i=this.idBlock.toBER(t);if(o.write(i),this.lenBlock.isIndefiniteForm)o.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(t,o),o.write(new ArrayBuffer(2));else{const a=this.valueBlock.toBER(t);this.lenBlock.length=a.byteLength;const s=this.lenBlock.toBER(t);o.write(s),o.write(a)}return r?yr:o.final()}toJSON(){const t={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(t.primitiveSchema=this.primitiveSchema.toJSON()),t}toString(t="ascii"){return t==="ascii"?this.onAsciiEncoding():Je.ToHex(this.toBER())}onAsciiEncoding(){const t=this.constructor.NAME,r=Je.ToHex(this.valueBlock.valueBeforeDecodeView);return`${t} : ${r}`}isEqual(t){if(this===t)return!0;if(!(t instanceof this.constructor))return!1;const r=this.toBER(),o=t.toBER();return e8(r,o)}}Qt.NAME="BaseBlock";function dk(n){var t;if(n instanceof ze.Constructed)for(const r of n.valueBlock.value)dk(r)&&(n.lenBlock.isIndefiniteForm=!0);return!!(!((t=n.lenBlock)===null||t===void 0)&&t.isIndefiniteForm)}class Bp extends Qt{getValue(){return this.valueBlock.value}setValue(t){this.valueBlock.value=t}constructor({value:t=wn,...r}={},o){super(r,o),t&&this.fromString(t)}fromBER(t,r,o){const i=this.valueBlock.fromBER(t,r,this.lenBlock.isIndefiniteForm?o:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),i)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}}Bp.NAME="BaseStringBlock";class fk extends _r(an){constructor({isHexOnly:t=!0,...r}={}){super(r),this.isHexOnly=t}}fk.NAME="PrimitiveValueBlock";var pk;class ss extends Qt{constructor(t={}){super(t,fk),this.idBlock.isConstructed=!1}}pk=ss,ze.Primitive=pk,ss.NAME="PRIMITIVE";const mk=100,gk=1e4,hk=16*1024*1024,c8="Maximum ASN.1 nesting depth exceeded",u8="Maximum ASN.1 node count exceeded",d8="Maximum ASN.1 content length exceeded";function ls(n={}){var t,r,o;return{depth:0,maxDepth:(t=n.maxDepth)!==null&&t!==void 0?t:mk,nodesCount:0,maxNodes:(r=n.maxNodes)!==null&&r!==void 0?r:gk,maxContentLength:(o=n.maxContentLength)!==null&&o!==void 0?o:hk}}function f8(n){const t=new Qt({},an);return t.error=n,{offset:-1,result:t}}function p8(n){if(n.nodesCount+=1,n.nodesCount>n.maxNodes)return u8}function m8(n,t){if(n>t.maxContentLength)return d8}function Tp(n,t,r,o){const i=o.depth+1;if(i>o.maxDepth)return f8(c8);o.depth=i;try{return Ac(n,t,r,o)}finally{o.depth-=1}}function g8(n,t){if(n instanceof t)return n;const r=new t;return r.idBlock=n.idBlock,r.lenBlock=n.lenBlock,r.warnings=n.warnings,r.valueBeforeDecodeView=n.valueBeforeDecodeView,r}function Ac(n,t=0,r=n.length,o=ls()){const i=t;let a=new Qt({},an);const s=new Po;if(!Lr(s,n,t,r))return a.error=s.error,{offset:-1,result:a};if(!n.subarray(t,t+r).length)return a.error="Zero buffer length",{offset:-1,result:a};const l=p8(o);if(l)return a.error=l,{offset:-1,result:a};let u=a.idBlock.fromBER(n,t,r);if(a.idBlock.warnings.length&&a.warnings.concat(a.idBlock.warnings),u===-1)return a.error=a.idBlock.error,{offset:-1,result:a};if(t=u,r-=a.idBlock.blockLength,u=a.lenBlock.fromBER(n,t,r),a.lenBlock.warnings.length&&a.warnings.concat(a.lenBlock.warnings),u===-1)return a.error=a.lenBlock.error,{offset:-1,result:a};t=u,r-=a.lenBlock.blockLength;const p=a.lenBlock.isIndefiniteForm?r:a.lenBlock.length,d=m8(p,o);if(d)return a.error=d,{offset:-1,result:a};if(!a.idBlock.isConstructed&&a.lenBlock.isIndefiniteForm)return a.error="Indefinite length form used for primitive encoding form",{offset:-1,result:a};let f=Qt;switch(a.idBlock.tagClass){case 1:if(a.idBlock.tagNumber>=37&&a.idBlock.isHexOnly===!1)return a.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:a};switch(a.idBlock.tagNumber){case 0:if(a.idBlock.isConstructed&&a.lenBlock.length>0)return a.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:a};f=ze.EndOfContent;break;case 1:f=ze.Boolean;break;case 2:f=ze.Integer;break;case 3:f=ze.BitString;break;case 4:f=ze.OctetString;break;case 5:f=ze.Null;break;case 6:f=ze.ObjectIdentifier;break;case 10:f=ze.Enumerated;break;case 12:f=ze.Utf8String;break;case 13:f=ze.RelativeObjectIdentifier;break;case 14:f=ze.TIME;break;case 15:return a.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:a};case 16:f=ze.Sequence;break;case 17:f=ze.Set;break;case 18:f=ze.NumericString;break;case 19:f=ze.PrintableString;break;case 20:f=ze.TeletexString;break;case 21:f=ze.VideotexString;break;case 22:f=ze.IA5String;break;case 23:f=ze.UTCTime;break;case 24:f=ze.GeneralizedTime;break;case 25:f=ze.GraphicString;break;case 26:f=ze.VisibleString;break;case 27:f=ze.GeneralString;break;case 28:f=ze.UniversalString;break;case 29:f=ze.CharacterString;break;case 30:f=ze.BmpString;break;case 31:f=ze.DATE;break;case 32:f=ze.TimeOfDay;break;case 33:f=ze.DateTime;break;case 34:f=ze.Duration;break;default:{const m=a.idBlock.isConstructed?new ze.Constructed:new ze.Primitive;m.idBlock=a.idBlock,m.lenBlock=a.lenBlock,m.warnings=a.warnings,a=m}}break;case 2:case 3:case 4:default:f=a.idBlock.isConstructed?ze.Constructed:ze.Primitive}return a=g8(a,f),u=a.fromBER(n,t,p,o),a.valueBeforeDecodeView=n.subarray(i,i+a.blockLength),{offset:u,result:a}}function Mi(n,t={}){if(!n.byteLength){const r=new Qt({},an);return r.error="Input buffer has zero length",{offset:-1,result:r}}return Ac(qe.toUint8Array(n).slice(),0,n.byteLength,ls(t))}function h8(n,t){return n?1:t}class ro extends an{constructor({value:t=[],isIndefiniteForm:r=!1,...o}={}){super(o),this.value=t,this.isIndefiniteForm=r}fromBER(t,r,o,i){const a=qe.toUint8Array(t),s=i??ls();if(!Lr(this,a,r,o))return-1;if(this.valueBeforeDecodeView=a.subarray(r,r+o),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),r;let c=r;for(;h8(this.isIndefiniteForm,o)>0;){const l=Tp(a,c,o,s);if(l.offset===-1)return this.error=l.result.error,this.warnings.concat(l.result.warnings),-1;if(c=l.offset,this.blockLength+=l.result.blockLength,o-=l.result.blockLength,this.value.push(l.result),this.isIndefiniteForm&&l.result.constructor.NAME===as)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===as?this.value.pop():this.warnings.push("No EndOfContent block encoded")),c}toBER(t,r){const o=r||new Sc;for(let i=0;i<this.value.length;i++)this.value[i].toBER(t,o);return r?yr:o.final()}toJSON(){const t={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(const r of this.value)t.value.push(r.toJSON());return t}}ro.NAME="ConstructedValueBlock";var yk;class fn extends Qt{constructor(t={}){super(t,ro),this.idBlock.isConstructed=!0}fromBER(t,r,o,i){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;const a=this.valueBlock.fromBER(t,r,this.lenBlock.isIndefiniteForm?o:this.lenBlock.length,i);return a===-1?(this.error=this.valueBlock.error,a):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),a)}onAsciiEncoding(){const t=[];for(const o of this.valueBlock.value)t.push(o.toString("ascii").split(`
516
516
  `).map(i=>` ${i}`).join(`
517
517
  `));const r=this.idBlock.tagClass===3?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return t.length?`${r} :
518
518
  ${t.join(`
519
- `)}`:`${r} :`}}yk=fn,He.Constructed=yk,fn.NAME="CONSTRUCTED";class _k extends an{fromBER(t,r,o){return r}toBER(t){return yr}}_k.override="EndOfContentValueBlock";var bk;class Op extends Qt{constructor(t={}){super(t,_k),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}bk=Op,He.EndOfContent=bk,Op.NAME=as;var wk;class Vo extends Qt{constructor(t={}){super(t,an),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(t,r,o){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=o,r+o>t.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):r+o}toBER(t,r){const o=new ArrayBuffer(2);if(!t){const i=new Uint8Array(o);i[0]=5,i[1]=0}return r&&r.write(o),o}onAsciiEncoding(){return`${this.constructor.NAME}`}}wk=Vo,He.Null=wk,Vo.NAME="NULL";class kk extends _r(an){get value(){for(const t of this.valueHexView)if(t>0)return!0;return!1}set value(t){this.valueHexView[0]=t?255:0}constructor({value:t,...r}={}){super(r),r.valueHex?this.valueHexView=Ke.toUint8Array(r.valueHex):this.valueHexView=new Uint8Array(1),t&&(this.value=t)}fromBER(t,r,o){const i=Ke.toUint8Array(t);return Lr(this,i,r,o)?(this.valueHexView=i.subarray(r,r+o),o>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,ok.call(this),this.blockLength=o,r+o):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}kk.NAME="BooleanValueBlock";var Ck;let vc=class extends Qt{getValue(){return this.valueBlock.value}setValue(t){this.valueBlock.value=t}constructor(t={}){super(t,kk),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};Ck=vc,He.Boolean=Ck,vc.NAME="BOOLEAN";class Ek extends _r(ro){constructor({isConstructed:t=!1,...r}={}){super(r),this.isConstructed=t}fromBER(t,r,o,i){let a=0;if(this.isConstructed){if(this.isHexOnly=!1,a=ro.prototype.fromBER.call(this,t,r,o,i),a===-1)return a;for(let s=0;s<this.value.length;s++){const c=this.value[s].constructor.NAME;if(c===as){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(c!==sk)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,a=super.fromBER(t,r,o),this.blockLength=o;return a}toBER(t,r){return this.isConstructed?ro.prototype.toBER.call(this,t,r):t?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}}Ek.NAME="OctetStringValueBlock";var Pp;let $o=class extends Qt{constructor({idBlock:t={},lenBlock:r={},...o}={}){var i,a;(i=o.isConstructed)!==null&&i!==void 0||(o.isConstructed=!!(!((a=o.value)===null||a===void 0)&&a.length)),super({idBlock:{isConstructed:o.isConstructed,...t},lenBlock:{...r,isIndefiniteForm:!!o.isIndefiniteForm},...o},Ek),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(t,r,o,i){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,o===0)return this.idBlock.error.length===0&&(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length===0&&(this.blockLength+=this.lenBlock.blockLength),r;if(!this.valueBlock.isConstructed){const s=(t instanceof ArrayBuffer?new Uint8Array(t):t).subarray(r,r+o);try{if(s.byteLength){const c=i??ls(),l=Tp(s,0,s.byteLength,c);l.offset!==-1&&l.offset===o&&(this.valueBlock.value=[l.result])}}catch{}}return super.fromBER(t,r,o,i)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return fn.prototype.onAsciiEncoding.call(this);const t=this.constructor.NAME,r=Je.ToHex(this.valueBlock.valueHexView);return`${t} : ${r}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;const t=[];for(const r of this.valueBlock.value)r instanceof Pp&&t.push(r.valueBlock.valueHexView);return Ke.concat(t)}};Pp=$o,He.OctetString=Pp,$o.NAME=sk;class Nk extends _r(ro){constructor({unusedBits:t=0,isConstructed:r=!1,...o}={}){super(o),this.unusedBits=t,this.isConstructed=r,this.blockLength=this.valueHexView.byteLength}fromBER(t,r,o,i){if(!o)return r;let a=-1;if(this.isConstructed){if(a=ro.prototype.fromBER.call(this,t,r,o,i),a===-1)return a;for(const l of this.value){const u=l.constructor.NAME;if(u===as){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(u!==lk)return this.error="BIT STRING may consists of BIT STRINGs only",-1;const p=l.valueBlock;if(this.unusedBits>0&&p.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=p.unusedBits}return a}const s=Ke.toUint8Array(t);if(!Lr(this,s,r,o))return-1;const c=s.subarray(r,r+o);if(this.unusedBits=c[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const l=c.subarray(1);try{if(l.byteLength){const u=i??ls(),p=Tp(l,0,l.byteLength,u);p.offset!==-1&&p.offset===o-1&&(this.value=[p.result])}}catch{}}return this.valueHexView=c.subarray(1),this.blockLength=c.length,r+o}toBER(t,r){if(this.isConstructed)return ro.prototype.toBER.call(this,t,r);if(t)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength){const i=new Uint8Array(1);return i[0]=0,i.buffer}const o=new Uint8Array(this.valueHexView.length+1);return o[0]=this.unusedBits,o.set(this.valueHexView,1),o.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}Nk.NAME="BitStringValueBlock";var Sk;let Ro=class extends Qt{constructor({idBlock:t={},lenBlock:r={},...o}={}){var i,a;(i=o.isConstructed)!==null&&i!==void 0||(o.isConstructed=!!(!((a=o.value)===null||a===void 0)&&a.length)),super({idBlock:{isConstructed:o.isConstructed,...t},lenBlock:{...r,isIndefiniteForm:!!o.isIndefiniteForm},...o},Nk),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(t,r,o,i){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(t,r,o,i)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return fn.prototype.onAsciiEncoding.call(this);{const t=[],r=this.valueBlock.valueHexView;for(const s of r)t.push(s.toString(2).padStart(8,"0"));const o=t.join(""),i=this.constructor.NAME,a=o.substring(0,o.length-this.valueBlock.unusedBits);return`${i} : ${a}`}}};Sk=Ro,He.BitString=Sk,Ro.NAME=lk;var xk;function f8(n,t){const r=new Uint8Array([0]),o=new Uint8Array(n),i=new Uint8Array(t);let a=o.slice(0);const s=a.length-1,c=i.slice(0),l=c.length-1;let u=0;const p=l<s?s:l;let d=0;for(let f=p;f>=0;f--,d++){switch(!0){case d<c.length:u=a[s-d]+c[l-d]+r[0];break;default:u=a[s-d]+r[0]}switch(r[0]=u/10,!0){case d>=a.length:a=Ap(new Uint8Array([u%10]),a);break;default:a[s-d]=u%10}}return r[0]>0&&(a=Ap(r,a)),a}function Ak(n){if(n>=is.length)for(let t=is.length;t<=n;t++){const r=new Uint8Array([0]);let o=is[t-1].slice(0);for(let i=o.length-1;i>=0;i--){const a=new Uint8Array([(o[i]<<1)+r[0]]);r[0]=a[0]/10,o[i]=a[0]%10}r[0]>0&&(o=Ap(r,o)),is.push(o)}return is[n]}function p8(n,t){let r=0;const o=new Uint8Array(n),i=new Uint8Array(t),a=o.slice(0),s=a.length-1,c=i.slice(0),l=c.length-1;let u,p=0;for(let d=l;d>=0;d--,p++)switch(u=a[s-p]-c[l-p]-r,!0){case u<0:r=1,a[s-p]=u+10;break;default:r=0,a[s-p]=u}if(r>0)for(let d=s-l+1;d>=0;d--,p++)if(u=a[s-p]-r,u<0)r=1,a[s-p]=u+10;else{r=0,a[s-p]=u;break}return a.slice()}class Vp extends _r(an){setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=ok.call(this)))}constructor({value:t,...r}={}){super(r),this._valueDec=0,r.valueHex&&this.setValueHex(),t!==void 0&&(this.valueDec=t)}set valueDec(t){this._valueDec=t,this.isHexOnly=!1,this.valueHexView=new Uint8Array(WU(t))}get valueDec(){return this._valueDec}fromDER(t,r,o,i=0){const a=this.fromBER(t,r,o);if(a===-1)return a;const s=this.valueHexView;return s[0]===0&&s[1]&128?this.valueHexView=s.subarray(1):i!==0&&s.length<i&&(i-s.length>1&&(i=s.length+1),this.valueHexView=s.subarray(i-s.length)),a}toDER(t=!1){const r=this.valueHexView;switch(!0){case(r[0]&128)!==0:{const o=new Uint8Array(this.valueHexView.length+1);o[0]=0,o.set(r,1),this.valueHexView=o}break;case(r[0]===0&&(r[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(t)}fromBER(t,r,o){const i=super.fromBER(t,r,o);return i===-1||this.setValueHex(),i}toBER(t){return t?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const t=this.valueHexView.length*8-1;let r=new Uint8Array(this.valueHexView.length*8/3),o=0,i;const a=this.valueHexView;let s="",c=!1;for(let l=a.byteLength-1;l>=0;l--){i=a[l];for(let u=0;u<8;u++){if((i&1)===1)switch(o){case t:r=p8(Ak(o),r),s="-";break;default:r=f8(r,Ak(o))}o++,i>>=1}}for(let l=0;l<r.length;l++)r[l]&&(c=!0),c&&(s+=ik.charAt(r[l]));return c===!1&&(s+=ik.charAt(0)),s}}xk=Vp,Vp.NAME="IntegerValueBlock",Object.defineProperty(xk.prototype,"valueHex",{set:function(n){this.valueHexView=new Uint8Array(n),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});var cs;class ji extends Qt{constructor(t={}){super(t,Vp),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return Nc(),BigInt(this.valueBlock.toString())}static fromBigInt(t){Nc();const r=BigInt(t),o=new Sc,i=r.toString(16).replace(/^-/,""),a=new Uint8Array(Je.FromHex(i));if(r<0){const c=new Uint8Array(a.length+(a[0]&128?1:0));c[0]|=128;const u=BigInt(`0x${Je.ToHex(c)}`)+r,p=Ke.toUint8Array(Je.FromHex(u.toString(16)));p[0]|=128,o.write(p)}else a[0]&128&&o.write(new Uint8Array([0])),o.write(a);return new cs({valueHex:o.final()})}convertToDER(){const t=new cs({valueHex:this.valueBlock.valueHexView});return t.valueBlock.toDER(),t}convertFromDER(){return new cs({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}cs=ji,He.Integer=cs,ji.NAME="INTEGER";var vk;class Ic extends ji{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}vk=Ic,He.Enumerated=vk,Ic.NAME="ENUMERATED";class $p extends _r(an){constructor({valueDec:t=-1,isFirstSid:r=!1,...o}={}){super(o),this.valueDec=t,this.isFirstSid=r}fromBER(t,r,o){if(!o)return r;const i=Ke.toUint8Array(t);if(!Lr(this,i,r,o))return-1;const a=i.subarray(r,r+o);this.valueHexView=new Uint8Array(o);for(let c=0;c<o&&(this.valueHexView[c]=a[c]&127,this.blockLength++,!!(a[c]&128));c++);const s=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength;c++)s[c]=this.valueHexView[c];return this.valueHexView=s,a[this.blockLength-1]&128?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Di(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),r+this.blockLength)}set valueBigInt(t){Nc();let r=BigInt(t).toString(2);for(;r.length%7;)r="0"+r;const o=new Uint8Array(r.length/7);for(let i=0;i<o.length;i++)o[i]=parseInt(r.slice(i*7,i*7+7),2)+(i+1<o.length?128:0);this.fromBER(o.buffer,0,o.length)}toBER(t){if(this.isHexOnly){if(t)return new ArrayBuffer(this.valueHexView.byteLength);const i=this.valueHexView,a=new Uint8Array(this.blockLength);for(let s=0;s<this.blockLength-1;s++)a[s]=i[s]|128;return a[this.blockLength-1]=i[this.blockLength-1],a.buffer}const r=Oo(this.valueDec,7);if(r.byteLength===0)return this.error="Error during encoding SID value",yr;const o=new Uint8Array(r.byteLength);if(!t){const i=new Uint8Array(r),a=r.byteLength-1;for(let s=0;s<a;s++)o[s]=i[s]|128;o[a]=i[a]}return o}toString(){let t="";if(this.isHexOnly)t=Je.ToHex(this.valueHexView);else if(this.isFirstSid){let r=this.valueDec;this.valueDec<=39?t="0.":this.valueDec<=79?(t="1.",r-=40):(t="2.",r-=80),t+=r.toString()}else t=this.valueDec.toString();return t}toJSON(){return{...super.toJSON(),valueDec:this.valueDec,isFirstSid:this.isFirstSid}}}$p.NAME="sidBlock";class Ik extends an{constructor({value:t=wn,...r}={}){super(r),this.value=[],t&&this.fromString(t)}fromBER(t,r,o){let i=r;for(;o>0;){const a=new $p;if(i=a.fromBER(t,i,o),i===-1)return this.blockLength=0,this.error=a.error,i;this.value.length===0&&(a.isFirstSid=!0),this.blockLength+=a.blockLength,o-=a.blockLength,this.value.push(a)}return i}toBER(t){const r=[];for(let o=0;o<this.value.length;o++){const i=this.value[o].toBER(t);if(i.byteLength===0)return this.error=this.value[o].error,yr;r.push(i)}return vp(r)}fromString(t){this.value=[];let r=0,o=0,i="",a=!1;do if(o=t.indexOf(".",r),o===-1?i=t.substring(r):i=t.substring(r,o),r=o+1,a){const s=this.value[0];let c=0;switch(s.valueDec){case 0:break;case 1:c=40;break;case 2:c=80;break;default:this.value=[];return}const l=parseInt(i,10);if(isNaN(l))return;s.valueDec=l+c,a=!1}else{const s=new $p;if(i>Number.MAX_SAFE_INTEGER){Nc();const c=BigInt(i);s.valueBigInt=c}else if(s.valueDec=parseInt(i,10),isNaN(s.valueDec))return;this.value.length||(s.isFirstSid=!0,a=!0),this.value.push(s)}while(o!==-1)}toString(){let t="",r=!1;for(let o=0;o<this.value.length;o++){r=this.value[o].isHexOnly;let i=this.value[o].toString();o!==0&&(t=`${t}.`),r?(i=`{${i}}`,this.value[o].isFirstSid?t=`2.{${i} - 80}`:t+=i):t+=i}return t}toJSON(){const t={...super.toJSON(),value:this.toString(),sidArray:[]};for(let r=0;r<this.value.length;r++)t.sidArray.push(this.value[r].toJSON());return t}}Ik.NAME="ObjectIdentifierValueBlock";var Bk;class Bc extends Qt{getValue(){return this.valueBlock.toString()}setValue(t){this.valueBlock.fromString(t)}constructor(t={}){super(t,Ik),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}Bk=Bc,He.ObjectIdentifier=Bk,Bc.NAME="OBJECT IDENTIFIER";class Rp extends _r(Po){constructor({valueDec:t=0,...r}={}){super(r),this.valueDec=t}fromBER(t,r,o){if(o===0)return r;const i=Ke.toUint8Array(t);if(!Lr(this,i,r,o))return-1;const a=i.subarray(r,r+o);this.valueHexView=new Uint8Array(o);for(let c=0;c<o&&(this.valueHexView[c]=a[c]&127,this.blockLength++,!!(a[c]&128));c++);const s=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength;c++)s[c]=this.valueHexView[c];return this.valueHexView=s,a[this.blockLength-1]&128?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Di(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),r+this.blockLength)}toBER(t){if(this.isHexOnly){if(t)return new ArrayBuffer(this.valueHexView.byteLength);const i=this.valueHexView,a=new Uint8Array(this.blockLength);for(let s=0;s<this.blockLength-1;s++)a[s]=i[s]|128;return a[this.blockLength-1]=i[this.blockLength-1],a.buffer}const r=Oo(this.valueDec,7);if(r.byteLength===0)return this.error="Error during encoding SID value",yr;const o=new Uint8Array(r.byteLength);if(!t){const i=new Uint8Array(r),a=r.byteLength-1;for(let s=0;s<a;s++)o[s]=i[s]|128;o[a]=i[a]}return o.buffer}toString(){let t="";return this.isHexOnly?t=Je.ToHex(this.valueHexView):t=this.valueDec.toString(),t}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}}Rp.NAME="relativeSidBlock";class Tk extends an{constructor({value:t=wn,...r}={}){super(r),this.value=[],t&&this.fromString(t)}fromBER(t,r,o){let i=r;for(;o>0;){const a=new Rp;if(i=a.fromBER(t,i,o),i===-1)return this.blockLength=0,this.error=a.error,i;this.blockLength+=a.blockLength,o-=a.blockLength,this.value.push(a)}return i}toBER(t,r){const o=[];for(let i=0;i<this.value.length;i++){const a=this.value[i].toBER(t);if(a.byteLength===0)return this.error=this.value[i].error,yr;o.push(a)}return vp(o)}fromString(t){this.value=[];let r=0,o=0,i="";do{o=t.indexOf(".",r),o===-1?i=t.substring(r):i=t.substring(r,o),r=o+1;const a=new Rp;if(a.valueDec=parseInt(i,10),isNaN(a.valueDec))return!0;this.value.push(a)}while(o!==-1);return!0}toString(){let t="",r=!1;for(let o=0;o<this.value.length;o++){r=this.value[o].isHexOnly;let i=this.value[o].toString();o!==0&&(t=`${t}.`),r&&(i=`{${i}}`),t+=i}return t}toJSON(){const t={...super.toJSON(),value:this.toString(),sidArray:[]};for(let r=0;r<this.value.length;r++)t.sidArray.push(this.value[r].toJSON());return t}}Tk.NAME="RelativeObjectIdentifierValueBlock";var Ok;class Lp extends Qt{getValue(){return this.valueBlock.toString()}setValue(t){this.valueBlock.fromString(t)}constructor(t={}){super(t,Tk),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}Ok=Lp,He.RelativeObjectIdentifier=Ok,Lp.NAME="RelativeObjectIdentifier";var Pk;class nr extends fn{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}Pk=nr,He.Sequence=Pk,nr.NAME="SEQUENCE";var Vk;let br=class extends fn{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};Vk=br,He.Set=Vk,br.NAME="SET";class $k extends _r(an){constructor({...t}={}){super(t),this.isHexOnly=!0,this.value=wn}toJSON(){return{...super.toJSON(),value:this.value}}}$k.NAME="StringValueBlock";class Rk extends $k{}Rk.NAME="SimpleStringValueBlock";class Tn extends Bp{constructor({...t}={}){super(t,Rk)}fromBuffer(t){this.valueBlock.value=String.fromCharCode.apply(null,Ke.toUint8Array(t))}fromString(t){const r=t.length,o=this.valueBlock.valueHexView=new Uint8Array(r);for(let i=0;i<r;i++)o[i]=t.charCodeAt(i);this.valueBlock.value=t}}Tn.NAME="SIMPLE STRING";class Lk extends Tn{fromBuffer(t){this.valueBlock.valueHexView=Ke.toUint8Array(t);try{this.valueBlock.value=Je.ToUtf8String(t)}catch(r){this.warnings.push(`Error during "decodeURIComponent": ${r}, using raw string`),this.valueBlock.value=Je.ToBinary(t)}}fromString(t){this.valueBlock.valueHexView=new Uint8Array(Je.FromUtf8String(t)),this.valueBlock.value=t}}Lk.NAME="Utf8StringValueBlock";var Dk;class Dr extends Lk{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}Dk=Dr,He.Utf8String=Dk,Dr.NAME="UTF8String";class Mk extends Tn{fromBuffer(t){this.valueBlock.value=Je.ToUtf16String(t),this.valueBlock.valueHexView=Ke.toUint8Array(t)}fromString(t){this.valueBlock.value=t,this.valueBlock.valueHexView=new Uint8Array(Je.FromUtf16String(t))}}Mk.NAME="BmpStringValueBlock";var jk;class Tc extends Mk{constructor({...t}={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}jk=Tc,He.BmpString=jk,Tc.NAME="BMPString";class Fk extends Tn{fromBuffer(t){const r=ArrayBuffer.isView(t)?t.slice().buffer:t.slice(0),o=new Uint8Array(r);for(let i=0;i<o.length;i+=4)o[i]=o[i+3],o[i+1]=o[i+2],o[i+2]=0,o[i+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(r))}fromString(t){const r=t.length,o=this.valueBlock.valueHexView=new Uint8Array(r*4);for(let i=0;i<r;i++){const a=Oo(t.charCodeAt(i),8),s=new Uint8Array(a);if(s.length>4)continue;const c=4-s.length;for(let l=s.length-1;l>=0;l--)o[i*4+l+c]=s[l]}this.valueBlock.value=t}}Fk.NAME="UniversalStringValueBlock";var Uk;class Oc extends Fk{constructor({...t}={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}Uk=Oc,He.UniversalString=Uk,Oc.NAME="UniversalString";var Kk;class Pc extends Tn{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}Kk=Pc,He.NumericString=Kk,Pc.NAME="NumericString";var qk;class Vc extends Tn{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}qk=Vc,He.PrintableString=qk,Vc.NAME="PrintableString";var Gk;class $c extends Tn{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}Gk=$c,He.TeletexString=Gk,$c.NAME="TeletexString";var Hk;class Rc extends Tn{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}Hk=Rc,He.VideotexString=Hk,Rc.NAME="VideotexString";var zk;class Lc extends Tn{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}zk=Lc,He.IA5String=zk,Lc.NAME="IA5String";var Wk;class Dc extends Tn{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}Wk=Dc,He.GraphicString=Wk,Dc.NAME="GraphicString";var Yk;class us extends Tn{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}Yk=us,He.VisibleString=Yk,us.NAME="VisibleString";var Jk;class Mc extends Tn{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}Jk=Mc,He.GeneralString=Jk,Mc.NAME="GeneralString";var Xk;class jc extends Tn{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}Xk=jc,He.CharacterString=Xk,jc.NAME="CharacterString";var Zk;class ds extends us{constructor({value:t,valueDate:r,...o}={}){if(super(o),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,t){this.fromString(t),this.valueBlock.valueHexView=new Uint8Array(t.length);for(let i=0;i<t.length;i++)this.valueBlock.valueHexView[i]=t.charCodeAt(i)}r&&(this.fromDate(r),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(t){this.fromString(String.fromCharCode.apply(null,Ke.toUint8Array(t)))}toBuffer(){const t=this.toString(),r=new ArrayBuffer(t.length),o=new Uint8Array(r);for(let i=0;i<t.length;i++)o[i]=t.charCodeAt(i);return r}fromDate(t){this.year=t.getUTCFullYear(),this.month=t.getUTCMonth()+1,this.day=t.getUTCDate(),this.hour=t.getUTCHours(),this.minute=t.getUTCMinutes(),this.second=t.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(t){const o=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig.exec(t);if(o===null){this.error="Wrong input string for conversion";return}const i=parseInt(o[1],10);i>=50?this.year=1900+i:this.year=2e3+i,this.month=parseInt(o[2],10),this.day=parseInt(o[3],10),this.hour=parseInt(o[4],10),this.minute=parseInt(o[5],10),this.second=parseInt(o[6],10)}toString(t="iso"){if(t==="iso"){const r=new Array(7);return r[0]=Bn(this.year<2e3?this.year-1900:this.year-2e3,2),r[1]=Bn(this.month,2),r[2]=Bn(this.day,2),r[3]=Bn(this.hour,2),r[4]=Bn(this.minute,2),r[5]=Bn(this.second,2),r[6]="Z",r.join("")}return super.toString(t)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return{...super.toJSON(),year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second}}}Zk=ds,He.UTCTime=Zk,ds.NAME="UTCTime";var Qk;class Fc extends ds{constructor(t={}){var r;super(t),(r=this.millisecond)!==null&&r!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(t){super.fromDate(t),this.millisecond=t.getUTCMilliseconds()}toDate(){const t=Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond);return new Date(t)}fromString(t){let r=!1,o="",i="",a=0,s,c=0,l=0;if(t[t.length-1]==="Z")o=t.substring(0,t.length-1),r=!0;else{const d=new Number(t[t.length-1]);if(isNaN(d.valueOf()))throw new Error("Wrong input string for conversion");o=t}if(r){if(o.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(o.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let d=1,f=o.indexOf("+"),m="";if(f===-1&&(f=o.indexOf("-"),d=-1),f!==-1){if(m=o.substring(f+1),o=o.substring(0,f),m.length!==2&&m.length!==4)throw new Error("Wrong input string for conversion");let h=parseInt(m.substring(0,2),10);if(isNaN(h.valueOf()))throw new Error("Wrong input string for conversion");if(c=d*h,m.length===4){if(h=parseInt(m.substring(2,4),10),isNaN(h.valueOf()))throw new Error("Wrong input string for conversion");l=d*h}}}let u=o.indexOf(".");if(u===-1&&(u=o.indexOf(",")),u!==-1){const d=new Number(`0${o.substring(u)}`);if(isNaN(d.valueOf()))throw new Error("Wrong input string for conversion");a=d.valueOf(),i=o.substring(0,u)}else i=o;switch(!0){case i.length===8:if(s=/(\d{4})(\d{2})(\d{2})/ig,u!==-1)throw new Error("Wrong input string for conversion");break;case i.length===10:if(s=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,u!==-1){let d=60*a;this.minute=Math.floor(d),d=60*(d-this.minute),this.second=Math.floor(d),d=1e3*(d-this.second),this.millisecond=Math.floor(d)}break;case i.length===12:if(s=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,u!==-1){let d=60*a;this.second=Math.floor(d),d=1e3*(d-this.second),this.millisecond=Math.floor(d)}break;case i.length===14:if(s=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,u!==-1){const d=1e3*a;this.millisecond=Math.floor(d)}break;default:throw new Error("Wrong input string for conversion")}const p=s.exec(i);if(p===null)throw new Error("Wrong input string for conversion");for(let d=1;d<p.length;d++)switch(d){case 1:this.year=parseInt(p[d],10);break;case 2:this.month=parseInt(p[d],10);break;case 3:this.day=parseInt(p[d],10);break;case 4:this.hour=parseInt(p[d],10)+c;break;case 5:this.minute=parseInt(p[d],10)+l;break;case 6:this.second=parseInt(p[d],10);break;default:throw new Error("Wrong input string for conversion")}if(r===!1){const d=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=d.getUTCFullYear(),this.month=d.getUTCMonth(),this.day=d.getUTCDay(),this.hour=d.getUTCHours(),this.minute=d.getUTCMinutes(),this.second=d.getUTCSeconds(),this.millisecond=d.getUTCMilliseconds()}}toString(t="iso"){if(t==="iso"){const r=[];return r.push(Bn(this.year,4)),r.push(Bn(this.month,2)),r.push(Bn(this.day,2)),r.push(Bn(this.hour,2)),r.push(Bn(this.minute,2)),r.push(Bn(this.second,2)),this.millisecond!==0&&(r.push("."),r.push(Bn(this.millisecond,3))),r.push("Z"),r.join("")}return super.toString(t)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}}Qk=Fc,He.GeneralizedTime=Qk,Fc.NAME="GeneralizedTime";var e0;class Dp extends Dr{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}e0=Dp,He.DATE=e0,Dp.NAME="DATE";var t0;class Mp extends Dr{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}t0=Mp,He.TimeOfDay=t0,Mp.NAME="TimeOfDay";var n0;class jp extends Dr{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}n0=jp,He.DateTime=n0,jp.NAME="DateTime";var r0;class Fp extends Dr{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}}r0=Fp,He.Duration=r0,Fp.NAME="Duration";var o0;class Up extends Dr{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}o0=Up,He.TIME=o0,Up.NAME="TIME";class Lo{constructor({name:t=wn,optional:r=!1}={}){this.name=t,this.optional=r}}class Kp extends Lo{constructor({value:t=[],...r}={}){super(r),this.value=t}}class Uc extends Lo{constructor({value:t=new Lo,local:r=!1,...o}={}){super(o),this.value=t,this.local=r}}class m8{get data(){return this.dataView.slice().buffer}set data(t){this.dataView=Ke.toUint8Array(t)}constructor({data:t=xc}={}){this.dataView=Ke.toUint8Array(t)}fromBER(t,r,o){const i=r+o;return this.dataView=Ke.toUint8Array(t).subarray(r,i),i}toBER(t){return this.dataView.slice().buffer}}function oo(n,t,r){if(r instanceof Kp){for(const a of r.value)if(oo(n,t,a).verified)return{verified:!0,result:n};{const a={verified:!1,result:{error:"Wrong values for Choice type"}};return r.hasOwnProperty(Ip)&&(a.name=r.name),a}}if(r instanceof Lo)return r.hasOwnProperty(Ip)&&(n[r.name]=t),{verified:!0,result:n};if(!(n instanceof Object))return{verified:!1,result:{error:"Wrong root object"}};if(!(t instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 data"}};if(!(r instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(XU in r))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(t8 in r.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(n8 in r.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const o=r.idBlock.toBER(!1);if(o.byteLength===0)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(r.idBlock.fromBER(o,0,o.byteLength)===-1)return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(r.idBlock.hasOwnProperty(ZU)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(r.idBlock.tagClass!==t.idBlock.tagClass)return{verified:!1,result:n};if(r.idBlock.hasOwnProperty(QU)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(r.idBlock.tagNumber!==t.idBlock.tagNumber)return{verified:!1,result:n};if(r.idBlock.hasOwnProperty(e8)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(r.idBlock.isConstructed!==t.idBlock.isConstructed)return{verified:!1,result:n};if(!(JU in r.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(r.idBlock.isHexOnly!==t.idBlock.isHexOnly)return{verified:!1,result:n};if(r.idBlock.isHexOnly){if(!(ak in r.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const a=r.idBlock.valueHexView,s=t.idBlock.valueHexView;if(a.length!==s.length)return{verified:!1,result:n};for(let c=0;c<a.length;c++)if(a[c]!==s[1])return{verified:!1,result:n}}if(r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,wn),r.name&&(n[r.name]=t)),r instanceof He.Constructed){let a=0,s={verified:!1,result:{error:"Unknown error"}},c=r.valueBlock.value.length;if(c>0&&r.valueBlock.value[0]instanceof Uc&&(c=t.valueBlock.value.length),c===0)return{verified:!0,result:n};if(t.valueBlock.value.length===0&&r.valueBlock.value.length!==0){let l=!0;for(let u=0;u<r.valueBlock.value.length;u++)l=l&&(r.valueBlock.value[u].optional||!1);return l?{verified:!0,result:n}:(r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,wn),r.name&&delete n[r.name]),n.error="Inconsistent object length",{verified:!1,result:n})}for(let l=0;l<c;l++)if(l-a>=t.valueBlock.value.length){if(r.valueBlock.value[l].optional===!1){const u={verified:!1,result:n};return n.error="Inconsistent length between ASN.1 data and schema",r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,wn),r.name&&(delete n[r.name],u.name=r.name)),u}}else if(r.valueBlock.value[0]instanceof Uc){if(s=oo(n,t.valueBlock.value[l],r.valueBlock.value[0].value),s.verified===!1)if(r.valueBlock.value[0].optional)a++;else return r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,wn),r.name&&delete n[r.name]),s;if(Ip in r.valueBlock.value[0]&&r.valueBlock.value[0].name.length>0){let u={};r8 in r.valueBlock.value[0]&&r.valueBlock.value[0].local?u=t:u=n,typeof u[r.valueBlock.value[0].name]>"u"&&(u[r.valueBlock.value[0].name]=[]),u[r.valueBlock.value[0].name].push(t.valueBlock.value[l])}}else if(s=oo(n,t.valueBlock.value[l-a],r.valueBlock.value[l]),s.verified===!1)if(r.valueBlock.value[l].optional)a++;else return r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,wn),r.name&&delete n[r.name]),s;if(s.verified===!1){const l={verified:!1,result:n};return r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,wn),r.name&&(delete n[r.name],l.name=r.name)),l}return{verified:!0,result:n}}if(r.primitiveSchema&&ak in t.valueBlock){const a=Ac(t.valueBlock.valueHexView);if(a.offset===-1){const s={verified:!1,result:a.result};return r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,wn),r.name&&(delete n[r.name],s.name=r.name)),s}return oo(n,a.result,r.primitiveSchema)}return{verified:!0,result:n}}function g8(n,t){if(!(t instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};const r=Ac(Ke.toUint8Array(n));return r.offset===-1?{verified:!1,result:r.result}:oo(r.result,r.result,t)}const i0=Object.freeze(Object.defineProperty({__proto__:null,Any:Lo,BaseBlock:Qt,BaseStringBlock:Bp,BitString:Ro,BmpString:Tc,Boolean:vc,CharacterString:jc,Choice:Kp,Constructed:fn,DATE:Dp,DEFAULT_MAX_CONTENT_LENGTH:hk,DEFAULT_MAX_DEPTH:mk,DEFAULT_MAX_NODES:gk,DateTime:jp,Duration:Fp,EndOfContent:Op,Enumerated:Ic,GeneralString:Mc,GeneralizedTime:Fc,GraphicString:Dc,HexBlock:_r,IA5String:Lc,Integer:ji,Null:Vo,NumericString:Pc,ObjectIdentifier:Bc,OctetString:$o,Primitive:ss,PrintableString:Vc,RawData:m8,RelativeObjectIdentifier:Lp,Repeated:Uc,Sequence:nr,Set:br,TIME:Up,TeletexString:$c,TimeOfDay:Mp,UTCTime:ds,UniversalString:Oc,Utf8String:Dr,ValueBlock:an,VideotexString:Rc,ViewWriter:Sc,VisibleString:us,compareSchema:oo,fromBER:Mi,verifySchema:g8},Symbol.toStringTag,{value:"Module"})),h8="[object ArrayBuffer]",y8="[object SharedArrayBuffer]";function a0(n){return Object.prototype.toString.call(n)}function _8(n){if(ArrayBuffer.isView(n))return!0;if(!n||typeof n!="object")return!1;const t=n;return typeof t.byteOffset=="number"&&typeof t.byteLength=="number"&&qp(t.buffer)}function s0(n){return a0(n)===h8}function b8(n){return typeof SharedArrayBuffer<"u"&&a0(n)===y8}function qp(n){return s0(n)||b8(n)}function w8(n){return _8(n)}function Kc(n){return qp(n)||w8(n)}function l0(n){if(!Kc(n))throw new TypeError("Expected ArrayBuffer, SharedArrayBuffer, or ArrayBufferView")}function qc(n){return l0(n),qp(n)?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}function rr(n){if(l0(n),s0(n))return n;const t=new ArrayBuffer(n.byteLength);return new Uint8Array(t).set(qc(n)),t}function k8(n,t,r={}){const o=qc(n),i=qc(t);if(!r.constantTime&&o.byteLength!==i.byteLength)return!1;const a=Math.max(o.byteLength,i.byteLength);let s=o.byteLength^i.byteLength;for(let c=0;c<a;c++)s|=(o[c]??0)^(i[c]??0);return s===0}var Pe;(function(n){n[n.Sequence=0]="Sequence",n[n.Set=1]="Set",n[n.Choice=2]="Choice"})(Pe||(Pe={}));var me;(function(n){n[n.Any=1]="Any",n[n.Boolean=2]="Boolean",n[n.OctetString=3]="OctetString",n[n.BitString=4]="BitString",n[n.Integer=5]="Integer",n[n.Enumerated=6]="Enumerated",n[n.ObjectIdentifier=7]="ObjectIdentifier",n[n.Utf8String=8]="Utf8String",n[n.BmpString=9]="BmpString",n[n.UniversalString=10]="UniversalString",n[n.NumericString=11]="NumericString",n[n.PrintableString=12]="PrintableString",n[n.TeletexString=13]="TeletexString",n[n.VideotexString=14]="VideotexString",n[n.IA5String=15]="IA5String",n[n.GraphicString=16]="GraphicString",n[n.VisibleString=17]="VisibleString",n[n.GeneralString=18]="GeneralString",n[n.CharacterString=19]="CharacterString",n[n.UTCTime=20]="UTCTime",n[n.GeneralizedTime=21]="GeneralizedTime",n[n.DATE=22]="DATE",n[n.TimeOfDay=23]="TimeOfDay",n[n.DateTime=24]="DateTime",n[n.Duration=25]="Duration",n[n.TIME=26]="TIME",n[n.Null=27]="Null"})(me||(me={}));class Gc{constructor(t,r=0){K(this,"unusedBits",0);K(this,"value",new ArrayBuffer(0));if(t)if(typeof t=="number")this.fromNumber(t);else if(Kc(t))this.unusedBits=r,this.value=rr(t);else throw TypeError("Unsupported type of 'params' argument for BitString")}fromASN(t){if(!(t instanceof Ro))throw new TypeError("Argument 'asn' is not instance of ASN.1 BitString");return this.unusedBits=t.valueBlock.unusedBits,this.value=rr(t.valueBlock.valueHex),this}toASN(){return new Ro({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(t){return new Ro({name:t})}toNumber(){let t="";const r=new Uint8Array(this.value);for(const o of r)t+=o.toString(2).padStart(8,"0");return t=t.split("").reverse().join(""),this.unusedBits&&(t=t.slice(this.unusedBits).padStart(this.unusedBits,"0")),parseInt(t,2)}fromNumber(t){let r=t.toString(2);const o=r.length+7>>3;this.unusedBits=(o<<3)-r.length;const i=new Uint8Array(o);r=r.padStart(o<<3,"0").split("").reverse().join("");let a=0;for(;a<o;)i[a]=parseInt(r.slice(a<<3,(a<<3)+8),2),a++;this.value=i.buffer}}class mt{constructor(t){K(this,"buffer");typeof t=="number"?this.buffer=new ArrayBuffer(t):Kc(t)?this.buffer=rr(t):Array.isArray(t)?this.buffer=new Uint8Array(t).buffer:this.buffer=new ArrayBuffer(0)}get byteLength(){return this.buffer.byteLength}get byteOffset(){return 0}fromASN(t){if(!(t instanceof $o))throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");return this.buffer=rr(t.valueBlock.valueHex),this}toASN(){return new $o({valueHex:this.buffer})}toSchema(t){return new $o({name:t})}}const C8={fromASN:n=>n instanceof Vo?null:rr(n.valueBeforeDecodeView),toASN:n=>{if(n===null)return new Vo;const t=Mi(n);if(t.result.error)throw new Error(t.result.error);return t.result}},E8={fromASN:n=>n.valueBlock.valueHexView.byteLength>=4?n.valueBlock.toString():n.valueBlock.valueDec,toASN:n=>new ji({value:+n})},N8={fromASN:n=>n.valueBlock.valueDec,toASN:n=>new Ic({value:n})},Ot={fromASN:n=>rr(n.valueBlock.valueHexView),toASN:n=>new ji({valueHex:n})},S8={fromASN:n=>rr(n.valueBlock.valueHexView),toASN:n=>new Ro({valueHex:n})},x8={fromASN:n=>n.valueBlock.toString(),toASN:n=>new Bc({value:n})},A8={fromASN:n=>n.valueBlock.value,toASN:n=>new vc({value:n})},Hc={fromASN:n=>rr(n.valueBlock.valueHexView),toASN:n=>new $o({valueHex:n})},v8={fromASN:n=>new mt(n.getValue()),toASN:n=>n.toASN()};function qn(n){return{fromASN:t=>t.valueBlock.value,toASN:t=>new n({value:t})}}const c0=qn(Dr),I8=qn(Tc),B8=qn(Oc),T8=qn(Pc),O8=qn(Vc),P8=qn($c),V8=qn(Rc),$8=qn(Lc),R8=qn(Dc),L8=qn(us),D8=qn(Mc),M8=qn(jc),j8={fromASN:n=>n.toDate(),toASN:n=>new ds({valueDate:n})},F8={fromASN:n=>n.toDate(),toASN:n=>new Fc({valueDate:n})},U8={fromASN:()=>null,toASN:()=>new Vo};function fs(n){switch(n){case me.Any:return C8;case me.BitString:return S8;case me.BmpString:return I8;case me.Boolean:return A8;case me.CharacterString:return M8;case me.Enumerated:return N8;case me.GeneralString:return D8;case me.GeneralizedTime:return F8;case me.GraphicString:return R8;case me.IA5String:return $8;case me.Integer:return E8;case me.Null:return U8;case me.NumericString:return T8;case me.ObjectIdentifier:return x8;case me.OctetString:return Hc;case me.PrintableString:return O8;case me.TeletexString:return P8;case me.UTCTime:return j8;case me.UniversalString:return B8;case me.Utf8String:return c0;case me.VideotexString:return V8;case me.VisibleString:return L8;default:return null}}function Mr(n){return typeof n=="function"&&n.prototype?n.prototype.toASN&&n.prototype.fromASN?!0:Mr(n.prototype):!!(n&&typeof n=="object"&&"toASN"in n&&"fromASN"in n)}function u0(n){var t;if(n){const r=Object.getPrototypeOf(n);return((t=r==null?void 0:r.prototype)==null?void 0:t.constructor)===Array?!0:u0(r)}return!1}function K8(n,t){if(!(n&&t)||n.byteLength!==t.byteLength)return!1;const r=new Uint8Array(n),o=new Uint8Array(t);for(let i=0;i<n.byteLength;i++)if(r[i]!==o[i])return!1;return!0}class q8{constructor(){K(this,"items",new WeakMap)}has(t){return this.items.has(t)}get(t,r=!1){const o=this.items.get(t);if(!o)throw new Error(`Cannot get schema for '${t.prototype.constructor.name}' target`);if(r&&!o.schema)throw new Error(`Schema '${t.prototype.constructor.name}' doesn't contain ASN.1 schema. Call 'AsnSchemaStorage.cache'.`);return o}cache(t){const r=this.get(t);r.schema||(r.schema=this.create(t,!0))}createDefault(t){const r={type:Pe.Sequence,items:{}},o=this.findParentSchema(t);return o&&(Object.assign(r,o),r.items=Object.assign({},r.items,o.items)),r}create(t,r){const o=this.items.get(t)||this.createDefault(t),i=[];for(const a in o.items){const s=o.items[a],c=r?a:"";let l;if(typeof s.type=="number"){const p=me[s.type],d=i0[p];if(!d)throw new Error(`Cannot get ASN1 class by name '${p}'`);l=new d({name:c})}else Mr(s.type)?l=new s.type().toSchema(c):s.optional?this.get(s.type).type===Pe.Choice?l=new Lo({name:c}):(l=this.create(s.type,!1),l.name=c):l=new Lo({name:c});const u=!!s.optional||s.defaultValue!==void 0;if(s.repeated){l.name="";const p=s.repeated==="set"?br:nr;l=new p({name:"",value:[new Uc({name:c,value:l})]})}if(s.context!==null&&s.context!==void 0)if(s.implicit)if(typeof s.type=="number"||Mr(s.type)){const p=s.repeated?fn:ss;i.push(new p({name:c,optional:u,idBlock:{tagClass:3,tagNumber:s.context}}))}else{this.cache(s.type);const p=!!s.repeated;let d=p?l:this.get(s.type,!0).schema;d="valueBlock"in d?d.valueBlock.value:d.value,i.push(new fn({name:p?"":c,optional:u,idBlock:{tagClass:3,tagNumber:s.context},value:d}))}else i.push(new fn({optional:u,idBlock:{tagClass:3,tagNumber:s.context},value:[l]}));else l.optional=u,i.push(l)}switch(o.type){case Pe.Sequence:return new nr({value:i,name:""});case Pe.Set:return new br({value:i,name:""});case Pe.Choice:return new Kp({value:i,name:""});default:throw new Error("Unsupported ASN1 type in use")}}set(t,r){return this.items.set(t,r),this}findParentSchema(t){const r=Object.getPrototypeOf(t);return r?this.items.get(r)||this.findParentSchema(r):null}}const nn=new q8,Le=n=>t=>{let r;nn.has(t)?r=nn.get(t):(r=nn.createDefault(t),nn.set(t,r)),Object.assign(r,n)},H=n=>(t,r)=>{let o;nn.has(t.constructor)?o=nn.get(t.constructor):(o=nn.createDefault(t.constructor),nn.set(t.constructor,o));const i=Object.assign({},n);if(typeof i.type=="number"&&!i.converter){const a=fs(n.type);if(!a)throw new Error(`Cannot get default converter for property '${r}' of ${t.constructor.name}`);i.converter=a}i.raw=n.raw,o.items[r]=i};class ps extends Error{constructor(){super(...arguments);K(this,"schemas",[])}}class G8{static parse(t,r,o){const i=Mi(rr(t),o==null?void 0:o.berOptions);if(i.result.error)throw new Error(i.result.error);return this.fromASN(i.result,r,o)}static fromASN(t,r,o){try{if(Mr(r))return new r().fromASN(t);const i=nn.get(r);nn.cache(r);let a=i.schema;const s=this.handleChoiceTypes(t,i,r,a,o);if(s!=null&&s.result)return s.result;s!=null&&s.targetSchema&&(a=s.targetSchema);const c=this.handleSequenceTypes(t,i,r,a),l=new r;return u0(r)?this.handleArrayTypes(t,i,r,o):(this.processSchemaItems(i,c,l,o),l)}catch(i){throw i instanceof ps&&i.schemas.push(r.name),i}}static handleChoiceTypes(t,r,o,i,a){if(t.constructor===fn&&r.type===Pe.Choice&&t.idBlock.tagClass===3)for(const s in r.items){const c=r.items[s];if(c.context===t.idBlock.tagNumber&&c.implicit&&typeof c.type=="function"&&nn.has(c.type)){const l=nn.get(c.type);if(l&&l.type===Pe.Sequence){const u=new nr;if("value"in t.valueBlock&&Array.isArray(t.valueBlock.value)&&"value"in u.valueBlock){u.valueBlock.value=t.valueBlock.value;const p=this.fromASN(u,c.type,a),d=new o;return d[s]=p,{result:d}}}}}else if(t.constructor===fn&&r.type!==Pe.Choice){const s=new fn({idBlock:{tagClass:3,tagNumber:t.idBlock.tagNumber},value:r.schema.valueBlock.value});for(const c in r.items)delete t[c];return{targetSchema:s}}return null}static handleSequenceTypes(t,r,o,i){if(r.type===Pe.Sequence){const a=oo({},t,i);if(!a.verified)throw new ps(`Data does not match to ${o.name} ASN1 schema.${a.result.error?` ${a.result.error}`:""}`);return a}else{const a=oo({},t,i);if(!a.verified)throw new ps(`Data does not match to ${o.name} ASN1 schema.${a.result.error?` ${a.result.error}`:""}`);return a}}static processRepeatedField(t,r,o){let i=t.slice(r);if(i.length===1&&i[0].constructor.name==="Sequence"){const a=i[0];a.valueBlock&&a.valueBlock.value&&Array.isArray(a.valueBlock.value)&&(i=a.valueBlock.value)}if(typeof o.type=="number"){const a=fs(o.type);if(!a)throw new Error(`No converter for ASN.1 type ${o.type}`);return i.filter(s=>s&&s.valueBlock).map(s=>{try{return a.fromASN(s)}catch{return}}).filter(s=>s!==void 0)}else return i.filter(a=>a&&a.valueBlock).map(a=>{try{return this.fromASN(a,o.type)}catch{return}}).filter(a=>a!==void 0)}static processPrimitiveField(t,r){const o=fs(r.type);if(!o)throw new Error(`No converter for ASN.1 type ${r.type}`);return o.fromASN(t)}static isOptionalChoiceField(t){return t.optional&&typeof t.type=="function"&&nn.has(t.type)&&nn.get(t.type).type===Pe.Choice}static processOptionalChoiceField(t,r){try{return{processed:!0,value:this.fromASN(t,r.type)}}catch(o){if(o instanceof ps&&/Wrong values for Choice type/.test(o.message))return{processed:!1};throw o}}static handleArrayTypes(t,r,o,i){if(!("value"in t.valueBlock&&Array.isArray(t.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const a=r.itemType;if(typeof a=="number"){const s=fs(a);if(!s)throw new Error(`Cannot get default converter for array item of ${o.name} ASN1 schema`);return o.from(t.valueBlock.value,c=>s.fromASN(c))}else return o.from(t.valueBlock.value,s=>this.fromASN(s,a,i))}static processSchemaItems(t,r,o,i){for(const a in t.items){const s=r.result[a];if(!s)continue;const c=t.items[a],l=c.type;let u;typeof l=="number"||Mr(l)?u=this.processPrimitiveSchemaItem(s,c,l,i):u=this.processComplexSchemaItem(s,c,l,i),u&&typeof u=="object"&&"value"in u&&"raw"in u?(o[a]=u.value,o[`${a}Raw`]=u.raw):o[a]=u}}static processPrimitiveSchemaItem(t,r,o,i){const a=r.converter??(Mr(o)?new o:null);if(!a)throw new Error("Converter is empty");return r.repeated?this.processRepeatedPrimitiveItem(t,r,a,i):this.processSinglePrimitiveItem(t,r,o,a,i)}static processRepeatedPrimitiveItem(t,r,o,i){if(r.implicit){const a=r.repeated==="sequence"?nr:br,s=new a;s.valueBlock=t.valueBlock;const c=Mi(s.toBER(!1),i==null?void 0:i.berOptions);if(c.offset===-1)throw new Error(`Cannot parse the child item. ${c.result.error}`);if(!("value"in c.result.valueBlock&&Array.isArray(c.result.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const l=c.result.valueBlock.value;return Array.from(l,u=>o.fromASN(u))}else return Array.from(t,a=>o.fromASN(a))}static processSinglePrimitiveItem(t,r,o,i,a){let s=t;if(r.implicit){let c;if(Mr(o))c=new o().toSchema("");else{const l=me[o],u=i0[l];if(!u)throw new Error(`Cannot get '${l}' class from asn1js module`);c=new u}c.valueBlock=s.valueBlock,s=Mi(c.toBER(!1),a==null?void 0:a.berOptions).result}return i.fromASN(s)}static processComplexSchemaItem(t,r,o,i){if(r.repeated){if(!Array.isArray(t))throw new Error("Cannot get list of items from the ASN.1 parsed value. ASN.1 value should be iterable.");return Array.from(t,a=>this.fromASN(a,o,i))}else{const a=this.handleImplicitTagging(t,r,o);if(this.isOptionalChoiceField(r))try{return this.fromASN(a,o,i)}catch(s){if(s instanceof ps&&/Wrong values for Choice type/.test(s.message))return;throw s}else{const s=this.fromASN(a,o,i);return r.raw?{value:s,raw:t.valueBeforeDecodeView}:s}}}static handleImplicitTagging(t,r,o){if(r.implicit&&typeof r.context=="number"){const i=nn.get(o);if(i.type===Pe.Sequence){const a=new nr;if("value"in t.valueBlock&&Array.isArray(t.valueBlock.value)&&"value"in a.valueBlock)return a.valueBlock.value=t.valueBlock.value,a}else if(i.type===Pe.Set){const a=new br;if("value"in t.valueBlock&&Array.isArray(t.valueBlock.value)&&"value"in a.valueBlock)return a.valueBlock.value=t.valueBlock.value,a}}return t}}class Gp{static serialize(t){return t instanceof Qt?t.toBER(!1):this.toASN(t).toBER(!1)}static toASN(t){if(t&&typeof t=="object"&&Mr(t))return t.toASN();if(!(t&&typeof t=="object"))throw new TypeError("Parameter 1 should be type of Object.");const r=t.constructor,o=nn.get(r);nn.cache(r);let i=[];if(o.itemType){if(!Array.isArray(t))throw new TypeError("Parameter 1 should be type of Array.");if(typeof o.itemType=="number"){const s=fs(o.itemType);if(!s)throw new Error(`Cannot get default converter for array item of ${r.name} ASN1 schema`);i=t.map(c=>s.toASN(c))}else i=t.map(s=>this.toAsnItem({type:o.itemType},"[]",r,s))}else for(const s in o.items){const c=o.items[s],l=t[s];if(l===void 0||c.defaultValue===l||typeof c.defaultValue=="object"&&typeof l=="object"&&K8(this.serialize(c.defaultValue),this.serialize(l)))continue;const u=Gp.toAsnItem(c,s,r,l);if(typeof c.context=="number")if(c.implicit)if(!c.repeated&&(typeof c.type=="number"||Mr(c.type))){const p={};p.valueHex=u instanceof Vo?rr(u.valueBeforeDecodeView):u.valueBlock.toBER(),i.push(new ss({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},...p}))}else i.push(new fn({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},value:u.valueBlock.value}));else i.push(new fn({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},value:[u]}));else c.repeated?i=i.concat(u):i.push(u)}let a;switch(o.type){case Pe.Sequence:a=new nr({value:i});break;case Pe.Set:a=new br({value:i});break;case Pe.Choice:if(!i[0])throw new Error(`Schema '${r.name}' has wrong data. Choice cannot be empty.`);a=i[0];break}return a}static toAsnItem(t,r,o,i){let a;if(typeof t.type=="number"){const s=t.converter;if(!s)throw new Error(`Property '${r}' doesn't have converter for type ${me[t.type]} in schema '${o.name}'`);if(t.repeated){if(!Array.isArray(i))throw new TypeError("Parameter 'objProp' should be type of Array.");const c=Array.from(i,u=>s.toASN(u)),l=t.repeated==="sequence"?nr:br;a=new l({value:c})}else a=s.toASN(i)}else if(t.repeated){if(!Array.isArray(i))throw new TypeError("Parameter 'objProp' should be type of Array.");const s=Array.from(i,l=>this.toASN(l)),c=t.repeated==="sequence"?nr:br;a=new c({value:s})}else a=this.toASN(i);return a}}class kt extends Array{constructor(t=[]){if(typeof t=="number")super(t);else{super();for(const r of t)this.push(r)}}}class Ue{static serialize(t){return Gp.serialize(t)}static parse(t,r,o){return G8.parse(t,r,o)}static toString(t,r){const o=Kc(t)?rr(t):Ue.serialize(t),i=Mi(o,r==null?void 0:r.berOptions);if(i.offset===-1)throw new Error(`Cannot decode ASN.1 data. ${i.result.error}`);return i.result.toString()}}function B(n,t,r,o){var i=arguments.length,a=i<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,r):o,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,r,o);else for(var c=n.length-1;c>=0;c--)(s=n[c])&&(a=(i<3?s(a):i>3?s(t,r,a):s(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}function at(n,t,r,o){if(r==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!o:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?o:r==="a"?o.call(n):o?o.value:t.get(n)}function Vt(n,t,r,o,i){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?n!==t||!i:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?i.call(n,r):i?i.value=r:t.set(n,r),r}typeof SuppressedError=="function"&&SuppressedError;function d0(n,t){if(!t)return n.join("");if(!Number.isInteger(t.size)||t.size<1)throw new RangeError("Hex group size must be a positive integer");const r=[];for(let o=0;o<n.length;o+=t.size)r.push(n.slice(o,o+t.size).join(""));return r.join(t.separator)}function f0(n,t={}){const r=qc(n),o=t.case??"lower",i=Array.from(r,s=>{const c=s.toString(16).padStart(2,"0");return o==="upper"?c.toUpperCase():c});let a="";if(t.line){const s=t.line.bytesPerLine;if(!Number.isInteger(s)||s<1)throw new RangeError("Hex bytesPerLine must be a positive integer");const c=t.line.separator??`
520
- `,l=[];for(let u=0;u<i.length;u+=s)l.push(d0(i.slice(u,u+s),t.group));a=l.join(c)}else a=d0(i,t.group);return`${t.prefix??""}${a}`}class p0{static isIPv4(t){return/^(\d{1,3}\.){3}\d{1,3}$/.test(t)}static parseIPv4(t){const r=t.split(".");if(r.length!==4)throw new Error("Invalid IPv4 address");return r.map(o=>{const i=parseInt(o,10);if(isNaN(i)||i<0||i>255)throw new Error("Invalid IPv4 address part");return i})}static parseIPv6(t){const o=this.expandIPv6(t).split(":");if(o.length!==8)throw new Error("Invalid IPv6 address");return o.reduce((i,a)=>{const s=parseInt(a,16);if(isNaN(s)||s<0||s>65535)throw new Error("Invalid IPv6 address part");return i.push(s>>8&255),i.push(s&255),i},[])}static expandIPv6(t){if(!t.includes("::"))return t;const r=t.split("::");if(r.length>2)throw new Error("Invalid IPv6 address");const o=r[0]?r[0].split(":"):[],i=r[1]?r[1].split(":"):[],a=8-(o.length+i.length);if(a<0)throw new Error("Invalid IPv6 address");return[...o,...Array(a).fill("0"),...i].join(":")}static formatIPv6(t){const r=[];for(let o=0;o<16;o+=2)r.push((t[o]<<8|t[o+1]).toString(16));return this.compressIPv6(r.join(":"))}static compressIPv6(t){const r=t.split(":");let o=-1,i=0,a=-1,s=0;for(let c=0;c<r.length;c++)r[c]==="0"?(a===-1&&(a=c),s++):(s>i&&(o=a,i=s),a=-1,s=0);if(s>i&&(o=a,i=s),i>1){const c=r.slice(0,o).join(":"),l=r.slice(o+i).join(":");return`${c}::${l}`}return t}static parseCIDR(t){const[r,o]=t.split("/"),i=parseInt(o,10);if(this.isIPv4(r)){if(i<0||i>32)throw new Error("Invalid IPv4 prefix length");return[this.parseIPv4(r),i]}else{if(i<0||i>128)throw new Error("Invalid IPv6 prefix length");return[this.parseIPv6(r),i]}}static decodeIP(t){if(t.length===64&&parseInt(t,16)===0)return"::/0";if(t.length!==16)return t;const r=parseInt(t.slice(8),16).toString(2).split("").reduce((i,a)=>i+ +a,0);let o=t.slice(0,8).replace(/(.{2})/g,i=>`${parseInt(i,16)}.`);return o=o.slice(0,-1),`${o}/${r}`}static toString(t){const r=new Uint8Array(t);if(r.length===4)return Array.from(r).join(".");if(r.length===16)return this.formatIPv6(r);if(r.length===8||r.length===32){const o=r.length/2,i=r.slice(0,o),a=r.slice(o);if(r.every(l=>l===0))return r.length===8?"0.0.0.0/0":"::/0";const c=a.reduce((l,u)=>l+(u.toString(2).match(/1/g)||[]).length,0);return r.length===8?`${Array.from(i).join(".")}/${c}`:`${this.formatIPv6(i)}/${c}`}return this.decodeIP(f0(t))}static fromString(t){if(t.includes("/")){const[o,i]=this.parseCIDR(t),a=new Uint8Array(o.length);let s=i;for(let l=0;l<a.length;l++)s>=8?(a[l]=255,s-=8):s>0&&(a[l]=255<<8-s,s=0);const c=new Uint8Array(o.length*2);return c.set(o,0),c.set(a,o.length),c.buffer}const r=this.isIPv4(t)?this.parseIPv4(t):this.parseIPv6(t);return new Uint8Array(r).buffer}}var Hp,zp,Wp;let rn=class{constructor(t={}){K(this,"teletexString");K(this,"printableString");K(this,"universalString");K(this,"utf8String");K(this,"bmpString");Object.assign(this,t)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};B([H({type:me.TeletexString})],rn.prototype,"teletexString",void 0),B([H({type:me.PrintableString})],rn.prototype,"printableString",void 0),B([H({type:me.UniversalString})],rn.prototype,"universalString",void 0),B([H({type:me.Utf8String})],rn.prototype,"utf8String",void 0),B([H({type:me.BmpString})],rn.prototype,"bmpString",void 0),rn=B([Le({type:Pe.Choice})],rn);let Fi=class extends rn{constructor(r={}){super(r);K(this,"ia5String");K(this,"anyValue");Object.assign(this,r)}toString(){return this.ia5String||(this.anyValue?f0(this.anyValue):super.toString())}};B([H({type:me.IA5String})],Fi.prototype,"ia5String",void 0),B([H({type:me.Any})],Fi.prototype,"anyValue",void 0),Fi=B([Le({type:Pe.Choice})],Fi);class zc{constructor(t={}){K(this,"type","");K(this,"value",new Fi);Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],zc.prototype,"type",void 0),B([H({type:Fi})],zc.prototype,"value",void 0);let Ui=Hp=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,Hp.prototype)}};Ui=Hp=B([Le({type:Pe.Set,itemType:zc})],Ui);let Yp=zp=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,zp.prototype)}};Yp=zp=B([Le({type:Pe.Sequence,itemType:Ui})],Yp);let Wt=Wp=class extends Yp{constructor(t){super(t),Object.setPrototypeOf(this,Wp.prototype)}};Wt=Wp=B([Le({type:Pe.Sequence})],Wt);const H8={fromASN:n=>p0.toString(Hc.fromASN(n)),toASN:n=>Hc.toASN(p0.fromString(n))};class ms{constructor(t={}){K(this,"typeId","");K(this,"value",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],ms.prototype,"typeId",void 0),B([H({type:me.Any,context:0})],ms.prototype,"value",void 0);class Jp{constructor(t={}){K(this,"nameAssigner");K(this,"partyName",new rn);Object.assign(this,t)}}B([H({type:rn,optional:!0,context:0,implicit:!0})],Jp.prototype,"nameAssigner",void 0),B([H({type:rn,context:1,implicit:!0})],Jp.prototype,"partyName",void 0);let ot=class{constructor(t={}){K(this,"otherName");K(this,"rfc822Name");K(this,"dNSName");K(this,"x400Address");K(this,"directoryName");K(this,"ediPartyName");K(this,"uniformResourceIdentifier");K(this,"iPAddress");K(this,"registeredID");Object.assign(this,t)}};B([H({type:ms,context:0,implicit:!0})],ot.prototype,"otherName",void 0),B([H({type:me.IA5String,context:1,implicit:!0})],ot.prototype,"rfc822Name",void 0),B([H({type:me.IA5String,context:2,implicit:!0})],ot.prototype,"dNSName",void 0),B([H({type:me.Any,context:3,implicit:!0})],ot.prototype,"x400Address",void 0),B([H({type:Wt,context:4,implicit:!1})],ot.prototype,"directoryName",void 0),B([H({type:Jp,context:5})],ot.prototype,"ediPartyName",void 0),B([H({type:me.IA5String,context:6,implicit:!0})],ot.prototype,"uniformResourceIdentifier",void 0),B([H({type:me.OctetString,context:7,implicit:!0,converter:H8})],ot.prototype,"iPAddress",void 0),B([H({type:me.ObjectIdentifier,context:8,implicit:!0})],ot.prototype,"registeredID",void 0),ot=B([Le({type:Pe.Choice})],ot);const Xp="1.3.6.1.5.5.7",z8=`${Xp}.1`,Ki=`${Xp}.3`,Wc=`${Xp}.48`,m0=`${Wc}.1`,g0=`${Wc}.2`,h0=`${Wc}.3`,y0=`${Wc}.5`,jr="2.5.29";var Zp;const Qp=`${z8}.1`;class gs{constructor(t={}){K(this,"accessMethod","");K(this,"accessLocation",new ot);Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],gs.prototype,"accessMethod",void 0),B([H({type:ot})],gs.prototype,"accessLocation",void 0);let qi=Zp=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,Zp.prototype)}};qi=Zp=B([Le({type:Pe.Sequence,itemType:gs})],qi);const em=`${jr}.35`;class tm extends mt{}class Do{constructor(t={}){K(this,"keyIdentifier");K(this,"authorityCertIssuer");K(this,"authorityCertSerialNumber");t&&Object.assign(this,t)}}B([H({type:tm,context:0,optional:!0,implicit:!0})],Do.prototype,"keyIdentifier",void 0),B([H({type:ot,context:1,optional:!0,implicit:!0,repeated:"sequence"})],Do.prototype,"authorityCertIssuer",void 0),B([H({type:me.Integer,context:2,optional:!0,implicit:!0,converter:Ot})],Do.prototype,"authorityCertSerialNumber",void 0);const _0=`${jr}.19`;class Yc{constructor(t={}){K(this,"cA",!1);K(this,"pathLenConstraint");Object.assign(this,t)}}B([H({type:me.Boolean,defaultValue:!1})],Yc.prototype,"cA",void 0),B([H({type:me.Integer,optional:!0})],Yc.prototype,"pathLenConstraint",void 0);var nm;let sn=nm=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,nm.prototype)}};sn=nm=B([Le({type:Pe.Sequence,itemType:ot})],sn);var rm;let b0=rm=class extends sn{constructor(t){super(t),Object.setPrototypeOf(this,rm.prototype)}};b0=rm=B([Le({type:Pe.Sequence})],b0);var om;const w0=`${jr}.32`;let Fr=class{constructor(t={}){K(this,"ia5String");K(this,"visibleString");K(this,"bmpString");K(this,"utf8String");Object.assign(this,t)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String||""}};B([H({type:me.IA5String})],Fr.prototype,"ia5String",void 0),B([H({type:me.VisibleString})],Fr.prototype,"visibleString",void 0),B([H({type:me.BmpString})],Fr.prototype,"bmpString",void 0),B([H({type:me.Utf8String})],Fr.prototype,"utf8String",void 0),Fr=B([Le({type:Pe.Choice})],Fr);class im{constructor(t={}){K(this,"organization",new Fr);K(this,"noticeNumbers",[]);Object.assign(this,t)}}B([H({type:Fr})],im.prototype,"organization",void 0),B([H({type:me.Integer,repeated:"sequence"})],im.prototype,"noticeNumbers",void 0);class am{constructor(t={}){K(this,"noticeRef");K(this,"explicitText");Object.assign(this,t)}}B([H({type:im,optional:!0})],am.prototype,"noticeRef",void 0),B([H({type:Fr,optional:!0})],am.prototype,"explicitText",void 0);let Jc=class{constructor(t={}){K(this,"cPSuri");K(this,"userNotice");Object.assign(this,t)}};B([H({type:me.IA5String})],Jc.prototype,"cPSuri",void 0),B([H({type:am})],Jc.prototype,"userNotice",void 0),Jc=B([Le({type:Pe.Choice})],Jc);class sm{constructor(t={}){K(this,"policyQualifierId","");K(this,"qualifier",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],sm.prototype,"policyQualifierId",void 0),B([H({type:me.Any})],sm.prototype,"qualifier",void 0);class Xc{constructor(t={}){K(this,"policyIdentifier","");K(this,"policyQualifiers");Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],Xc.prototype,"policyIdentifier",void 0),B([H({type:sm,repeated:"sequence",optional:!0})],Xc.prototype,"policyQualifiers",void 0);let Zc=om=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,om.prototype)}};Zc=om=B([Le({type:Pe.Sequence,itemType:Xc})],Zc);let Qc=class{constructor(t=0){K(this,"value");this.value=t}};B([H({type:me.Integer})],Qc.prototype,"value",void 0),Qc=B([Le({type:Pe.Choice})],Qc);let k0=class extends Qc{};k0=B([Le({type:Pe.Choice})],k0);var lm;const cm=`${jr}.31`;var or;(function(n){n[n.unused=1]="unused",n[n.keyCompromise=2]="keyCompromise",n[n.cACompromise=4]="cACompromise",n[n.affiliationChanged=8]="affiliationChanged",n[n.superseded=16]="superseded",n[n.cessationOfOperation=32]="cessationOfOperation",n[n.certificateHold=64]="certificateHold",n[n.privilegeWithdrawn=128]="privilegeWithdrawn",n[n.aACompromise=256]="aACompromise"})(or||(or={}));class C0 extends Gc{toJSON(){const t=[],r=this.toNumber();return r&or.aACompromise&&t.push("aACompromise"),r&or.affiliationChanged&&t.push("affiliationChanged"),r&or.cACompromise&&t.push("cACompromise"),r&or.certificateHold&&t.push("certificateHold"),r&or.cessationOfOperation&&t.push("cessationOfOperation"),r&or.keyCompromise&&t.push("keyCompromise"),r&or.privilegeWithdrawn&&t.push("privilegeWithdrawn"),r&or.superseded&&t.push("superseded"),r&or.unused&&t.push("unused"),t}toString(){return`[${this.toJSON().join(", ")}]`}}let Mo=class{constructor(t={}){K(this,"fullName");K(this,"nameRelativeToCRLIssuer");Object.assign(this,t)}};B([H({type:ot,context:0,repeated:"sequence",implicit:!0})],Mo.prototype,"fullName",void 0),B([H({type:Ui,context:1,implicit:!0})],Mo.prototype,"nameRelativeToCRLIssuer",void 0),Mo=B([Le({type:Pe.Choice})],Mo);class Gi{constructor(t={}){K(this,"distributionPoint");K(this,"reasons");K(this,"cRLIssuer");Object.assign(this,t)}}B([H({type:Mo,context:0,optional:!0})],Gi.prototype,"distributionPoint",void 0),B([H({type:C0,context:1,optional:!0,implicit:!0})],Gi.prototype,"reasons",void 0),B([H({type:ot,context:2,optional:!0,repeated:"sequence",implicit:!0})],Gi.prototype,"cRLIssuer",void 0);let Hi=lm=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,lm.prototype)}};Hi=lm=B([Le({type:Pe.Sequence,itemType:Gi})],Hi);var um;let E0=um=class extends Hi{constructor(t){super(t),Object.setPrototypeOf(this,um.prototype)}};E0=um=B([Le({type:Pe.Sequence,itemType:Gi})],E0);const Jo=class Jo{constructor(t={}){K(this,"distributionPoint");K(this,"onlyContainsUserCerts",Jo.ONLY);K(this,"onlyContainsCACerts",Jo.ONLY);K(this,"onlySomeReasons");K(this,"indirectCRL",Jo.ONLY);K(this,"onlyContainsAttributeCerts",Jo.ONLY);Object.assign(this,t)}};K(Jo,"ONLY",!1);let Gn=Jo;B([H({type:Mo,context:0,optional:!0})],Gn.prototype,"distributionPoint",void 0),B([H({type:me.Boolean,context:1,defaultValue:Gn.ONLY,implicit:!0})],Gn.prototype,"onlyContainsUserCerts",void 0),B([H({type:me.Boolean,context:2,defaultValue:Gn.ONLY,implicit:!0})],Gn.prototype,"onlyContainsCACerts",void 0),B([H({type:C0,context:3,optional:!0,implicit:!0})],Gn.prototype,"onlySomeReasons",void 0),B([H({type:me.Boolean,context:4,defaultValue:Gn.ONLY,implicit:!0})],Gn.prototype,"indirectCRL",void 0),B([H({type:me.Boolean,context:5,defaultValue:Gn.ONLY,implicit:!0})],Gn.prototype,"onlyContainsAttributeCerts",void 0);var hs;(function(n){n[n.unspecified=0]="unspecified",n[n.keyCompromise=1]="keyCompromise",n[n.cACompromise=2]="cACompromise",n[n.affiliationChanged=3]="affiliationChanged",n[n.superseded=4]="superseded",n[n.cessationOfOperation=5]="cessationOfOperation",n[n.certificateHold=6]="certificateHold",n[n.removeFromCRL=8]="removeFromCRL",n[n.privilegeWithdrawn=9]="privilegeWithdrawn",n[n.aACompromise=10]="aACompromise"})(hs||(hs={}));let dm=class{constructor(t=hs.unspecified){K(this,"reason",hs.unspecified);this.reason=t}toJSON(){return hs[this.reason]}toString(){return this.toJSON()}};B([H({type:me.Enumerated})],dm.prototype,"reason",void 0),dm=B([Le({type:Pe.Choice})],dm);var fm;const N0=`${jr}.37`;let eu=fm=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,fm.prototype)}};eu=fm=B([Le({type:Pe.Sequence,itemType:me.ObjectIdentifier})],eu);const W8=`${Ki}.1`,Y8=`${Ki}.2`,J8=`${Ki}.3`,X8=`${Ki}.4`,Z8=`${Ki}.8`,Q8=`${Ki}.9`;let pm=class{constructor(t=new ArrayBuffer(0)){K(this,"value");this.value=t}};B([H({type:me.Integer,converter:Ot})],pm.prototype,"value",void 0),pm=B([Le({type:Pe.Choice})],pm);let mm=class{constructor(t){K(this,"value",new Date);t&&(this.value=t)}};B([H({type:me.GeneralizedTime})],mm.prototype,"value",void 0),mm=B([Le({type:Pe.Choice})],mm);var gm;const S0=`${jr}.18`;let x0=gm=class extends sn{constructor(t){super(t),Object.setPrototypeOf(this,gm.prototype)}};x0=gm=B([Le({type:Pe.Sequence})],x0);const A0=`${jr}.15`;var ir;(function(n){n[n.digitalSignature=1]="digitalSignature",n[n.nonRepudiation=2]="nonRepudiation",n[n.keyEncipherment=4]="keyEncipherment",n[n.dataEncipherment=8]="dataEncipherment",n[n.keyAgreement=16]="keyAgreement",n[n.keyCertSign=32]="keyCertSign",n[n.cRLSign=64]="cRLSign",n[n.encipherOnly=128]="encipherOnly",n[n.decipherOnly=256]="decipherOnly"})(ir||(ir={}));class hm extends Gc{toJSON(){const t=this.toNumber(),r=[];return t&ir.cRLSign&&r.push("crlSign"),t&ir.dataEncipherment&&r.push("dataEncipherment"),t&ir.decipherOnly&&r.push("decipherOnly"),t&ir.digitalSignature&&r.push("digitalSignature"),t&ir.encipherOnly&&r.push("encipherOnly"),t&ir.keyAgreement&&r.push("keyAgreement"),t&ir.keyCertSign&&r.push("keyCertSign"),t&ir.keyEncipherment&&r.push("keyEncipherment"),t&ir.nonRepudiation&&r.push("nonRepudiation"),r}toString(){return`[${this.toJSON().join(", ")}]`}}var ym;class tu{constructor(t={}){K(this,"base",new ot);K(this,"minimum",0);K(this,"maximum");Object.assign(this,t)}}B([H({type:ot})],tu.prototype,"base",void 0),B([H({type:me.Integer,context:0,defaultValue:0,implicit:!0})],tu.prototype,"minimum",void 0),B([H({type:me.Integer,context:1,optional:!0,implicit:!0})],tu.prototype,"maximum",void 0);let nu=ym=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,ym.prototype)}};nu=ym=B([Le({type:Pe.Sequence,itemType:tu})],nu);class v0{constructor(t={}){K(this,"permittedSubtrees");K(this,"excludedSubtrees");Object.assign(this,t)}}B([H({type:nu,context:0,optional:!0,implicit:!0})],v0.prototype,"permittedSubtrees",void 0),B([H({type:nu,context:1,optional:!0,implicit:!0})],v0.prototype,"excludedSubtrees",void 0);class I0{constructor(t={}){K(this,"requireExplicitPolicy");K(this,"inhibitPolicyMapping");Object.assign(this,t)}}B([H({type:me.Integer,context:0,implicit:!0,optional:!0,converter:Ot})],I0.prototype,"requireExplicitPolicy",void 0),B([H({type:me.Integer,context:1,implicit:!0,optional:!0,converter:Ot})],I0.prototype,"inhibitPolicyMapping",void 0);var _m;class bm{constructor(t={}){K(this,"issuerDomainPolicy","");K(this,"subjectDomainPolicy","");Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],bm.prototype,"issuerDomainPolicy",void 0),B([H({type:me.ObjectIdentifier})],bm.prototype,"subjectDomainPolicy",void 0);let B0=_m=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,_m.prototype)}};B0=_m=B([Le({type:Pe.Sequence,itemType:bm})],B0);var wm;const T0=`${jr}.17`;let km=wm=class extends sn{constructor(t){super(t),Object.setPrototypeOf(this,wm.prototype)}};km=wm=B([Le({type:Pe.Sequence})],km);let Ur=class{constructor(t={}){K(this,"type","");K(this,"values",[]);Object.assign(this,t)}};B([H({type:me.ObjectIdentifier})],Ur.prototype,"type",void 0),B([H({type:me.Any,repeated:"set"})],Ur.prototype,"values",void 0);var Cm;let O0=Cm=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,Cm.prototype)}};O0=Cm=B([Le({type:Pe.Sequence,itemType:Ur})],O0);const P0=`${jr}.14`;class io extends tm{}class V0{constructor(t={}){K(this,"notBefore");K(this,"notAfter");Object.assign(this,t)}}B([H({type:me.GeneralizedTime,context:0,implicit:!0,optional:!0})],V0.prototype,"notBefore",void 0),B([H({type:me.GeneralizedTime,context:1,implicit:!0,optional:!0})],V0.prototype,"notAfter",void 0);var ys;(function(n){n[n.keyUpdateAllowed=1]="keyUpdateAllowed",n[n.newExtensions=2]="newExtensions",n[n.pKIXCertificate=4]="pKIXCertificate"})(ys||(ys={}));class $0 extends Gc{toJSON(){const t=[],r=this.toNumber();return r&ys.pKIXCertificate&&t.push("pKIXCertificate"),r&ys.newExtensions&&t.push("newExtensions"),r&ys.keyUpdateAllowed&&t.push("keyUpdateAllowed"),t}toString(){return`[${this.toJSON().join(", ")}]`}}class R0{constructor(t={}){K(this,"entrustVers","");K(this,"entrustInfoFlags",new $0);Object.assign(this,t)}}B([H({type:me.GeneralString})],R0.prototype,"entrustVers",void 0),B([H({type:$0})],R0.prototype,"entrustInfoFlags",void 0);var Em;let L0=Em=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,Em.prototype)}};L0=Em=B([Le({type:Pe.Sequence,itemType:gs})],L0);class Ge{constructor(t={}){K(this,"algorithm","");K(this,"parameters");Object.assign(this,t)}isEqual(t){return t instanceof Ge&&t.algorithm==this.algorithm&&(t.parameters&&this.parameters&&k8(t.parameters,this.parameters)||t.parameters===this.parameters)}}B([H({type:me.ObjectIdentifier})],Ge.prototype,"algorithm",void 0),B([H({type:me.Any,optional:!0})],Ge.prototype,"parameters",void 0);class wr{constructor(t={}){K(this,"algorithm",new Ge);K(this,"subjectPublicKey",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:Ge})],wr.prototype,"algorithm",void 0),B([H({type:me.BitString})],wr.prototype,"subjectPublicKey",void 0);let on=class{constructor(t){K(this,"utcTime");K(this,"generalTime");if(t)if(typeof t=="string"||typeof t=="number"||t instanceof Date){const r=new Date(t);r.setMilliseconds(0),r.getUTCFullYear()>2049?this.generalTime=r:this.utcTime=r}else Object.assign(this,t)}getTime(){const t=this.utcTime||this.generalTime;if(!t)throw new Error("Cannot get time from CHOICE object");return t}};B([H({type:me.UTCTime})],on.prototype,"utcTime",void 0),B([H({type:me.GeneralizedTime})],on.prototype,"generalTime",void 0),on=B([Le({type:Pe.Choice})],on);class ru{constructor(t){K(this,"notBefore",new on(new Date));K(this,"notAfter",new on(new Date));t&&(this.notBefore=new on(t.notBefore),this.notAfter=new on(t.notAfter))}}B([H({type:on})],ru.prototype,"notBefore",void 0),B([H({type:on})],ru.prototype,"notAfter",void 0);var Nm;let kr=(Xo=class{constructor(t={}){K(this,"extnID","");K(this,"critical",Xo.CRITICAL);K(this,"extnValue",new mt);Object.assign(this,t)}},K(Xo,"CRITICAL",!1),Xo);B([H({type:me.ObjectIdentifier})],kr.prototype,"extnID",void 0),B([H({type:me.Boolean,defaultValue:kr.CRITICAL})],kr.prototype,"critical",void 0),B([H({type:mt})],kr.prototype,"extnValue",void 0);let jo=Nm=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,Nm.prototype)}};jo=Nm=B([Le({type:Pe.Sequence,itemType:kr})],jo);var zi;(function(n){n[n.v1=0]="v1",n[n.v2=1]="v2",n[n.v3=2]="v3"})(zi||(zi={}));class Hn{constructor(t={}){K(this,"version",zi.v1);K(this,"serialNumber",new ArrayBuffer(0));K(this,"signature",new Ge);K(this,"issuer",new Wt);K(this,"validity",new ru);K(this,"subject",new Wt);K(this,"subjectPublicKeyInfo",new wr);K(this,"issuerUniqueID");K(this,"subjectUniqueID");K(this,"extensions");Object.assign(this,t)}}B([H({type:me.Integer,context:0,defaultValue:zi.v1})],Hn.prototype,"version",void 0),B([H({type:me.Integer,converter:Ot})],Hn.prototype,"serialNumber",void 0),B([H({type:Ge})],Hn.prototype,"signature",void 0),B([H({type:Wt})],Hn.prototype,"issuer",void 0),B([H({type:ru})],Hn.prototype,"validity",void 0),B([H({type:Wt})],Hn.prototype,"subject",void 0),B([H({type:wr})],Hn.prototype,"subjectPublicKeyInfo",void 0),B([H({type:me.BitString,context:1,implicit:!0,optional:!0})],Hn.prototype,"issuerUniqueID",void 0),B([H({type:me.BitString,context:2,implicit:!0,optional:!0})],Hn.prototype,"subjectUniqueID",void 0),B([H({type:jo,context:3,optional:!0})],Hn.prototype,"extensions",void 0);class Wi{constructor(t={}){K(this,"tbsCertificate",new Hn);K(this,"tbsCertificateRaw");K(this,"signatureAlgorithm",new Ge);K(this,"signatureValue",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:Hn,raw:!0})],Wi.prototype,"tbsCertificate",void 0),B([H({type:Ge})],Wi.prototype,"signatureAlgorithm",void 0),B([H({type:me.BitString})],Wi.prototype,"signatureValue",void 0);class ou{constructor(t={}){K(this,"userCertificate",new ArrayBuffer(0));K(this,"revocationDate",new on);K(this,"crlEntryExtensions");Object.assign(this,t)}}B([H({type:me.Integer,converter:Ot})],ou.prototype,"userCertificate",void 0),B([H({type:on})],ou.prototype,"revocationDate",void 0),B([H({type:kr,optional:!0,repeated:"sequence"})],ou.prototype,"crlEntryExtensions",void 0);class Kr{constructor(t={}){K(this,"version");K(this,"signature",new Ge);K(this,"issuer",new Wt);K(this,"thisUpdate",new on);K(this,"nextUpdate");K(this,"revokedCertificates");K(this,"crlExtensions");Object.assign(this,t)}}B([H({type:me.Integer,optional:!0})],Kr.prototype,"version",void 0),B([H({type:Ge})],Kr.prototype,"signature",void 0),B([H({type:Wt})],Kr.prototype,"issuer",void 0),B([H({type:on})],Kr.prototype,"thisUpdate",void 0),B([H({type:on,optional:!0})],Kr.prototype,"nextUpdate",void 0),B([H({type:ou,repeated:"sequence",optional:!0})],Kr.prototype,"revokedCertificates",void 0),B([H({type:kr,optional:!0,context:0,repeated:"sequence"})],Kr.prototype,"crlExtensions",void 0);class Sm{constructor(t={}){K(this,"tbsCertList",new Kr);K(this,"tbsCertListRaw");K(this,"signatureAlgorithm",new Ge);K(this,"signature",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:Kr,raw:!0})],Sm.prototype,"tbsCertList",void 0),B([H({type:Ge})],Sm.prototype,"signatureAlgorithm",void 0),B([H({type:me.BitString})],Sm.prototype,"signature",void 0);class Yi{constructor(t={}){K(this,"issuer",new Wt);K(this,"serialNumber",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:Wt})],Yi.prototype,"issuer",void 0),B([H({type:me.Integer,converter:Ot})],Yi.prototype,"serialNumber",void 0);let Ji=class{constructor(t={}){K(this,"subjectKeyIdentifier");K(this,"issuerAndSerialNumber");Object.assign(this,t)}};B([H({type:io,context:0,implicit:!0})],Ji.prototype,"subjectKeyIdentifier",void 0),B([H({type:Yi})],Ji.prototype,"issuerAndSerialNumber",void 0),Ji=B([Le({type:Pe.Choice})],Ji);var qr;(function(n){n[n.v0=0]="v0",n[n.v1=1]="v1",n[n.v2=2]="v2",n[n.v3=3]="v3",n[n.v4=4]="v4",n[n.v5=5]="v5"})(qr||(qr={}));let _s=class extends Ge{};_s=B([Le({type:Pe.Sequence})],_s);let iu=class extends Ge{};iu=B([Le({type:Pe.Sequence})],iu);let Cr=class extends Ge{};Cr=B([Le({type:Pe.Sequence})],Cr);let au=class extends Ge{};au=B([Le({type:Pe.Sequence})],au);let D0=class extends Ge{};D0=B([Le({type:Pe.Sequence})],D0);let xm=class extends Ge{};xm=B([Le({type:Pe.Sequence})],xm);let Xi=class{constructor(t={}){K(this,"attrType","");K(this,"attrValues",[]);Object.assign(this,t)}};B([H({type:me.ObjectIdentifier})],Xi.prototype,"attrType",void 0),B([H({type:me.Any,repeated:"set"})],Xi.prototype,"attrValues",void 0);var Am;class Er{constructor(t={}){K(this,"version",qr.v0);K(this,"sid",new Ji);K(this,"digestAlgorithm",new _s);K(this,"signedAttrs");K(this,"signedAttrsRaw");K(this,"signatureAlgorithm",new iu);K(this,"signature",new mt);K(this,"unsignedAttrs");Object.assign(this,t)}}B([H({type:me.Integer})],Er.prototype,"version",void 0),B([H({type:Ji})],Er.prototype,"sid",void 0),B([H({type:_s})],Er.prototype,"digestAlgorithm",void 0),B([H({type:Xi,repeated:"set",context:0,implicit:!0,optional:!0,raw:!0})],Er.prototype,"signedAttrs",void 0),B([H({type:iu})],Er.prototype,"signatureAlgorithm",void 0),B([H({type:mt})],Er.prototype,"signature",void 0),B([H({type:Xi,repeated:"set",context:1,implicit:!0,optional:!0})],Er.prototype,"unsignedAttrs",void 0);let su=Am=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,Am.prototype)}};su=Am=B([Le({type:Pe.Set,itemType:Er})],su);let M0=class extends Er{};M0=B([Le({type:Pe.Sequence})],M0);let j0=class extends on{};j0=B([Le({type:Pe.Choice})],j0);class vm{constructor(t={}){K(this,"acIssuer",new ot);K(this,"acSerial",0);K(this,"attrs",[]);Object.assign(this,t)}}B([H({type:ot})],vm.prototype,"acIssuer",void 0),B([H({type:me.Integer})],vm.prototype,"acSerial",void 0),B([H({type:Ur,repeated:"sequence"})],vm.prototype,"attrs",void 0);var Im;let lu=Im=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,Im.prototype)}};lu=Im=B([Le({type:Pe.Sequence,itemType:me.ObjectIdentifier})],lu);class cu{constructor(t={}){K(this,"pathLenConstraint");K(this,"permittedAttrs");K(this,"excludedAttrs");K(this,"permitUnSpecified",!0);Object.assign(this,t)}}B([H({type:me.Integer,optional:!0})],cu.prototype,"pathLenConstraint",void 0),B([H({type:lu,implicit:!0,context:0,optional:!0})],cu.prototype,"permittedAttrs",void 0),B([H({type:lu,implicit:!0,context:1,optional:!0})],cu.prototype,"excludedAttrs",void 0),B([H({type:me.Boolean,defaultValue:!0})],cu.prototype,"permitUnSpecified",void 0);class Fo{constructor(t={}){K(this,"issuer",new sn);K(this,"serial",new ArrayBuffer(0));K(this,"issuerUID",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:sn})],Fo.prototype,"issuer",void 0),B([H({type:me.Integer,converter:Ot})],Fo.prototype,"serial",void 0),B([H({type:me.BitString,optional:!0})],Fo.prototype,"issuerUID",void 0);var Bm;(function(n){n[n.publicKey=0]="publicKey",n[n.publicKeyCert=1]="publicKeyCert",n[n.otherObjectTypes=2]="otherObjectTypes"})(Bm||(Bm={}));class Uo{constructor(t={}){K(this,"digestedObjectType",Bm.publicKey);K(this,"otherObjectTypeID");K(this,"digestAlgorithm",new Ge);K(this,"objectDigest",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:me.Enumerated})],Uo.prototype,"digestedObjectType",void 0),B([H({type:me.ObjectIdentifier,optional:!0})],Uo.prototype,"otherObjectTypeID",void 0),B([H({type:Ge})],Uo.prototype,"digestAlgorithm",void 0),B([H({type:me.BitString})],Uo.prototype,"objectDigest",void 0);class uu{constructor(t={}){K(this,"issuerName");K(this,"baseCertificateID");K(this,"objectDigestInfo");Object.assign(this,t)}}B([H({type:sn,optional:!0})],uu.prototype,"issuerName",void 0),B([H({type:Fo,context:0,implicit:!0,optional:!0})],uu.prototype,"baseCertificateID",void 0),B([H({type:Uo,context:1,implicit:!0,optional:!0})],uu.prototype,"objectDigestInfo",void 0);let Zi=class{constructor(t={}){K(this,"v1Form");K(this,"v2Form");Object.assign(this,t)}};B([H({type:ot,repeated:"sequence"})],Zi.prototype,"v1Form",void 0),B([H({type:uu,context:0,implicit:!0})],Zi.prototype,"v2Form",void 0),Zi=B([Le({type:Pe.Choice})],Zi);class du{constructor(t={}){K(this,"notBeforeTime",new Date);K(this,"notAfterTime",new Date);Object.assign(this,t)}}B([H({type:me.GeneralizedTime})],du.prototype,"notBeforeTime",void 0),B([H({type:me.GeneralizedTime})],du.prototype,"notAfterTime",void 0);class bs{constructor(t={}){K(this,"baseCertificateID");K(this,"entityName");K(this,"objectDigestInfo");Object.assign(this,t)}}B([H({type:Fo,implicit:!0,context:0,optional:!0})],bs.prototype,"baseCertificateID",void 0),B([H({type:sn,implicit:!0,context:1,optional:!0})],bs.prototype,"entityName",void 0),B([H({type:Uo,implicit:!0,context:2,optional:!0})],bs.prototype,"objectDigestInfo",void 0);var Tm;(function(n){n[n.v2=1]="v2"})(Tm||(Tm={}));class ar{constructor(t={}){K(this,"version",Tm.v2);K(this,"holder",new bs);K(this,"issuer",new Zi);K(this,"signature",new Ge);K(this,"serialNumber",new ArrayBuffer(0));K(this,"attrCertValidityPeriod",new du);K(this,"attributes",[]);K(this,"issuerUniqueID");K(this,"extensions");Object.assign(this,t)}}B([H({type:me.Integer})],ar.prototype,"version",void 0),B([H({type:bs})],ar.prototype,"holder",void 0),B([H({type:Zi})],ar.prototype,"issuer",void 0),B([H({type:Ge})],ar.prototype,"signature",void 0),B([H({type:me.Integer,converter:Ot})],ar.prototype,"serialNumber",void 0),B([H({type:du})],ar.prototype,"attrCertValidityPeriod",void 0),B([H({type:Ur,repeated:"sequence"})],ar.prototype,"attributes",void 0),B([H({type:me.BitString,optional:!0})],ar.prototype,"issuerUniqueID",void 0),B([H({type:jo,optional:!0})],ar.prototype,"extensions",void 0);class fu{constructor(t={}){K(this,"acinfo",new ar);K(this,"signatureAlgorithm",new Ge);K(this,"signatureValue",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:ar})],fu.prototype,"acinfo",void 0),B([H({type:Ge})],fu.prototype,"signatureAlgorithm",void 0),B([H({type:me.BitString})],fu.prototype,"signatureValue",void 0);var pu;(function(n){n[n.unmarked=1]="unmarked",n[n.unclassified=2]="unclassified",n[n.restricted=4]="restricted",n[n.confidential=8]="confidential",n[n.secret=16]="secret",n[n.topSecret=32]="topSecret"})(pu||(pu={}));class Om extends Gc{}class Pm{constructor(t={}){K(this,"type","");K(this,"value",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:me.ObjectIdentifier,implicit:!0,context:0})],Pm.prototype,"type",void 0),B([H({type:me.Any,implicit:!0,context:1})],Pm.prototype,"value",void 0);class Vm{constructor(t={}){K(this,"policyId","");K(this,"classList",new Om(pu.unclassified));K(this,"securityCategories");Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],Vm.prototype,"policyId",void 0),B([H({type:Om,defaultValue:new Om(pu.unclassified)})],Vm.prototype,"classList",void 0),B([H({type:Pm,repeated:"set"})],Vm.prototype,"securityCategories",void 0);class mu{constructor(t={}){K(this,"cotets");K(this,"oid");K(this,"string");Object.assign(this,t)}}B([H({type:mt})],mu.prototype,"cotets",void 0),B([H({type:me.ObjectIdentifier})],mu.prototype,"oid",void 0),B([H({type:me.Utf8String})],mu.prototype,"string",void 0);class F0{constructor(t={}){K(this,"policyAuthority");K(this,"values",[]);Object.assign(this,t)}}B([H({type:sn,implicit:!0,context:0,optional:!0})],F0.prototype,"policyAuthority",void 0),B([H({type:mu,repeated:"sequence"})],F0.prototype,"values",void 0);var $m;class gu{constructor(t={}){K(this,"targetCertificate",new Fo);K(this,"targetName");K(this,"certDigestInfo");Object.assign(this,t)}}B([H({type:Fo})],gu.prototype,"targetCertificate",void 0),B([H({type:ot,optional:!0})],gu.prototype,"targetName",void 0),B([H({type:Uo,optional:!0})],gu.prototype,"certDigestInfo",void 0);let Qi=class{constructor(t={}){K(this,"targetName");K(this,"targetGroup");K(this,"targetCert");Object.assign(this,t)}};B([H({type:ot,context:0,implicit:!0})],Qi.prototype,"targetName",void 0),B([H({type:ot,context:1,implicit:!0})],Qi.prototype,"targetGroup",void 0),B([H({type:gu,context:2,implicit:!0})],Qi.prototype,"targetCert",void 0),Qi=B([Le({type:Pe.Choice})],Qi);let Rm=$m=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,$m.prototype)}};Rm=$m=B([Le({type:Pe.Sequence,itemType:Qi})],Rm);var Lm;let U0=Lm=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,Lm.prototype)}};U0=Lm=B([Le({type:Pe.Sequence,itemType:Rm})],U0);class K0{constructor(t={}){K(this,"roleAuthority");K(this,"roleName");Object.assign(this,t)}}B([H({type:sn,implicit:!0,context:0,optional:!0})],K0.prototype,"roleAuthority",void 0),B([H({type:ot,implicit:!0,context:1})],K0.prototype,"roleName",void 0);class Dm{constructor(t={}){K(this,"service",new ot);K(this,"ident",new ot);K(this,"authInfo");Object.assign(this,t)}}B([H({type:ot})],Dm.prototype,"service",void 0),B([H({type:ot})],Dm.prototype,"ident",void 0),B([H({type:mt,optional:!0})],Dm.prototype,"authInfo",void 0);var Mm;class jm{constructor(t={}){K(this,"otherCertFormat","");K(this,"otherCert",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],jm.prototype,"otherCertFormat",void 0),B([H({type:me.Any})],jm.prototype,"otherCert",void 0);let ea=class{constructor(t={}){K(this,"certificate");K(this,"v2AttrCert");K(this,"other");Object.assign(this,t)}};B([H({type:Wi})],ea.prototype,"certificate",void 0),B([H({type:fu,context:2,implicit:!0})],ea.prototype,"v2AttrCert",void 0),B([H({type:jm,context:3,implicit:!0})],ea.prototype,"other",void 0),ea=B([Le({type:Pe.Choice})],ea);let hu=Mm=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,Mm.prototype)}};hu=Mm=B([Le({type:Pe.Set,itemType:ea})],hu);class ta{constructor(t={}){K(this,"contentType","");K(this,"content",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],ta.prototype,"contentType",void 0),B([H({type:me.Any,context:0})],ta.prototype,"content",void 0);let ws=class{constructor(t={}){K(this,"single");K(this,"any");Object.assign(this,t)}};B([H({type:mt})],ws.prototype,"single",void 0),B([H({type:me.Any})],ws.prototype,"any",void 0),ws=B([Le({type:Pe.Choice})],ws);class yu{constructor(t={}){K(this,"eContentType","");K(this,"eContent");Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],yu.prototype,"eContentType",void 0),B([H({type:ws,context:0,optional:!0})],yu.prototype,"eContent",void 0);let ks=class{constructor(t={}){K(this,"value");K(this,"constructedValue");Object.assign(this,t)}};B([H({type:mt,context:0,implicit:!0,optional:!0})],ks.prototype,"value",void 0),B([H({type:mt,converter:v8,context:0,implicit:!0,optional:!0,repeated:"sequence"})],ks.prototype,"constructedValue",void 0),ks=B([Le({type:Pe.Choice})],ks);class Cs{constructor(t={}){K(this,"contentType","");K(this,"contentEncryptionAlgorithm",new au);K(this,"encryptedContent");Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],Cs.prototype,"contentType",void 0),B([H({type:au})],Cs.prototype,"contentEncryptionAlgorithm",void 0),B([H({type:ks,optional:!0})],Cs.prototype,"encryptedContent",void 0);class _u{constructor(t={}){K(this,"keyAttrId","");K(this,"keyAttr");Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],_u.prototype,"keyAttrId",void 0),B([H({type:me.Any,optional:!0})],_u.prototype,"keyAttr",void 0);var Fm;class bu{constructor(t={}){K(this,"subjectKeyIdentifier",new io);K(this,"date");K(this,"other");Object.assign(this,t)}}B([H({type:io})],bu.prototype,"subjectKeyIdentifier",void 0),B([H({type:me.GeneralizedTime,optional:!0})],bu.prototype,"date",void 0),B([H({type:_u,optional:!0})],bu.prototype,"other",void 0);let na=class{constructor(t={}){K(this,"rKeyId");K(this,"issuerAndSerialNumber");Object.assign(this,t)}};B([H({type:bu,context:0,implicit:!0,optional:!0})],na.prototype,"rKeyId",void 0),B([H({type:Yi,optional:!0})],na.prototype,"issuerAndSerialNumber",void 0),na=B([Le({type:Pe.Choice})],na);class Um{constructor(t={}){K(this,"rid",new na);K(this,"encryptedKey",new mt);Object.assign(this,t)}}B([H({type:na})],Um.prototype,"rid",void 0),B([H({type:mt})],Um.prototype,"encryptedKey",void 0);let wu=Fm=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,Fm.prototype)}};wu=Fm=B([Le({type:Pe.Sequence,itemType:Um})],wu);class Km{constructor(t={}){K(this,"algorithm",new Ge);K(this,"publicKey",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:Ge})],Km.prototype,"algorithm",void 0),B([H({type:me.BitString})],Km.prototype,"publicKey",void 0);let Ko=class{constructor(t={}){K(this,"subjectKeyIdentifier");K(this,"originatorKey");K(this,"issuerAndSerialNumber");Object.assign(this,t)}};B([H({type:io,context:0,implicit:!0,optional:!0})],Ko.prototype,"subjectKeyIdentifier",void 0),B([H({type:Km,context:1,implicit:!0,optional:!0})],Ko.prototype,"originatorKey",void 0),B([H({type:Yi,optional:!0})],Ko.prototype,"issuerAndSerialNumber",void 0),Ko=B([Le({type:Pe.Choice})],Ko);class ra{constructor(t={}){K(this,"version",qr.v3);K(this,"originator",new Ko);K(this,"ukm");K(this,"keyEncryptionAlgorithm",new Cr);K(this,"recipientEncryptedKeys",new wu);Object.assign(this,t)}}B([H({type:me.Integer})],ra.prototype,"version",void 0),B([H({type:Ko,context:0})],ra.prototype,"originator",void 0),B([H({type:mt,context:1,optional:!0})],ra.prototype,"ukm",void 0),B([H({type:Cr})],ra.prototype,"keyEncryptionAlgorithm",void 0),B([H({type:wu})],ra.prototype,"recipientEncryptedKeys",void 0);let oa=class{constructor(t={}){K(this,"subjectKeyIdentifier");K(this,"issuerAndSerialNumber");Object.assign(this,t)}};B([H({type:io,context:0,implicit:!0})],oa.prototype,"subjectKeyIdentifier",void 0),B([H({type:Yi})],oa.prototype,"issuerAndSerialNumber",void 0),oa=B([Le({type:Pe.Choice})],oa);class Es{constructor(t={}){K(this,"version",qr.v0);K(this,"rid",new oa);K(this,"keyEncryptionAlgorithm",new Cr);K(this,"encryptedKey",new mt);Object.assign(this,t)}}B([H({type:me.Integer})],Es.prototype,"version",void 0),B([H({type:oa})],Es.prototype,"rid",void 0),B([H({type:Cr})],Es.prototype,"keyEncryptionAlgorithm",void 0),B([H({type:mt})],Es.prototype,"encryptedKey",void 0);class Ns{constructor(t={}){K(this,"keyIdentifier",new mt);K(this,"date");K(this,"other");Object.assign(this,t)}}B([H({type:mt})],Ns.prototype,"keyIdentifier",void 0),B([H({type:me.GeneralizedTime,optional:!0})],Ns.prototype,"date",void 0),B([H({type:_u,optional:!0})],Ns.prototype,"other",void 0);class Ss{constructor(t={}){K(this,"version",qr.v4);K(this,"kekid",new Ns);K(this,"keyEncryptionAlgorithm",new Cr);K(this,"encryptedKey",new mt);Object.assign(this,t)}}B([H({type:me.Integer})],Ss.prototype,"version",void 0),B([H({type:Ns})],Ss.prototype,"kekid",void 0),B([H({type:Cr})],Ss.prototype,"keyEncryptionAlgorithm",void 0),B([H({type:mt})],Ss.prototype,"encryptedKey",void 0);class xs{constructor(t={}){K(this,"version",qr.v0);K(this,"keyDerivationAlgorithm");K(this,"keyEncryptionAlgorithm",new Cr);K(this,"encryptedKey",new mt);Object.assign(this,t)}}B([H({type:me.Integer})],xs.prototype,"version",void 0),B([H({type:xm,context:0,optional:!0})],xs.prototype,"keyDerivationAlgorithm",void 0),B([H({type:Cr})],xs.prototype,"keyEncryptionAlgorithm",void 0),B([H({type:mt})],xs.prototype,"encryptedKey",void 0);class qm{constructor(t={}){K(this,"oriType","");K(this,"oriValue",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],qm.prototype,"oriType",void 0),B([H({type:me.Any})],qm.prototype,"oriValue",void 0);let ao=class{constructor(t={}){K(this,"ktri");K(this,"kari");K(this,"kekri");K(this,"pwri");K(this,"ori");Object.assign(this,t)}};B([H({type:Es,optional:!0})],ao.prototype,"ktri",void 0),B([H({type:ra,context:1,implicit:!0,optional:!0})],ao.prototype,"kari",void 0),B([H({type:Ss,context:2,implicit:!0,optional:!0})],ao.prototype,"kekri",void 0),B([H({type:xs,context:3,implicit:!0,optional:!0})],ao.prototype,"pwri",void 0),B([H({type:qm,context:4,implicit:!0,optional:!0})],ao.prototype,"ori",void 0),ao=B([Le({type:Pe.Choice})],ao);var Gm;let ku=Gm=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,Gm.prototype)}};ku=Gm=B([Le({type:Pe.Set,itemType:ao})],ku);var Hm;class Cu{constructor(t={}){K(this,"otherRevInfoFormat","");K(this,"otherRevInfo",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],Cu.prototype,"otherRevInfoFormat",void 0),B([H({type:me.Any})],Cu.prototype,"otherRevInfo",void 0);let Eu=class{constructor(t={}){K(this,"other",new Cu);Object.assign(this,t)}};B([H({type:Cu,context:1,implicit:!0})],Eu.prototype,"other",void 0),Eu=B([Le({type:Pe.Choice})],Eu);let Nu=Hm=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,Hm.prototype)}};Nu=Hm=B([Le({type:Pe.Set,itemType:Eu})],Nu);class zm{constructor(t={}){K(this,"certs");K(this,"crls");Object.assign(this,t)}}B([H({type:hu,context:0,implicit:!0,optional:!0})],zm.prototype,"certs",void 0),B([H({type:Nu,context:1,implicit:!0,optional:!0})],zm.prototype,"crls",void 0);var Wm;let Ym=Wm=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,Wm.prototype)}};Ym=Wm=B([Le({type:Pe.Set,itemType:Xi})],Ym);class As{constructor(t={}){K(this,"version",qr.v0);K(this,"originatorInfo");K(this,"recipientInfos",new ku);K(this,"encryptedContentInfo",new Cs);K(this,"unprotectedAttrs");Object.assign(this,t)}}B([H({type:me.Integer})],As.prototype,"version",void 0),B([H({type:zm,context:0,implicit:!0,optional:!0})],As.prototype,"originatorInfo",void 0),B([H({type:ku})],As.prototype,"recipientInfos",void 0),B([H({type:Cs})],As.prototype,"encryptedContentInfo",void 0),B([H({type:Ym,context:1,implicit:!0,optional:!0})],As.prototype,"unprotectedAttrs",void 0);const eK="1.2.840.113549.1.7.2";var Jm;let Su=Jm=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,Jm.prototype)}};Su=Jm=B([Le({type:Pe.Set,itemType:_s})],Su);class ia{constructor(t={}){K(this,"version",qr.v0);K(this,"digestAlgorithms",new Su);K(this,"encapContentInfo",new yu);K(this,"certificates");K(this,"crls");K(this,"signerInfos",new su);Object.assign(this,t)}}B([H({type:me.Integer})],ia.prototype,"version",void 0),B([H({type:Su})],ia.prototype,"digestAlgorithms",void 0),B([H({type:yu})],ia.prototype,"encapContentInfo",void 0),B([H({type:hu,context:0,implicit:!0,optional:!0})],ia.prototype,"certificates",void 0),B([H({type:Nu,context:1,implicit:!0,optional:!0})],ia.prototype,"crls",void 0),B([H({type:su})],ia.prototype,"signerInfos",void 0);const vs="1.2.840.10045.2.1",Xm="1.2.840.10045.4.1",q0="1.2.840.10045.4.3.1",Zm="1.2.840.10045.4.3.2",Qm="1.2.840.10045.4.3.3",eg="1.2.840.10045.4.3.4",G0="1.2.840.10045.3.1.7",H0="1.3.132.0.34",z0="1.3.132.0.35";function Is(n){return new Ge({algorithm:n})}const tK=Is(Xm);Is(q0);const nK=Is(Zm),rK=Is(Qm),oK=Is(eg);let Bs=class{constructor(t={}){K(this,"fieldType");K(this,"parameters");Object.assign(this,t)}};B([H({type:me.ObjectIdentifier})],Bs.prototype,"fieldType",void 0),B([H({type:me.Any})],Bs.prototype,"parameters",void 0),Bs=B([Le({type:Pe.Sequence})],Bs);class iK extends mt{}let aa=class{constructor(t={}){K(this,"a");K(this,"b");K(this,"seed");Object.assign(this,t)}};B([H({type:me.OctetString})],aa.prototype,"a",void 0),B([H({type:me.OctetString})],aa.prototype,"b",void 0),B([H({type:me.BitString,optional:!0})],aa.prototype,"seed",void 0),aa=B([Le({type:Pe.Sequence})],aa);var tg;(function(n){n[n.ecpVer1=1]="ecpVer1"})(tg||(tg={}));let Gr=class{constructor(t={}){K(this,"version",tg.ecpVer1);K(this,"fieldID");K(this,"curve");K(this,"base");K(this,"order");K(this,"cofactor");Object.assign(this,t)}};B([H({type:me.Integer})],Gr.prototype,"version",void 0),B([H({type:Bs})],Gr.prototype,"fieldID",void 0),B([H({type:aa})],Gr.prototype,"curve",void 0),B([H({type:iK})],Gr.prototype,"base",void 0),B([H({type:me.Integer,converter:Ot})],Gr.prototype,"order",void 0),B([H({type:me.Integer,optional:!0})],Gr.prototype,"cofactor",void 0),Gr=B([Le({type:Pe.Sequence})],Gr);let so=class{constructor(t={}){K(this,"namedCurve");K(this,"implicitCurve");K(this,"specifiedCurve");Object.assign(this,t)}};B([H({type:me.ObjectIdentifier})],so.prototype,"namedCurve",void 0),B([H({type:me.Null})],so.prototype,"implicitCurve",void 0),B([H({type:Gr})],so.prototype,"specifiedCurve",void 0),so=B([Le({type:Pe.Choice})],so);class xu{constructor(t={}){K(this,"version",1);K(this,"privateKey",new mt);K(this,"parameters");K(this,"publicKey");Object.assign(this,t)}}B([H({type:me.Integer})],xu.prototype,"version",void 0),B([H({type:mt})],xu.prototype,"privateKey",void 0),B([H({type:so,context:0,optional:!0})],xu.prototype,"parameters",void 0),B([H({type:me.BitString,context:1,optional:!0})],xu.prototype,"publicKey",void 0);class Au{constructor(t={}){K(this,"r",new ArrayBuffer(0));K(this,"s",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:me.Integer,converter:Ot})],Au.prototype,"r",void 0),B([H({type:me.Integer,converter:Ot})],Au.prototype,"s",void 0);const kn="1.2.840.113549.1.1",qo=`${kn}.1`,aK=`${kn}.7`,sK=`${kn}.9`,Ts=`${kn}.10`,lK=`${kn}.2`,cK=`${kn}.4`,vu=`${kn}.5`,uK=`${kn}.14`,ng=`${kn}.11`,Iu=`${kn}.12`,Bu=`${kn}.13`,W0=`${kn}.15`,Y0=`${kn}.16`,Tu="1.3.14.3.2.26",J0="2.16.840.1.101.3.4.2.4",Ou="2.16.840.1.101.3.4.2.1",Pu="2.16.840.1.101.3.4.2.2",Vu="2.16.840.1.101.3.4.2.3",dK="2.16.840.1.101.3.4.2.5",fK="2.16.840.1.101.3.4.2.6",pK="1.2.840.113549.2.2",mK="1.2.840.113549.2.5",$u=`${kn}.8`;function Yt(n){return new Ge({algorithm:n,parameters:null})}Yt(pK),Yt(mK);const Go=Yt(Tu);Yt(J0),Yt(Ou),Yt(Pu),Yt(Vu),Yt(dK),Yt(fK);const X0=new Ge({algorithm:$u,parameters:Ue.serialize(Go)}),Z0=new Ge({algorithm:sK,parameters:Ue.serialize(Hc.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))});Yt(qo),Yt(lK),Yt(cK),Yt(vu),Yt(W0),Yt(Y0),Yt(Iu),Yt(Bu),Yt(W0),Yt(Y0);class Ru{constructor(t={}){K(this,"hashAlgorithm",new Ge(Go));K(this,"maskGenAlgorithm",new Ge({algorithm:$u,parameters:Ue.serialize(Go)}));K(this,"pSourceAlgorithm",new Ge(Z0));Object.assign(this,t)}}B([H({type:Ge,context:0,defaultValue:Go})],Ru.prototype,"hashAlgorithm",void 0),B([H({type:Ge,context:1,defaultValue:X0})],Ru.prototype,"maskGenAlgorithm",void 0),B([H({type:Ge,context:2,defaultValue:Z0})],Ru.prototype,"pSourceAlgorithm",void 0),new Ge({algorithm:aK,parameters:Ue.serialize(new Ru)});class Ho{constructor(t={}){K(this,"hashAlgorithm",new Ge(Go));K(this,"maskGenAlgorithm",new Ge({algorithm:$u,parameters:Ue.serialize(Go)}));K(this,"saltLength",20);K(this,"trailerField",1);Object.assign(this,t)}}B([H({type:Ge,context:0,defaultValue:Go})],Ho.prototype,"hashAlgorithm",void 0),B([H({type:Ge,context:1,defaultValue:X0})],Ho.prototype,"maskGenAlgorithm",void 0),B([H({type:me.Integer,context:2,defaultValue:20})],Ho.prototype,"saltLength",void 0),B([H({type:me.Integer,context:3,defaultValue:1})],Ho.prototype,"trailerField",void 0),new Ge({algorithm:Ts,parameters:Ue.serialize(new Ho)});class Lu{constructor(t={}){K(this,"digestAlgorithm",new Ge);K(this,"digest",new mt);Object.assign(this,t)}}B([H({type:Ge})],Lu.prototype,"digestAlgorithm",void 0),B([H({type:mt})],Lu.prototype,"digest",void 0);var rg;class Du{constructor(t={}){K(this,"prime",new ArrayBuffer(0));K(this,"exponent",new ArrayBuffer(0));K(this,"coefficient",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:me.Integer,converter:Ot})],Du.prototype,"prime",void 0),B([H({type:me.Integer,converter:Ot})],Du.prototype,"exponent",void 0),B([H({type:me.Integer,converter:Ot})],Du.prototype,"coefficient",void 0);let og=rg=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,rg.prototype)}};og=rg=B([Le({type:Pe.Sequence,itemType:Du})],og);class Nr{constructor(t={}){K(this,"version",0);K(this,"modulus",new ArrayBuffer(0));K(this,"publicExponent",new ArrayBuffer(0));K(this,"privateExponent",new ArrayBuffer(0));K(this,"prime1",new ArrayBuffer(0));K(this,"prime2",new ArrayBuffer(0));K(this,"exponent1",new ArrayBuffer(0));K(this,"exponent2",new ArrayBuffer(0));K(this,"coefficient",new ArrayBuffer(0));K(this,"otherPrimeInfos");Object.assign(this,t)}}B([H({type:me.Integer})],Nr.prototype,"version",void 0),B([H({type:me.Integer,converter:Ot})],Nr.prototype,"modulus",void 0),B([H({type:me.Integer,converter:Ot})],Nr.prototype,"publicExponent",void 0),B([H({type:me.Integer,converter:Ot})],Nr.prototype,"privateExponent",void 0),B([H({type:me.Integer,converter:Ot})],Nr.prototype,"prime1",void 0),B([H({type:me.Integer,converter:Ot})],Nr.prototype,"prime2",void 0),B([H({type:me.Integer,converter:Ot})],Nr.prototype,"exponent1",void 0),B([H({type:me.Integer,converter:Ot})],Nr.prototype,"exponent2",void 0),B([H({type:me.Integer,converter:Ot})],Nr.prototype,"coefficient",void 0),B([H({type:og,optional:!0})],Nr.prototype,"otherPrimeInfos",void 0);class ig{constructor(t={}){K(this,"modulus",new ArrayBuffer(0));K(this,"publicExponent",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:me.Integer,converter:Ot})],ig.prototype,"modulus",void 0),B([H({type:me.Integer,converter:Ot})],ig.prototype,"publicExponent",void 0);var ag;(function(n){n[n.Transient=0]="Transient",n[n.Singleton=1]="Singleton",n[n.ResolutionScoped=2]="ResolutionScoped",n[n.ContainerScoped=3]="ContainerScoped"})(ag||(ag={}));const Cn=ag;/*! *****************************************************************************
519
+ `)}`:`${r} :`}}yk=fn,ze.Constructed=yk,fn.NAME="CONSTRUCTED";class _k extends an{fromBER(t,r,o){return r}toBER(t){return yr}}_k.override="EndOfContentValueBlock";var bk;class Op extends Qt{constructor(t={}){super(t,_k),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}bk=Op,ze.EndOfContent=bk,Op.NAME=as;var wk;class Vo extends Qt{constructor(t={}){super(t,an),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(t,r,o){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=o,r+o>t.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):r+o}toBER(t,r){const o=new ArrayBuffer(2);if(!t){const i=new Uint8Array(o);i[0]=5,i[1]=0}return r&&r.write(o),o}onAsciiEncoding(){return`${this.constructor.NAME}`}}wk=Vo,ze.Null=wk,Vo.NAME="NULL";class kk extends _r(an){get value(){for(const t of this.valueHexView)if(t>0)return!0;return!1}set value(t){this.valueHexView[0]=t?255:0}constructor({value:t,...r}={}){super(r),r.valueHex?this.valueHexView=qe.toUint8Array(r.valueHex):this.valueHexView=new Uint8Array(1),t&&(this.value=t)}fromBER(t,r,o){const i=qe.toUint8Array(t);return Lr(this,i,r,o)?(this.valueHexView=i.subarray(r,r+o),o>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,ok.call(this),this.blockLength=o,r+o):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}kk.NAME="BooleanValueBlock";var Ck;let vc=class extends Qt{getValue(){return this.valueBlock.value}setValue(t){this.valueBlock.value=t}constructor(t={}){super(t,kk),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};Ck=vc,ze.Boolean=Ck,vc.NAME="BOOLEAN";class Ek extends _r(ro){constructor({isConstructed:t=!1,...r}={}){super(r),this.isConstructed=t}fromBER(t,r,o,i){let a=0;if(this.isConstructed){if(this.isHexOnly=!1,a=ro.prototype.fromBER.call(this,t,r,o,i),a===-1)return a;for(let s=0;s<this.value.length;s++){const c=this.value[s].constructor.NAME;if(c===as){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(c!==sk)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,a=super.fromBER(t,r,o),this.blockLength=o;return a}toBER(t,r){return this.isConstructed?ro.prototype.toBER.call(this,t,r):t?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}}Ek.NAME="OctetStringValueBlock";var Pp;let $o=class extends Qt{constructor({idBlock:t={},lenBlock:r={},...o}={}){var i,a;(i=o.isConstructed)!==null&&i!==void 0||(o.isConstructed=!!(!((a=o.value)===null||a===void 0)&&a.length)),super({idBlock:{isConstructed:o.isConstructed,...t},lenBlock:{...r,isIndefiniteForm:!!o.isIndefiniteForm},...o},Ek),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(t,r,o,i){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,o===0)return this.idBlock.error.length===0&&(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length===0&&(this.blockLength+=this.lenBlock.blockLength),r;if(!this.valueBlock.isConstructed){const s=(t instanceof ArrayBuffer?new Uint8Array(t):t).subarray(r,r+o);try{if(s.byteLength){const c=i??ls(),l=Tp(s,0,s.byteLength,c);l.offset!==-1&&l.offset===o&&(this.valueBlock.value=[l.result])}}catch{}}return super.fromBER(t,r,o,i)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return fn.prototype.onAsciiEncoding.call(this);const t=this.constructor.NAME,r=Je.ToHex(this.valueBlock.valueHexView);return`${t} : ${r}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;const t=[];for(const r of this.valueBlock.value)r instanceof Pp&&t.push(r.valueBlock.valueHexView);return qe.concat(t)}};Pp=$o,ze.OctetString=Pp,$o.NAME=sk;class Nk extends _r(ro){constructor({unusedBits:t=0,isConstructed:r=!1,...o}={}){super(o),this.unusedBits=t,this.isConstructed=r,this.blockLength=this.valueHexView.byteLength}fromBER(t,r,o,i){if(!o)return r;let a=-1;if(this.isConstructed){if(a=ro.prototype.fromBER.call(this,t,r,o,i),a===-1)return a;for(const l of this.value){const u=l.constructor.NAME;if(u===as){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(u!==lk)return this.error="BIT STRING may consists of BIT STRINGs only",-1;const p=l.valueBlock;if(this.unusedBits>0&&p.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=p.unusedBits}return a}const s=qe.toUint8Array(t);if(!Lr(this,s,r,o))return-1;const c=s.subarray(r,r+o);if(this.unusedBits=c[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const l=c.subarray(1);try{if(l.byteLength){const u=i??ls(),p=Tp(l,0,l.byteLength,u);p.offset!==-1&&p.offset===o-1&&(this.value=[p.result])}}catch{}}return this.valueHexView=c.subarray(1),this.blockLength=c.length,r+o}toBER(t,r){if(this.isConstructed)return ro.prototype.toBER.call(this,t,r);if(t)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength){const i=new Uint8Array(1);return i[0]=0,i.buffer}const o=new Uint8Array(this.valueHexView.length+1);return o[0]=this.unusedBits,o.set(this.valueHexView,1),o.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}Nk.NAME="BitStringValueBlock";var Sk;let Ro=class extends Qt{constructor({idBlock:t={},lenBlock:r={},...o}={}){var i,a;(i=o.isConstructed)!==null&&i!==void 0||(o.isConstructed=!!(!((a=o.value)===null||a===void 0)&&a.length)),super({idBlock:{isConstructed:o.isConstructed,...t},lenBlock:{...r,isIndefiniteForm:!!o.isIndefiniteForm},...o},Nk),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(t,r,o,i){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(t,r,o,i)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return fn.prototype.onAsciiEncoding.call(this);{const t=[],r=this.valueBlock.valueHexView;for(const s of r)t.push(s.toString(2).padStart(8,"0"));const o=t.join(""),i=this.constructor.NAME,a=o.substring(0,o.length-this.valueBlock.unusedBits);return`${i} : ${a}`}}};Sk=Ro,ze.BitString=Sk,Ro.NAME=lk;var xk;function y8(n,t){const r=new Uint8Array([0]),o=new Uint8Array(n),i=new Uint8Array(t);let a=o.slice(0);const s=a.length-1,c=i.slice(0),l=c.length-1;let u=0;const p=l<s?s:l;let d=0;for(let f=p;f>=0;f--,d++){switch(!0){case d<c.length:u=a[s-d]+c[l-d]+r[0];break;default:u=a[s-d]+r[0]}switch(r[0]=u/10,!0){case d>=a.length:a=Ap(new Uint8Array([u%10]),a);break;default:a[s-d]=u%10}}return r[0]>0&&(a=Ap(r,a)),a}function Ak(n){if(n>=is.length)for(let t=is.length;t<=n;t++){const r=new Uint8Array([0]);let o=is[t-1].slice(0);for(let i=o.length-1;i>=0;i--){const a=new Uint8Array([(o[i]<<1)+r[0]]);r[0]=a[0]/10,o[i]=a[0]%10}r[0]>0&&(o=Ap(r,o)),is.push(o)}return is[n]}function _8(n,t){let r=0;const o=new Uint8Array(n),i=new Uint8Array(t),a=o.slice(0),s=a.length-1,c=i.slice(0),l=c.length-1;let u,p=0;for(let d=l;d>=0;d--,p++)switch(u=a[s-p]-c[l-p]-r,!0){case u<0:r=1,a[s-p]=u+10;break;default:r=0,a[s-p]=u}if(r>0)for(let d=s-l+1;d>=0;d--,p++)if(u=a[s-p]-r,u<0)r=1,a[s-p]=u+10;else{r=0,a[s-p]=u;break}return a.slice()}class Vp extends _r(an){setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=ok.call(this)))}constructor({value:t,...r}={}){super(r),this._valueDec=0,r.valueHex&&this.setValueHex(),t!==void 0&&(this.valueDec=t)}set valueDec(t){this._valueDec=t,this.isHexOnly=!1,this.valueHexView=new Uint8Array(QU(t))}get valueDec(){return this._valueDec}fromDER(t,r,o,i=0){const a=this.fromBER(t,r,o);if(a===-1)return a;const s=this.valueHexView;return s[0]===0&&s[1]&128?this.valueHexView=s.subarray(1):i!==0&&s.length<i&&(i-s.length>1&&(i=s.length+1),this.valueHexView=s.subarray(i-s.length)),a}toDER(t=!1){const r=this.valueHexView;switch(!0){case(r[0]&128)!==0:{const o=new Uint8Array(this.valueHexView.length+1);o[0]=0,o.set(r,1),this.valueHexView=o}break;case(r[0]===0&&(r[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(t)}fromBER(t,r,o){const i=super.fromBER(t,r,o);return i===-1||this.setValueHex(),i}toBER(t){return t?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const t=this.valueHexView.length*8-1;let r=new Uint8Array(this.valueHexView.length*8/3),o=0,i;const a=this.valueHexView;let s="",c=!1;for(let l=a.byteLength-1;l>=0;l--){i=a[l];for(let u=0;u<8;u++){if((i&1)===1)switch(o){case t:r=_8(Ak(o),r),s="-";break;default:r=y8(r,Ak(o))}o++,i>>=1}}for(let l=0;l<r.length;l++)r[l]&&(c=!0),c&&(s+=ik.charAt(r[l]));return c===!1&&(s+=ik.charAt(0)),s}}xk=Vp,Vp.NAME="IntegerValueBlock",Object.defineProperty(xk.prototype,"valueHex",{set:function(n){this.valueHexView=new Uint8Array(n),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});var cs;class ji extends Qt{constructor(t={}){super(t,Vp),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return Nc(),BigInt(this.valueBlock.toString())}static fromBigInt(t){Nc();const r=BigInt(t),o=new Sc,i=r.toString(16).replace(/^-/,""),a=new Uint8Array(Je.FromHex(i));if(r<0){const c=new Uint8Array(a.length+(a[0]&128?1:0));c[0]|=128;const u=BigInt(`0x${Je.ToHex(c)}`)+r,p=qe.toUint8Array(Je.FromHex(u.toString(16)));p[0]|=128,o.write(p)}else a[0]&128&&o.write(new Uint8Array([0])),o.write(a);return new cs({valueHex:o.final()})}convertToDER(){const t=new cs({valueHex:this.valueBlock.valueHexView});return t.valueBlock.toDER(),t}convertFromDER(){return new cs({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}cs=ji,ze.Integer=cs,ji.NAME="INTEGER";var vk;class Ic extends ji{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}vk=Ic,ze.Enumerated=vk,Ic.NAME="ENUMERATED";class $p extends _r(an){constructor({valueDec:t=-1,isFirstSid:r=!1,...o}={}){super(o),this.valueDec=t,this.isFirstSid=r}fromBER(t,r,o){if(!o)return r;const i=qe.toUint8Array(t);if(!Lr(this,i,r,o))return-1;const a=i.subarray(r,r+o);this.valueHexView=new Uint8Array(o);for(let c=0;c<o&&(this.valueHexView[c]=a[c]&127,this.blockLength++,!!(a[c]&128));c++);const s=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength;c++)s[c]=this.valueHexView[c];return this.valueHexView=s,a[this.blockLength-1]&128?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Di(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),r+this.blockLength)}set valueBigInt(t){Nc();let r=BigInt(t).toString(2);for(;r.length%7;)r="0"+r;const o=new Uint8Array(r.length/7);for(let i=0;i<o.length;i++)o[i]=parseInt(r.slice(i*7,i*7+7),2)+(i+1<o.length?128:0);this.fromBER(o.buffer,0,o.length)}toBER(t){if(this.isHexOnly){if(t)return new ArrayBuffer(this.valueHexView.byteLength);const i=this.valueHexView,a=new Uint8Array(this.blockLength);for(let s=0;s<this.blockLength-1;s++)a[s]=i[s]|128;return a[this.blockLength-1]=i[this.blockLength-1],a.buffer}const r=Oo(this.valueDec,7);if(r.byteLength===0)return this.error="Error during encoding SID value",yr;const o=new Uint8Array(r.byteLength);if(!t){const i=new Uint8Array(r),a=r.byteLength-1;for(let s=0;s<a;s++)o[s]=i[s]|128;o[a]=i[a]}return o}toString(){let t="";if(this.isHexOnly)t=Je.ToHex(this.valueHexView);else if(this.isFirstSid){let r=this.valueDec;this.valueDec<=39?t="0.":this.valueDec<=79?(t="1.",r-=40):(t="2.",r-=80),t+=r.toString()}else t=this.valueDec.toString();return t}toJSON(){return{...super.toJSON(),valueDec:this.valueDec,isFirstSid:this.isFirstSid}}}$p.NAME="sidBlock";class Ik extends an{constructor({value:t=wn,...r}={}){super(r),this.value=[],t&&this.fromString(t)}fromBER(t,r,o){let i=r;for(;o>0;){const a=new $p;if(i=a.fromBER(t,i,o),i===-1)return this.blockLength=0,this.error=a.error,i;this.value.length===0&&(a.isFirstSid=!0),this.blockLength+=a.blockLength,o-=a.blockLength,this.value.push(a)}return i}toBER(t){const r=[];for(let o=0;o<this.value.length;o++){const i=this.value[o].toBER(t);if(i.byteLength===0)return this.error=this.value[o].error,yr;r.push(i)}return vp(r)}fromString(t){this.value=[];let r=0,o=0,i="",a=!1;do if(o=t.indexOf(".",r),o===-1?i=t.substring(r):i=t.substring(r,o),r=o+1,a){const s=this.value[0];let c=0;switch(s.valueDec){case 0:break;case 1:c=40;break;case 2:c=80;break;default:this.value=[];return}const l=parseInt(i,10);if(isNaN(l))return;s.valueDec=l+c,a=!1}else{const s=new $p;if(i>Number.MAX_SAFE_INTEGER){Nc();const c=BigInt(i);s.valueBigInt=c}else if(s.valueDec=parseInt(i,10),isNaN(s.valueDec))return;this.value.length||(s.isFirstSid=!0,a=!0),this.value.push(s)}while(o!==-1)}toString(){let t="",r=!1;for(let o=0;o<this.value.length;o++){r=this.value[o].isHexOnly;let i=this.value[o].toString();o!==0&&(t=`${t}.`),r?(i=`{${i}}`,this.value[o].isFirstSid?t=`2.{${i} - 80}`:t+=i):t+=i}return t}toJSON(){const t={...super.toJSON(),value:this.toString(),sidArray:[]};for(let r=0;r<this.value.length;r++)t.sidArray.push(this.value[r].toJSON());return t}}Ik.NAME="ObjectIdentifierValueBlock";var Bk;class Bc extends Qt{getValue(){return this.valueBlock.toString()}setValue(t){this.valueBlock.fromString(t)}constructor(t={}){super(t,Ik),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}Bk=Bc,ze.ObjectIdentifier=Bk,Bc.NAME="OBJECT IDENTIFIER";class Rp extends _r(Po){constructor({valueDec:t=0,...r}={}){super(r),this.valueDec=t}fromBER(t,r,o){if(o===0)return r;const i=qe.toUint8Array(t);if(!Lr(this,i,r,o))return-1;const a=i.subarray(r,r+o);this.valueHexView=new Uint8Array(o);for(let c=0;c<o&&(this.valueHexView[c]=a[c]&127,this.blockLength++,!!(a[c]&128));c++);const s=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength;c++)s[c]=this.valueHexView[c];return this.valueHexView=s,a[this.blockLength-1]&128?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Di(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),r+this.blockLength)}toBER(t){if(this.isHexOnly){if(t)return new ArrayBuffer(this.valueHexView.byteLength);const i=this.valueHexView,a=new Uint8Array(this.blockLength);for(let s=0;s<this.blockLength-1;s++)a[s]=i[s]|128;return a[this.blockLength-1]=i[this.blockLength-1],a.buffer}const r=Oo(this.valueDec,7);if(r.byteLength===0)return this.error="Error during encoding SID value",yr;const o=new Uint8Array(r.byteLength);if(!t){const i=new Uint8Array(r),a=r.byteLength-1;for(let s=0;s<a;s++)o[s]=i[s]|128;o[a]=i[a]}return o.buffer}toString(){let t="";return this.isHexOnly?t=Je.ToHex(this.valueHexView):t=this.valueDec.toString(),t}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}}Rp.NAME="relativeSidBlock";class Tk extends an{constructor({value:t=wn,...r}={}){super(r),this.value=[],t&&this.fromString(t)}fromBER(t,r,o){let i=r;for(;o>0;){const a=new Rp;if(i=a.fromBER(t,i,o),i===-1)return this.blockLength=0,this.error=a.error,i;this.blockLength+=a.blockLength,o-=a.blockLength,this.value.push(a)}return i}toBER(t,r){const o=[];for(let i=0;i<this.value.length;i++){const a=this.value[i].toBER(t);if(a.byteLength===0)return this.error=this.value[i].error,yr;o.push(a)}return vp(o)}fromString(t){this.value=[];let r=0,o=0,i="";do{o=t.indexOf(".",r),o===-1?i=t.substring(r):i=t.substring(r,o),r=o+1;const a=new Rp;if(a.valueDec=parseInt(i,10),isNaN(a.valueDec))return!0;this.value.push(a)}while(o!==-1);return!0}toString(){let t="",r=!1;for(let o=0;o<this.value.length;o++){r=this.value[o].isHexOnly;let i=this.value[o].toString();o!==0&&(t=`${t}.`),r&&(i=`{${i}}`),t+=i}return t}toJSON(){const t={...super.toJSON(),value:this.toString(),sidArray:[]};for(let r=0;r<this.value.length;r++)t.sidArray.push(this.value[r].toJSON());return t}}Tk.NAME="RelativeObjectIdentifierValueBlock";var Ok;class Lp extends Qt{getValue(){return this.valueBlock.toString()}setValue(t){this.valueBlock.fromString(t)}constructor(t={}){super(t,Tk),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}Ok=Lp,ze.RelativeObjectIdentifier=Ok,Lp.NAME="RelativeObjectIdentifier";var Pk;class nr extends fn{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}Pk=nr,ze.Sequence=Pk,nr.NAME="SEQUENCE";var Vk;let br=class extends fn{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};Vk=br,ze.Set=Vk,br.NAME="SET";class $k extends _r(an){constructor({...t}={}){super(t),this.isHexOnly=!0,this.value=wn}toJSON(){return{...super.toJSON(),value:this.value}}}$k.NAME="StringValueBlock";class Rk extends $k{}Rk.NAME="SimpleStringValueBlock";class Tn extends Bp{constructor({...t}={}){super(t,Rk)}fromBuffer(t){this.valueBlock.value=String.fromCharCode.apply(null,qe.toUint8Array(t))}fromString(t){const r=t.length,o=this.valueBlock.valueHexView=new Uint8Array(r);for(let i=0;i<r;i++)o[i]=t.charCodeAt(i);this.valueBlock.value=t}}Tn.NAME="SIMPLE STRING";class Lk extends Tn{fromBuffer(t){this.valueBlock.valueHexView=qe.toUint8Array(t);try{this.valueBlock.value=Je.ToUtf8String(t)}catch(r){this.warnings.push(`Error during "decodeURIComponent": ${r}, using raw string`),this.valueBlock.value=Je.ToBinary(t)}}fromString(t){this.valueBlock.valueHexView=new Uint8Array(Je.FromUtf8String(t)),this.valueBlock.value=t}}Lk.NAME="Utf8StringValueBlock";var Dk;class Dr extends Lk{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}Dk=Dr,ze.Utf8String=Dk,Dr.NAME="UTF8String";class Mk extends Tn{fromBuffer(t){this.valueBlock.value=Je.ToUtf16String(t),this.valueBlock.valueHexView=qe.toUint8Array(t)}fromString(t){this.valueBlock.value=t,this.valueBlock.valueHexView=new Uint8Array(Je.FromUtf16String(t))}}Mk.NAME="BmpStringValueBlock";var jk;class Tc extends Mk{constructor({...t}={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}jk=Tc,ze.BmpString=jk,Tc.NAME="BMPString";class Fk extends Tn{fromBuffer(t){const r=ArrayBuffer.isView(t)?t.slice().buffer:t.slice(0),o=new Uint8Array(r);for(let i=0;i<o.length;i+=4)o[i]=o[i+3],o[i+1]=o[i+2],o[i+2]=0,o[i+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(r))}fromString(t){const r=t.length,o=this.valueBlock.valueHexView=new Uint8Array(r*4);for(let i=0;i<r;i++){const a=Oo(t.charCodeAt(i),8),s=new Uint8Array(a);if(s.length>4)continue;const c=4-s.length;for(let l=s.length-1;l>=0;l--)o[i*4+l+c]=s[l]}this.valueBlock.value=t}}Fk.NAME="UniversalStringValueBlock";var Uk;class Oc extends Fk{constructor({...t}={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}Uk=Oc,ze.UniversalString=Uk,Oc.NAME="UniversalString";var Kk;class Pc extends Tn{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}Kk=Pc,ze.NumericString=Kk,Pc.NAME="NumericString";var qk;class Vc extends Tn{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}qk=Vc,ze.PrintableString=qk,Vc.NAME="PrintableString";var Gk;class $c extends Tn{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}Gk=$c,ze.TeletexString=Gk,$c.NAME="TeletexString";var Hk;class Rc extends Tn{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}Hk=Rc,ze.VideotexString=Hk,Rc.NAME="VideotexString";var zk;class Lc extends Tn{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}zk=Lc,ze.IA5String=zk,Lc.NAME="IA5String";var Wk;class Dc extends Tn{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}Wk=Dc,ze.GraphicString=Wk,Dc.NAME="GraphicString";var Yk;class us extends Tn{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}Yk=us,ze.VisibleString=Yk,us.NAME="VisibleString";var Jk;class Mc extends Tn{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}Jk=Mc,ze.GeneralString=Jk,Mc.NAME="GeneralString";var Xk;class jc extends Tn{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}Xk=jc,ze.CharacterString=Xk,jc.NAME="CharacterString";var Zk;class ds extends us{constructor({value:t,valueDate:r,...o}={}){if(super(o),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,t){this.fromString(t),this.valueBlock.valueHexView=new Uint8Array(t.length);for(let i=0;i<t.length;i++)this.valueBlock.valueHexView[i]=t.charCodeAt(i)}r&&(this.fromDate(r),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(t){this.fromString(String.fromCharCode.apply(null,qe.toUint8Array(t)))}toBuffer(){const t=this.toString(),r=new ArrayBuffer(t.length),o=new Uint8Array(r);for(let i=0;i<t.length;i++)o[i]=t.charCodeAt(i);return r}fromDate(t){this.year=t.getUTCFullYear(),this.month=t.getUTCMonth()+1,this.day=t.getUTCDate(),this.hour=t.getUTCHours(),this.minute=t.getUTCMinutes(),this.second=t.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(t){const o=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig.exec(t);if(o===null){this.error="Wrong input string for conversion";return}const i=parseInt(o[1],10);i>=50?this.year=1900+i:this.year=2e3+i,this.month=parseInt(o[2],10),this.day=parseInt(o[3],10),this.hour=parseInt(o[4],10),this.minute=parseInt(o[5],10),this.second=parseInt(o[6],10)}toString(t="iso"){if(t==="iso"){const r=new Array(7);return r[0]=Bn(this.year<2e3?this.year-1900:this.year-2e3,2),r[1]=Bn(this.month,2),r[2]=Bn(this.day,2),r[3]=Bn(this.hour,2),r[4]=Bn(this.minute,2),r[5]=Bn(this.second,2),r[6]="Z",r.join("")}return super.toString(t)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return{...super.toJSON(),year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second}}}Zk=ds,ze.UTCTime=Zk,ds.NAME="UTCTime";var Qk;class Fc extends ds{constructor(t={}){var r;super(t),(r=this.millisecond)!==null&&r!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(t){super.fromDate(t),this.millisecond=t.getUTCMilliseconds()}toDate(){const t=Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond);return new Date(t)}fromString(t){let r=!1,o="",i="",a=0,s,c=0,l=0;if(t[t.length-1]==="Z")o=t.substring(0,t.length-1),r=!0;else{const d=new Number(t[t.length-1]);if(isNaN(d.valueOf()))throw new Error("Wrong input string for conversion");o=t}if(r){if(o.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(o.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let d=1,f=o.indexOf("+"),m="";if(f===-1&&(f=o.indexOf("-"),d=-1),f!==-1){if(m=o.substring(f+1),o=o.substring(0,f),m.length!==2&&m.length!==4)throw new Error("Wrong input string for conversion");let h=parseInt(m.substring(0,2),10);if(isNaN(h.valueOf()))throw new Error("Wrong input string for conversion");if(c=d*h,m.length===4){if(h=parseInt(m.substring(2,4),10),isNaN(h.valueOf()))throw new Error("Wrong input string for conversion");l=d*h}}}let u=o.indexOf(".");if(u===-1&&(u=o.indexOf(",")),u!==-1){const d=new Number(`0${o.substring(u)}`);if(isNaN(d.valueOf()))throw new Error("Wrong input string for conversion");a=d.valueOf(),i=o.substring(0,u)}else i=o;switch(!0){case i.length===8:if(s=/(\d{4})(\d{2})(\d{2})/ig,u!==-1)throw new Error("Wrong input string for conversion");break;case i.length===10:if(s=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,u!==-1){let d=60*a;this.minute=Math.floor(d),d=60*(d-this.minute),this.second=Math.floor(d),d=1e3*(d-this.second),this.millisecond=Math.floor(d)}break;case i.length===12:if(s=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,u!==-1){let d=60*a;this.second=Math.floor(d),d=1e3*(d-this.second),this.millisecond=Math.floor(d)}break;case i.length===14:if(s=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,u!==-1){const d=1e3*a;this.millisecond=Math.floor(d)}break;default:throw new Error("Wrong input string for conversion")}const p=s.exec(i);if(p===null)throw new Error("Wrong input string for conversion");for(let d=1;d<p.length;d++)switch(d){case 1:this.year=parseInt(p[d],10);break;case 2:this.month=parseInt(p[d],10);break;case 3:this.day=parseInt(p[d],10);break;case 4:this.hour=parseInt(p[d],10)+c;break;case 5:this.minute=parseInt(p[d],10)+l;break;case 6:this.second=parseInt(p[d],10);break;default:throw new Error("Wrong input string for conversion")}if(r===!1){const d=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=d.getUTCFullYear(),this.month=d.getUTCMonth(),this.day=d.getUTCDay(),this.hour=d.getUTCHours(),this.minute=d.getUTCMinutes(),this.second=d.getUTCSeconds(),this.millisecond=d.getUTCMilliseconds()}}toString(t="iso"){if(t==="iso"){const r=[];return r.push(Bn(this.year,4)),r.push(Bn(this.month,2)),r.push(Bn(this.day,2)),r.push(Bn(this.hour,2)),r.push(Bn(this.minute,2)),r.push(Bn(this.second,2)),this.millisecond!==0&&(r.push("."),r.push(Bn(this.millisecond,3))),r.push("Z"),r.join("")}return super.toString(t)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}}Qk=Fc,ze.GeneralizedTime=Qk,Fc.NAME="GeneralizedTime";var e0;class Dp extends Dr{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}e0=Dp,ze.DATE=e0,Dp.NAME="DATE";var t0;class Mp extends Dr{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}t0=Mp,ze.TimeOfDay=t0,Mp.NAME="TimeOfDay";var n0;class jp extends Dr{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}n0=jp,ze.DateTime=n0,jp.NAME="DateTime";var r0;class Fp extends Dr{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}}r0=Fp,ze.Duration=r0,Fp.NAME="Duration";var o0;class Up extends Dr{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}o0=Up,ze.TIME=o0,Up.NAME="TIME";class Lo{constructor({name:t=wn,optional:r=!1}={}){this.name=t,this.optional=r}}class Kp extends Lo{constructor({value:t=[],...r}={}){super(r),this.value=t}}class Uc extends Lo{constructor({value:t=new Lo,local:r=!1,...o}={}){super(o),this.value=t,this.local=r}}class b8{get data(){return this.dataView.slice().buffer}set data(t){this.dataView=qe.toUint8Array(t)}constructor({data:t=xc}={}){this.dataView=qe.toUint8Array(t)}fromBER(t,r,o){const i=r+o;return this.dataView=qe.toUint8Array(t).subarray(r,i),i}toBER(t){return this.dataView.slice().buffer}}function oo(n,t,r){if(r instanceof Kp){for(const a of r.value)if(oo(n,t,a).verified)return{verified:!0,result:n};{const a={verified:!1,result:{error:"Wrong values for Choice type"}};return r.hasOwnProperty(Ip)&&(a.name=r.name),a}}if(r instanceof Lo)return r.hasOwnProperty(Ip)&&(n[r.name]=t),{verified:!0,result:n};if(!(n instanceof Object))return{verified:!1,result:{error:"Wrong root object"}};if(!(t instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 data"}};if(!(r instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(n8 in r))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(a8 in r.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(s8 in r.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const o=r.idBlock.toBER(!1);if(o.byteLength===0)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(r.idBlock.fromBER(o,0,o.byteLength)===-1)return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(r.idBlock.hasOwnProperty(r8)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(r.idBlock.tagClass!==t.idBlock.tagClass)return{verified:!1,result:n};if(r.idBlock.hasOwnProperty(o8)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(r.idBlock.tagNumber!==t.idBlock.tagNumber)return{verified:!1,result:n};if(r.idBlock.hasOwnProperty(i8)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(r.idBlock.isConstructed!==t.idBlock.isConstructed)return{verified:!1,result:n};if(!(t8 in r.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(r.idBlock.isHexOnly!==t.idBlock.isHexOnly)return{verified:!1,result:n};if(r.idBlock.isHexOnly){if(!(ak in r.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const a=r.idBlock.valueHexView,s=t.idBlock.valueHexView;if(a.length!==s.length)return{verified:!1,result:n};for(let c=0;c<a.length;c++)if(a[c]!==s[1])return{verified:!1,result:n}}if(r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,wn),r.name&&(n[r.name]=t)),r instanceof ze.Constructed){let a=0,s={verified:!1,result:{error:"Unknown error"}},c=r.valueBlock.value.length;if(c>0&&r.valueBlock.value[0]instanceof Uc&&(c=t.valueBlock.value.length),c===0)return{verified:!0,result:n};if(t.valueBlock.value.length===0&&r.valueBlock.value.length!==0){let l=!0;for(let u=0;u<r.valueBlock.value.length;u++)l=l&&(r.valueBlock.value[u].optional||!1);return l?{verified:!0,result:n}:(r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,wn),r.name&&delete n[r.name]),n.error="Inconsistent object length",{verified:!1,result:n})}for(let l=0;l<c;l++)if(l-a>=t.valueBlock.value.length){if(r.valueBlock.value[l].optional===!1){const u={verified:!1,result:n};return n.error="Inconsistent length between ASN.1 data and schema",r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,wn),r.name&&(delete n[r.name],u.name=r.name)),u}}else if(r.valueBlock.value[0]instanceof Uc){if(s=oo(n,t.valueBlock.value[l],r.valueBlock.value[0].value),s.verified===!1)if(r.valueBlock.value[0].optional)a++;else return r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,wn),r.name&&delete n[r.name]),s;if(Ip in r.valueBlock.value[0]&&r.valueBlock.value[0].name.length>0){let u={};l8 in r.valueBlock.value[0]&&r.valueBlock.value[0].local?u=t:u=n,typeof u[r.valueBlock.value[0].name]>"u"&&(u[r.valueBlock.value[0].name]=[]),u[r.valueBlock.value[0].name].push(t.valueBlock.value[l])}}else if(s=oo(n,t.valueBlock.value[l-a],r.valueBlock.value[l]),s.verified===!1)if(r.valueBlock.value[l].optional)a++;else return r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,wn),r.name&&delete n[r.name]),s;if(s.verified===!1){const l={verified:!1,result:n};return r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,wn),r.name&&(delete n[r.name],l.name=r.name)),l}return{verified:!0,result:n}}if(r.primitiveSchema&&ak in t.valueBlock){const a=Ac(t.valueBlock.valueHexView);if(a.offset===-1){const s={verified:!1,result:a.result};return r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,wn),r.name&&(delete n[r.name],s.name=r.name)),s}return oo(n,a.result,r.primitiveSchema)}return{verified:!0,result:n}}function w8(n,t){if(!(t instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};const r=Ac(qe.toUint8Array(n));return r.offset===-1?{verified:!1,result:r.result}:oo(r.result,r.result,t)}const i0=Object.freeze(Object.defineProperty({__proto__:null,Any:Lo,BaseBlock:Qt,BaseStringBlock:Bp,BitString:Ro,BmpString:Tc,Boolean:vc,CharacterString:jc,Choice:Kp,Constructed:fn,DATE:Dp,DEFAULT_MAX_CONTENT_LENGTH:hk,DEFAULT_MAX_DEPTH:mk,DEFAULT_MAX_NODES:gk,DateTime:jp,Duration:Fp,EndOfContent:Op,Enumerated:Ic,GeneralString:Mc,GeneralizedTime:Fc,GraphicString:Dc,HexBlock:_r,IA5String:Lc,Integer:ji,Null:Vo,NumericString:Pc,ObjectIdentifier:Bc,OctetString:$o,Primitive:ss,PrintableString:Vc,RawData:b8,RelativeObjectIdentifier:Lp,Repeated:Uc,Sequence:nr,Set:br,TIME:Up,TeletexString:$c,TimeOfDay:Mp,UTCTime:ds,UniversalString:Oc,Utf8String:Dr,ValueBlock:an,VideotexString:Rc,ViewWriter:Sc,VisibleString:us,compareSchema:oo,fromBER:Mi,verifySchema:w8},Symbol.toStringTag,{value:"Module"})),k8="[object ArrayBuffer]",C8="[object SharedArrayBuffer]";function a0(n){return Object.prototype.toString.call(n)}function E8(n){if(ArrayBuffer.isView(n))return!0;if(!n||typeof n!="object")return!1;const t=n;return typeof t.byteOffset=="number"&&typeof t.byteLength=="number"&&qp(t.buffer)}function s0(n){return a0(n)===k8}function N8(n){return typeof SharedArrayBuffer<"u"&&a0(n)===C8}function qp(n){return s0(n)||N8(n)}function S8(n){return E8(n)}function Kc(n){return qp(n)||S8(n)}function l0(n){if(!Kc(n))throw new TypeError("Expected ArrayBuffer, SharedArrayBuffer, or ArrayBufferView")}function qc(n){return l0(n),qp(n)?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}function rr(n){if(l0(n),s0(n))return n;const t=new ArrayBuffer(n.byteLength);return new Uint8Array(t).set(qc(n)),t}function x8(n,t,r={}){const o=qc(n),i=qc(t);if(!r.constantTime&&o.byteLength!==i.byteLength)return!1;const a=Math.max(o.byteLength,i.byteLength);let s=o.byteLength^i.byteLength;for(let c=0;c<a;c++)s|=(o[c]??0)^(i[c]??0);return s===0}var Pe;(function(n){n[n.Sequence=0]="Sequence",n[n.Set=1]="Set",n[n.Choice=2]="Choice"})(Pe||(Pe={}));var me;(function(n){n[n.Any=1]="Any",n[n.Boolean=2]="Boolean",n[n.OctetString=3]="OctetString",n[n.BitString=4]="BitString",n[n.Integer=5]="Integer",n[n.Enumerated=6]="Enumerated",n[n.ObjectIdentifier=7]="ObjectIdentifier",n[n.Utf8String=8]="Utf8String",n[n.BmpString=9]="BmpString",n[n.UniversalString=10]="UniversalString",n[n.NumericString=11]="NumericString",n[n.PrintableString=12]="PrintableString",n[n.TeletexString=13]="TeletexString",n[n.VideotexString=14]="VideotexString",n[n.IA5String=15]="IA5String",n[n.GraphicString=16]="GraphicString",n[n.VisibleString=17]="VisibleString",n[n.GeneralString=18]="GeneralString",n[n.CharacterString=19]="CharacterString",n[n.UTCTime=20]="UTCTime",n[n.GeneralizedTime=21]="GeneralizedTime",n[n.DATE=22]="DATE",n[n.TimeOfDay=23]="TimeOfDay",n[n.DateTime=24]="DateTime",n[n.Duration=25]="Duration",n[n.TIME=26]="TIME",n[n.Null=27]="Null"})(me||(me={}));class Gc{constructor(t,r=0){K(this,"unusedBits",0);K(this,"value",new ArrayBuffer(0));if(t)if(typeof t=="number")this.fromNumber(t);else if(Kc(t))this.unusedBits=r,this.value=rr(t);else throw TypeError("Unsupported type of 'params' argument for BitString")}fromASN(t){if(!(t instanceof Ro))throw new TypeError("Argument 'asn' is not instance of ASN.1 BitString");return this.unusedBits=t.valueBlock.unusedBits,this.value=rr(t.valueBlock.valueHex),this}toASN(){return new Ro({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(t){return new Ro({name:t})}toNumber(){let t="";const r=new Uint8Array(this.value);for(const o of r)t+=o.toString(2).padStart(8,"0");return t=t.split("").reverse().join(""),this.unusedBits&&(t=t.slice(this.unusedBits).padStart(this.unusedBits,"0")),parseInt(t,2)}fromNumber(t){let r=t.toString(2);const o=r.length+7>>3;this.unusedBits=(o<<3)-r.length;const i=new Uint8Array(o);r=r.padStart(o<<3,"0").split("").reverse().join("");let a=0;for(;a<o;)i[a]=parseInt(r.slice(a<<3,(a<<3)+8),2),a++;this.value=i.buffer}}class mt{constructor(t){K(this,"buffer");typeof t=="number"?this.buffer=new ArrayBuffer(t):Kc(t)?this.buffer=rr(t):Array.isArray(t)?this.buffer=new Uint8Array(t).buffer:this.buffer=new ArrayBuffer(0)}get byteLength(){return this.buffer.byteLength}get byteOffset(){return 0}fromASN(t){if(!(t instanceof $o))throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");return this.buffer=rr(t.valueBlock.valueHex),this}toASN(){return new $o({valueHex:this.buffer})}toSchema(t){return new $o({name:t})}}const A8={fromASN:n=>n instanceof Vo?null:rr(n.valueBeforeDecodeView),toASN:n=>{if(n===null)return new Vo;const t=Mi(n);if(t.result.error)throw new Error(t.result.error);return t.result}},v8={fromASN:n=>n.valueBlock.valueHexView.byteLength>=4?n.valueBlock.toString():n.valueBlock.valueDec,toASN:n=>new ji({value:+n})},I8={fromASN:n=>n.valueBlock.valueDec,toASN:n=>new Ic({value:n})},Ot={fromASN:n=>rr(n.valueBlock.valueHexView),toASN:n=>new ji({valueHex:n})},B8={fromASN:n=>rr(n.valueBlock.valueHexView),toASN:n=>new Ro({valueHex:n})},T8={fromASN:n=>n.valueBlock.toString(),toASN:n=>new Bc({value:n})},O8={fromASN:n=>n.valueBlock.value,toASN:n=>new vc({value:n})},Hc={fromASN:n=>rr(n.valueBlock.valueHexView),toASN:n=>new $o({valueHex:n})},P8={fromASN:n=>new mt(n.getValue()),toASN:n=>n.toASN()};function qn(n){return{fromASN:t=>t.valueBlock.value,toASN:t=>new n({value:t})}}const c0=qn(Dr),V8=qn(Tc),$8=qn(Oc),R8=qn(Pc),L8=qn(Vc),D8=qn($c),M8=qn(Rc),j8=qn(Lc),F8=qn(Dc),U8=qn(us),K8=qn(Mc),q8=qn(jc),G8={fromASN:n=>n.toDate(),toASN:n=>new ds({valueDate:n})},H8={fromASN:n=>n.toDate(),toASN:n=>new Fc({valueDate:n})},z8={fromASN:()=>null,toASN:()=>new Vo};function fs(n){switch(n){case me.Any:return A8;case me.BitString:return B8;case me.BmpString:return V8;case me.Boolean:return O8;case me.CharacterString:return q8;case me.Enumerated:return I8;case me.GeneralString:return K8;case me.GeneralizedTime:return H8;case me.GraphicString:return F8;case me.IA5String:return j8;case me.Integer:return v8;case me.Null:return z8;case me.NumericString:return R8;case me.ObjectIdentifier:return T8;case me.OctetString:return Hc;case me.PrintableString:return L8;case me.TeletexString:return D8;case me.UTCTime:return G8;case me.UniversalString:return $8;case me.Utf8String:return c0;case me.VideotexString:return M8;case me.VisibleString:return U8;default:return null}}function Mr(n){return typeof n=="function"&&n.prototype?n.prototype.toASN&&n.prototype.fromASN?!0:Mr(n.prototype):!!(n&&typeof n=="object"&&"toASN"in n&&"fromASN"in n)}function u0(n){var t;if(n){const r=Object.getPrototypeOf(n);return((t=r==null?void 0:r.prototype)==null?void 0:t.constructor)===Array?!0:u0(r)}return!1}function W8(n,t){if(!(n&&t)||n.byteLength!==t.byteLength)return!1;const r=new Uint8Array(n),o=new Uint8Array(t);for(let i=0;i<n.byteLength;i++)if(r[i]!==o[i])return!1;return!0}class Y8{constructor(){K(this,"items",new WeakMap)}has(t){return this.items.has(t)}get(t,r=!1){const o=this.items.get(t);if(!o)throw new Error(`Cannot get schema for '${t.prototype.constructor.name}' target`);if(r&&!o.schema)throw new Error(`Schema '${t.prototype.constructor.name}' doesn't contain ASN.1 schema. Call 'AsnSchemaStorage.cache'.`);return o}cache(t){const r=this.get(t);r.schema||(r.schema=this.create(t,!0))}createDefault(t){const r={type:Pe.Sequence,items:{}},o=this.findParentSchema(t);return o&&(Object.assign(r,o),r.items=Object.assign({},r.items,o.items)),r}create(t,r){const o=this.items.get(t)||this.createDefault(t),i=[];for(const a in o.items){const s=o.items[a],c=r?a:"";let l;if(typeof s.type=="number"){const p=me[s.type],d=i0[p];if(!d)throw new Error(`Cannot get ASN1 class by name '${p}'`);l=new d({name:c})}else Mr(s.type)?l=new s.type().toSchema(c):s.optional?this.get(s.type).type===Pe.Choice?l=new Lo({name:c}):(l=this.create(s.type,!1),l.name=c):l=new Lo({name:c});const u=!!s.optional||s.defaultValue!==void 0;if(s.repeated){l.name="";const p=s.repeated==="set"?br:nr;l=new p({name:"",value:[new Uc({name:c,value:l})]})}if(s.context!==null&&s.context!==void 0)if(s.implicit)if(typeof s.type=="number"||Mr(s.type)){const p=s.repeated?fn:ss;i.push(new p({name:c,optional:u,idBlock:{tagClass:3,tagNumber:s.context}}))}else{this.cache(s.type);const p=!!s.repeated;let d=p?l:this.get(s.type,!0).schema;d="valueBlock"in d?d.valueBlock.value:d.value,i.push(new fn({name:p?"":c,optional:u,idBlock:{tagClass:3,tagNumber:s.context},value:d}))}else i.push(new fn({optional:u,idBlock:{tagClass:3,tagNumber:s.context},value:[l]}));else l.optional=u,i.push(l)}switch(o.type){case Pe.Sequence:return new nr({value:i,name:""});case Pe.Set:return new br({value:i,name:""});case Pe.Choice:return new Kp({value:i,name:""});default:throw new Error("Unsupported ASN1 type in use")}}set(t,r){return this.items.set(t,r),this}findParentSchema(t){const r=Object.getPrototypeOf(t);return r?this.items.get(r)||this.findParentSchema(r):null}}const nn=new Y8,Le=n=>t=>{let r;nn.has(t)?r=nn.get(t):(r=nn.createDefault(t),nn.set(t,r)),Object.assign(r,n)},H=n=>(t,r)=>{let o;nn.has(t.constructor)?o=nn.get(t.constructor):(o=nn.createDefault(t.constructor),nn.set(t.constructor,o));const i=Object.assign({},n);if(typeof i.type=="number"&&!i.converter){const a=fs(n.type);if(!a)throw new Error(`Cannot get default converter for property '${r}' of ${t.constructor.name}`);i.converter=a}i.raw=n.raw,o.items[r]=i};class ps extends Error{constructor(){super(...arguments);K(this,"schemas",[])}}class J8{static parse(t,r,o){const i=Mi(rr(t),o==null?void 0:o.berOptions);if(i.result.error)throw new Error(i.result.error);return this.fromASN(i.result,r,o)}static fromASN(t,r,o){try{if(Mr(r))return new r().fromASN(t);const i=nn.get(r);nn.cache(r);let a=i.schema;const s=this.handleChoiceTypes(t,i,r,a,o);if(s!=null&&s.result)return s.result;s!=null&&s.targetSchema&&(a=s.targetSchema);const c=this.handleSequenceTypes(t,i,r,a),l=new r;return u0(r)?this.handleArrayTypes(t,i,r,o):(this.processSchemaItems(i,c,l,o),l)}catch(i){throw i instanceof ps&&i.schemas.push(r.name),i}}static handleChoiceTypes(t,r,o,i,a){if(t.constructor===fn&&r.type===Pe.Choice&&t.idBlock.tagClass===3)for(const s in r.items){const c=r.items[s];if(c.context===t.idBlock.tagNumber&&c.implicit&&typeof c.type=="function"&&nn.has(c.type)){const l=nn.get(c.type);if(l&&l.type===Pe.Sequence){const u=new nr;if("value"in t.valueBlock&&Array.isArray(t.valueBlock.value)&&"value"in u.valueBlock){u.valueBlock.value=t.valueBlock.value;const p=this.fromASN(u,c.type,a),d=new o;return d[s]=p,{result:d}}}}}else if(t.constructor===fn&&r.type!==Pe.Choice){const s=new fn({idBlock:{tagClass:3,tagNumber:t.idBlock.tagNumber},value:r.schema.valueBlock.value});for(const c in r.items)delete t[c];return{targetSchema:s}}return null}static handleSequenceTypes(t,r,o,i){if(r.type===Pe.Sequence){const a=oo({},t,i);if(!a.verified)throw new ps(`Data does not match to ${o.name} ASN1 schema.${a.result.error?` ${a.result.error}`:""}`);return a}else{const a=oo({},t,i);if(!a.verified)throw new ps(`Data does not match to ${o.name} ASN1 schema.${a.result.error?` ${a.result.error}`:""}`);return a}}static processRepeatedField(t,r,o){let i=t.slice(r);if(i.length===1&&i[0].constructor.name==="Sequence"){const a=i[0];a.valueBlock&&a.valueBlock.value&&Array.isArray(a.valueBlock.value)&&(i=a.valueBlock.value)}if(typeof o.type=="number"){const a=fs(o.type);if(!a)throw new Error(`No converter for ASN.1 type ${o.type}`);return i.filter(s=>s&&s.valueBlock).map(s=>{try{return a.fromASN(s)}catch{return}}).filter(s=>s!==void 0)}else return i.filter(a=>a&&a.valueBlock).map(a=>{try{return this.fromASN(a,o.type)}catch{return}}).filter(a=>a!==void 0)}static processPrimitiveField(t,r){const o=fs(r.type);if(!o)throw new Error(`No converter for ASN.1 type ${r.type}`);return o.fromASN(t)}static isOptionalChoiceField(t){return t.optional&&typeof t.type=="function"&&nn.has(t.type)&&nn.get(t.type).type===Pe.Choice}static processOptionalChoiceField(t,r){try{return{processed:!0,value:this.fromASN(t,r.type)}}catch(o){if(o instanceof ps&&/Wrong values for Choice type/.test(o.message))return{processed:!1};throw o}}static handleArrayTypes(t,r,o,i){if(!("value"in t.valueBlock&&Array.isArray(t.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const a=r.itemType;if(typeof a=="number"){const s=fs(a);if(!s)throw new Error(`Cannot get default converter for array item of ${o.name} ASN1 schema`);return o.from(t.valueBlock.value,c=>s.fromASN(c))}else return o.from(t.valueBlock.value,s=>this.fromASN(s,a,i))}static processSchemaItems(t,r,o,i){for(const a in t.items){const s=r.result[a];if(!s)continue;const c=t.items[a],l=c.type;let u;typeof l=="number"||Mr(l)?u=this.processPrimitiveSchemaItem(s,c,l,i):u=this.processComplexSchemaItem(s,c,l,i),u&&typeof u=="object"&&"value"in u&&"raw"in u?(o[a]=u.value,o[`${a}Raw`]=u.raw):o[a]=u}}static processPrimitiveSchemaItem(t,r,o,i){const a=r.converter??(Mr(o)?new o:null);if(!a)throw new Error("Converter is empty");return r.repeated?this.processRepeatedPrimitiveItem(t,r,a,i):this.processSinglePrimitiveItem(t,r,o,a,i)}static processRepeatedPrimitiveItem(t,r,o,i){if(r.implicit){const a=r.repeated==="sequence"?nr:br,s=new a;s.valueBlock=t.valueBlock;const c=Mi(s.toBER(!1),i==null?void 0:i.berOptions);if(c.offset===-1)throw new Error(`Cannot parse the child item. ${c.result.error}`);if(!("value"in c.result.valueBlock&&Array.isArray(c.result.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const l=c.result.valueBlock.value;return Array.from(l,u=>o.fromASN(u))}else return Array.from(t,a=>o.fromASN(a))}static processSinglePrimitiveItem(t,r,o,i,a){let s=t;if(r.implicit){let c;if(Mr(o))c=new o().toSchema("");else{const l=me[o],u=i0[l];if(!u)throw new Error(`Cannot get '${l}' class from asn1js module`);c=new u}c.valueBlock=s.valueBlock,s=Mi(c.toBER(!1),a==null?void 0:a.berOptions).result}return i.fromASN(s)}static processComplexSchemaItem(t,r,o,i){if(r.repeated){if(!Array.isArray(t))throw new Error("Cannot get list of items from the ASN.1 parsed value. ASN.1 value should be iterable.");return Array.from(t,a=>this.fromASN(a,o,i))}else{const a=this.handleImplicitTagging(t,r,o);if(this.isOptionalChoiceField(r))try{return this.fromASN(a,o,i)}catch(s){if(s instanceof ps&&/Wrong values for Choice type/.test(s.message))return;throw s}else{const s=this.fromASN(a,o,i);return r.raw?{value:s,raw:t.valueBeforeDecodeView}:s}}}static handleImplicitTagging(t,r,o){if(r.implicit&&typeof r.context=="number"){const i=nn.get(o);if(i.type===Pe.Sequence){const a=new nr;if("value"in t.valueBlock&&Array.isArray(t.valueBlock.value)&&"value"in a.valueBlock)return a.valueBlock.value=t.valueBlock.value,a}else if(i.type===Pe.Set){const a=new br;if("value"in t.valueBlock&&Array.isArray(t.valueBlock.value)&&"value"in a.valueBlock)return a.valueBlock.value=t.valueBlock.value,a}}return t}}class Gp{static serialize(t){return t instanceof Qt?t.toBER(!1):this.toASN(t).toBER(!1)}static toASN(t){if(t&&typeof t=="object"&&Mr(t))return t.toASN();if(!(t&&typeof t=="object"))throw new TypeError("Parameter 1 should be type of Object.");const r=t.constructor,o=nn.get(r);nn.cache(r);let i=[];if(o.itemType){if(!Array.isArray(t))throw new TypeError("Parameter 1 should be type of Array.");if(typeof o.itemType=="number"){const s=fs(o.itemType);if(!s)throw new Error(`Cannot get default converter for array item of ${r.name} ASN1 schema`);i=t.map(c=>s.toASN(c))}else i=t.map(s=>this.toAsnItem({type:o.itemType},"[]",r,s))}else for(const s in o.items){const c=o.items[s],l=t[s];if(l===void 0||c.defaultValue===l||typeof c.defaultValue=="object"&&typeof l=="object"&&W8(this.serialize(c.defaultValue),this.serialize(l)))continue;const u=Gp.toAsnItem(c,s,r,l);if(typeof c.context=="number")if(c.implicit)if(!c.repeated&&(typeof c.type=="number"||Mr(c.type))){const p={};p.valueHex=u instanceof Vo?rr(u.valueBeforeDecodeView):u.valueBlock.toBER(),i.push(new ss({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},...p}))}else i.push(new fn({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},value:u.valueBlock.value}));else i.push(new fn({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},value:[u]}));else c.repeated?i=i.concat(u):i.push(u)}let a;switch(o.type){case Pe.Sequence:a=new nr({value:i});break;case Pe.Set:a=new br({value:i});break;case Pe.Choice:if(!i[0])throw new Error(`Schema '${r.name}' has wrong data. Choice cannot be empty.`);a=i[0];break}return a}static toAsnItem(t,r,o,i){let a;if(typeof t.type=="number"){const s=t.converter;if(!s)throw new Error(`Property '${r}' doesn't have converter for type ${me[t.type]} in schema '${o.name}'`);if(t.repeated){if(!Array.isArray(i))throw new TypeError("Parameter 'objProp' should be type of Array.");const c=Array.from(i,u=>s.toASN(u)),l=t.repeated==="sequence"?nr:br;a=new l({value:c})}else a=s.toASN(i)}else if(t.repeated){if(!Array.isArray(i))throw new TypeError("Parameter 'objProp' should be type of Array.");const s=Array.from(i,l=>this.toASN(l)),c=t.repeated==="sequence"?nr:br;a=new c({value:s})}else a=this.toASN(i);return a}}class kt extends Array{constructor(t=[]){if(typeof t=="number")super(t);else{super();for(const r of t)this.push(r)}}}class Ue{static serialize(t){return Gp.serialize(t)}static parse(t,r,o){return J8.parse(t,r,o)}static toString(t,r){const o=Kc(t)?rr(t):Ue.serialize(t),i=Mi(o,r==null?void 0:r.berOptions);if(i.offset===-1)throw new Error(`Cannot decode ASN.1 data. ${i.result.error}`);return i.result.toString()}}function B(n,t,r,o){var i=arguments.length,a=i<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,r):o,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,r,o);else for(var c=n.length-1;c>=0;c--)(s=n[c])&&(a=(i<3?s(a):i>3?s(t,r,a):s(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}function at(n,t,r,o){if(r==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!o:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?o:r==="a"?o.call(n):o?o.value:t.get(n)}function Vt(n,t,r,o,i){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?n!==t||!i:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?i.call(n,r):i?i.value=r:t.set(n,r),r}typeof SuppressedError=="function"&&SuppressedError;function d0(n,t){if(!t)return n.join("");if(!Number.isInteger(t.size)||t.size<1)throw new RangeError("Hex group size must be a positive integer");const r=[];for(let o=0;o<n.length;o+=t.size)r.push(n.slice(o,o+t.size).join(""));return r.join(t.separator)}function f0(n,t={}){const r=qc(n),o=t.case??"lower",i=Array.from(r,s=>{const c=s.toString(16).padStart(2,"0");return o==="upper"?c.toUpperCase():c});let a="";if(t.line){const s=t.line.bytesPerLine;if(!Number.isInteger(s)||s<1)throw new RangeError("Hex bytesPerLine must be a positive integer");const c=t.line.separator??`
520
+ `,l=[];for(let u=0;u<i.length;u+=s)l.push(d0(i.slice(u,u+s),t.group));a=l.join(c)}else a=d0(i,t.group);return`${t.prefix??""}${a}`}class p0{static isIPv4(t){return/^(\d{1,3}\.){3}\d{1,3}$/.test(t)}static parseIPv4(t){const r=t.split(".");if(r.length!==4)throw new Error("Invalid IPv4 address");return r.map(o=>{const i=parseInt(o,10);if(isNaN(i)||i<0||i>255)throw new Error("Invalid IPv4 address part");return i})}static parseIPv6(t){const o=this.expandIPv6(t).split(":");if(o.length!==8)throw new Error("Invalid IPv6 address");return o.reduce((i,a)=>{const s=parseInt(a,16);if(isNaN(s)||s<0||s>65535)throw new Error("Invalid IPv6 address part");return i.push(s>>8&255),i.push(s&255),i},[])}static expandIPv6(t){if(!t.includes("::"))return t;const r=t.split("::");if(r.length>2)throw new Error("Invalid IPv6 address");const o=r[0]?r[0].split(":"):[],i=r[1]?r[1].split(":"):[],a=8-(o.length+i.length);if(a<0)throw new Error("Invalid IPv6 address");return[...o,...Array(a).fill("0"),...i].join(":")}static formatIPv6(t){const r=[];for(let o=0;o<16;o+=2)r.push((t[o]<<8|t[o+1]).toString(16));return this.compressIPv6(r.join(":"))}static compressIPv6(t){const r=t.split(":");let o=-1,i=0,a=-1,s=0;for(let c=0;c<r.length;c++)r[c]==="0"?(a===-1&&(a=c),s++):(s>i&&(o=a,i=s),a=-1,s=0);if(s>i&&(o=a,i=s),i>1){const c=r.slice(0,o).join(":"),l=r.slice(o+i).join(":");return`${c}::${l}`}return t}static parseCIDR(t){const[r,o]=t.split("/"),i=parseInt(o,10);if(this.isIPv4(r)){if(i<0||i>32)throw new Error("Invalid IPv4 prefix length");return[this.parseIPv4(r),i]}else{if(i<0||i>128)throw new Error("Invalid IPv6 prefix length");return[this.parseIPv6(r),i]}}static decodeIP(t){if(t.length===64&&parseInt(t,16)===0)return"::/0";if(t.length!==16)return t;const r=parseInt(t.slice(8),16).toString(2).split("").reduce((i,a)=>i+ +a,0);let o=t.slice(0,8).replace(/(.{2})/g,i=>`${parseInt(i,16)}.`);return o=o.slice(0,-1),`${o}/${r}`}static toString(t){const r=new Uint8Array(t);if(r.length===4)return Array.from(r).join(".");if(r.length===16)return this.formatIPv6(r);if(r.length===8||r.length===32){const o=r.length/2,i=r.slice(0,o),a=r.slice(o);if(r.every(l=>l===0))return r.length===8?"0.0.0.0/0":"::/0";const c=a.reduce((l,u)=>l+(u.toString(2).match(/1/g)||[]).length,0);return r.length===8?`${Array.from(i).join(".")}/${c}`:`${this.formatIPv6(i)}/${c}`}return this.decodeIP(f0(t))}static fromString(t){if(t.includes("/")){const[o,i]=this.parseCIDR(t),a=new Uint8Array(o.length);let s=i;for(let l=0;l<a.length;l++)s>=8?(a[l]=255,s-=8):s>0&&(a[l]=255<<8-s,s=0);const c=new Uint8Array(o.length*2);return c.set(o,0),c.set(a,o.length),c.buffer}const r=this.isIPv4(t)?this.parseIPv4(t):this.parseIPv6(t);return new Uint8Array(r).buffer}}var Hp,zp,Wp;let rn=class{constructor(t={}){K(this,"teletexString");K(this,"printableString");K(this,"universalString");K(this,"utf8String");K(this,"bmpString");Object.assign(this,t)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};B([H({type:me.TeletexString})],rn.prototype,"teletexString",void 0),B([H({type:me.PrintableString})],rn.prototype,"printableString",void 0),B([H({type:me.UniversalString})],rn.prototype,"universalString",void 0),B([H({type:me.Utf8String})],rn.prototype,"utf8String",void 0),B([H({type:me.BmpString})],rn.prototype,"bmpString",void 0),rn=B([Le({type:Pe.Choice})],rn);let Fi=class extends rn{constructor(r={}){super(r);K(this,"ia5String");K(this,"anyValue");Object.assign(this,r)}toString(){return this.ia5String||(this.anyValue?f0(this.anyValue):super.toString())}};B([H({type:me.IA5String})],Fi.prototype,"ia5String",void 0),B([H({type:me.Any})],Fi.prototype,"anyValue",void 0),Fi=B([Le({type:Pe.Choice})],Fi);class zc{constructor(t={}){K(this,"type","");K(this,"value",new Fi);Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],zc.prototype,"type",void 0),B([H({type:Fi})],zc.prototype,"value",void 0);let Ui=Hp=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,Hp.prototype)}};Ui=Hp=B([Le({type:Pe.Set,itemType:zc})],Ui);let Yp=zp=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,zp.prototype)}};Yp=zp=B([Le({type:Pe.Sequence,itemType:Ui})],Yp);let Wt=Wp=class extends Yp{constructor(t){super(t),Object.setPrototypeOf(this,Wp.prototype)}};Wt=Wp=B([Le({type:Pe.Sequence})],Wt);const X8={fromASN:n=>p0.toString(Hc.fromASN(n)),toASN:n=>Hc.toASN(p0.fromString(n))};class ms{constructor(t={}){K(this,"typeId","");K(this,"value",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],ms.prototype,"typeId",void 0),B([H({type:me.Any,context:0})],ms.prototype,"value",void 0);class Jp{constructor(t={}){K(this,"nameAssigner");K(this,"partyName",new rn);Object.assign(this,t)}}B([H({type:rn,optional:!0,context:0,implicit:!0})],Jp.prototype,"nameAssigner",void 0),B([H({type:rn,context:1,implicit:!0})],Jp.prototype,"partyName",void 0);let ot=class{constructor(t={}){K(this,"otherName");K(this,"rfc822Name");K(this,"dNSName");K(this,"x400Address");K(this,"directoryName");K(this,"ediPartyName");K(this,"uniformResourceIdentifier");K(this,"iPAddress");K(this,"registeredID");Object.assign(this,t)}};B([H({type:ms,context:0,implicit:!0})],ot.prototype,"otherName",void 0),B([H({type:me.IA5String,context:1,implicit:!0})],ot.prototype,"rfc822Name",void 0),B([H({type:me.IA5String,context:2,implicit:!0})],ot.prototype,"dNSName",void 0),B([H({type:me.Any,context:3,implicit:!0})],ot.prototype,"x400Address",void 0),B([H({type:Wt,context:4,implicit:!1})],ot.prototype,"directoryName",void 0),B([H({type:Jp,context:5})],ot.prototype,"ediPartyName",void 0),B([H({type:me.IA5String,context:6,implicit:!0})],ot.prototype,"uniformResourceIdentifier",void 0),B([H({type:me.OctetString,context:7,implicit:!0,converter:X8})],ot.prototype,"iPAddress",void 0),B([H({type:me.ObjectIdentifier,context:8,implicit:!0})],ot.prototype,"registeredID",void 0),ot=B([Le({type:Pe.Choice})],ot);const Xp="1.3.6.1.5.5.7",Z8=`${Xp}.1`,Ki=`${Xp}.3`,Wc=`${Xp}.48`,m0=`${Wc}.1`,g0=`${Wc}.2`,h0=`${Wc}.3`,y0=`${Wc}.5`,jr="2.5.29";var Zp;const Qp=`${Z8}.1`;class gs{constructor(t={}){K(this,"accessMethod","");K(this,"accessLocation",new ot);Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],gs.prototype,"accessMethod",void 0),B([H({type:ot})],gs.prototype,"accessLocation",void 0);let qi=Zp=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,Zp.prototype)}};qi=Zp=B([Le({type:Pe.Sequence,itemType:gs})],qi);const em=`${jr}.35`;class tm extends mt{}class Do{constructor(t={}){K(this,"keyIdentifier");K(this,"authorityCertIssuer");K(this,"authorityCertSerialNumber");t&&Object.assign(this,t)}}B([H({type:tm,context:0,optional:!0,implicit:!0})],Do.prototype,"keyIdentifier",void 0),B([H({type:ot,context:1,optional:!0,implicit:!0,repeated:"sequence"})],Do.prototype,"authorityCertIssuer",void 0),B([H({type:me.Integer,context:2,optional:!0,implicit:!0,converter:Ot})],Do.prototype,"authorityCertSerialNumber",void 0);const _0=`${jr}.19`;class Yc{constructor(t={}){K(this,"cA",!1);K(this,"pathLenConstraint");Object.assign(this,t)}}B([H({type:me.Boolean,defaultValue:!1})],Yc.prototype,"cA",void 0),B([H({type:me.Integer,optional:!0})],Yc.prototype,"pathLenConstraint",void 0);var nm;let sn=nm=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,nm.prototype)}};sn=nm=B([Le({type:Pe.Sequence,itemType:ot})],sn);var rm;let b0=rm=class extends sn{constructor(t){super(t),Object.setPrototypeOf(this,rm.prototype)}};b0=rm=B([Le({type:Pe.Sequence})],b0);var om;const w0=`${jr}.32`;let Fr=class{constructor(t={}){K(this,"ia5String");K(this,"visibleString");K(this,"bmpString");K(this,"utf8String");Object.assign(this,t)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String||""}};B([H({type:me.IA5String})],Fr.prototype,"ia5String",void 0),B([H({type:me.VisibleString})],Fr.prototype,"visibleString",void 0),B([H({type:me.BmpString})],Fr.prototype,"bmpString",void 0),B([H({type:me.Utf8String})],Fr.prototype,"utf8String",void 0),Fr=B([Le({type:Pe.Choice})],Fr);class im{constructor(t={}){K(this,"organization",new Fr);K(this,"noticeNumbers",[]);Object.assign(this,t)}}B([H({type:Fr})],im.prototype,"organization",void 0),B([H({type:me.Integer,repeated:"sequence"})],im.prototype,"noticeNumbers",void 0);class am{constructor(t={}){K(this,"noticeRef");K(this,"explicitText");Object.assign(this,t)}}B([H({type:im,optional:!0})],am.prototype,"noticeRef",void 0),B([H({type:Fr,optional:!0})],am.prototype,"explicitText",void 0);let Jc=class{constructor(t={}){K(this,"cPSuri");K(this,"userNotice");Object.assign(this,t)}};B([H({type:me.IA5String})],Jc.prototype,"cPSuri",void 0),B([H({type:am})],Jc.prototype,"userNotice",void 0),Jc=B([Le({type:Pe.Choice})],Jc);class sm{constructor(t={}){K(this,"policyQualifierId","");K(this,"qualifier",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],sm.prototype,"policyQualifierId",void 0),B([H({type:me.Any})],sm.prototype,"qualifier",void 0);class Xc{constructor(t={}){K(this,"policyIdentifier","");K(this,"policyQualifiers");Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],Xc.prototype,"policyIdentifier",void 0),B([H({type:sm,repeated:"sequence",optional:!0})],Xc.prototype,"policyQualifiers",void 0);let Zc=om=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,om.prototype)}};Zc=om=B([Le({type:Pe.Sequence,itemType:Xc})],Zc);let Qc=class{constructor(t=0){K(this,"value");this.value=t}};B([H({type:me.Integer})],Qc.prototype,"value",void 0),Qc=B([Le({type:Pe.Choice})],Qc);let k0=class extends Qc{};k0=B([Le({type:Pe.Choice})],k0);var lm;const cm=`${jr}.31`;var or;(function(n){n[n.unused=1]="unused",n[n.keyCompromise=2]="keyCompromise",n[n.cACompromise=4]="cACompromise",n[n.affiliationChanged=8]="affiliationChanged",n[n.superseded=16]="superseded",n[n.cessationOfOperation=32]="cessationOfOperation",n[n.certificateHold=64]="certificateHold",n[n.privilegeWithdrawn=128]="privilegeWithdrawn",n[n.aACompromise=256]="aACompromise"})(or||(or={}));class C0 extends Gc{toJSON(){const t=[],r=this.toNumber();return r&or.aACompromise&&t.push("aACompromise"),r&or.affiliationChanged&&t.push("affiliationChanged"),r&or.cACompromise&&t.push("cACompromise"),r&or.certificateHold&&t.push("certificateHold"),r&or.cessationOfOperation&&t.push("cessationOfOperation"),r&or.keyCompromise&&t.push("keyCompromise"),r&or.privilegeWithdrawn&&t.push("privilegeWithdrawn"),r&or.superseded&&t.push("superseded"),r&or.unused&&t.push("unused"),t}toString(){return`[${this.toJSON().join(", ")}]`}}let Mo=class{constructor(t={}){K(this,"fullName");K(this,"nameRelativeToCRLIssuer");Object.assign(this,t)}};B([H({type:ot,context:0,repeated:"sequence",implicit:!0})],Mo.prototype,"fullName",void 0),B([H({type:Ui,context:1,implicit:!0})],Mo.prototype,"nameRelativeToCRLIssuer",void 0),Mo=B([Le({type:Pe.Choice})],Mo);class Gi{constructor(t={}){K(this,"distributionPoint");K(this,"reasons");K(this,"cRLIssuer");Object.assign(this,t)}}B([H({type:Mo,context:0,optional:!0})],Gi.prototype,"distributionPoint",void 0),B([H({type:C0,context:1,optional:!0,implicit:!0})],Gi.prototype,"reasons",void 0),B([H({type:ot,context:2,optional:!0,repeated:"sequence",implicit:!0})],Gi.prototype,"cRLIssuer",void 0);let Hi=lm=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,lm.prototype)}};Hi=lm=B([Le({type:Pe.Sequence,itemType:Gi})],Hi);var um;let E0=um=class extends Hi{constructor(t){super(t),Object.setPrototypeOf(this,um.prototype)}};E0=um=B([Le({type:Pe.Sequence,itemType:Gi})],E0);const Jo=class Jo{constructor(t={}){K(this,"distributionPoint");K(this,"onlyContainsUserCerts",Jo.ONLY);K(this,"onlyContainsCACerts",Jo.ONLY);K(this,"onlySomeReasons");K(this,"indirectCRL",Jo.ONLY);K(this,"onlyContainsAttributeCerts",Jo.ONLY);Object.assign(this,t)}};K(Jo,"ONLY",!1);let Gn=Jo;B([H({type:Mo,context:0,optional:!0})],Gn.prototype,"distributionPoint",void 0),B([H({type:me.Boolean,context:1,defaultValue:Gn.ONLY,implicit:!0})],Gn.prototype,"onlyContainsUserCerts",void 0),B([H({type:me.Boolean,context:2,defaultValue:Gn.ONLY,implicit:!0})],Gn.prototype,"onlyContainsCACerts",void 0),B([H({type:C0,context:3,optional:!0,implicit:!0})],Gn.prototype,"onlySomeReasons",void 0),B([H({type:me.Boolean,context:4,defaultValue:Gn.ONLY,implicit:!0})],Gn.prototype,"indirectCRL",void 0),B([H({type:me.Boolean,context:5,defaultValue:Gn.ONLY,implicit:!0})],Gn.prototype,"onlyContainsAttributeCerts",void 0);var hs;(function(n){n[n.unspecified=0]="unspecified",n[n.keyCompromise=1]="keyCompromise",n[n.cACompromise=2]="cACompromise",n[n.affiliationChanged=3]="affiliationChanged",n[n.superseded=4]="superseded",n[n.cessationOfOperation=5]="cessationOfOperation",n[n.certificateHold=6]="certificateHold",n[n.removeFromCRL=8]="removeFromCRL",n[n.privilegeWithdrawn=9]="privilegeWithdrawn",n[n.aACompromise=10]="aACompromise"})(hs||(hs={}));let dm=class{constructor(t=hs.unspecified){K(this,"reason",hs.unspecified);this.reason=t}toJSON(){return hs[this.reason]}toString(){return this.toJSON()}};B([H({type:me.Enumerated})],dm.prototype,"reason",void 0),dm=B([Le({type:Pe.Choice})],dm);var fm;const N0=`${jr}.37`;let eu=fm=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,fm.prototype)}};eu=fm=B([Le({type:Pe.Sequence,itemType:me.ObjectIdentifier})],eu);const Q8=`${Ki}.1`,eK=`${Ki}.2`,tK=`${Ki}.3`,nK=`${Ki}.4`,rK=`${Ki}.8`,oK=`${Ki}.9`;let pm=class{constructor(t=new ArrayBuffer(0)){K(this,"value");this.value=t}};B([H({type:me.Integer,converter:Ot})],pm.prototype,"value",void 0),pm=B([Le({type:Pe.Choice})],pm);let mm=class{constructor(t){K(this,"value",new Date);t&&(this.value=t)}};B([H({type:me.GeneralizedTime})],mm.prototype,"value",void 0),mm=B([Le({type:Pe.Choice})],mm);var gm;const S0=`${jr}.18`;let x0=gm=class extends sn{constructor(t){super(t),Object.setPrototypeOf(this,gm.prototype)}};x0=gm=B([Le({type:Pe.Sequence})],x0);const A0=`${jr}.15`;var ir;(function(n){n[n.digitalSignature=1]="digitalSignature",n[n.nonRepudiation=2]="nonRepudiation",n[n.keyEncipherment=4]="keyEncipherment",n[n.dataEncipherment=8]="dataEncipherment",n[n.keyAgreement=16]="keyAgreement",n[n.keyCertSign=32]="keyCertSign",n[n.cRLSign=64]="cRLSign",n[n.encipherOnly=128]="encipherOnly",n[n.decipherOnly=256]="decipherOnly"})(ir||(ir={}));class hm extends Gc{toJSON(){const t=this.toNumber(),r=[];return t&ir.cRLSign&&r.push("crlSign"),t&ir.dataEncipherment&&r.push("dataEncipherment"),t&ir.decipherOnly&&r.push("decipherOnly"),t&ir.digitalSignature&&r.push("digitalSignature"),t&ir.encipherOnly&&r.push("encipherOnly"),t&ir.keyAgreement&&r.push("keyAgreement"),t&ir.keyCertSign&&r.push("keyCertSign"),t&ir.keyEncipherment&&r.push("keyEncipherment"),t&ir.nonRepudiation&&r.push("nonRepudiation"),r}toString(){return`[${this.toJSON().join(", ")}]`}}var ym;class tu{constructor(t={}){K(this,"base",new ot);K(this,"minimum",0);K(this,"maximum");Object.assign(this,t)}}B([H({type:ot})],tu.prototype,"base",void 0),B([H({type:me.Integer,context:0,defaultValue:0,implicit:!0})],tu.prototype,"minimum",void 0),B([H({type:me.Integer,context:1,optional:!0,implicit:!0})],tu.prototype,"maximum",void 0);let nu=ym=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,ym.prototype)}};nu=ym=B([Le({type:Pe.Sequence,itemType:tu})],nu);class v0{constructor(t={}){K(this,"permittedSubtrees");K(this,"excludedSubtrees");Object.assign(this,t)}}B([H({type:nu,context:0,optional:!0,implicit:!0})],v0.prototype,"permittedSubtrees",void 0),B([H({type:nu,context:1,optional:!0,implicit:!0})],v0.prototype,"excludedSubtrees",void 0);class I0{constructor(t={}){K(this,"requireExplicitPolicy");K(this,"inhibitPolicyMapping");Object.assign(this,t)}}B([H({type:me.Integer,context:0,implicit:!0,optional:!0,converter:Ot})],I0.prototype,"requireExplicitPolicy",void 0),B([H({type:me.Integer,context:1,implicit:!0,optional:!0,converter:Ot})],I0.prototype,"inhibitPolicyMapping",void 0);var _m;class bm{constructor(t={}){K(this,"issuerDomainPolicy","");K(this,"subjectDomainPolicy","");Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],bm.prototype,"issuerDomainPolicy",void 0),B([H({type:me.ObjectIdentifier})],bm.prototype,"subjectDomainPolicy",void 0);let B0=_m=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,_m.prototype)}};B0=_m=B([Le({type:Pe.Sequence,itemType:bm})],B0);var wm;const T0=`${jr}.17`;let km=wm=class extends sn{constructor(t){super(t),Object.setPrototypeOf(this,wm.prototype)}};km=wm=B([Le({type:Pe.Sequence})],km);let Ur=class{constructor(t={}){K(this,"type","");K(this,"values",[]);Object.assign(this,t)}};B([H({type:me.ObjectIdentifier})],Ur.prototype,"type",void 0),B([H({type:me.Any,repeated:"set"})],Ur.prototype,"values",void 0);var Cm;let O0=Cm=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,Cm.prototype)}};O0=Cm=B([Le({type:Pe.Sequence,itemType:Ur})],O0);const P0=`${jr}.14`;class io extends tm{}class V0{constructor(t={}){K(this,"notBefore");K(this,"notAfter");Object.assign(this,t)}}B([H({type:me.GeneralizedTime,context:0,implicit:!0,optional:!0})],V0.prototype,"notBefore",void 0),B([H({type:me.GeneralizedTime,context:1,implicit:!0,optional:!0})],V0.prototype,"notAfter",void 0);var ys;(function(n){n[n.keyUpdateAllowed=1]="keyUpdateAllowed",n[n.newExtensions=2]="newExtensions",n[n.pKIXCertificate=4]="pKIXCertificate"})(ys||(ys={}));class $0 extends Gc{toJSON(){const t=[],r=this.toNumber();return r&ys.pKIXCertificate&&t.push("pKIXCertificate"),r&ys.newExtensions&&t.push("newExtensions"),r&ys.keyUpdateAllowed&&t.push("keyUpdateAllowed"),t}toString(){return`[${this.toJSON().join(", ")}]`}}class R0{constructor(t={}){K(this,"entrustVers","");K(this,"entrustInfoFlags",new $0);Object.assign(this,t)}}B([H({type:me.GeneralString})],R0.prototype,"entrustVers",void 0),B([H({type:$0})],R0.prototype,"entrustInfoFlags",void 0);var Em;let L0=Em=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,Em.prototype)}};L0=Em=B([Le({type:Pe.Sequence,itemType:gs})],L0);class He{constructor(t={}){K(this,"algorithm","");K(this,"parameters");Object.assign(this,t)}isEqual(t){return t instanceof He&&t.algorithm==this.algorithm&&(t.parameters&&this.parameters&&x8(t.parameters,this.parameters)||t.parameters===this.parameters)}}B([H({type:me.ObjectIdentifier})],He.prototype,"algorithm",void 0),B([H({type:me.Any,optional:!0})],He.prototype,"parameters",void 0);class wr{constructor(t={}){K(this,"algorithm",new He);K(this,"subjectPublicKey",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:He})],wr.prototype,"algorithm",void 0),B([H({type:me.BitString})],wr.prototype,"subjectPublicKey",void 0);let on=class{constructor(t){K(this,"utcTime");K(this,"generalTime");if(t)if(typeof t=="string"||typeof t=="number"||t instanceof Date){const r=new Date(t);r.setMilliseconds(0),r.getUTCFullYear()>2049?this.generalTime=r:this.utcTime=r}else Object.assign(this,t)}getTime(){const t=this.utcTime||this.generalTime;if(!t)throw new Error("Cannot get time from CHOICE object");return t}};B([H({type:me.UTCTime})],on.prototype,"utcTime",void 0),B([H({type:me.GeneralizedTime})],on.prototype,"generalTime",void 0),on=B([Le({type:Pe.Choice})],on);class ru{constructor(t){K(this,"notBefore",new on(new Date));K(this,"notAfter",new on(new Date));t&&(this.notBefore=new on(t.notBefore),this.notAfter=new on(t.notAfter))}}B([H({type:on})],ru.prototype,"notBefore",void 0),B([H({type:on})],ru.prototype,"notAfter",void 0);var Nm;let kr=(Xo=class{constructor(t={}){K(this,"extnID","");K(this,"critical",Xo.CRITICAL);K(this,"extnValue",new mt);Object.assign(this,t)}},K(Xo,"CRITICAL",!1),Xo);B([H({type:me.ObjectIdentifier})],kr.prototype,"extnID",void 0),B([H({type:me.Boolean,defaultValue:kr.CRITICAL})],kr.prototype,"critical",void 0),B([H({type:mt})],kr.prototype,"extnValue",void 0);let jo=Nm=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,Nm.prototype)}};jo=Nm=B([Le({type:Pe.Sequence,itemType:kr})],jo);var zi;(function(n){n[n.v1=0]="v1",n[n.v2=1]="v2",n[n.v3=2]="v3"})(zi||(zi={}));class Hn{constructor(t={}){K(this,"version",zi.v1);K(this,"serialNumber",new ArrayBuffer(0));K(this,"signature",new He);K(this,"issuer",new Wt);K(this,"validity",new ru);K(this,"subject",new Wt);K(this,"subjectPublicKeyInfo",new wr);K(this,"issuerUniqueID");K(this,"subjectUniqueID");K(this,"extensions");Object.assign(this,t)}}B([H({type:me.Integer,context:0,defaultValue:zi.v1})],Hn.prototype,"version",void 0),B([H({type:me.Integer,converter:Ot})],Hn.prototype,"serialNumber",void 0),B([H({type:He})],Hn.prototype,"signature",void 0),B([H({type:Wt})],Hn.prototype,"issuer",void 0),B([H({type:ru})],Hn.prototype,"validity",void 0),B([H({type:Wt})],Hn.prototype,"subject",void 0),B([H({type:wr})],Hn.prototype,"subjectPublicKeyInfo",void 0),B([H({type:me.BitString,context:1,implicit:!0,optional:!0})],Hn.prototype,"issuerUniqueID",void 0),B([H({type:me.BitString,context:2,implicit:!0,optional:!0})],Hn.prototype,"subjectUniqueID",void 0),B([H({type:jo,context:3,optional:!0})],Hn.prototype,"extensions",void 0);class Wi{constructor(t={}){K(this,"tbsCertificate",new Hn);K(this,"tbsCertificateRaw");K(this,"signatureAlgorithm",new He);K(this,"signatureValue",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:Hn,raw:!0})],Wi.prototype,"tbsCertificate",void 0),B([H({type:He})],Wi.prototype,"signatureAlgorithm",void 0),B([H({type:me.BitString})],Wi.prototype,"signatureValue",void 0);class ou{constructor(t={}){K(this,"userCertificate",new ArrayBuffer(0));K(this,"revocationDate",new on);K(this,"crlEntryExtensions");Object.assign(this,t)}}B([H({type:me.Integer,converter:Ot})],ou.prototype,"userCertificate",void 0),B([H({type:on})],ou.prototype,"revocationDate",void 0),B([H({type:kr,optional:!0,repeated:"sequence"})],ou.prototype,"crlEntryExtensions",void 0);class Kr{constructor(t={}){K(this,"version");K(this,"signature",new He);K(this,"issuer",new Wt);K(this,"thisUpdate",new on);K(this,"nextUpdate");K(this,"revokedCertificates");K(this,"crlExtensions");Object.assign(this,t)}}B([H({type:me.Integer,optional:!0})],Kr.prototype,"version",void 0),B([H({type:He})],Kr.prototype,"signature",void 0),B([H({type:Wt})],Kr.prototype,"issuer",void 0),B([H({type:on})],Kr.prototype,"thisUpdate",void 0),B([H({type:on,optional:!0})],Kr.prototype,"nextUpdate",void 0),B([H({type:ou,repeated:"sequence",optional:!0})],Kr.prototype,"revokedCertificates",void 0),B([H({type:kr,optional:!0,context:0,repeated:"sequence"})],Kr.prototype,"crlExtensions",void 0);class Sm{constructor(t={}){K(this,"tbsCertList",new Kr);K(this,"tbsCertListRaw");K(this,"signatureAlgorithm",new He);K(this,"signature",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:Kr,raw:!0})],Sm.prototype,"tbsCertList",void 0),B([H({type:He})],Sm.prototype,"signatureAlgorithm",void 0),B([H({type:me.BitString})],Sm.prototype,"signature",void 0);class Yi{constructor(t={}){K(this,"issuer",new Wt);K(this,"serialNumber",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:Wt})],Yi.prototype,"issuer",void 0),B([H({type:me.Integer,converter:Ot})],Yi.prototype,"serialNumber",void 0);let Ji=class{constructor(t={}){K(this,"subjectKeyIdentifier");K(this,"issuerAndSerialNumber");Object.assign(this,t)}};B([H({type:io,context:0,implicit:!0})],Ji.prototype,"subjectKeyIdentifier",void 0),B([H({type:Yi})],Ji.prototype,"issuerAndSerialNumber",void 0),Ji=B([Le({type:Pe.Choice})],Ji);var qr;(function(n){n[n.v0=0]="v0",n[n.v1=1]="v1",n[n.v2=2]="v2",n[n.v3=3]="v3",n[n.v4=4]="v4",n[n.v5=5]="v5"})(qr||(qr={}));let _s=class extends He{};_s=B([Le({type:Pe.Sequence})],_s);let iu=class extends He{};iu=B([Le({type:Pe.Sequence})],iu);let Cr=class extends He{};Cr=B([Le({type:Pe.Sequence})],Cr);let au=class extends He{};au=B([Le({type:Pe.Sequence})],au);let D0=class extends He{};D0=B([Le({type:Pe.Sequence})],D0);let xm=class extends He{};xm=B([Le({type:Pe.Sequence})],xm);let Xi=class{constructor(t={}){K(this,"attrType","");K(this,"attrValues",[]);Object.assign(this,t)}};B([H({type:me.ObjectIdentifier})],Xi.prototype,"attrType",void 0),B([H({type:me.Any,repeated:"set"})],Xi.prototype,"attrValues",void 0);var Am;class Er{constructor(t={}){K(this,"version",qr.v0);K(this,"sid",new Ji);K(this,"digestAlgorithm",new _s);K(this,"signedAttrs");K(this,"signedAttrsRaw");K(this,"signatureAlgorithm",new iu);K(this,"signature",new mt);K(this,"unsignedAttrs");Object.assign(this,t)}}B([H({type:me.Integer})],Er.prototype,"version",void 0),B([H({type:Ji})],Er.prototype,"sid",void 0),B([H({type:_s})],Er.prototype,"digestAlgorithm",void 0),B([H({type:Xi,repeated:"set",context:0,implicit:!0,optional:!0,raw:!0})],Er.prototype,"signedAttrs",void 0),B([H({type:iu})],Er.prototype,"signatureAlgorithm",void 0),B([H({type:mt})],Er.prototype,"signature",void 0),B([H({type:Xi,repeated:"set",context:1,implicit:!0,optional:!0})],Er.prototype,"unsignedAttrs",void 0);let su=Am=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,Am.prototype)}};su=Am=B([Le({type:Pe.Set,itemType:Er})],su);let M0=class extends Er{};M0=B([Le({type:Pe.Sequence})],M0);let j0=class extends on{};j0=B([Le({type:Pe.Choice})],j0);class vm{constructor(t={}){K(this,"acIssuer",new ot);K(this,"acSerial",0);K(this,"attrs",[]);Object.assign(this,t)}}B([H({type:ot})],vm.prototype,"acIssuer",void 0),B([H({type:me.Integer})],vm.prototype,"acSerial",void 0),B([H({type:Ur,repeated:"sequence"})],vm.prototype,"attrs",void 0);var Im;let lu=Im=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,Im.prototype)}};lu=Im=B([Le({type:Pe.Sequence,itemType:me.ObjectIdentifier})],lu);class cu{constructor(t={}){K(this,"pathLenConstraint");K(this,"permittedAttrs");K(this,"excludedAttrs");K(this,"permitUnSpecified",!0);Object.assign(this,t)}}B([H({type:me.Integer,optional:!0})],cu.prototype,"pathLenConstraint",void 0),B([H({type:lu,implicit:!0,context:0,optional:!0})],cu.prototype,"permittedAttrs",void 0),B([H({type:lu,implicit:!0,context:1,optional:!0})],cu.prototype,"excludedAttrs",void 0),B([H({type:me.Boolean,defaultValue:!0})],cu.prototype,"permitUnSpecified",void 0);class Fo{constructor(t={}){K(this,"issuer",new sn);K(this,"serial",new ArrayBuffer(0));K(this,"issuerUID",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:sn})],Fo.prototype,"issuer",void 0),B([H({type:me.Integer,converter:Ot})],Fo.prototype,"serial",void 0),B([H({type:me.BitString,optional:!0})],Fo.prototype,"issuerUID",void 0);var Bm;(function(n){n[n.publicKey=0]="publicKey",n[n.publicKeyCert=1]="publicKeyCert",n[n.otherObjectTypes=2]="otherObjectTypes"})(Bm||(Bm={}));class Uo{constructor(t={}){K(this,"digestedObjectType",Bm.publicKey);K(this,"otherObjectTypeID");K(this,"digestAlgorithm",new He);K(this,"objectDigest",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:me.Enumerated})],Uo.prototype,"digestedObjectType",void 0),B([H({type:me.ObjectIdentifier,optional:!0})],Uo.prototype,"otherObjectTypeID",void 0),B([H({type:He})],Uo.prototype,"digestAlgorithm",void 0),B([H({type:me.BitString})],Uo.prototype,"objectDigest",void 0);class uu{constructor(t={}){K(this,"issuerName");K(this,"baseCertificateID");K(this,"objectDigestInfo");Object.assign(this,t)}}B([H({type:sn,optional:!0})],uu.prototype,"issuerName",void 0),B([H({type:Fo,context:0,implicit:!0,optional:!0})],uu.prototype,"baseCertificateID",void 0),B([H({type:Uo,context:1,implicit:!0,optional:!0})],uu.prototype,"objectDigestInfo",void 0);let Zi=class{constructor(t={}){K(this,"v1Form");K(this,"v2Form");Object.assign(this,t)}};B([H({type:ot,repeated:"sequence"})],Zi.prototype,"v1Form",void 0),B([H({type:uu,context:0,implicit:!0})],Zi.prototype,"v2Form",void 0),Zi=B([Le({type:Pe.Choice})],Zi);class du{constructor(t={}){K(this,"notBeforeTime",new Date);K(this,"notAfterTime",new Date);Object.assign(this,t)}}B([H({type:me.GeneralizedTime})],du.prototype,"notBeforeTime",void 0),B([H({type:me.GeneralizedTime})],du.prototype,"notAfterTime",void 0);class bs{constructor(t={}){K(this,"baseCertificateID");K(this,"entityName");K(this,"objectDigestInfo");Object.assign(this,t)}}B([H({type:Fo,implicit:!0,context:0,optional:!0})],bs.prototype,"baseCertificateID",void 0),B([H({type:sn,implicit:!0,context:1,optional:!0})],bs.prototype,"entityName",void 0),B([H({type:Uo,implicit:!0,context:2,optional:!0})],bs.prototype,"objectDigestInfo",void 0);var Tm;(function(n){n[n.v2=1]="v2"})(Tm||(Tm={}));class ar{constructor(t={}){K(this,"version",Tm.v2);K(this,"holder",new bs);K(this,"issuer",new Zi);K(this,"signature",new He);K(this,"serialNumber",new ArrayBuffer(0));K(this,"attrCertValidityPeriod",new du);K(this,"attributes",[]);K(this,"issuerUniqueID");K(this,"extensions");Object.assign(this,t)}}B([H({type:me.Integer})],ar.prototype,"version",void 0),B([H({type:bs})],ar.prototype,"holder",void 0),B([H({type:Zi})],ar.prototype,"issuer",void 0),B([H({type:He})],ar.prototype,"signature",void 0),B([H({type:me.Integer,converter:Ot})],ar.prototype,"serialNumber",void 0),B([H({type:du})],ar.prototype,"attrCertValidityPeriod",void 0),B([H({type:Ur,repeated:"sequence"})],ar.prototype,"attributes",void 0),B([H({type:me.BitString,optional:!0})],ar.prototype,"issuerUniqueID",void 0),B([H({type:jo,optional:!0})],ar.prototype,"extensions",void 0);class fu{constructor(t={}){K(this,"acinfo",new ar);K(this,"signatureAlgorithm",new He);K(this,"signatureValue",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:ar})],fu.prototype,"acinfo",void 0),B([H({type:He})],fu.prototype,"signatureAlgorithm",void 0),B([H({type:me.BitString})],fu.prototype,"signatureValue",void 0);var pu;(function(n){n[n.unmarked=1]="unmarked",n[n.unclassified=2]="unclassified",n[n.restricted=4]="restricted",n[n.confidential=8]="confidential",n[n.secret=16]="secret",n[n.topSecret=32]="topSecret"})(pu||(pu={}));class Om extends Gc{}class Pm{constructor(t={}){K(this,"type","");K(this,"value",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:me.ObjectIdentifier,implicit:!0,context:0})],Pm.prototype,"type",void 0),B([H({type:me.Any,implicit:!0,context:1})],Pm.prototype,"value",void 0);class Vm{constructor(t={}){K(this,"policyId","");K(this,"classList",new Om(pu.unclassified));K(this,"securityCategories");Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],Vm.prototype,"policyId",void 0),B([H({type:Om,defaultValue:new Om(pu.unclassified)})],Vm.prototype,"classList",void 0),B([H({type:Pm,repeated:"set"})],Vm.prototype,"securityCategories",void 0);class mu{constructor(t={}){K(this,"cotets");K(this,"oid");K(this,"string");Object.assign(this,t)}}B([H({type:mt})],mu.prototype,"cotets",void 0),B([H({type:me.ObjectIdentifier})],mu.prototype,"oid",void 0),B([H({type:me.Utf8String})],mu.prototype,"string",void 0);class F0{constructor(t={}){K(this,"policyAuthority");K(this,"values",[]);Object.assign(this,t)}}B([H({type:sn,implicit:!0,context:0,optional:!0})],F0.prototype,"policyAuthority",void 0),B([H({type:mu,repeated:"sequence"})],F0.prototype,"values",void 0);var $m;class gu{constructor(t={}){K(this,"targetCertificate",new Fo);K(this,"targetName");K(this,"certDigestInfo");Object.assign(this,t)}}B([H({type:Fo})],gu.prototype,"targetCertificate",void 0),B([H({type:ot,optional:!0})],gu.prototype,"targetName",void 0),B([H({type:Uo,optional:!0})],gu.prototype,"certDigestInfo",void 0);let Qi=class{constructor(t={}){K(this,"targetName");K(this,"targetGroup");K(this,"targetCert");Object.assign(this,t)}};B([H({type:ot,context:0,implicit:!0})],Qi.prototype,"targetName",void 0),B([H({type:ot,context:1,implicit:!0})],Qi.prototype,"targetGroup",void 0),B([H({type:gu,context:2,implicit:!0})],Qi.prototype,"targetCert",void 0),Qi=B([Le({type:Pe.Choice})],Qi);let Rm=$m=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,$m.prototype)}};Rm=$m=B([Le({type:Pe.Sequence,itemType:Qi})],Rm);var Lm;let U0=Lm=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,Lm.prototype)}};U0=Lm=B([Le({type:Pe.Sequence,itemType:Rm})],U0);class K0{constructor(t={}){K(this,"roleAuthority");K(this,"roleName");Object.assign(this,t)}}B([H({type:sn,implicit:!0,context:0,optional:!0})],K0.prototype,"roleAuthority",void 0),B([H({type:ot,implicit:!0,context:1})],K0.prototype,"roleName",void 0);class Dm{constructor(t={}){K(this,"service",new ot);K(this,"ident",new ot);K(this,"authInfo");Object.assign(this,t)}}B([H({type:ot})],Dm.prototype,"service",void 0),B([H({type:ot})],Dm.prototype,"ident",void 0),B([H({type:mt,optional:!0})],Dm.prototype,"authInfo",void 0);var Mm;class jm{constructor(t={}){K(this,"otherCertFormat","");K(this,"otherCert",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],jm.prototype,"otherCertFormat",void 0),B([H({type:me.Any})],jm.prototype,"otherCert",void 0);let ea=class{constructor(t={}){K(this,"certificate");K(this,"v2AttrCert");K(this,"other");Object.assign(this,t)}};B([H({type:Wi})],ea.prototype,"certificate",void 0),B([H({type:fu,context:2,implicit:!0})],ea.prototype,"v2AttrCert",void 0),B([H({type:jm,context:3,implicit:!0})],ea.prototype,"other",void 0),ea=B([Le({type:Pe.Choice})],ea);let hu=Mm=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,Mm.prototype)}};hu=Mm=B([Le({type:Pe.Set,itemType:ea})],hu);class ta{constructor(t={}){K(this,"contentType","");K(this,"content",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],ta.prototype,"contentType",void 0),B([H({type:me.Any,context:0})],ta.prototype,"content",void 0);let ws=class{constructor(t={}){K(this,"single");K(this,"any");Object.assign(this,t)}};B([H({type:mt})],ws.prototype,"single",void 0),B([H({type:me.Any})],ws.prototype,"any",void 0),ws=B([Le({type:Pe.Choice})],ws);class yu{constructor(t={}){K(this,"eContentType","");K(this,"eContent");Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],yu.prototype,"eContentType",void 0),B([H({type:ws,context:0,optional:!0})],yu.prototype,"eContent",void 0);let ks=class{constructor(t={}){K(this,"value");K(this,"constructedValue");Object.assign(this,t)}};B([H({type:mt,context:0,implicit:!0,optional:!0})],ks.prototype,"value",void 0),B([H({type:mt,converter:P8,context:0,implicit:!0,optional:!0,repeated:"sequence"})],ks.prototype,"constructedValue",void 0),ks=B([Le({type:Pe.Choice})],ks);class Cs{constructor(t={}){K(this,"contentType","");K(this,"contentEncryptionAlgorithm",new au);K(this,"encryptedContent");Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],Cs.prototype,"contentType",void 0),B([H({type:au})],Cs.prototype,"contentEncryptionAlgorithm",void 0),B([H({type:ks,optional:!0})],Cs.prototype,"encryptedContent",void 0);class _u{constructor(t={}){K(this,"keyAttrId","");K(this,"keyAttr");Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],_u.prototype,"keyAttrId",void 0),B([H({type:me.Any,optional:!0})],_u.prototype,"keyAttr",void 0);var Fm;class bu{constructor(t={}){K(this,"subjectKeyIdentifier",new io);K(this,"date");K(this,"other");Object.assign(this,t)}}B([H({type:io})],bu.prototype,"subjectKeyIdentifier",void 0),B([H({type:me.GeneralizedTime,optional:!0})],bu.prototype,"date",void 0),B([H({type:_u,optional:!0})],bu.prototype,"other",void 0);let na=class{constructor(t={}){K(this,"rKeyId");K(this,"issuerAndSerialNumber");Object.assign(this,t)}};B([H({type:bu,context:0,implicit:!0,optional:!0})],na.prototype,"rKeyId",void 0),B([H({type:Yi,optional:!0})],na.prototype,"issuerAndSerialNumber",void 0),na=B([Le({type:Pe.Choice})],na);class Um{constructor(t={}){K(this,"rid",new na);K(this,"encryptedKey",new mt);Object.assign(this,t)}}B([H({type:na})],Um.prototype,"rid",void 0),B([H({type:mt})],Um.prototype,"encryptedKey",void 0);let wu=Fm=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,Fm.prototype)}};wu=Fm=B([Le({type:Pe.Sequence,itemType:Um})],wu);class Km{constructor(t={}){K(this,"algorithm",new He);K(this,"publicKey",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:He})],Km.prototype,"algorithm",void 0),B([H({type:me.BitString})],Km.prototype,"publicKey",void 0);let Ko=class{constructor(t={}){K(this,"subjectKeyIdentifier");K(this,"originatorKey");K(this,"issuerAndSerialNumber");Object.assign(this,t)}};B([H({type:io,context:0,implicit:!0,optional:!0})],Ko.prototype,"subjectKeyIdentifier",void 0),B([H({type:Km,context:1,implicit:!0,optional:!0})],Ko.prototype,"originatorKey",void 0),B([H({type:Yi,optional:!0})],Ko.prototype,"issuerAndSerialNumber",void 0),Ko=B([Le({type:Pe.Choice})],Ko);class ra{constructor(t={}){K(this,"version",qr.v3);K(this,"originator",new Ko);K(this,"ukm");K(this,"keyEncryptionAlgorithm",new Cr);K(this,"recipientEncryptedKeys",new wu);Object.assign(this,t)}}B([H({type:me.Integer})],ra.prototype,"version",void 0),B([H({type:Ko,context:0})],ra.prototype,"originator",void 0),B([H({type:mt,context:1,optional:!0})],ra.prototype,"ukm",void 0),B([H({type:Cr})],ra.prototype,"keyEncryptionAlgorithm",void 0),B([H({type:wu})],ra.prototype,"recipientEncryptedKeys",void 0);let oa=class{constructor(t={}){K(this,"subjectKeyIdentifier");K(this,"issuerAndSerialNumber");Object.assign(this,t)}};B([H({type:io,context:0,implicit:!0})],oa.prototype,"subjectKeyIdentifier",void 0),B([H({type:Yi})],oa.prototype,"issuerAndSerialNumber",void 0),oa=B([Le({type:Pe.Choice})],oa);class Es{constructor(t={}){K(this,"version",qr.v0);K(this,"rid",new oa);K(this,"keyEncryptionAlgorithm",new Cr);K(this,"encryptedKey",new mt);Object.assign(this,t)}}B([H({type:me.Integer})],Es.prototype,"version",void 0),B([H({type:oa})],Es.prototype,"rid",void 0),B([H({type:Cr})],Es.prototype,"keyEncryptionAlgorithm",void 0),B([H({type:mt})],Es.prototype,"encryptedKey",void 0);class Ns{constructor(t={}){K(this,"keyIdentifier",new mt);K(this,"date");K(this,"other");Object.assign(this,t)}}B([H({type:mt})],Ns.prototype,"keyIdentifier",void 0),B([H({type:me.GeneralizedTime,optional:!0})],Ns.prototype,"date",void 0),B([H({type:_u,optional:!0})],Ns.prototype,"other",void 0);class Ss{constructor(t={}){K(this,"version",qr.v4);K(this,"kekid",new Ns);K(this,"keyEncryptionAlgorithm",new Cr);K(this,"encryptedKey",new mt);Object.assign(this,t)}}B([H({type:me.Integer})],Ss.prototype,"version",void 0),B([H({type:Ns})],Ss.prototype,"kekid",void 0),B([H({type:Cr})],Ss.prototype,"keyEncryptionAlgorithm",void 0),B([H({type:mt})],Ss.prototype,"encryptedKey",void 0);class xs{constructor(t={}){K(this,"version",qr.v0);K(this,"keyDerivationAlgorithm");K(this,"keyEncryptionAlgorithm",new Cr);K(this,"encryptedKey",new mt);Object.assign(this,t)}}B([H({type:me.Integer})],xs.prototype,"version",void 0),B([H({type:xm,context:0,optional:!0})],xs.prototype,"keyDerivationAlgorithm",void 0),B([H({type:Cr})],xs.prototype,"keyEncryptionAlgorithm",void 0),B([H({type:mt})],xs.prototype,"encryptedKey",void 0);class qm{constructor(t={}){K(this,"oriType","");K(this,"oriValue",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],qm.prototype,"oriType",void 0),B([H({type:me.Any})],qm.prototype,"oriValue",void 0);let ao=class{constructor(t={}){K(this,"ktri");K(this,"kari");K(this,"kekri");K(this,"pwri");K(this,"ori");Object.assign(this,t)}};B([H({type:Es,optional:!0})],ao.prototype,"ktri",void 0),B([H({type:ra,context:1,implicit:!0,optional:!0})],ao.prototype,"kari",void 0),B([H({type:Ss,context:2,implicit:!0,optional:!0})],ao.prototype,"kekri",void 0),B([H({type:xs,context:3,implicit:!0,optional:!0})],ao.prototype,"pwri",void 0),B([H({type:qm,context:4,implicit:!0,optional:!0})],ao.prototype,"ori",void 0),ao=B([Le({type:Pe.Choice})],ao);var Gm;let ku=Gm=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,Gm.prototype)}};ku=Gm=B([Le({type:Pe.Set,itemType:ao})],ku);var Hm;class Cu{constructor(t={}){K(this,"otherRevInfoFormat","");K(this,"otherRevInfo",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],Cu.prototype,"otherRevInfoFormat",void 0),B([H({type:me.Any})],Cu.prototype,"otherRevInfo",void 0);let Eu=class{constructor(t={}){K(this,"other",new Cu);Object.assign(this,t)}};B([H({type:Cu,context:1,implicit:!0})],Eu.prototype,"other",void 0),Eu=B([Le({type:Pe.Choice})],Eu);let Nu=Hm=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,Hm.prototype)}};Nu=Hm=B([Le({type:Pe.Set,itemType:Eu})],Nu);class zm{constructor(t={}){K(this,"certs");K(this,"crls");Object.assign(this,t)}}B([H({type:hu,context:0,implicit:!0,optional:!0})],zm.prototype,"certs",void 0),B([H({type:Nu,context:1,implicit:!0,optional:!0})],zm.prototype,"crls",void 0);var Wm;let Ym=Wm=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,Wm.prototype)}};Ym=Wm=B([Le({type:Pe.Set,itemType:Xi})],Ym);class As{constructor(t={}){K(this,"version",qr.v0);K(this,"originatorInfo");K(this,"recipientInfos",new ku);K(this,"encryptedContentInfo",new Cs);K(this,"unprotectedAttrs");Object.assign(this,t)}}B([H({type:me.Integer})],As.prototype,"version",void 0),B([H({type:zm,context:0,implicit:!0,optional:!0})],As.prototype,"originatorInfo",void 0),B([H({type:ku})],As.prototype,"recipientInfos",void 0),B([H({type:Cs})],As.prototype,"encryptedContentInfo",void 0),B([H({type:Ym,context:1,implicit:!0,optional:!0})],As.prototype,"unprotectedAttrs",void 0);const iK="1.2.840.113549.1.7.2";var Jm;let Su=Jm=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,Jm.prototype)}};Su=Jm=B([Le({type:Pe.Set,itemType:_s})],Su);class ia{constructor(t={}){K(this,"version",qr.v0);K(this,"digestAlgorithms",new Su);K(this,"encapContentInfo",new yu);K(this,"certificates");K(this,"crls");K(this,"signerInfos",new su);Object.assign(this,t)}}B([H({type:me.Integer})],ia.prototype,"version",void 0),B([H({type:Su})],ia.prototype,"digestAlgorithms",void 0),B([H({type:yu})],ia.prototype,"encapContentInfo",void 0),B([H({type:hu,context:0,implicit:!0,optional:!0})],ia.prototype,"certificates",void 0),B([H({type:Nu,context:1,implicit:!0,optional:!0})],ia.prototype,"crls",void 0),B([H({type:su})],ia.prototype,"signerInfos",void 0);const vs="1.2.840.10045.2.1",Xm="1.2.840.10045.4.1",q0="1.2.840.10045.4.3.1",Zm="1.2.840.10045.4.3.2",Qm="1.2.840.10045.4.3.3",eg="1.2.840.10045.4.3.4",G0="1.2.840.10045.3.1.7",H0="1.3.132.0.34",z0="1.3.132.0.35";function Is(n){return new He({algorithm:n})}const aK=Is(Xm);Is(q0);const sK=Is(Zm),lK=Is(Qm),cK=Is(eg);let Bs=class{constructor(t={}){K(this,"fieldType");K(this,"parameters");Object.assign(this,t)}};B([H({type:me.ObjectIdentifier})],Bs.prototype,"fieldType",void 0),B([H({type:me.Any})],Bs.prototype,"parameters",void 0),Bs=B([Le({type:Pe.Sequence})],Bs);class uK extends mt{}let aa=class{constructor(t={}){K(this,"a");K(this,"b");K(this,"seed");Object.assign(this,t)}};B([H({type:me.OctetString})],aa.prototype,"a",void 0),B([H({type:me.OctetString})],aa.prototype,"b",void 0),B([H({type:me.BitString,optional:!0})],aa.prototype,"seed",void 0),aa=B([Le({type:Pe.Sequence})],aa);var tg;(function(n){n[n.ecpVer1=1]="ecpVer1"})(tg||(tg={}));let Gr=class{constructor(t={}){K(this,"version",tg.ecpVer1);K(this,"fieldID");K(this,"curve");K(this,"base");K(this,"order");K(this,"cofactor");Object.assign(this,t)}};B([H({type:me.Integer})],Gr.prototype,"version",void 0),B([H({type:Bs})],Gr.prototype,"fieldID",void 0),B([H({type:aa})],Gr.prototype,"curve",void 0),B([H({type:uK})],Gr.prototype,"base",void 0),B([H({type:me.Integer,converter:Ot})],Gr.prototype,"order",void 0),B([H({type:me.Integer,optional:!0})],Gr.prototype,"cofactor",void 0),Gr=B([Le({type:Pe.Sequence})],Gr);let so=class{constructor(t={}){K(this,"namedCurve");K(this,"implicitCurve");K(this,"specifiedCurve");Object.assign(this,t)}};B([H({type:me.ObjectIdentifier})],so.prototype,"namedCurve",void 0),B([H({type:me.Null})],so.prototype,"implicitCurve",void 0),B([H({type:Gr})],so.prototype,"specifiedCurve",void 0),so=B([Le({type:Pe.Choice})],so);class xu{constructor(t={}){K(this,"version",1);K(this,"privateKey",new mt);K(this,"parameters");K(this,"publicKey");Object.assign(this,t)}}B([H({type:me.Integer})],xu.prototype,"version",void 0),B([H({type:mt})],xu.prototype,"privateKey",void 0),B([H({type:so,context:0,optional:!0})],xu.prototype,"parameters",void 0),B([H({type:me.BitString,context:1,optional:!0})],xu.prototype,"publicKey",void 0);class Au{constructor(t={}){K(this,"r",new ArrayBuffer(0));K(this,"s",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:me.Integer,converter:Ot})],Au.prototype,"r",void 0),B([H({type:me.Integer,converter:Ot})],Au.prototype,"s",void 0);const kn="1.2.840.113549.1.1",qo=`${kn}.1`,dK=`${kn}.7`,fK=`${kn}.9`,Ts=`${kn}.10`,pK=`${kn}.2`,mK=`${kn}.4`,vu=`${kn}.5`,gK=`${kn}.14`,ng=`${kn}.11`,Iu=`${kn}.12`,Bu=`${kn}.13`,W0=`${kn}.15`,Y0=`${kn}.16`,Tu="1.3.14.3.2.26",J0="2.16.840.1.101.3.4.2.4",Ou="2.16.840.1.101.3.4.2.1",Pu="2.16.840.1.101.3.4.2.2",Vu="2.16.840.1.101.3.4.2.3",hK="2.16.840.1.101.3.4.2.5",yK="2.16.840.1.101.3.4.2.6",_K="1.2.840.113549.2.2",bK="1.2.840.113549.2.5",$u=`${kn}.8`;function Yt(n){return new He({algorithm:n,parameters:null})}Yt(_K),Yt(bK);const Go=Yt(Tu);Yt(J0),Yt(Ou),Yt(Pu),Yt(Vu),Yt(hK),Yt(yK);const X0=new He({algorithm:$u,parameters:Ue.serialize(Go)}),Z0=new He({algorithm:fK,parameters:Ue.serialize(Hc.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))});Yt(qo),Yt(pK),Yt(mK),Yt(vu),Yt(W0),Yt(Y0),Yt(Iu),Yt(Bu),Yt(W0),Yt(Y0);class Ru{constructor(t={}){K(this,"hashAlgorithm",new He(Go));K(this,"maskGenAlgorithm",new He({algorithm:$u,parameters:Ue.serialize(Go)}));K(this,"pSourceAlgorithm",new He(Z0));Object.assign(this,t)}}B([H({type:He,context:0,defaultValue:Go})],Ru.prototype,"hashAlgorithm",void 0),B([H({type:He,context:1,defaultValue:X0})],Ru.prototype,"maskGenAlgorithm",void 0),B([H({type:He,context:2,defaultValue:Z0})],Ru.prototype,"pSourceAlgorithm",void 0),new He({algorithm:dK,parameters:Ue.serialize(new Ru)});class Ho{constructor(t={}){K(this,"hashAlgorithm",new He(Go));K(this,"maskGenAlgorithm",new He({algorithm:$u,parameters:Ue.serialize(Go)}));K(this,"saltLength",20);K(this,"trailerField",1);Object.assign(this,t)}}B([H({type:He,context:0,defaultValue:Go})],Ho.prototype,"hashAlgorithm",void 0),B([H({type:He,context:1,defaultValue:X0})],Ho.prototype,"maskGenAlgorithm",void 0),B([H({type:me.Integer,context:2,defaultValue:20})],Ho.prototype,"saltLength",void 0),B([H({type:me.Integer,context:3,defaultValue:1})],Ho.prototype,"trailerField",void 0),new He({algorithm:Ts,parameters:Ue.serialize(new Ho)});class Lu{constructor(t={}){K(this,"digestAlgorithm",new He);K(this,"digest",new mt);Object.assign(this,t)}}B([H({type:He})],Lu.prototype,"digestAlgorithm",void 0),B([H({type:mt})],Lu.prototype,"digest",void 0);var rg;class Du{constructor(t={}){K(this,"prime",new ArrayBuffer(0));K(this,"exponent",new ArrayBuffer(0));K(this,"coefficient",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:me.Integer,converter:Ot})],Du.prototype,"prime",void 0),B([H({type:me.Integer,converter:Ot})],Du.prototype,"exponent",void 0),B([H({type:me.Integer,converter:Ot})],Du.prototype,"coefficient",void 0);let og=rg=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,rg.prototype)}};og=rg=B([Le({type:Pe.Sequence,itemType:Du})],og);class Nr{constructor(t={}){K(this,"version",0);K(this,"modulus",new ArrayBuffer(0));K(this,"publicExponent",new ArrayBuffer(0));K(this,"privateExponent",new ArrayBuffer(0));K(this,"prime1",new ArrayBuffer(0));K(this,"prime2",new ArrayBuffer(0));K(this,"exponent1",new ArrayBuffer(0));K(this,"exponent2",new ArrayBuffer(0));K(this,"coefficient",new ArrayBuffer(0));K(this,"otherPrimeInfos");Object.assign(this,t)}}B([H({type:me.Integer})],Nr.prototype,"version",void 0),B([H({type:me.Integer,converter:Ot})],Nr.prototype,"modulus",void 0),B([H({type:me.Integer,converter:Ot})],Nr.prototype,"publicExponent",void 0),B([H({type:me.Integer,converter:Ot})],Nr.prototype,"privateExponent",void 0),B([H({type:me.Integer,converter:Ot})],Nr.prototype,"prime1",void 0),B([H({type:me.Integer,converter:Ot})],Nr.prototype,"prime2",void 0),B([H({type:me.Integer,converter:Ot})],Nr.prototype,"exponent1",void 0),B([H({type:me.Integer,converter:Ot})],Nr.prototype,"exponent2",void 0),B([H({type:me.Integer,converter:Ot})],Nr.prototype,"coefficient",void 0),B([H({type:og,optional:!0})],Nr.prototype,"otherPrimeInfos",void 0);class ig{constructor(t={}){K(this,"modulus",new ArrayBuffer(0));K(this,"publicExponent",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:me.Integer,converter:Ot})],ig.prototype,"modulus",void 0),B([H({type:me.Integer,converter:Ot})],ig.prototype,"publicExponent",void 0);var ag;(function(n){n[n.Transient=0]="Transient",n[n.Singleton=1]="Singleton",n[n.ResolutionScoped=2]="ResolutionScoped",n[n.ContainerScoped=3]="ContainerScoped"})(ag||(ag={}));const Cn=ag;/*! *****************************************************************************
521
521
  Copyright (c) Microsoft Corporation.
522
522
 
523
523
  Permission to use, copy, modify, and/or distribute this software for any
@@ -530,9 +530,9 @@ ${t.join(`
530
530
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
531
531
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
532
532
  PERFORMANCE OF THIS SOFTWARE.
533
- ***************************************************************************** */var sg=function(n,t){return sg=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},sg(n,t)};function lg(n,t){sg(n,t);function r(){this.constructor=n}n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function gK(n,t,r,o){function i(a){return a instanceof r?a:new r(function(s){s(a)})}return new(r||(r=Promise))(function(a,s){function c(p){try{u(o.next(p))}catch(d){s(d)}}function l(p){try{u(o.throw(p))}catch(d){s(d)}}function u(p){p.done?a(p.value):i(p.value).then(c,l)}u((o=o.apply(n,[])).next())})}function hK(n,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},o,i,a,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(u){return function(p){return l([u,p])}}function l(u){if(o)throw new TypeError("Generator is already executing.");for(;r;)try{if(o=1,i&&(a=u[0]&2?i.return:u[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,u[1])).done)return a;switch(i=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){r.label=u[1];break}if(u[0]===6&&r.label<a[1]){r.label=a[1],a=u;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(u);break}a[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(n,r)}catch(p){u=[6,p],i=0}finally{o=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function Mu(n){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&n[t],o=0;if(r)return r.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&o>=n.length&&(n=void 0),{value:n&&n[o++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ju(n,t){var r=typeof Symbol=="function"&&n[Symbol.iterator];if(!r)return n;var o=r.call(n),i,a=[],s;try{for(;(t===void 0||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(s)throw s.error}}return a}function zo(){for(var n=[],t=0;t<arguments.length;t++)n=n.concat(ju(arguments[t]));return n}var yK="injectionTokens";function _K(n){var t=Reflect.getMetadata("design:paramtypes",n)||[],r=Reflect.getOwnMetadata(yK,n)||{};return Object.keys(r).forEach(function(o){t[+o]=r[o]}),t}function Q0(n){return!!n.useClass}function cg(n){return!!n.useFactory}var eC=function(){function n(t){this.wrap=t,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}return n.prototype.createProxy=function(t){var r=this,o={},i=!1,a,s=function(){return i||(a=t(r.wrap()),i=!0),a};return new Proxy(o,this.createHandler(s))},n.prototype.createHandler=function(t){var r={},o=function(i){r[i]=function(){for(var a=[],s=0;s<arguments.length;s++)a[s]=arguments[s];a[0]=t();var c=Reflect[i];return c.apply(void 0,zo(a))}};return this.reflectMethods.forEach(o),r},n}();function sa(n){return typeof n=="string"||typeof n=="symbol"}function bK(n){return typeof n=="object"&&"token"in n&&"multiple"in n}function tC(n){return typeof n=="object"&&"token"in n&&"transform"in n}function wK(n){return typeof n=="function"||n instanceof eC}function Fu(n){return!!n.useToken}function Uu(n){return n.useValue!=null}function kK(n){return Q0(n)||Uu(n)||Fu(n)||cg(n)}var ug=function(){function n(){this._registryMap=new Map}return n.prototype.entries=function(){return this._registryMap.entries()},n.prototype.getAll=function(t){return this.ensure(t),this._registryMap.get(t)},n.prototype.get=function(t){this.ensure(t);var r=this._registryMap.get(t);return r[r.length-1]||null},n.prototype.set=function(t,r){this.ensure(t),this._registryMap.get(t).push(r)},n.prototype.setAll=function(t,r){this._registryMap.set(t,r)},n.prototype.has=function(t){return this.ensure(t),this._registryMap.get(t).length>0},n.prototype.clear=function(){this._registryMap.clear()},n.prototype.ensure=function(t){this._registryMap.has(t)||this._registryMap.set(t,[])},n}(),CK=function(n){lg(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t}(ug),Ku=function(){function n(){this.scopedResolutions=new Map}return n}();function EK(n,t){if(n===null)return"at position #"+t;var r=n.split(",")[t].trim();return'"'+r+'" at position #'+t}function NK(n,t,r){return r===void 0&&(r=" "),zo([n],t.message.split(`
533
+ ***************************************************************************** */var sg=function(n,t){return sg=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},sg(n,t)};function lg(n,t){sg(n,t);function r(){this.constructor=n}n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function wK(n,t,r,o){function i(a){return a instanceof r?a:new r(function(s){s(a)})}return new(r||(r=Promise))(function(a,s){function c(p){try{u(o.next(p))}catch(d){s(d)}}function l(p){try{u(o.throw(p))}catch(d){s(d)}}function u(p){p.done?a(p.value):i(p.value).then(c,l)}u((o=o.apply(n,[])).next())})}function kK(n,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},o,i,a,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(u){return function(p){return l([u,p])}}function l(u){if(o)throw new TypeError("Generator is already executing.");for(;r;)try{if(o=1,i&&(a=u[0]&2?i.return:u[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,u[1])).done)return a;switch(i=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){r.label=u[1];break}if(u[0]===6&&r.label<a[1]){r.label=a[1],a=u;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(u);break}a[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(n,r)}catch(p){u=[6,p],i=0}finally{o=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function Mu(n){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&n[t],o=0;if(r)return r.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&o>=n.length&&(n=void 0),{value:n&&n[o++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ju(n,t){var r=typeof Symbol=="function"&&n[Symbol.iterator];if(!r)return n;var o=r.call(n),i,a=[],s;try{for(;(t===void 0||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(s)throw s.error}}return a}function zo(){for(var n=[],t=0;t<arguments.length;t++)n=n.concat(ju(arguments[t]));return n}var CK="injectionTokens";function EK(n){var t=Reflect.getMetadata("design:paramtypes",n)||[],r=Reflect.getOwnMetadata(CK,n)||{};return Object.keys(r).forEach(function(o){t[+o]=r[o]}),t}function Q0(n){return!!n.useClass}function cg(n){return!!n.useFactory}var eC=function(){function n(t){this.wrap=t,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}return n.prototype.createProxy=function(t){var r=this,o={},i=!1,a,s=function(){return i||(a=t(r.wrap()),i=!0),a};return new Proxy(o,this.createHandler(s))},n.prototype.createHandler=function(t){var r={},o=function(i){r[i]=function(){for(var a=[],s=0;s<arguments.length;s++)a[s]=arguments[s];a[0]=t();var c=Reflect[i];return c.apply(void 0,zo(a))}};return this.reflectMethods.forEach(o),r},n}();function sa(n){return typeof n=="string"||typeof n=="symbol"}function NK(n){return typeof n=="object"&&"token"in n&&"multiple"in n}function tC(n){return typeof n=="object"&&"token"in n&&"transform"in n}function SK(n){return typeof n=="function"||n instanceof eC}function Fu(n){return!!n.useToken}function Uu(n){return n.useValue!=null}function xK(n){return Q0(n)||Uu(n)||Fu(n)||cg(n)}var ug=function(){function n(){this._registryMap=new Map}return n.prototype.entries=function(){return this._registryMap.entries()},n.prototype.getAll=function(t){return this.ensure(t),this._registryMap.get(t)},n.prototype.get=function(t){this.ensure(t);var r=this._registryMap.get(t);return r[r.length-1]||null},n.prototype.set=function(t,r){this.ensure(t),this._registryMap.get(t).push(r)},n.prototype.setAll=function(t,r){this._registryMap.set(t,r)},n.prototype.has=function(t){return this.ensure(t),this._registryMap.get(t).length>0},n.prototype.clear=function(){this._registryMap.clear()},n.prototype.ensure=function(t){this._registryMap.has(t)||this._registryMap.set(t,[])},n}(),AK=function(n){lg(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t}(ug),Ku=function(){function n(){this.scopedResolutions=new Map}return n}();function vK(n,t){if(n===null)return"at position #"+t;var r=n.split(",")[t].trim();return'"'+r+'" at position #'+t}function IK(n,t,r){return r===void 0&&(r=" "),zo([n],t.message.split(`
534
534
  `).map(function(o){return r+o})).join(`
535
- `)}function SK(n,t,r){var o=ju(n.toString().match(/constructor\(([\w, ]+)\)/)||[],2),i=o[1],a=i===void 0?null:i,s=EK(a,t);return NK("Cannot inject the dependency "+s+' of "'+n.name+'" constructor. Reason:',r)}function xK(n){if(typeof n.dispose!="function")return!1;var t=n.dispose;return!(t.length>0)}var AK=function(n){lg(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t}(ug),vK=function(n){lg(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t}(ug),IK=function(){function n(){this.preResolution=new AK,this.postResolution=new vK}return n}(),nC=new Map,BK=function(){function n(t){this.parent=t,this._registry=new CK,this.interceptors=new IK,this.disposed=!1,this.disposables=new Set}return n.prototype.register=function(t,r,o){o===void 0&&(o={lifecycle:Cn.Transient}),this.ensureNotDisposed();var i;if(kK(r)?i=r:i={useClass:r},Fu(i))for(var a=[t],s=i;s!=null;){var c=s.useToken;if(a.includes(c))throw new Error("Token registration cycle detected! "+zo(a,[c]).join(" -> "));a.push(c);var l=this._registry.get(c);l&&Fu(l.provider)?s=l.provider:s=null}if((o.lifecycle===Cn.Singleton||o.lifecycle==Cn.ContainerScoped||o.lifecycle==Cn.ResolutionScoped)&&(Uu(i)||cg(i)))throw new Error('Cannot use lifecycle "'+Cn[o.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(t,{provider:i,options:o}),this},n.prototype.registerType=function(t,r){return this.ensureNotDisposed(),sa(r)?this.register(t,{useToken:r}):this.register(t,{useClass:r})},n.prototype.registerInstance=function(t,r){return this.ensureNotDisposed(),this.register(t,{useValue:r})},n.prototype.registerSingleton=function(t,r){if(this.ensureNotDisposed(),sa(t)){if(sa(r))return this.register(t,{useToken:r},{lifecycle:Cn.Singleton});if(r)return this.register(t,{useClass:r},{lifecycle:Cn.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var o=t;return r&&!sa(r)&&(o=r),this.register(t,{useClass:o},{lifecycle:Cn.Singleton})},n.prototype.resolve=function(t,r,o){r===void 0&&(r=new Ku),o===void 0&&(o=!1),this.ensureNotDisposed();var i=this.getRegistration(t);if(!i&&sa(t)){if(o)return;throw new Error('Attempted to resolve unregistered dependency token: "'+t.toString()+'"')}if(this.executePreResolutionInterceptor(t,"Single"),i){var a=this.resolveRegistration(i,r);return this.executePostResolutionInterceptor(t,a,"Single"),a}if(wK(t)){var a=this.construct(t,r);return this.executePostResolutionInterceptor(t,a,"Single"),a}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},n.prototype.executePreResolutionInterceptor=function(t,r){var o,i;if(this.interceptors.preResolution.has(t)){var a=[];try{for(var s=Mu(this.interceptors.preResolution.getAll(t)),c=s.next();!c.done;c=s.next()){var l=c.value;l.options.frequency!="Once"&&a.push(l),l.callback(t,r)}}catch(u){o={error:u}}finally{try{c&&!c.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}this.interceptors.preResolution.setAll(t,a)}},n.prototype.executePostResolutionInterceptor=function(t,r,o){var i,a;if(this.interceptors.postResolution.has(t)){var s=[];try{for(var c=Mu(this.interceptors.postResolution.getAll(t)),l=c.next();!l.done;l=c.next()){var u=l.value;u.options.frequency!="Once"&&s.push(u),u.callback(t,r,o)}}catch(p){i={error:p}}finally{try{l&&!l.done&&(a=c.return)&&a.call(c)}finally{if(i)throw i.error}}this.interceptors.postResolution.setAll(t,s)}},n.prototype.resolveRegistration=function(t,r){if(this.ensureNotDisposed(),t.options.lifecycle===Cn.ResolutionScoped&&r.scopedResolutions.has(t))return r.scopedResolutions.get(t);var o=t.options.lifecycle===Cn.Singleton,i=t.options.lifecycle===Cn.ContainerScoped,a=o||i,s;return Uu(t.provider)?s=t.provider.useValue:Fu(t.provider)?s=a?t.instance||(t.instance=this.resolve(t.provider.useToken,r)):this.resolve(t.provider.useToken,r):Q0(t.provider)?s=a?t.instance||(t.instance=this.construct(t.provider.useClass,r)):this.construct(t.provider.useClass,r):cg(t.provider)?s=t.provider.useFactory(this):s=this.construct(t.provider,r),t.options.lifecycle===Cn.ResolutionScoped&&r.scopedResolutions.set(t,s),s},n.prototype.resolveAll=function(t,r,o){var i=this;r===void 0&&(r=new Ku),o===void 0&&(o=!1),this.ensureNotDisposed();var a=this.getAllRegistrations(t);if(!a&&sa(t)){if(o)return[];throw new Error('Attempted to resolve unregistered dependency token: "'+t.toString()+'"')}if(this.executePreResolutionInterceptor(t,"All"),a){var s=a.map(function(l){return i.resolveRegistration(l,r)});return this.executePostResolutionInterceptor(t,s,"All"),s}var c=[this.construct(t,r)];return this.executePostResolutionInterceptor(t,c,"All"),c},n.prototype.isRegistered=function(t,r){return r===void 0&&(r=!1),this.ensureNotDisposed(),this._registry.has(t)||r&&(this.parent||!1)&&this.parent.isRegistered(t,!0)},n.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},n.prototype.clearInstances=function(){var t,r;this.ensureNotDisposed();try{for(var o=Mu(this._registry.entries()),i=o.next();!i.done;i=o.next()){var a=ju(i.value,2),s=a[0],c=a[1];this._registry.setAll(s,c.filter(function(l){return!Uu(l.provider)}).map(function(l){return l.instance=void 0,l}))}}catch(l){t={error:l}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}},n.prototype.createChildContainer=function(){var t,r;this.ensureNotDisposed();var o=new n(this);try{for(var i=Mu(this._registry.entries()),a=i.next();!a.done;a=i.next()){var s=ju(a.value,2),c=s[0],l=s[1];l.some(function(u){var p=u.options;return p.lifecycle===Cn.ContainerScoped})&&o._registry.setAll(c,l.map(function(u){return u.options.lifecycle===Cn.ContainerScoped?{provider:u.provider,options:u.options}:u}))}}catch(u){t={error:u}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return o},n.prototype.beforeResolution=function(t,r,o){o===void 0&&(o={frequency:"Always"}),this.interceptors.preResolution.set(t,{callback:r,options:o})},n.prototype.afterResolution=function(t,r,o){o===void 0&&(o={frequency:"Always"}),this.interceptors.postResolution.set(t,{callback:r,options:o})},n.prototype.dispose=function(){return gK(this,void 0,void 0,function(){var t;return hK(this,function(r){switch(r.label){case 0:return this.disposed=!0,t=[],this.disposables.forEach(function(o){var i=o.dispose();i&&t.push(i)}),[4,Promise.all(t)];case 1:return r.sent(),[2]}})})},n.prototype.getRegistration=function(t){return this.isRegistered(t)?this._registry.get(t):this.parent?this.parent.getRegistration(t):null},n.prototype.getAllRegistrations=function(t){return this.isRegistered(t)?this._registry.getAll(t):this.parent?this.parent.getAllRegistrations(t):null},n.prototype.construct=function(t,r){var o=this;if(t instanceof eC)return t.createProxy(function(a){return o.resolve(a,r)});var i=function(){var a=nC.get(t);if(!a||a.length===0){if(t.length===0)return new t;throw new Error('TypeInfo not known for "'+t.name+'"')}var s=a.map(o.resolveParams(r,t));return new(t.bind.apply(t,zo([void 0],s)))}();return xK(i)&&this.disposables.add(i),i},n.prototype.resolveParams=function(t,r){var o=this;return function(i,a){var s,c,l;try{return bK(i)?tC(i)?i.multiple?(s=o.resolve(i.transform)).transform.apply(s,zo([o.resolveAll(i.token,new Ku,i.isOptional)],i.transformArgs)):(c=o.resolve(i.transform)).transform.apply(c,zo([o.resolve(i.token,t,i.isOptional)],i.transformArgs)):i.multiple?o.resolveAll(i.token,new Ku,i.isOptional):o.resolve(i.token,t,i.isOptional):tC(i)?(l=o.resolve(i.transform,t)).transform.apply(l,zo([o.resolve(i.token,t)],i.transformArgs)):o.resolve(i,t)}catch(u){throw new Error(SK(r,a,u))}}},n.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},n}(),pn=new BK;function qu(n){return function(t){nC.set(t,_K(t))}}if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);var dg;class Gu{constructor(t={}){K(this,"attrId","");K(this,"attrValues",[]);Object.assign(t)}}B([H({type:me.ObjectIdentifier})],Gu.prototype,"attrId",void 0),B([H({type:me.Any,repeated:"set"})],Gu.prototype,"attrValues",void 0);let rC=dg=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,dg.prototype)}};rC=dg=B([Le({type:Pe.Sequence,itemType:Gu})],rC);var fg;let oC=fg=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,fg.prototype)}};oC=fg=B([Le({type:Pe.Sequence,itemType:ta})],oC);class iC{constructor(t={}){K(this,"certId","");K(this,"certValue",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],iC.prototype,"certId",void 0),B([H({type:me.Any,context:0})],iC.prototype,"certValue",void 0);class aC{constructor(t={}){K(this,"crlId","");K(this,"crltValue",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],aC.prototype,"crlId",void 0),B([H({type:me.Any,context:0})],aC.prototype,"crltValue",void 0);class sC extends mt{}let Hu=class{constructor(t={}){K(this,"encryptionAlgorithm",new Ge);K(this,"encryptedData",new sC);Object.assign(this,t)}};B([H({type:Ge})],Hu.prototype,"encryptionAlgorithm",void 0),B([H({type:sC})],Hu.prototype,"encryptedData",void 0);var pg,mg;(function(n){n[n.v1=0]="v1"})(mg||(mg={}));class lC extends mt{}let gg=pg=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,pg.prototype)}};gg=pg=B([Le({type:Pe.Sequence,itemType:Ur})],gg);class Os{constructor(t={}){K(this,"version",mg.v1);K(this,"privateKeyAlgorithm",new Ge);K(this,"privateKey",new lC);K(this,"attributes");Object.assign(this,t)}}B([H({type:me.Integer})],Os.prototype,"version",void 0),B([H({type:Ge})],Os.prototype,"privateKeyAlgorithm",void 0),B([H({type:lC})],Os.prototype,"privateKey",void 0),B([H({type:gg,implicit:!0,context:0,optional:!0})],Os.prototype,"attributes",void 0);let cC=class extends Os{};cC=B([Le({type:Pe.Sequence})],cC);let uC=class extends Hu{};uC=B([Le({type:Pe.Sequence})],uC);class dC{constructor(t={}){K(this,"secretTypeId","");K(this,"secretValue",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],dC.prototype,"secretTypeId",void 0),B([H({type:me.Any,context:0})],dC.prototype,"secretValue",void 0);class Ps{constructor(t={}){K(this,"mac",new Lu);K(this,"macSalt",new mt);K(this,"iterations",1);Object.assign(this,t)}}B([H({type:Lu})],Ps.prototype,"mac",void 0),B([H({type:mt})],Ps.prototype,"macSalt",void 0),B([H({type:me.Integer,defaultValue:1})],Ps.prototype,"iterations",void 0);class zu{constructor(t={}){K(this,"version",3);K(this,"authSafe",new ta);K(this,"macData",new Ps);Object.assign(this,t)}}B([H({type:me.Integer})],zu.prototype,"version",void 0),B([H({type:ta})],zu.prototype,"authSafe",void 0),B([H({type:Ps,optional:!0})],zu.prototype,"macData",void 0);var hg;class Wu{constructor(t={}){K(this,"bagId","");K(this,"bagValue",new ArrayBuffer(0));K(this,"bagAttributes");Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],Wu.prototype,"bagId",void 0),B([H({type:me.Any,context:0})],Wu.prototype,"bagValue",void 0),B([H({type:Gu,repeated:"set",optional:!0})],Wu.prototype,"bagAttributes",void 0);let fC=hg=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,hg.prototype)}};fC=hg=B([Le({type:Pe.Sequence,itemType:Wu})],fC);var yg,_g,bg;const pC="1.2.840.113549.1.9",mC=`${pC}.7`,wg=`${pC}.14`;let Yu=class extends rn{constructor(r={}){super(r);K(this,"ia5String")}toString(){return this.ia5String||super.toString()}};B([H({type:me.IA5String})],Yu.prototype,"ia5String",void 0),Yu=B([Le({type:Pe.Choice})],Yu);let gC=class extends ta{};gC=B([Le({type:Pe.Sequence})],gC);let hC=class extends zu{};hC=B([Le({type:Pe.Sequence})],hC);let yC=class extends Hu{};yC=B([Le({type:Pe.Sequence})],yC);let kg=class{constructor(t=""){K(this,"value");this.value=t}toString(){return this.value}};B([H({type:me.IA5String})],kg.prototype,"value",void 0),kg=B([Le({type:Pe.Choice})],kg);let _C=class extends Yu{};_C=B([Le({type:Pe.Choice})],_C);let bC=class extends rn{};bC=B([Le({type:Pe.Choice})],bC);let Cg=class{constructor(t=new Date){K(this,"value");this.value=t}};B([H({type:me.GeneralizedTime})],Cg.prototype,"value",void 0),Cg=B([Le({type:Pe.Choice})],Cg);let wC=class extends rn{};wC=B([Le({type:Pe.Choice})],wC);let Eg=class{constructor(t="M"){K(this,"value");this.value=t}toString(){return this.value}};B([H({type:me.PrintableString})],Eg.prototype,"value",void 0),Eg=B([Le({type:Pe.Choice})],Eg);let Ju=class{constructor(t=""){K(this,"value");this.value=t}toString(){return this.value}};B([H({type:me.PrintableString})],Ju.prototype,"value",void 0),Ju=B([Le({type:Pe.Choice})],Ju);let kC=class extends Ju{};kC=B([Le({type:Pe.Choice})],kC);let CC=class extends rn{};CC=B([Le({type:Pe.Choice})],CC);let Ng=class{constructor(t=""){K(this,"value");this.value=t}toString(){return this.value}};B([H({type:me.ObjectIdentifier})],Ng.prototype,"value",void 0),Ng=B([Le({type:Pe.Choice})],Ng);let EC=class extends on{};EC=B([Le({type:Pe.Choice})],EC);let Sg=class{constructor(t=0){K(this,"value");this.value=t}toString(){return this.value.toString()}};B([H({type:me.Integer})],Sg.prototype,"value",void 0),Sg=B([Le({type:Pe.Choice})],Sg);let NC=class extends Er{};NC=B([Le({type:Pe.Sequence})],NC);let Xu=class extends rn{};Xu=B([Le({type:Pe.Choice})],Xu);let SC=yg=class extends jo{constructor(t){super(t),Object.setPrototypeOf(this,yg.prototype)}};SC=yg=B([Le({type:Pe.Sequence})],SC);let xC=_g=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,_g.prototype)}};xC=_g=B([Le({type:Pe.Set,itemType:Xi})],xC);let xg=class{constructor(t=""){K(this,"value");this.value=t}toString(){return this.value}};B([H({type:me.BmpString})],xg.prototype,"value",void 0),xg=B([Le({type:Pe.Choice})],xg);let Ag=class extends Ge{};Ag=B([Le({type:Pe.Sequence})],Ag);let AC=bg=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,bg.prototype)}};AC=bg=B([Le({type:Pe.Sequence,itemType:Ag})],AC);var vg;let Zu=vg=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,vg.prototype)}};Zu=vg=B([Le({type:Pe.Sequence,itemType:Ur})],Zu);class la{constructor(t={}){K(this,"version",0);K(this,"subject",new Wt);K(this,"subjectPKInfo",new wr);K(this,"attributes",new Zu);Object.assign(this,t)}}B([H({type:me.Integer})],la.prototype,"version",void 0),B([H({type:Wt})],la.prototype,"subject",void 0),B([H({type:wr})],la.prototype,"subjectPKInfo",void 0),B([H({type:Zu,implicit:!0,context:0,optional:!0})],la.prototype,"attributes",void 0);class Vs{constructor(t={}){K(this,"certificationRequestInfo",new la);K(this,"certificationRequestInfoRaw");K(this,"signatureAlgorithm",new Ge);K(this,"signature",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:la,raw:!0})],Vs.prototype,"certificationRequestInfo",void 0),B([H({type:Ge})],Vs.prototype,"signatureAlgorithm",void 0),B([H({type:me.BitString})],Vs.prototype,"signature",void 0);/*!
535
+ `)}function BK(n,t,r){var o=ju(n.toString().match(/constructor\(([\w, ]+)\)/)||[],2),i=o[1],a=i===void 0?null:i,s=vK(a,t);return IK("Cannot inject the dependency "+s+' of "'+n.name+'" constructor. Reason:',r)}function TK(n){if(typeof n.dispose!="function")return!1;var t=n.dispose;return!(t.length>0)}var OK=function(n){lg(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t}(ug),PK=function(n){lg(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t}(ug),VK=function(){function n(){this.preResolution=new OK,this.postResolution=new PK}return n}(),nC=new Map,$K=function(){function n(t){this.parent=t,this._registry=new AK,this.interceptors=new VK,this.disposed=!1,this.disposables=new Set}return n.prototype.register=function(t,r,o){o===void 0&&(o={lifecycle:Cn.Transient}),this.ensureNotDisposed();var i;if(xK(r)?i=r:i={useClass:r},Fu(i))for(var a=[t],s=i;s!=null;){var c=s.useToken;if(a.includes(c))throw new Error("Token registration cycle detected! "+zo(a,[c]).join(" -> "));a.push(c);var l=this._registry.get(c);l&&Fu(l.provider)?s=l.provider:s=null}if((o.lifecycle===Cn.Singleton||o.lifecycle==Cn.ContainerScoped||o.lifecycle==Cn.ResolutionScoped)&&(Uu(i)||cg(i)))throw new Error('Cannot use lifecycle "'+Cn[o.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(t,{provider:i,options:o}),this},n.prototype.registerType=function(t,r){return this.ensureNotDisposed(),sa(r)?this.register(t,{useToken:r}):this.register(t,{useClass:r})},n.prototype.registerInstance=function(t,r){return this.ensureNotDisposed(),this.register(t,{useValue:r})},n.prototype.registerSingleton=function(t,r){if(this.ensureNotDisposed(),sa(t)){if(sa(r))return this.register(t,{useToken:r},{lifecycle:Cn.Singleton});if(r)return this.register(t,{useClass:r},{lifecycle:Cn.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var o=t;return r&&!sa(r)&&(o=r),this.register(t,{useClass:o},{lifecycle:Cn.Singleton})},n.prototype.resolve=function(t,r,o){r===void 0&&(r=new Ku),o===void 0&&(o=!1),this.ensureNotDisposed();var i=this.getRegistration(t);if(!i&&sa(t)){if(o)return;throw new Error('Attempted to resolve unregistered dependency token: "'+t.toString()+'"')}if(this.executePreResolutionInterceptor(t,"Single"),i){var a=this.resolveRegistration(i,r);return this.executePostResolutionInterceptor(t,a,"Single"),a}if(SK(t)){var a=this.construct(t,r);return this.executePostResolutionInterceptor(t,a,"Single"),a}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},n.prototype.executePreResolutionInterceptor=function(t,r){var o,i;if(this.interceptors.preResolution.has(t)){var a=[];try{for(var s=Mu(this.interceptors.preResolution.getAll(t)),c=s.next();!c.done;c=s.next()){var l=c.value;l.options.frequency!="Once"&&a.push(l),l.callback(t,r)}}catch(u){o={error:u}}finally{try{c&&!c.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}this.interceptors.preResolution.setAll(t,a)}},n.prototype.executePostResolutionInterceptor=function(t,r,o){var i,a;if(this.interceptors.postResolution.has(t)){var s=[];try{for(var c=Mu(this.interceptors.postResolution.getAll(t)),l=c.next();!l.done;l=c.next()){var u=l.value;u.options.frequency!="Once"&&s.push(u),u.callback(t,r,o)}}catch(p){i={error:p}}finally{try{l&&!l.done&&(a=c.return)&&a.call(c)}finally{if(i)throw i.error}}this.interceptors.postResolution.setAll(t,s)}},n.prototype.resolveRegistration=function(t,r){if(this.ensureNotDisposed(),t.options.lifecycle===Cn.ResolutionScoped&&r.scopedResolutions.has(t))return r.scopedResolutions.get(t);var o=t.options.lifecycle===Cn.Singleton,i=t.options.lifecycle===Cn.ContainerScoped,a=o||i,s;return Uu(t.provider)?s=t.provider.useValue:Fu(t.provider)?s=a?t.instance||(t.instance=this.resolve(t.provider.useToken,r)):this.resolve(t.provider.useToken,r):Q0(t.provider)?s=a?t.instance||(t.instance=this.construct(t.provider.useClass,r)):this.construct(t.provider.useClass,r):cg(t.provider)?s=t.provider.useFactory(this):s=this.construct(t.provider,r),t.options.lifecycle===Cn.ResolutionScoped&&r.scopedResolutions.set(t,s),s},n.prototype.resolveAll=function(t,r,o){var i=this;r===void 0&&(r=new Ku),o===void 0&&(o=!1),this.ensureNotDisposed();var a=this.getAllRegistrations(t);if(!a&&sa(t)){if(o)return[];throw new Error('Attempted to resolve unregistered dependency token: "'+t.toString()+'"')}if(this.executePreResolutionInterceptor(t,"All"),a){var s=a.map(function(l){return i.resolveRegistration(l,r)});return this.executePostResolutionInterceptor(t,s,"All"),s}var c=[this.construct(t,r)];return this.executePostResolutionInterceptor(t,c,"All"),c},n.prototype.isRegistered=function(t,r){return r===void 0&&(r=!1),this.ensureNotDisposed(),this._registry.has(t)||r&&(this.parent||!1)&&this.parent.isRegistered(t,!0)},n.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},n.prototype.clearInstances=function(){var t,r;this.ensureNotDisposed();try{for(var o=Mu(this._registry.entries()),i=o.next();!i.done;i=o.next()){var a=ju(i.value,2),s=a[0],c=a[1];this._registry.setAll(s,c.filter(function(l){return!Uu(l.provider)}).map(function(l){return l.instance=void 0,l}))}}catch(l){t={error:l}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}},n.prototype.createChildContainer=function(){var t,r;this.ensureNotDisposed();var o=new n(this);try{for(var i=Mu(this._registry.entries()),a=i.next();!a.done;a=i.next()){var s=ju(a.value,2),c=s[0],l=s[1];l.some(function(u){var p=u.options;return p.lifecycle===Cn.ContainerScoped})&&o._registry.setAll(c,l.map(function(u){return u.options.lifecycle===Cn.ContainerScoped?{provider:u.provider,options:u.options}:u}))}}catch(u){t={error:u}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return o},n.prototype.beforeResolution=function(t,r,o){o===void 0&&(o={frequency:"Always"}),this.interceptors.preResolution.set(t,{callback:r,options:o})},n.prototype.afterResolution=function(t,r,o){o===void 0&&(o={frequency:"Always"}),this.interceptors.postResolution.set(t,{callback:r,options:o})},n.prototype.dispose=function(){return wK(this,void 0,void 0,function(){var t;return kK(this,function(r){switch(r.label){case 0:return this.disposed=!0,t=[],this.disposables.forEach(function(o){var i=o.dispose();i&&t.push(i)}),[4,Promise.all(t)];case 1:return r.sent(),[2]}})})},n.prototype.getRegistration=function(t){return this.isRegistered(t)?this._registry.get(t):this.parent?this.parent.getRegistration(t):null},n.prototype.getAllRegistrations=function(t){return this.isRegistered(t)?this._registry.getAll(t):this.parent?this.parent.getAllRegistrations(t):null},n.prototype.construct=function(t,r){var o=this;if(t instanceof eC)return t.createProxy(function(a){return o.resolve(a,r)});var i=function(){var a=nC.get(t);if(!a||a.length===0){if(t.length===0)return new t;throw new Error('TypeInfo not known for "'+t.name+'"')}var s=a.map(o.resolveParams(r,t));return new(t.bind.apply(t,zo([void 0],s)))}();return TK(i)&&this.disposables.add(i),i},n.prototype.resolveParams=function(t,r){var o=this;return function(i,a){var s,c,l;try{return NK(i)?tC(i)?i.multiple?(s=o.resolve(i.transform)).transform.apply(s,zo([o.resolveAll(i.token,new Ku,i.isOptional)],i.transformArgs)):(c=o.resolve(i.transform)).transform.apply(c,zo([o.resolve(i.token,t,i.isOptional)],i.transformArgs)):i.multiple?o.resolveAll(i.token,new Ku,i.isOptional):o.resolve(i.token,t,i.isOptional):tC(i)?(l=o.resolve(i.transform,t)).transform.apply(l,zo([o.resolve(i.token,t)],i.transformArgs)):o.resolve(i,t)}catch(u){throw new Error(BK(r,a,u))}}},n.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},n}(),pn=new $K;function qu(n){return function(t){nC.set(t,EK(t))}}if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);var dg;class Gu{constructor(t={}){K(this,"attrId","");K(this,"attrValues",[]);Object.assign(t)}}B([H({type:me.ObjectIdentifier})],Gu.prototype,"attrId",void 0),B([H({type:me.Any,repeated:"set"})],Gu.prototype,"attrValues",void 0);let rC=dg=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,dg.prototype)}};rC=dg=B([Le({type:Pe.Sequence,itemType:Gu})],rC);var fg;let oC=fg=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,fg.prototype)}};oC=fg=B([Le({type:Pe.Sequence,itemType:ta})],oC);class iC{constructor(t={}){K(this,"certId","");K(this,"certValue",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],iC.prototype,"certId",void 0),B([H({type:me.Any,context:0})],iC.prototype,"certValue",void 0);class aC{constructor(t={}){K(this,"crlId","");K(this,"crltValue",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],aC.prototype,"crlId",void 0),B([H({type:me.Any,context:0})],aC.prototype,"crltValue",void 0);class sC extends mt{}let Hu=class{constructor(t={}){K(this,"encryptionAlgorithm",new He);K(this,"encryptedData",new sC);Object.assign(this,t)}};B([H({type:He})],Hu.prototype,"encryptionAlgorithm",void 0),B([H({type:sC})],Hu.prototype,"encryptedData",void 0);var pg,mg;(function(n){n[n.v1=0]="v1"})(mg||(mg={}));class lC extends mt{}let gg=pg=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,pg.prototype)}};gg=pg=B([Le({type:Pe.Sequence,itemType:Ur})],gg);class Os{constructor(t={}){K(this,"version",mg.v1);K(this,"privateKeyAlgorithm",new He);K(this,"privateKey",new lC);K(this,"attributes");Object.assign(this,t)}}B([H({type:me.Integer})],Os.prototype,"version",void 0),B([H({type:He})],Os.prototype,"privateKeyAlgorithm",void 0),B([H({type:lC})],Os.prototype,"privateKey",void 0),B([H({type:gg,implicit:!0,context:0,optional:!0})],Os.prototype,"attributes",void 0);let cC=class extends Os{};cC=B([Le({type:Pe.Sequence})],cC);let uC=class extends Hu{};uC=B([Le({type:Pe.Sequence})],uC);class dC{constructor(t={}){K(this,"secretTypeId","");K(this,"secretValue",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],dC.prototype,"secretTypeId",void 0),B([H({type:me.Any,context:0})],dC.prototype,"secretValue",void 0);class Ps{constructor(t={}){K(this,"mac",new Lu);K(this,"macSalt",new mt);K(this,"iterations",1);Object.assign(this,t)}}B([H({type:Lu})],Ps.prototype,"mac",void 0),B([H({type:mt})],Ps.prototype,"macSalt",void 0),B([H({type:me.Integer,defaultValue:1})],Ps.prototype,"iterations",void 0);class zu{constructor(t={}){K(this,"version",3);K(this,"authSafe",new ta);K(this,"macData",new Ps);Object.assign(this,t)}}B([H({type:me.Integer})],zu.prototype,"version",void 0),B([H({type:ta})],zu.prototype,"authSafe",void 0),B([H({type:Ps,optional:!0})],zu.prototype,"macData",void 0);var hg;class Wu{constructor(t={}){K(this,"bagId","");K(this,"bagValue",new ArrayBuffer(0));K(this,"bagAttributes");Object.assign(this,t)}}B([H({type:me.ObjectIdentifier})],Wu.prototype,"bagId",void 0),B([H({type:me.Any,context:0})],Wu.prototype,"bagValue",void 0),B([H({type:Gu,repeated:"set",optional:!0})],Wu.prototype,"bagAttributes",void 0);let fC=hg=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,hg.prototype)}};fC=hg=B([Le({type:Pe.Sequence,itemType:Wu})],fC);var yg,_g,bg;const pC="1.2.840.113549.1.9",mC=`${pC}.7`,wg=`${pC}.14`;let Yu=class extends rn{constructor(r={}){super(r);K(this,"ia5String")}toString(){return this.ia5String||super.toString()}};B([H({type:me.IA5String})],Yu.prototype,"ia5String",void 0),Yu=B([Le({type:Pe.Choice})],Yu);let gC=class extends ta{};gC=B([Le({type:Pe.Sequence})],gC);let hC=class extends zu{};hC=B([Le({type:Pe.Sequence})],hC);let yC=class extends Hu{};yC=B([Le({type:Pe.Sequence})],yC);let kg=class{constructor(t=""){K(this,"value");this.value=t}toString(){return this.value}};B([H({type:me.IA5String})],kg.prototype,"value",void 0),kg=B([Le({type:Pe.Choice})],kg);let _C=class extends Yu{};_C=B([Le({type:Pe.Choice})],_C);let bC=class extends rn{};bC=B([Le({type:Pe.Choice})],bC);let Cg=class{constructor(t=new Date){K(this,"value");this.value=t}};B([H({type:me.GeneralizedTime})],Cg.prototype,"value",void 0),Cg=B([Le({type:Pe.Choice})],Cg);let wC=class extends rn{};wC=B([Le({type:Pe.Choice})],wC);let Eg=class{constructor(t="M"){K(this,"value");this.value=t}toString(){return this.value}};B([H({type:me.PrintableString})],Eg.prototype,"value",void 0),Eg=B([Le({type:Pe.Choice})],Eg);let Ju=class{constructor(t=""){K(this,"value");this.value=t}toString(){return this.value}};B([H({type:me.PrintableString})],Ju.prototype,"value",void 0),Ju=B([Le({type:Pe.Choice})],Ju);let kC=class extends Ju{};kC=B([Le({type:Pe.Choice})],kC);let CC=class extends rn{};CC=B([Le({type:Pe.Choice})],CC);let Ng=class{constructor(t=""){K(this,"value");this.value=t}toString(){return this.value}};B([H({type:me.ObjectIdentifier})],Ng.prototype,"value",void 0),Ng=B([Le({type:Pe.Choice})],Ng);let EC=class extends on{};EC=B([Le({type:Pe.Choice})],EC);let Sg=class{constructor(t=0){K(this,"value");this.value=t}toString(){return this.value.toString()}};B([H({type:me.Integer})],Sg.prototype,"value",void 0),Sg=B([Le({type:Pe.Choice})],Sg);let NC=class extends Er{};NC=B([Le({type:Pe.Sequence})],NC);let Xu=class extends rn{};Xu=B([Le({type:Pe.Choice})],Xu);let SC=yg=class extends jo{constructor(t){super(t),Object.setPrototypeOf(this,yg.prototype)}};SC=yg=B([Le({type:Pe.Sequence})],SC);let xC=_g=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,_g.prototype)}};xC=_g=B([Le({type:Pe.Set,itemType:Xi})],xC);let xg=class{constructor(t=""){K(this,"value");this.value=t}toString(){return this.value}};B([H({type:me.BmpString})],xg.prototype,"value",void 0),xg=B([Le({type:Pe.Choice})],xg);let Ag=class extends He{};Ag=B([Le({type:Pe.Sequence})],Ag);let AC=bg=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,bg.prototype)}};AC=bg=B([Le({type:Pe.Sequence,itemType:Ag})],AC);var vg;let Zu=vg=class extends kt{constructor(t){super(t),Object.setPrototypeOf(this,vg.prototype)}};Zu=vg=B([Le({type:Pe.Sequence,itemType:Ur})],Zu);class la{constructor(t={}){K(this,"version",0);K(this,"subject",new Wt);K(this,"subjectPKInfo",new wr);K(this,"attributes",new Zu);Object.assign(this,t)}}B([H({type:me.Integer})],la.prototype,"version",void 0),B([H({type:Wt})],la.prototype,"subject",void 0),B([H({type:wr})],la.prototype,"subjectPKInfo",void 0),B([H({type:Zu,implicit:!0,context:0,optional:!0})],la.prototype,"attributes",void 0);class Vs{constructor(t={}){K(this,"certificationRequestInfo",new la);K(this,"certificationRequestInfoRaw");K(this,"signatureAlgorithm",new He);K(this,"signature",new ArrayBuffer(0));Object.assign(this,t)}}B([H({type:la,raw:!0})],Vs.prototype,"certificationRequestInfo",void 0),B([H({type:He})],Vs.prototype,"signatureAlgorithm",void 0),B([H({type:me.BitString})],Vs.prototype,"signature",void 0);/*!
536
536
  * MIT License
537
537
  *
538
538
  * Copyright (c) Peculiar Ventures. All rights reserved.
@@ -555,8 +555,8 @@ ${t.join(`
555
555
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
556
556
  * SOFTWARE.
557
557
  *
558
- */const ca="crypto.algorithm";class vC{getAlgorithms(){return pn.resolveAll(ca)}toAsnAlgorithm(t){const r={...t};r.hash&&typeof r.hash=="string"&&(r.hash={name:r.hash});for(const o of this.getAlgorithms()){const i=o.toAsnAlgorithm(r);if(i)return i}if(/^[0-9.]+$/.test(t.name)){const o=new Ge({algorithm:t.name});if("parameters"in t){const i=t;o.parameters=i.parameters}return o}throw new Error("Cannot convert WebCrypto algorithm to ASN.1 algorithm")}toWebAlgorithm(t){for(const o of this.getAlgorithms()){const i=o.toWebAlgorithm(t);if(i)return i}return{name:t.algorithm,parameters:t.parameters}}}const Wo="crypto.algorithmProvider";pn.registerSingleton(Wo,vC);var Qu;const En="1.3.36.3.3.2.8.1.1",IC=`${En}.1`,BC=`${En}.2`,TC=`${En}.3`,OC=`${En}.4`,PC=`${En}.5`,VC=`${En}.6`,$C=`${En}.7`,RC=`${En}.8`,LC=`${En}.9`,DC=`${En}.10`,MC=`${En}.11`,jC=`${En}.12`,FC=`${En}.13`,UC=`${En}.14`,KC="brainpoolP160r1",qC="brainpoolP160t1",GC="brainpoolP192r1",HC="brainpoolP192t1",zC="brainpoolP224r1",WC="brainpoolP224t1",YC="brainpoolP256r1",JC="brainpoolP256t1",XC="brainpoolP320r1",ZC="brainpoolP320t1",QC="brainpoolP384r1",e1="brainpoolP384t1",t1="brainpoolP512r1",n1="brainpoolP512t1",Lt="ECDSA";let ua=Qu=class{toAsnAlgorithm(t){switch(t.name.toLowerCase()){case Lt.toLowerCase():if("hash"in t)switch((typeof t.hash=="string"?t.hash:t.hash.name).toLowerCase()){case"sha-1":return tK;case"sha-256":return nK;case"sha-384":return rK;case"sha-512":return oK}else if("namedCurve"in t){let r="";switch(t.namedCurve){case"P-256":r=G0;break;case"K-256":r=Qu.SECP256K1;break;case"P-384":r=H0;break;case"P-521":r=z0;break;case KC:r=IC;break;case qC:r=BC;break;case GC:r=TC;break;case HC:r=OC;break;case zC:r=PC;break;case WC:r=VC;break;case YC:r=$C;break;case JC:r=RC;break;case XC:r=LC;break;case ZC:r=DC;break;case QC:r=MC;break;case e1:r=jC;break;case t1:r=FC;break;case n1:r=UC;break}if(r)return new Ge({algorithm:vs,parameters:Ue.serialize(new so({namedCurve:r}))})}}return null}toWebAlgorithm(t){switch(t.algorithm){case Xm:return{name:Lt,hash:{name:"SHA-1"}};case Zm:return{name:Lt,hash:{name:"SHA-256"}};case Qm:return{name:Lt,hash:{name:"SHA-384"}};case eg:return{name:Lt,hash:{name:"SHA-512"}};case vs:{if(!t.parameters)throw new TypeError("Cannot get required parameters from EC algorithm");switch(Ue.parse(t.parameters,so).namedCurve){case G0:return{name:Lt,namedCurve:"P-256"};case Qu.SECP256K1:return{name:Lt,namedCurve:"K-256"};case H0:return{name:Lt,namedCurve:"P-384"};case z0:return{name:Lt,namedCurve:"P-521"};case IC:return{name:Lt,namedCurve:KC};case BC:return{name:Lt,namedCurve:qC};case TC:return{name:Lt,namedCurve:GC};case OC:return{name:Lt,namedCurve:HC};case PC:return{name:Lt,namedCurve:zC};case VC:return{name:Lt,namedCurve:WC};case $C:return{name:Lt,namedCurve:YC};case RC:return{name:Lt,namedCurve:JC};case LC:return{name:Lt,namedCurve:XC};case DC:return{name:Lt,namedCurve:ZC};case MC:return{name:Lt,namedCurve:QC};case jC:return{name:Lt,namedCurve:e1};case FC:return{name:Lt,namedCurve:t1};case UC:return{name:Lt,namedCurve:n1}}}}return null}};ua.SECP256K1="1.3.132.0.10",ua=Qu=B([qu()],ua),pn.registerSingleton(ca,ua);const r1=Symbol("name"),o1=Symbol("value");class gt{constructor(t,r={},o=""){this[r1]=t,this[o1]=o;for(const i in r)this[i]=r[i]}}gt.NAME=r1,gt.VALUE=o1;class i1{static toTextObject(t){const r=new gt("Algorithm Identifier",{},Hr.toString(t.algorithm));if(t.parameters)switch(t.algorithm){case vs:{const o=new ua().toWebAlgorithm(t);o&&"namedCurve"in o?r["Named Curve"]=o.namedCurve:r.Parameters=t.parameters;break}default:r.Parameters=t.parameters}return r}}class Hr{static toString(t){const r=this.items[t];return r||t}}Hr.items={[Tu]:"sha1",[J0]:"sha224",[Ou]:"sha256",[Pu]:"sha384",[Vu]:"sha512",[qo]:"rsaEncryption",[vu]:"sha1WithRSAEncryption",[uK]:"sha224WithRSAEncryption",[ng]:"sha256WithRSAEncryption",[Iu]:"sha384WithRSAEncryption",[Bu]:"sha512WithRSAEncryption",[vs]:"ecPublicKey",[Xm]:"ecdsaWithSHA1",[q0]:"ecdsaWithSHA224",[Zm]:"ecdsaWithSHA256",[Qm]:"ecdsaWithSHA384",[eg]:"ecdsaWithSHA512",[W8]:"TLS WWW server authentication",[Y8]:"TLS WWW client authentication",[J8]:"Code Signing",[X8]:"E-mail Protection",[Z8]:"Time Stamping",[Q8]:"OCSP Signing",[eK]:"Signed Data"};class lo{static serialize(t){return this.serializeObj(t).join(`
559
- `)}static pad(t=0){return"".padStart(2*t," ")}static serializeObj(t,r=0){const o=[];let i=this.pad(r++),a="";const s=t[gt.VALUE];s&&(a=` ${s}`),o.push(`${i}${t[gt.NAME]}:${a}`),i=this.pad(r);for(const c in t){if(typeof c=="symbol")continue;const l=t[c],u=c?`${c}: `:"";if(typeof l=="string"||typeof l=="number"||typeof l=="boolean")o.push(`${i}${u}${l}`);else if(l instanceof Date)o.push(`${i}${u}${l.toUTCString()}`);else if(Array.isArray(l))for(const p of l)p[gt.NAME]=c,o.push(...this.serializeObj(p,r));else if(l instanceof gt)l[gt.NAME]=c,o.push(...this.serializeObj(l,r));else if(Ke.isBufferSource(l))c?(o.push(`${i}${u}`),o.push(...this.serializeBufferSource(l,r+1))):o.push(...this.serializeBufferSource(l,r));else if("toTextObject"in l){const p=l.toTextObject();p[gt.NAME]=c,o.push(...this.serializeObj(p,r))}else throw new TypeError("Cannot serialize data in text format. Unsupported type.")}return o}static serializeBufferSource(t,r=0){const o=this.pad(r),i=Ke.toUint8Array(t),a=[];for(let s=0;s<i.length;){const c=[];for(let l=0;l<16&&s<i.length;l++){l===8&&c.push("");const u=i[s++].toString(16).padStart(2,"0");c.push(u)}a.push(`${o}${c.join(" ")}`)}return a}static serializeAlgorithm(t){return this.algorithmSerializer.toTextObject(t)}}lo.oidSerializer=Hr,lo.algorithmSerializer=i1;var da;class zr{get rawData(){return at(this,da,"f")||Vt(this,da,Ue.serialize(this.asn),"f"),at(this,da,"f")}constructor(...t){da.set(this,void 0),Ke.isBufferSource(t[0])?(this.asn=Ue.parse(t[0],t[1]),Vt(this,da,Ke.toArrayBuffer(t[0]),"f"),this.onInit(this.asn)):(this.asn=t[0],this.onInit(this.asn))}equal(t){return t instanceof zr?zU(t.rawData,this.rawData):!1}toString(t="text"){switch(t){case"asn":return Ue.toString(this.rawData);case"text":return lo.serialize(this.toTextObject());case"hex":return Je.ToHex(this.rawData);case"base64":return Je.ToBase64(this.rawData);case"base64url":return Je.ToBase64Url(this.rawData);default:throw TypeError("Argument 'format' is unsupported value")}}getTextName(){return this.constructor.NAME}toTextObject(){const t=this.toTextObjectEmpty();return t[""]=this.rawData,t}toTextObjectEmpty(t){return new gt(this.getTextName(),{},t)}}da=new WeakMap,zr.NAME="ASN";class Nn extends zr{constructor(...t){let r;Ke.isBufferSource(t[0])?r=Ke.toArrayBuffer(t[0]):r=Ue.serialize(new kr({extnID:t[0],critical:t[1],extnValue:new mt(Ke.toArrayBuffer(t[2]))})),super(r,kr)}onInit(t){this.type=t.extnID,this.critical=t.critical,this.value=t.extnValue.buffer}toTextObject(){const t=this.toTextObjectWithoutValue();return t[""]=this.value,t}toTextObjectWithoutValue(){const t=this.toTextObjectEmpty(this.critical?"critical":void 0);return t[gt.NAME]===Nn.NAME&&(t[gt.NAME]=Hr.toString(this.type)),t}}var a1;class Wr{static isCryptoKeyPair(t){return t&&t.privateKey&&t.publicKey}static isCryptoKey(t){return t&&t.usages&&t.type&&t.algorithm&&t.extractable!==void 0}constructor(){this.items=new Map,this[a1]="CryptoProvider",typeof self<"u"&&typeof crypto<"u"?this.set(Wr.DEFAULT,crypto):typeof global<"u"&&global.crypto&&global.crypto.subtle&&this.set(Wr.DEFAULT,global.crypto)}clear(){this.items.clear()}delete(t){return this.items.delete(t)}forEach(t,r){return this.items.forEach(t,r)}has(t){return this.items.has(t)}get size(){return this.items.size}entries(){return this.items.entries()}keys(){return this.items.keys()}values(){return this.items.values()}[Symbol.iterator](){return this.items[Symbol.iterator]()}get(t=Wr.DEFAULT){const r=this.items.get(t.toLowerCase());if(!r)throw new Error(`Cannot get Crypto by name '${t}'`);return r}set(t,r){if(typeof t=="string"){if(!r)throw new TypeError("Argument 'value' is required");this.items.set(t.toLowerCase(),r)}else this.items.set(Wr.DEFAULT,t);return this}}a1=Symbol.toStringTag,Wr.DEFAULT="default";const zn=new Wr,TK=/^[0-2](?:\.[1-9][0-9]*)+$/;function OK(n){return new RegExp(TK).test(n)}class Ig{constructor(t={}){this.items={};for(const r in t)this.register(r,t[r])}get(t){return this.items[t]||null}findId(t){return OK(t)?t:this.get(t)}register(t,r){this.items[t]=r,this.items[r]=t}}const Sn=new Ig;Sn.register("CN","2.5.4.3"),Sn.register("L","2.5.4.7"),Sn.register("ST","2.5.4.8"),Sn.register("O","2.5.4.10"),Sn.register("OU","2.5.4.11"),Sn.register("C","2.5.4.6"),Sn.register("DC","0.9.2342.19200300.100.1.25"),Sn.register("E","1.2.840.113549.1.9.1"),Sn.register("G","2.5.4.42"),Sn.register("I","2.5.4.43"),Sn.register("SN","2.5.4.4"),Sn.register("T","2.5.4.12");function PK(n,t){return`\\${Je.ToHex(Je.FromUtf8String(t)).toUpperCase()}`}function VK(n){return n.replace(/([,+"\\<>;])/g,"\\$1").replace(/^([ #])/,"\\$1").replace(/([ ]$)/,"\\$1").replace(/([\r\n\t])/,PK)}class co{static isASCII(t){for(let r=0;r<t.length;r++)if(t.charCodeAt(r)>255)return!1;return!0}static isPrintableString(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/g.test(t)}constructor(t,r={}){this.extraNames=new Ig,this.asn=new Wt;for(const o in r)if(Object.prototype.hasOwnProperty.call(r,o)){const i=r[o];this.extraNames.register(o,i)}typeof t=="string"?this.asn=this.fromString(t):t instanceof Wt?this.asn=t:Ke.isBufferSource(t)?this.asn=Ue.parse(t,Wt):this.asn=this.fromJSON(t)}getField(t){const r=this.extraNames.findId(t)||Sn.findId(t),o=[];for(const i of this.asn)for(const a of i)a.type===r&&o.push(a.value.toString());return o}getName(t){return this.extraNames.get(t)||Sn.get(t)}toString(){return this.asn.map(t=>t.map(r=>{const o=this.getName(r.type)||r.type,i=r.value.anyValue?`#${Je.ToHex(r.value.anyValue)}`:VK(r.value.toString());return`${o}=${i}`}).join("+")).join(", ")}toJSON(){var t;const r=[];for(const o of this.asn){const i={};for(const a of o){const s=this.getName(a.type)||a.type;(t=i[s])!==null&&t!==void 0||(i[s]=[]),i[s].push(a.value.anyValue?`#${Je.ToHex(a.value.anyValue)}`:a.value.toString())}r.push(i)}return r}fromString(t){const r=new Wt,o=/(\d\.[\d.]*\d|[A-Za-z]+)=((?:"")|(?:".*?[^\\]")|(?:[^,+"\\](?=[,+]|$))|(?:[^,+].*?(?:[^\\][,+]))|(?:))([,+])?/g;let i=null,a=",";for(;i=o.exec(`${t},`);){let[,s,c]=i;const l=c[c.length-1];(l===","||l==="+")&&(c=c.slice(0,c.length-1),i[3]=l);const u=i[3];s=this.getTypeOid(s);const p=this.createAttribute(s,c);a==="+"?r[r.length-1].push(p):r.push(new Ui([p])),a=u}return r}fromJSON(t){const r=new Wt;for(const o of t){const i=new Ui;for(const a in o){const s=this.getTypeOid(a),c=o[a];for(const l of c){const u=this.createAttribute(s,l);i.push(u)}}r.push(i)}return r}getTypeOid(t){if(/[\d.]+/.test(t)||(t=this.getName(t)||""),!t)throw new Error(`Cannot get OID for name type '${t}'`);return t}createAttribute(t,r){const o=new zc({type:t});if(typeof r=="object")for(const i in r)switch(i){case"ia5String":o.value.ia5String=r[i];break;case"utf8String":o.value.utf8String=r[i];break;case"universalString":o.value.universalString=r[i];break;case"bmpString":o.value.bmpString=r[i];break;case"printableString":o.value.printableString=r[i];break}else if(r[0]==="#")o.value.anyValue=Je.FromHex(r.slice(1));else{const i=this.processStringValue(r);t===this.getName("E")||t===this.getName("DC")?o.value.ia5String=i:co.isPrintableString(i)?o.value.printableString=i:o.value.utf8String=i}return o}processStringValue(t){const r=/"(.*?[^\\])?"/.exec(t);return r&&(t=r[1]),t.replace(/\\0a/ig,`
560
- `).replace(/\\0d/ig,"\r").replace(/\\0g/ig," ").replace(/\\(.)/g,"$1")}toArrayBuffer(){return Ue.serialize(this.asn)}async getThumbprint(t,r){let o,i="SHA-1";return t&&(typeof t=="object"&&"subtle"in t?o=t:(i=t,o=r)),o??(o=zn.get()),await o.subtle.digest(i,this.toArrayBuffer())}}const s1="Cannot initialize GeneralName from ASN.1 data.",l1=`${s1} Unsupported string format in use.`,$K=`${s1} Value doesn't match to GUID regular expression.`,c1=/^([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})$/i,u1="1.3.6.1.4.1.311.25.1",d1="1.3.6.1.4.1.311.20.2.3",ed="dns",td="dn",nd="email",rd="ip",od="url",id="guid",ad="upn",$s="id";class Yr extends zr{constructor(...t){let r;if(t.length===2)switch(t[0]){case td:{const o=new co(t[1]).toArrayBuffer(),i=Ue.parse(o,Wt);r=new ot({directoryName:i});break}case ed:r=new ot({dNSName:t[1]});break;case nd:r=new ot({rfc822Name:t[1]});break;case id:{const o=new RegExp(c1,"i").exec(t[1]);if(!o)throw new Error("Cannot parse GUID value. Value doesn't match to regular expression");const i=o.slice(1).map((a,s)=>s<3?Je.ToHex(new Uint8Array(Je.FromHex(a)).reverse()):a).join("");r=new ot({otherName:new ms({typeId:u1,value:Ue.serialize(new mt(Je.FromHex(i)))})});break}case rd:r=new ot({iPAddress:t[1]});break;case $s:r=new ot({registeredID:t[1]});break;case ad:{r=new ot({otherName:new ms({typeId:d1,value:Ue.serialize(c0.toASN(t[1]))})});break}case od:r=new ot({uniformResourceIdentifier:t[1]});break;default:throw new Error("Cannot create GeneralName. Unsupported type of the name")}else Ke.isBufferSource(t[0])?r=Ue.parse(t[0],ot):r=t[0];super(r)}onInit(t){if(t.dNSName!=null)this.type=ed,this.value=t.dNSName;else if(t.rfc822Name!=null)this.type=nd,this.value=t.rfc822Name;else if(t.iPAddress!=null)this.type=rd,this.value=t.iPAddress;else if(t.uniformResourceIdentifier!=null)this.type=od,this.value=t.uniformResourceIdentifier;else if(t.registeredID!=null)this.type=$s,this.value=t.registeredID;else if(t.directoryName!=null)this.type=td,this.value=new co(t.directoryName).toString();else if(t.otherName!=null)if(t.otherName.typeId===u1){this.type=id;const r=Ue.parse(t.otherName.value,mt),o=new RegExp(c1,"i").exec(Je.ToHex(r));if(!o)throw new Error($K);this.value=o.slice(1).map((i,a)=>a<3?Je.ToHex(new Uint8Array(Je.FromHex(i)).reverse()):i).join("-")}else if(t.otherName.typeId===d1)this.type=ad,this.value=Ue.parse(t.otherName.value,rn).toString();else throw new Error(l1);else throw new Error(l1)}toJSON(){return{type:this.type,value:this.value}}toTextObject(){let t;switch(this.type){case td:case ed:case id:case rd:case $s:case ad:case od:t=this.type.toUpperCase();break;case nd:t="Email";break;default:throw new Error("Unsupported GeneralName type")}let r=this.value;return this.type===$s&&(r=Hr.toString(r)),new gt(t,void 0,r)}}class uo extends zr{constructor(t){let r;if(t instanceof sn)r=t;else if(Array.isArray(t)){const o=[];for(const i of t)if(i instanceof ot)o.push(i);else{const a=Ue.parse(new Yr(i.type,i.value).rawData,ot);o.push(a)}r=new sn(o)}else if(Ke.isBufferSource(t))r=Ue.parse(t,sn);else throw new Error("Cannot initialize GeneralNames. Incorrect incoming arguments");super(r)}onInit(t){const r=[];for(const o of t){let i=null;try{i=new Yr(o)}catch{continue}r.push(i)}this.items=r}toJSON(){return this.items.map(t=>t.toJSON())}toTextObject(){const t=super.toTextObjectEmpty();for(const r of this.items){const o=r.toTextObject();let i=t[o[gt.NAME]];Array.isArray(i)||(i=[],t[o[gt.NAME]]=i),i.push(o)}return t}}uo.NAME="GeneralNames";const Rs="-{5}",Ls="\\n",RK=`[^${Ls}]+`,LK=`${Rs}BEGIN (${RK}(?=${Rs}))${Rs}`,DK=`${Rs}END \\1${Rs}`,fa="\\n",MK=`[^:${Ls}]+`,jK=`(?:[^${Ls}]+${fa}(?: +[^${Ls}]+${fa})*)`,FK=`(?:[a-zA-Z0-9=+/]+${fa})+`,f1=`${LK}${fa}(?:((?:${MK}: ${jK})+))?${fa}?(${FK})${DK}`,UK=new RegExp(`[${Ls}]+`,"g");class xn{static isPem(t){return typeof t=="string"&&new RegExp(f1,"g").test(t.replace(/\r/g,""))}static decodeWithHeaders(t){t=t.replace(/\r/g,"");const r=new RegExp(f1,"g"),o=[];let i=null;for(;i=r.exec(t);){const a=i[3].replace(UK,""),s={type:i[1],headers:[],rawData:Je.FromBase64(a)},c=i[2];if(c){const l=c.split(new RegExp(fa,"g"));let u=null;for(const p of l){const[d,f]=p.split(/:(.*)/);if(f===void 0){if(!u)throw new Error("Cannot parse PEM string. Incorrect header value");u.value+=d.trim()}else u&&s.headers.push(u),u={key:d,value:f.trim()}}u&&s.headers.push(u)}o.push(s)}return o}static decode(t){return this.decodeWithHeaders(t).map(o=>o.rawData)}static decodeFirst(t){const r=this.decode(t);if(!r.length)throw new RangeError("PEM string doesn't contain any objects");return r[0]}static encode(t,r){if(Array.isArray(t)){const o=new Array;return r?t.forEach(i=>{if(!Ke.isBufferSource(i))throw new TypeError("Cannot encode array of BufferSource in PEM format. Not all items of the array are BufferSource");o.push(this.encodeStruct({type:r,rawData:Ke.toArrayBuffer(i)}))}):t.forEach(i=>{if(!("type"in i))throw new TypeError("Cannot encode array of PemStruct in PEM format. Not all items of the array are PemStrut");o.push(this.encodeStruct(i))}),o.join(`
561
- `)}else{if(!r)throw new Error("Required argument 'tag' is missed");return this.encodeStruct({type:r,rawData:Ke.toArrayBuffer(t)})}}static encodeStruct(t){var r;const o=t.type.toLocaleUpperCase(),i=[];if(i.push(`-----BEGIN ${o}-----`),!((r=t.headers)===null||r===void 0)&&r.length){for(const s of t.headers)i.push(`${s.key}: ${s.value}`);i.push("")}const a=Je.ToBase64(t.rawData);for(let s=0;s<a.length;s+=64)i.push(a.substring(s,s+64));return i.push(`-----END ${o}-----`),i.join(`
562
- `)}}xn.CertificateTag="CERTIFICATE",xn.CrlTag="CRL",xn.CertificateRequestTag="CERTIFICATE REQUEST",xn.PublicKeyTag="PUBLIC KEY",xn.PrivateKeyTag="PRIVATE KEY";class Sr extends zr{static isAsnEncoded(t){return Ke.isBufferSource(t)||typeof t=="string"}static toArrayBuffer(t){if(typeof t=="string"){if(xn.isPem(t))return xn.decode(t)[0];if(Je.isHex(t))return Je.FromHex(t);if(Je.isBase64(t))return Je.FromBase64(t);if(Je.isBase64Url(t))return Je.FromBase64Url(t);throw new TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url")}else{const r=Ke.toUint8Array(t);if(r.length>0&&r[0]===48)return Ke.toArrayBuffer(t);const o=Je.ToBinary(t);if(xn.isPem(o))return xn.decode(o)[0];if(Je.isHex(o))return Je.FromHex(o);if(Je.isBase64(o))return Je.FromBase64(o);if(Je.isBase64Url(o))return Je.FromBase64Url(o);throw new TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url")}}constructor(...t){Sr.isAsnEncoded(t[0])?super(Sr.toArrayBuffer(t[0]),t[1]):super(t[0])}toString(t="pem"){switch(t){case"pem":return xn.encode(this.rawData,this.tag);default:return super.toString(t)}}}class sr extends Sr{static async create(t,r=zn.get()){if(t instanceof sr)return t;if(Wr.isCryptoKey(t)){if(t.type!=="public")throw new TypeError("Public key is required");const o=await r.subtle.exportKey("spki",t);return new sr(o)}else{if(t.publicKey)return t.publicKey;if(Ke.isBufferSource(t))return new sr(t);throw new TypeError("Unsupported PublicKeyType")}}constructor(t){Sr.isAsnEncoded(t)?super(t,wr):super(t),this.tag=xn.PublicKeyTag}async export(t,r,o){let i,a=["verify"],s={hash:"SHA-256",...this.algorithm};r?(s=t,a=r,i=o):i=t,i??(i=zn.get());let c=this.rawData;const l=Ue.parse(this.rawData,wr);return l.algorithm.algorithm===Ts&&(c=KK(l,c)),i.subtle.importKey("spki",c,s,!0,a)}onInit(t){const r=pn.resolve(Wo),o=this.algorithm=r.toWebAlgorithm(t.algorithm);switch(t.algorithm.algorithm){case qo:{const i=Ue.parse(t.subjectPublicKey,ig),a=Ke.toUint8Array(i.modulus);o.publicExponent=Ke.toUint8Array(i.publicExponent),o.modulusLength=(a[0]?a:a.slice(1)).byteLength<<3;break}}}async getThumbprint(t,r){let o,i="SHA-1";return t&&(typeof t=="object"&&"subtle"in t?o=t:(i=t,o=r)),o??(o=zn.get()),await o.subtle.digest(i,this.rawData)}async getKeyIdentifier(t,r){let o,i="SHA-1";t&&(typeof t=="object"&&"subtle"in t?o=t:(i=t,o=r)),o??(o=zn.get());const a=Ue.parse(this.rawData,wr);return await o.subtle.digest(i,a.subjectPublicKey)}toTextObject(){const t=this.toTextObjectEmpty(),r=Ue.parse(this.rawData,wr);switch(t.Algorithm=lo.serializeAlgorithm(r.algorithm),r.algorithm.algorithm){case vs:t["EC Point"]=r.subjectPublicKey;break;case qo:default:t["Raw Data"]=r.subjectPublicKey}return t}}function KK(n,t){return n.algorithm=new Ge({algorithm:qo,parameters:null}),t=Ue.serialize(n),t}class pa extends Nn{static async create(t,r=!1,o=zn.get()){if("name"in t&&"serialNumber"in t)return new pa(t,r);const a=await(await sr.create(t,o)).getKeyIdentifier(o);return new pa(Je.ToHex(a),r)}constructor(...t){if(Ke.isBufferSource(t[0]))super(t[0]);else if(typeof t[0]=="string"){const r=new Do({keyIdentifier:new tm(Je.FromHex(t[0]))});super(em,t[1],Ue.serialize(r))}else{const r=t[0],o=r.name instanceof uo?Ue.parse(r.name.rawData,sn):r.name,i=new Do({authorityCertIssuer:o,authorityCertSerialNumber:Je.FromHex(r.serialNumber)});super(em,t[1],Ue.serialize(i))}}onInit(t){super.onInit(t);const r=Ue.parse(t.extnValue,Do);r.keyIdentifier&&(this.keyId=Je.ToHex(r.keyIdentifier)),(r.authorityCertIssuer||r.authorityCertSerialNumber)&&(this.certId={name:r.authorityCertIssuer||[],serialNumber:r.authorityCertSerialNumber?Je.ToHex(r.authorityCertSerialNumber):""})}toTextObject(){const t=this.toTextObjectWithoutValue(),r=Ue.parse(this.value,Do);return r.authorityCertIssuer&&(t["Authority Issuer"]=new uo(r.authorityCertIssuer).toTextObject()),r.authorityCertSerialNumber&&(t["Authority Serial Number"]=r.authorityCertSerialNumber),r.keyIdentifier&&(t[""]=r.keyIdentifier),t}}pa.NAME="Authority Key Identifier";class Bg extends Nn{constructor(...t){if(Ke.isBufferSource(t[0])){super(t[0]);const r=Ue.parse(this.value,Yc);this.ca=r.cA,this.pathLength=r.pathLenConstraint}else{const r=new Yc({cA:t[0],pathLenConstraint:t[1]});super(_0,t[2],Ue.serialize(r)),this.ca=t[0],this.pathLength=t[1]}}toTextObject(){const t=this.toTextObjectWithoutValue();return this.ca&&(t.CA=this.ca),this.pathLength!==void 0&&(t["Path Length"]=this.pathLength),t}}Bg.NAME="Basic Constraints";var Tg;(function(n){n.serverAuth="1.3.6.1.5.5.7.3.1",n.clientAuth="1.3.6.1.5.5.7.3.2",n.codeSigning="1.3.6.1.5.5.7.3.3",n.emailProtection="1.3.6.1.5.5.7.3.4",n.timeStamping="1.3.6.1.5.5.7.3.8",n.ocspSigning="1.3.6.1.5.5.7.3.9"})(Tg||(Tg={}));class Og extends Nn{constructor(...t){if(Ke.isBufferSource(t[0])){super(t[0]);const r=Ue.parse(this.value,eu);this.usages=r.map(o=>o)}else{const r=new eu(t[0]);super(N0,t[1],Ue.serialize(r)),this.usages=t[0]}}toTextObject(){const t=this.toTextObjectWithoutValue();return t[""]=this.usages.map(r=>Hr.toString(r)).join(", "),t}}Og.NAME="Extended Key Usages";var Pg;(function(n){n[n.digitalSignature=1]="digitalSignature",n[n.nonRepudiation=2]="nonRepudiation",n[n.keyEncipherment=4]="keyEncipherment",n[n.dataEncipherment=8]="dataEncipherment",n[n.keyAgreement=16]="keyAgreement",n[n.keyCertSign=32]="keyCertSign",n[n.cRLSign=64]="cRLSign",n[n.encipherOnly=128]="encipherOnly",n[n.decipherOnly=256]="decipherOnly"})(Pg||(Pg={}));class Vg extends Nn{constructor(...t){if(Ke.isBufferSource(t[0])){super(t[0]);const r=Ue.parse(this.value,hm);this.usages=r.toNumber()}else{const r=new hm(t[0]);super(A0,t[1],Ue.serialize(r)),this.usages=t[0]}}toTextObject(){const t=this.toTextObjectWithoutValue(),r=Ue.parse(this.value,hm);return t[""]=r.toJSON().join(", "),t}}Vg.NAME="Key Usages";class Ds extends Nn{static async create(t,r=!1,o=zn.get()){const a=await(await sr.create(t,o)).getKeyIdentifier(o);return new Ds(Je.ToHex(a),r)}constructor(...t){if(Ke.isBufferSource(t[0])){super(t[0]);const r=Ue.parse(this.value,io);this.keyId=Je.ToHex(r)}else{const r=typeof t[0]=="string"?Je.FromHex(t[0]):t[0],o=new io(r);super(P0,t[1],Ue.serialize(o)),this.keyId=Je.ToHex(r)}}toTextObject(){const t=this.toTextObjectWithoutValue(),r=Ue.parse(this.value,io);return t[""]=r,t}}Ds.NAME="Subject Key Identifier";class $g extends Nn{constructor(...t){Ke.isBufferSource(t[0])?super(t[0]):super(T0,t[1],new uo(t[0]||[]).rawData)}onInit(t){super.onInit(t);const r=Ue.parse(t.extnValue,km);this.names=new uo(r)}toTextObject(){const t=this.toTextObjectWithoutValue(),r=this.names.toTextObject();for(const o in r)t[o]=r[o];return t}}$g.NAME="Subject Alternative Name";class An{static register(t,r){this.items.set(t,r)}static create(t){const r=new Nn(t),o=this.items.get(r.type);return o?new o(t):r}}An.items=new Map;class Rg extends Nn{constructor(...t){var r;if(Ke.isBufferSource(t[0])){super(t[0]);const o=Ue.parse(this.value,Zc);this.policies=o.map(i=>i.policyIdentifier)}else{const o=t[0],i=(r=t[1])!==null&&r!==void 0?r:!1,a=new Zc(o.map(s=>new Xc({policyIdentifier:s})));super(w0,i,Ue.serialize(a)),this.policies=o}}toTextObject(){const t=this.toTextObjectWithoutValue();return t.Policy=this.policies.map(r=>new gt("",{},Hr.toString(r))),t}}Rg.NAME="Certificate Policies",An.register(w0,Rg);class Lg extends Nn{constructor(...t){var r;if(Ke.isBufferSource(t[0]))super(t[0]);else if(Array.isArray(t[0])&&typeof t[0][0]=="string"){const i=t[0].map(s=>new Gi({distributionPoint:new Mo({fullName:[new ot({uniformResourceIdentifier:s})]})})),a=new Hi(i);super(cm,t[1],Ue.serialize(a))}else{const o=new Hi(t[0]);super(cm,t[1],Ue.serialize(o))}(r=this.distributionPoints)!==null&&r!==void 0||(this.distributionPoints=[])}onInit(t){super.onInit(t);const r=Ue.parse(t.extnValue,Hi);this.distributionPoints=r}toTextObject(){const t=this.toTextObjectWithoutValue();return t["Distribution Point"]=this.distributionPoints.map(r=>{var o;const i=new gt("");return!((o=r.distributionPoint)===null||o===void 0)&&o.fullName&&(i[""]=r.distributionPoint.fullName.map(a=>new Yr(a).toString()).join(", ")),r.reasons&&(i.Reasons=r.reasons.toString()),r.cRLIssuer&&(i["CRL Issuer"]=r.cRLIssuer.map(a=>a.toString()).join(", ")),i}),t}}Lg.NAME="CRL Distribution Points";class Dg extends Nn{constructor(...t){var r,o,i,a;if(Ke.isBufferSource(t[0]))super(t[0]);else if(t[0]instanceof qi){const s=new qi(t[0]);super(Qp,t[1],Ue.serialize(s))}else{const s=t[0],c=new qi;ld(c,s,m0,"ocsp"),ld(c,s,g0,"caIssuers"),ld(c,s,h0,"timeStamping"),ld(c,s,y0,"caRepository"),super(Qp,t[1],Ue.serialize(c))}(r=this.ocsp)!==null&&r!==void 0||(this.ocsp=[]),(o=this.caIssuers)!==null&&o!==void 0||(this.caIssuers=[]),(i=this.timeStamping)!==null&&i!==void 0||(this.timeStamping=[]),(a=this.caRepository)!==null&&a!==void 0||(this.caRepository=[])}onInit(t){super.onInit(t),this.ocsp=[],this.caIssuers=[],this.timeStamping=[],this.caRepository=[],Ue.parse(t.extnValue,qi).forEach(o=>{switch(o.accessMethod){case m0:this.ocsp.push(new Yr(o.accessLocation));break;case g0:this.caIssuers.push(new Yr(o.accessLocation));break;case h0:this.timeStamping.push(new Yr(o.accessLocation));break;case y0:this.caRepository.push(new Yr(o.accessLocation));break}})}toTextObject(){const t=this.toTextObjectWithoutValue();return this.ocsp.length&&sd(t,"OCSP",this.ocsp),this.caIssuers.length&&sd(t,"CA Issuers",this.caIssuers),this.timeStamping.length&&sd(t,"Time Stamping",this.timeStamping),this.caRepository.length&&sd(t,"CA Repository",this.caRepository),t}}Dg.NAME="Authority Info Access";function sd(n,t,r){if(r.length===1)n[t]=r[0].toTextObject();else{const o=new gt("");r.forEach((i,a)=>{const s=i.toTextObject(),c=`${s[gt.NAME]} ${a+1}`;let l=o[c];Array.isArray(l)||(l=[],o[c]=l),l.push(s)}),n[t]=o}}function ld(n,t,r,o){const i=t[o];i&&(Array.isArray(i)?i:[i]).forEach(s=>{typeof s=="string"&&(s=new Yr("url",s)),n.push(new gs({accessMethod:r,accessLocation:Ue.parse(s.rawData,ot)}))})}class Mg extends Nn{constructor(...t){Ke.isBufferSource(t[0])?super(t[0]):super(S0,t[1],new uo(t[0]||[]).rawData)}onInit(t){super.onInit(t);const r=Ue.parse(t.extnValue,sn);this.names=new uo(r)}toTextObject(){const t=this.toTextObjectWithoutValue(),r=this.names.toTextObject();for(const o in r)t[o]=r[o];return t}}Mg.NAME="Issuer Alternative Name";class Yo extends zr{constructor(...t){let r;if(Ke.isBufferSource(t[0]))r=Ke.toArrayBuffer(t[0]);else{const o=t[0],i=Array.isArray(t[1])?t[1].map(a=>Ke.toArrayBuffer(a)):[];r=Ue.serialize(new Ur({type:o,values:i}))}super(r,Ur)}onInit(t){this.type=t.type,this.values=t.values}toTextObject(){const t=this.toTextObjectWithoutValue();return t.Value=this.values.map(r=>new gt("",{"":r})),t}toTextObjectWithoutValue(){const t=this.toTextObjectEmpty();return t[gt.NAME]===Yo.NAME&&(t[gt.NAME]=Hr.toString(this.type)),t}}Yo.NAME="Attribute";class jg extends Yo{constructor(...t){var r;if(Ke.isBufferSource(t[0]))super(t[0]);else{const o=new Xu({printableString:t[0]});super(mC,[Ue.serialize(o)])}(r=this.password)!==null&&r!==void 0||(this.password="")}onInit(t){if(super.onInit(t),this.values[0]){const r=Ue.parse(this.values[0],Xu);this.password=r.toString()}}toTextObject(){const t=this.toTextObjectWithoutValue();return t[gt.VALUE]=this.password,t}}jg.NAME="Challenge Password";class cd extends Yo{constructor(...t){var r;if(Ke.isBufferSource(t[0]))super(t[0]);else{const o=t[0],i=new jo;for(const a of o)i.push(Ue.parse(a.rawData,kr));super(wg,[Ue.serialize(i)])}(r=this.items)!==null&&r!==void 0||(this.items=[])}onInit(t){if(super.onInit(t),this.values[0]){const r=Ue.parse(this.values[0],jo);this.items=r.map(o=>An.create(Ue.serialize(o)))}}toTextObject(){const t=this.toTextObjectWithoutValue(),r=this.items.map(o=>o.toTextObject());for(const o of r)t[o[gt.NAME]]=o;return t}}cd.NAME="Extensions";class Ms{static register(t,r){this.items.set(t,r)}static create(t){const r=new Yo(t),o=this.items.get(r.type);return o?new o(t):r}}Ms.items=new Map;const js="crypto.signatureFormatter";class p1{toAsnSignature(t,r){return Ke.toArrayBuffer(r)}toWebSignature(t,r){return Ke.toArrayBuffer(r)}}var ud;let dd=ud=class{static createPssParams(t,r){const o=ud.getHashAlgorithm(t);return o?new Ho({hashAlgorithm:o,maskGenAlgorithm:new Ge({algorithm:$u,parameters:Ue.serialize(o)}),saltLength:r}):null}static getHashAlgorithm(t){const r=pn.resolve(Wo);return typeof t=="string"?r.toAsnAlgorithm({name:t}):typeof t=="object"&&t&&"name"in t?r.toAsnAlgorithm(t):null}toAsnAlgorithm(t){switch(t.name.toLowerCase()){case"rsassa-pkcs1-v1_5":if("hash"in t){let r;if(typeof t.hash=="string")r=t.hash;else if(t.hash&&typeof t.hash=="object"&&"name"in t.hash&&typeof t.hash.name=="string")r=t.hash.name.toUpperCase();else throw new Error("Cannot get hash algorithm name");switch(r.toLowerCase()){case"sha-1":return new Ge({algorithm:vu,parameters:null});case"sha-256":return new Ge({algorithm:ng,parameters:null});case"sha-384":return new Ge({algorithm:Iu,parameters:null});case"sha-512":return new Ge({algorithm:Bu,parameters:null})}}else return new Ge({algorithm:qo,parameters:null});break;case"rsa-pss":if("hash"in t){if(!("saltLength"in t&&typeof t.saltLength=="number"))throw new Error("Cannot get 'saltLength' from 'alg' argument");const r=ud.createPssParams(t.hash,t.saltLength);if(!r)throw new Error("Cannot create PSS parameters");return new Ge({algorithm:Ts,parameters:Ue.serialize(r)})}else return new Ge({algorithm:Ts,parameters:null})}return null}toWebAlgorithm(t){switch(t.algorithm){case qo:return{name:"RSASSA-PKCS1-v1_5"};case vu:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case ng:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case Iu:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case Bu:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case Ts:if(t.parameters){const r=Ue.parse(t.parameters,Ho);return{name:"RSA-PSS",hash:pn.resolve(Wo).toWebAlgorithm(r.hashAlgorithm),saltLength:r.saltLength}}else return{name:"RSA-PSS"}}return null}};dd=ud=B([qu()],dd),pn.registerSingleton(ca,dd);let fd=class{toAsnAlgorithm(t){switch(t.name.toLowerCase()){case"sha-1":return new Ge({algorithm:Tu});case"sha-256":return new Ge({algorithm:Ou});case"sha-384":return new Ge({algorithm:Pu});case"sha-512":return new Ge({algorithm:Vu})}return null}toWebAlgorithm(t){switch(t.algorithm){case Tu:return{name:"SHA-1"};case Ou:return{name:"SHA-256"};case Pu:return{name:"SHA-384"};case Vu:return{name:"SHA-512"}}return null}};fd=B([qu()],fd),pn.registerSingleton(ca,fd);class On{addPadding(t,r){const o=Ke.toUint8Array(r),i=new Uint8Array(t);return i.set(o,t-o.length),i.buffer}removePadding(t,r=!1){let o=Ke.toUint8Array(t);for(let i=0;i<o.length;i++)if(o[i]){o=o.slice(i);break}if(r&&o[0]>127){const i=new Uint8Array(o.length+1);return i.set(o,1),i.buffer}return o.buffer}toAsnSignature(t,r){if(t.name==="ECDSA"){const o=t.namedCurve,i=On.namedCurveSize.get(o)||On.defaultNamedCurveSize,a=new Au,s=Ke.toUint8Array(r);return a.r=this.removePadding(s.slice(0,i),!0),a.s=this.removePadding(s.slice(i,i+i),!0),Ue.serialize(a)}return null}toWebSignature(t,r){if(t.name==="ECDSA"){const o=Ue.parse(r,Au),i=t.namedCurve,a=On.namedCurveSize.get(i)||On.defaultNamedCurveSize,s=this.addPadding(a,this.removePadding(o.r)),c=this.addPadding(a,this.removePadding(o.s));return HU(s,c)}return null}}On.namedCurveSize=new Map,On.defaultNamedCurveSize=32;const pd="1.3.101.110",Fg="1.3.101.111",md="1.3.101.112",Ug="1.3.101.113";let gd=class{toAsnAlgorithm(t){let r=null;switch(t.name.toLowerCase()){case"ed25519":r=md;break;case"x25519":r=pd;break;case"eddsa":switch(t.namedCurve.toLowerCase()){case"ed25519":r=md;break;case"ed448":r=Ug;break}break;case"ecdh-es":switch(t.namedCurve.toLowerCase()){case"x25519":r=pd;break;case"x448":r=Fg;break}}return r?new Ge({algorithm:r}):null}toWebAlgorithm(t){switch(t.algorithm){case md:return{name:"Ed25519"};case Ug:return{name:"EdDSA",namedCurve:"Ed448"};case pd:return{name:"X25519"};case Fg:return{name:"ECDH-ES",namedCurve:"X448"}}return null}};gd=B([qu()],gd),pn.registerSingleton(ca,gd);var Fs,Us,Ks,qs,Gs,Hs,zs,ma;class m1 extends Sr{get subjectName(){return at(this,Us,"f")||Vt(this,Us,new co(this.asn.certificationRequestInfo.subject),"f"),at(this,Us,"f")}get subject(){return at(this,Ks,"f")||Vt(this,Ks,this.subjectName.toString(),"f"),at(this,Ks,"f")}get signatureAlgorithm(){if(!at(this,qs,"f")){const t=pn.resolve(Wo);Vt(this,qs,t.toWebAlgorithm(this.asn.signatureAlgorithm),"f")}return at(this,qs,"f")}get signature(){return at(this,Gs,"f")||Vt(this,Gs,this.asn.signature,"f"),at(this,Gs,"f")}get publicKey(){return at(this,Hs,"f")||Vt(this,Hs,new sr(this.asn.certificationRequestInfo.subjectPKInfo),"f"),at(this,Hs,"f")}get attributes(){return at(this,zs,"f")||Vt(this,zs,this.asn.certificationRequestInfo.attributes.map(t=>Ms.create(Ue.serialize(t))),"f"),at(this,zs,"f")}get extensions(){if(!at(this,ma,"f")){Vt(this,ma,[],"f");const t=this.getAttribute(wg);t instanceof cd&&Vt(this,ma,t.items,"f")}return at(this,ma,"f")}get tbs(){return at(this,Fs,"f")||Vt(this,Fs,this.asn.certificationRequestInfoRaw||Ue.serialize(this.asn.certificationRequestInfo),"f"),at(this,Fs,"f")}constructor(t){const r=Sr.isAsnEncoded(t)?[t,Vs]:[t];super(r[0],r[1]),Fs.set(this,void 0),Us.set(this,void 0),Ks.set(this,void 0),qs.set(this,void 0),Gs.set(this,void 0),Hs.set(this,void 0),zs.set(this,void 0),ma.set(this,void 0),this.tag=xn.CertificateRequestTag}onInit(t){}getAttribute(t){for(const r of this.attributes)if(r.type===t)return r;return null}getAttributes(t){return this.attributes.filter(r=>r.type===t)}getExtension(t){for(const r of this.extensions)if(r.type===t)return r;return null}getExtensions(t){return this.extensions.filter(r=>r.type===t)}async verify(t=zn.get()){const r={...this.publicKey.algorithm,...this.signatureAlgorithm},o=await this.publicKey.export(r,["verify"],t),i=pn.resolveAll(js).reverse();let a=null;for(const c of i)if(a=c.toWebSignature(r,this.signature),a)break;if(!a)throw Error("Cannot convert WebCrypto signature value to ASN.1 format");return await t.subtle.verify(this.signatureAlgorithm,o,a,this.tbs)}toTextObject(){const t=this.toTextObjectEmpty(),r=Ue.parse(this.rawData,Vs),o=r.certificationRequestInfo,i=new gt("",{Version:`${zi[o.version]} (${o.version})`,Subject:this.subject,"Subject Public Key Info":this.publicKey});if(this.attributes.length){const a=new gt("");for(const s of this.attributes){const c=s.toTextObject();a[c[gt.NAME]]=c}i.Attributes=a}return t.Data=i,t.Signature=new gt("",{Algorithm:lo.serializeAlgorithm(r.signatureAlgorithm),"":r.signature}),t}}Fs=new WeakMap,Us=new WeakMap,Ks=new WeakMap,qs=new WeakMap,Gs=new WeakMap,Hs=new WeakMap,zs=new WeakMap,ma=new WeakMap,m1.NAME="PKCS#10 Certificate Request";var Ws,Ys,Js,Xs,Zs,Qs,el,tl,nl,rl,ga,ol;class g1 extends Sr{get publicKey(){return at(this,ol,"f")||Vt(this,ol,new sr(this.asn.tbsCertificate.subjectPublicKeyInfo),"f"),at(this,ol,"f")}get serialNumber(){if(!at(this,Ys,"f")){const t=this.asn.tbsCertificate;let r=new Uint8Array(t.serialNumber);r.length>1&&r[0]===0&&r[1]>127&&(r=r.slice(1)),Vt(this,Ys,Je.ToHex(r),"f")}return at(this,Ys,"f")}get subjectName(){return at(this,Js,"f")||Vt(this,Js,new co(this.asn.tbsCertificate.subject),"f"),at(this,Js,"f")}get subject(){return at(this,Xs,"f")||Vt(this,Xs,this.subjectName.toString(),"f"),at(this,Xs,"f")}get issuerName(){return at(this,Zs,"f")||Vt(this,Zs,new co(this.asn.tbsCertificate.issuer),"f"),at(this,Zs,"f")}get issuer(){return at(this,Qs,"f")||Vt(this,Qs,this.issuerName.toString(),"f"),at(this,Qs,"f")}get notBefore(){if(!at(this,el,"f")){const t=this.asn.tbsCertificate.validity.notBefore.utcTime||this.asn.tbsCertificate.validity.notBefore.generalTime;if(!t)throw new Error("Cannot get 'notBefore' value");Vt(this,el,t,"f")}return at(this,el,"f")}get notAfter(){if(!at(this,tl,"f")){const t=this.asn.tbsCertificate.validity.notAfter.utcTime||this.asn.tbsCertificate.validity.notAfter.generalTime;if(!t)throw new Error("Cannot get 'notAfter' value");Vt(this,tl,t,"f")}return at(this,tl,"f")}get signatureAlgorithm(){if(!at(this,nl,"f")){const t=pn.resolve(Wo);Vt(this,nl,t.toWebAlgorithm(this.asn.signatureAlgorithm),"f")}return at(this,nl,"f")}get signature(){return at(this,rl,"f")||Vt(this,rl,this.asn.signatureValue,"f"),at(this,rl,"f")}get extensions(){return at(this,ga,"f")||(Vt(this,ga,[],"f"),this.asn.tbsCertificate.extensions&&Vt(this,ga,this.asn.tbsCertificate.extensions.map(t=>An.create(Ue.serialize(t))),"f")),at(this,ga,"f")}get tbs(){return at(this,Ws,"f")||Vt(this,Ws,this.asn.tbsCertificateRaw||Ue.serialize(this.asn.tbsCertificate),"f"),at(this,Ws,"f")}constructor(t){const r=Sr.isAsnEncoded(t)?[t,Wi]:[t];super(r[0],r[1]),Ws.set(this,void 0),Ys.set(this,void 0),Js.set(this,void 0),Xs.set(this,void 0),Zs.set(this,void 0),Qs.set(this,void 0),el.set(this,void 0),tl.set(this,void 0),nl.set(this,void 0),rl.set(this,void 0),ga.set(this,void 0),ol.set(this,void 0),this.tag=xn.CertificateTag}onInit(t){}getExtension(t){for(const r of this.extensions)if(typeof t=="string"){if(r.type===t)return r}else if(r instanceof t)return r;return null}getExtensions(t){return this.extensions.filter(r=>typeof t=="string"?r.type===t:r instanceof t)}async verify(t={},r=zn.get()){let o,i;const a=t.publicKey;try{if(!a)o={...this.publicKey.algorithm,...this.signatureAlgorithm},i=await this.publicKey.export(o,["verify"],r);else if("publicKey"in a)o={...a.publicKey.algorithm,...this.signatureAlgorithm},i=await a.publicKey.export(o,["verify"],r);else if(a instanceof sr)o={...a.algorithm,...this.signatureAlgorithm},i=await a.export(o,["verify"],r);else if(Ke.isBufferSource(a)){const u=new sr(a);o={...u.algorithm,...this.signatureAlgorithm},i=await u.export(o,["verify"],r)}else o={...a.algorithm,...this.signatureAlgorithm},i=a}catch{return!1}const s=pn.resolveAll(js).reverse();let c=null;for(const u of s)if(c=u.toWebSignature(o,this.signature),c)break;if(!c)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");const l=await r.subtle.verify(this.signatureAlgorithm,i,c,this.tbs);if(t.signatureOnly)return l;{const p=(t.date||new Date).getTime();return l&&this.notBefore.getTime()<p&&p<this.notAfter.getTime()}}async getThumbprint(t,r){let o,i="SHA-1";return t&&(typeof t=="object"&&"subtle"in t?o=t:(i=t,o=r)),o??(o=zn.get()),await o.subtle.digest(i,this.rawData)}async isSelfSigned(t=zn.get()){return this.subject===this.issuer&&await this.verify({signatureOnly:!0},t)}toTextObject(){const t=this.toTextObjectEmpty(),r=Ue.parse(this.rawData,Wi),o=r.tbsCertificate,i=new gt("",{Version:`${zi[o.version]} (${o.version})`,"Serial Number":o.serialNumber,"Signature Algorithm":lo.serializeAlgorithm(o.signature),Issuer:this.issuer,Validity:new gt("",{"Not Before":o.validity.notBefore.getTime(),"Not After":o.validity.notAfter.getTime()}),Subject:this.subject,"Subject Public Key Info":this.publicKey});if(o.issuerUniqueID&&(i["Issuer Unique ID"]=o.issuerUniqueID),o.subjectUniqueID&&(i["Subject Unique ID"]=o.subjectUniqueID),this.extensions.length){const a=new gt("");for(const s of this.extensions){const c=s.toTextObject();a[c[gt.NAME]]=c}i.Extensions=a}return t.Data=i,t.Signature=new gt("",{Algorithm:lo.serializeAlgorithm(r.signatureAlgorithm),"":r.signatureValue}),t}}Ws=new WeakMap,Ys=new WeakMap,Js=new WeakMap,Xs=new WeakMap,Zs=new WeakMap,Qs=new WeakMap,el=new WeakMap,tl=new WeakMap,nl=new WeakMap,rl=new WeakMap,ga=new WeakMap,ol=new WeakMap,g1.NAME="Certificate";var Kg;(function(n){n[n.unspecified=0]="unspecified",n[n.keyCompromise=1]="keyCompromise",n[n.cACompromise=2]="cACompromise",n[n.affiliationChanged=3]="affiliationChanged",n[n.superseded=4]="superseded",n[n.cessationOfOperation=5]="cessationOfOperation",n[n.certificateHold=6]="certificateHold",n[n.removeFromCRL=8]="removeFromCRL",n[n.privilegeWithdrawn=9]="privilegeWithdrawn",n[n.aACompromise=10]="aACompromise"})(Kg||(Kg={})),An.register(_0,Bg),An.register(N0,Og),An.register(A0,Vg),An.register(P0,Ds),An.register(em,pa),An.register(T0,$g),An.register(cm,Lg),An.register(Qp,Dg),An.register(S0,Mg),Ms.register(mC,jg),Ms.register(wg,cd),pn.registerSingleton(js,p1),pn.registerSingleton(js,On),On.namedCurveSize.set("P-256",32),On.namedCurveSize.set("K-256",32),On.namedCurveSize.set("P-384",48),On.namedCurveSize.set("P-521",66);const qK=Object.freeze(Object.defineProperty({__proto__:null,AlgorithmProvider:vC,AsnData:zr,AsnDefaultSignatureFormatter:p1,AsnEcSignatureFormatter:On,Attribute:Yo,AttributeFactory:Ms,AuthorityInfoAccessExtension:Dg,AuthorityKeyIdentifierExtension:pa,BasicConstraintsExtension:Bg,CRLDistributionPointsExtension:Lg,CertificatePolicyExtension:Rg,ChallengePasswordAttribute:jg,CryptoProvider:Wr,DN:td,DNS:ed,DefaultAlgorithmSerializer:i1,EMAIL:nd,get EcAlgorithm(){return ua},get EdAlgorithm(){return gd},get ExtendedKeyUsage(){return Tg},ExtendedKeyUsageExtension:Og,Extension:Nn,ExtensionFactory:An,ExtensionsAttribute:cd,GUID:id,GeneralName:Yr,GeneralNames:uo,IP:rd,IssuerAlternativeNameExtension:Mg,get KeyUsageFlags(){return Pg},KeyUsagesExtension:Vg,Name:co,NameIdentifier:Ig,OidSerializer:Hr,PemConverter:xn,PemData:Sr,Pkcs10CertificateRequest:m1,PublicKey:sr,REGISTERED_ID:$s,get RsaAlgorithm(){return dd},get ShaAlgorithm(){return fd},SubjectAlternativeNameExtension:$g,SubjectKeyIdentifierExtension:Ds,TextConverter:lo,TextObject:gt,UPN:ad,URL:od,X509Certificate:g1,get X509CrlReason(){return Kg},cryptoProvider:zn,diAlgorithm:ca,diAlgorithmProvider:Wo,diAsnSignatureFormatter:js,idEd25519:md,idEd448:Ug,idX25519:pd,idX448:Fg},Symbol.toStringTag,{value:"Module"}));Object.defineProperty(ve,"PluginIcon",{enumerable:!0,get:()=>xr.PluginIcon}),Object.defineProperty(ve,"getPluginIconURL",{enumerable:!0,get:()=>xr.getPluginIconURL}),Object.defineProperty(ve,"PluginGroup",{enumerable:!0,get:()=>fe.PluginGroup}),Object.defineProperty(ve,"PluginScope",{enumerable:!0,get:()=>fe.PluginScope}),ve.ArrayField=zt,ve.BooleanField=hn,ve.CommonForm=sp,ve.CustomPluginForm=Sj,ve.DynamicLayout=er,ve.EXPERIMENTAL_FREE_FORM_PROVIDER=Yd,ve.EntityTypeIdField=wo,ve.EnumField=Dt,ve.FEATURE_FLAGS=fr,ve.FIELD_PATH_KEY=wf,ve.FIELD_RENDERERS=So,ve.FIELD_RENDERER_SLOTS=Kl,ve.FIELD_RESET_LABEL_PATH_SETTING=kf,ve.FREE_FORM_SCHEMA_MAP_KEY=oi,ve.Field=it,ve.FieldRenderer=Rt,ve.FlowCanvas=pf,ve.ForeignField=$_,ve.Form=Zt,ve.JsonField=V_,ve.MapField=pr,ve.NodeBadge=ff,ve.NumberField=Ht,ve.ObjectField=Ut,ve.PluginCatalog=yU,ve.PluginConfigCard=TU,ve.PluginConfigurationForm=rw,ve.PluginFeaturedArray=Ml,ve.PluginForm=Wj,ve.PluginGroupArray=mf,ve.PluginGroupArraySortedAlphabetically=jl,ve.PluginList=rF,ve.PluginPartialType=Dl,ve.PluginSelect=IF,ve.PluginSelectCard=wp,ve.PluginSelectGrid=Ep,ve.StringArrayField=hi,ve.StringField=Xe,ve.SwitchField=O_,ve.TOASTER_PROVIDER=Ly,ve.buildAncestor=E_,ve.buildArraySchemaMap=Fa,ve.buildMapSchemaMap=Ua,ve.buildRecordSchemaMap=ja,ve.buildSchemaMap=N_,ve.defaultLabelFormatter=Gl,ve.generalizePath=pi,ve.pluginConfigRegistry=yp,ve.pluginEndpoints=tt,ve.provideEditorStore=uf,ve.provideFormShared=x_,ve.renderRuleExactMatch=ZT,ve.replaceByDictionary=Sf,ve.replaceByDictionaryInFieldName=xf,ve.useEditorStore=$t,ve.useField=Ft,ve.useFieldAncestors=bf,ve.useFieldAttrs=ln,ve.useFieldLabel=T_,ve.useFieldPath=Ef,ve.useFieldRenderer=v_,ve.useFormData=Nf,ve.useFormShared=pt,ve.useItemKeys=ql,ve.useLabelPath=B_,ve.useMapField=Hl,ve.useOptionalFormShared=A_,ve.usePluginMetaData=OU,ve.useProvideExperimentalFreeForms=PU,ve.useProvideFreeFormPluginLayout=JV,ve.useSchemaExposer=I_,ve.useSchemaHelpers=S_,Object.defineProperty(ve,Symbol.toStringTag,{value:"Module"})});
558
+ */const ca="crypto.algorithm";class vC{getAlgorithms(){return pn.resolveAll(ca)}toAsnAlgorithm(t){const r={...t};r.hash&&typeof r.hash=="string"&&(r.hash={name:r.hash});for(const o of this.getAlgorithms()){const i=o.toAsnAlgorithm(r);if(i)return i}if(/^[0-9.]+$/.test(t.name)){const o=new He({algorithm:t.name});if("parameters"in t){const i=t;o.parameters=i.parameters}return o}throw new Error("Cannot convert WebCrypto algorithm to ASN.1 algorithm")}toWebAlgorithm(t){for(const o of this.getAlgorithms()){const i=o.toWebAlgorithm(t);if(i)return i}return{name:t.algorithm,parameters:t.parameters}}}const Wo="crypto.algorithmProvider";pn.registerSingleton(Wo,vC);var Qu;const En="1.3.36.3.3.2.8.1.1",IC=`${En}.1`,BC=`${En}.2`,TC=`${En}.3`,OC=`${En}.4`,PC=`${En}.5`,VC=`${En}.6`,$C=`${En}.7`,RC=`${En}.8`,LC=`${En}.9`,DC=`${En}.10`,MC=`${En}.11`,jC=`${En}.12`,FC=`${En}.13`,UC=`${En}.14`,KC="brainpoolP160r1",qC="brainpoolP160t1",GC="brainpoolP192r1",HC="brainpoolP192t1",zC="brainpoolP224r1",WC="brainpoolP224t1",YC="brainpoolP256r1",JC="brainpoolP256t1",XC="brainpoolP320r1",ZC="brainpoolP320t1",QC="brainpoolP384r1",e1="brainpoolP384t1",t1="brainpoolP512r1",n1="brainpoolP512t1",Lt="ECDSA";let ua=Qu=class{toAsnAlgorithm(t){switch(t.name.toLowerCase()){case Lt.toLowerCase():if("hash"in t)switch((typeof t.hash=="string"?t.hash:t.hash.name).toLowerCase()){case"sha-1":return aK;case"sha-256":return sK;case"sha-384":return lK;case"sha-512":return cK}else if("namedCurve"in t){let r="";switch(t.namedCurve){case"P-256":r=G0;break;case"K-256":r=Qu.SECP256K1;break;case"P-384":r=H0;break;case"P-521":r=z0;break;case KC:r=IC;break;case qC:r=BC;break;case GC:r=TC;break;case HC:r=OC;break;case zC:r=PC;break;case WC:r=VC;break;case YC:r=$C;break;case JC:r=RC;break;case XC:r=LC;break;case ZC:r=DC;break;case QC:r=MC;break;case e1:r=jC;break;case t1:r=FC;break;case n1:r=UC;break}if(r)return new He({algorithm:vs,parameters:Ue.serialize(new so({namedCurve:r}))})}}return null}toWebAlgorithm(t){switch(t.algorithm){case Xm:return{name:Lt,hash:{name:"SHA-1"}};case Zm:return{name:Lt,hash:{name:"SHA-256"}};case Qm:return{name:Lt,hash:{name:"SHA-384"}};case eg:return{name:Lt,hash:{name:"SHA-512"}};case vs:{if(!t.parameters)throw new TypeError("Cannot get required parameters from EC algorithm");switch(Ue.parse(t.parameters,so).namedCurve){case G0:return{name:Lt,namedCurve:"P-256"};case Qu.SECP256K1:return{name:Lt,namedCurve:"K-256"};case H0:return{name:Lt,namedCurve:"P-384"};case z0:return{name:Lt,namedCurve:"P-521"};case IC:return{name:Lt,namedCurve:KC};case BC:return{name:Lt,namedCurve:qC};case TC:return{name:Lt,namedCurve:GC};case OC:return{name:Lt,namedCurve:HC};case PC:return{name:Lt,namedCurve:zC};case VC:return{name:Lt,namedCurve:WC};case $C:return{name:Lt,namedCurve:YC};case RC:return{name:Lt,namedCurve:JC};case LC:return{name:Lt,namedCurve:XC};case DC:return{name:Lt,namedCurve:ZC};case MC:return{name:Lt,namedCurve:QC};case jC:return{name:Lt,namedCurve:e1};case FC:return{name:Lt,namedCurve:t1};case UC:return{name:Lt,namedCurve:n1}}}}return null}};ua.SECP256K1="1.3.132.0.10",ua=Qu=B([qu()],ua),pn.registerSingleton(ca,ua);const r1=Symbol("name"),o1=Symbol("value");class gt{constructor(t,r={},o=""){this[r1]=t,this[o1]=o;for(const i in r)this[i]=r[i]}}gt.NAME=r1,gt.VALUE=o1;class i1{static toTextObject(t){const r=new gt("Algorithm Identifier",{},Hr.toString(t.algorithm));if(t.parameters)switch(t.algorithm){case vs:{const o=new ua().toWebAlgorithm(t);o&&"namedCurve"in o?r["Named Curve"]=o.namedCurve:r.Parameters=t.parameters;break}default:r.Parameters=t.parameters}return r}}class Hr{static toString(t){const r=this.items[t];return r||t}}Hr.items={[Tu]:"sha1",[J0]:"sha224",[Ou]:"sha256",[Pu]:"sha384",[Vu]:"sha512",[qo]:"rsaEncryption",[vu]:"sha1WithRSAEncryption",[gK]:"sha224WithRSAEncryption",[ng]:"sha256WithRSAEncryption",[Iu]:"sha384WithRSAEncryption",[Bu]:"sha512WithRSAEncryption",[vs]:"ecPublicKey",[Xm]:"ecdsaWithSHA1",[q0]:"ecdsaWithSHA224",[Zm]:"ecdsaWithSHA256",[Qm]:"ecdsaWithSHA384",[eg]:"ecdsaWithSHA512",[Q8]:"TLS WWW server authentication",[eK]:"TLS WWW client authentication",[tK]:"Code Signing",[nK]:"E-mail Protection",[rK]:"Time Stamping",[oK]:"OCSP Signing",[iK]:"Signed Data"};class lo{static serialize(t){return this.serializeObj(t).join(`
559
+ `)}static pad(t=0){return"".padStart(2*t," ")}static serializeObj(t,r=0){const o=[];let i=this.pad(r++),a="";const s=t[gt.VALUE];s&&(a=` ${s}`),o.push(`${i}${t[gt.NAME]}:${a}`),i=this.pad(r);for(const c in t){if(typeof c=="symbol")continue;const l=t[c],u=c?`${c}: `:"";if(typeof l=="string"||typeof l=="number"||typeof l=="boolean")o.push(`${i}${u}${l}`);else if(l instanceof Date)o.push(`${i}${u}${l.toUTCString()}`);else if(Array.isArray(l))for(const p of l)p[gt.NAME]=c,o.push(...this.serializeObj(p,r));else if(l instanceof gt)l[gt.NAME]=c,o.push(...this.serializeObj(l,r));else if(qe.isBufferSource(l))c?(o.push(`${i}${u}`),o.push(...this.serializeBufferSource(l,r+1))):o.push(...this.serializeBufferSource(l,r));else if("toTextObject"in l){const p=l.toTextObject();p[gt.NAME]=c,o.push(...this.serializeObj(p,r))}else throw new TypeError("Cannot serialize data in text format. Unsupported type.")}return o}static serializeBufferSource(t,r=0){const o=this.pad(r),i=qe.toUint8Array(t),a=[];for(let s=0;s<i.length;){const c=[];for(let l=0;l<16&&s<i.length;l++){l===8&&c.push("");const u=i[s++].toString(16).padStart(2,"0");c.push(u)}a.push(`${o}${c.join(" ")}`)}return a}static serializeAlgorithm(t){return this.algorithmSerializer.toTextObject(t)}}lo.oidSerializer=Hr,lo.algorithmSerializer=i1;var da;class zr{get rawData(){return at(this,da,"f")||Vt(this,da,Ue.serialize(this.asn),"f"),at(this,da,"f")}constructor(...t){da.set(this,void 0),qe.isBufferSource(t[0])?(this.asn=Ue.parse(t[0],t[1]),Vt(this,da,qe.toArrayBuffer(t[0]),"f"),this.onInit(this.asn)):(this.asn=t[0],this.onInit(this.asn))}equal(t){return t instanceof zr?ZU(t.rawData,this.rawData):!1}toString(t="text"){switch(t){case"asn":return Ue.toString(this.rawData);case"text":return lo.serialize(this.toTextObject());case"hex":return Je.ToHex(this.rawData);case"base64":return Je.ToBase64(this.rawData);case"base64url":return Je.ToBase64Url(this.rawData);default:throw TypeError("Argument 'format' is unsupported value")}}getTextName(){return this.constructor.NAME}toTextObject(){const t=this.toTextObjectEmpty();return t[""]=this.rawData,t}toTextObjectEmpty(t){return new gt(this.getTextName(),{},t)}}da=new WeakMap,zr.NAME="ASN";class Nn extends zr{constructor(...t){let r;qe.isBufferSource(t[0])?r=qe.toArrayBuffer(t[0]):r=Ue.serialize(new kr({extnID:t[0],critical:t[1],extnValue:new mt(qe.toArrayBuffer(t[2]))})),super(r,kr)}onInit(t){this.type=t.extnID,this.critical=t.critical,this.value=t.extnValue.buffer}toTextObject(){const t=this.toTextObjectWithoutValue();return t[""]=this.value,t}toTextObjectWithoutValue(){const t=this.toTextObjectEmpty(this.critical?"critical":void 0);return t[gt.NAME]===Nn.NAME&&(t[gt.NAME]=Hr.toString(this.type)),t}}var a1;class Wr{static isCryptoKeyPair(t){return t&&t.privateKey&&t.publicKey}static isCryptoKey(t){return t&&t.usages&&t.type&&t.algorithm&&t.extractable!==void 0}constructor(){this.items=new Map,this[a1]="CryptoProvider",typeof self<"u"&&typeof crypto<"u"?this.set(Wr.DEFAULT,crypto):typeof global<"u"&&global.crypto&&global.crypto.subtle&&this.set(Wr.DEFAULT,global.crypto)}clear(){this.items.clear()}delete(t){return this.items.delete(t)}forEach(t,r){return this.items.forEach(t,r)}has(t){return this.items.has(t)}get size(){return this.items.size}entries(){return this.items.entries()}keys(){return this.items.keys()}values(){return this.items.values()}[Symbol.iterator](){return this.items[Symbol.iterator]()}get(t=Wr.DEFAULT){const r=this.items.get(t.toLowerCase());if(!r)throw new Error(`Cannot get Crypto by name '${t}'`);return r}set(t,r){if(typeof t=="string"){if(!r)throw new TypeError("Argument 'value' is required");this.items.set(t.toLowerCase(),r)}else this.items.set(Wr.DEFAULT,t);return this}}a1=Symbol.toStringTag,Wr.DEFAULT="default";const zn=new Wr,RK=/^[0-2](?:\.[1-9][0-9]*)+$/;function LK(n){return new RegExp(RK).test(n)}class Ig{constructor(t={}){this.items={};for(const r in t)this.register(r,t[r])}get(t){return this.items[t]||null}findId(t){return LK(t)?t:this.get(t)}register(t,r){this.items[t]=r,this.items[r]=t}}const Sn=new Ig;Sn.register("CN","2.5.4.3"),Sn.register("L","2.5.4.7"),Sn.register("ST","2.5.4.8"),Sn.register("O","2.5.4.10"),Sn.register("OU","2.5.4.11"),Sn.register("C","2.5.4.6"),Sn.register("DC","0.9.2342.19200300.100.1.25"),Sn.register("E","1.2.840.113549.1.9.1"),Sn.register("G","2.5.4.42"),Sn.register("I","2.5.4.43"),Sn.register("SN","2.5.4.4"),Sn.register("T","2.5.4.12");function DK(n,t){return`\\${Je.ToHex(Je.FromUtf8String(t)).toUpperCase()}`}function MK(n){return n.replace(/([,+"\\<>;])/g,"\\$1").replace(/^([ #])/,"\\$1").replace(/([ ]$)/,"\\$1").replace(/([\r\n\t])/,DK)}class co{static isASCII(t){for(let r=0;r<t.length;r++)if(t.charCodeAt(r)>255)return!1;return!0}static isPrintableString(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/g.test(t)}constructor(t,r={}){this.extraNames=new Ig,this.asn=new Wt;for(const o in r)if(Object.prototype.hasOwnProperty.call(r,o)){const i=r[o];this.extraNames.register(o,i)}typeof t=="string"?this.asn=this.fromString(t):t instanceof Wt?this.asn=t:qe.isBufferSource(t)?this.asn=Ue.parse(t,Wt):this.asn=this.fromJSON(t)}getField(t){const r=this.extraNames.findId(t)||Sn.findId(t),o=[];for(const i of this.asn)for(const a of i)a.type===r&&o.push(a.value.toString());return o}getName(t){return this.extraNames.get(t)||Sn.get(t)}toString(){return this.asn.map(t=>t.map(r=>{const o=this.getName(r.type)||r.type,i=r.value.anyValue?`#${Je.ToHex(r.value.anyValue)}`:MK(r.value.toString());return`${o}=${i}`}).join("+")).join(", ")}toJSON(){var t;const r=[];for(const o of this.asn){const i={};for(const a of o){const s=this.getName(a.type)||a.type;(t=i[s])!==null&&t!==void 0||(i[s]=[]),i[s].push(a.value.anyValue?`#${Je.ToHex(a.value.anyValue)}`:a.value.toString())}r.push(i)}return r}fromString(t){const r=new Wt,o=/(\d\.[\d.]*\d|[A-Za-z]+)=((?:"")|(?:".*?[^\\]")|(?:[^,+"\\](?=[,+]|$))|(?:[^,+].*?(?:[^\\][,+]))|(?:))([,+])?/g;let i=null,a=",";for(;i=o.exec(`${t},`);){let[,s,c]=i;const l=c[c.length-1];(l===","||l==="+")&&(c=c.slice(0,c.length-1),i[3]=l);const u=i[3];s=this.getTypeOid(s);const p=this.createAttribute(s,c);a==="+"?r[r.length-1].push(p):r.push(new Ui([p])),a=u}return r}fromJSON(t){const r=new Wt;for(const o of t){const i=new Ui;for(const a in o){const s=this.getTypeOid(a),c=o[a];for(const l of c){const u=this.createAttribute(s,l);i.push(u)}}r.push(i)}return r}getTypeOid(t){if(/[\d.]+/.test(t)||(t=this.getName(t)||""),!t)throw new Error(`Cannot get OID for name type '${t}'`);return t}createAttribute(t,r){const o=new zc({type:t});if(typeof r=="object")for(const i in r)switch(i){case"ia5String":o.value.ia5String=r[i];break;case"utf8String":o.value.utf8String=r[i];break;case"universalString":o.value.universalString=r[i];break;case"bmpString":o.value.bmpString=r[i];break;case"printableString":o.value.printableString=r[i];break}else if(r[0]==="#")o.value.anyValue=Je.FromHex(r.slice(1));else{const i=this.processStringValue(r);t===this.getName("E")||t===this.getName("DC")?o.value.ia5String=i:co.isPrintableString(i)?o.value.printableString=i:o.value.utf8String=i}return o}processStringValue(t){const r=/"(.*?[^\\])?"/.exec(t);return r&&(t=r[1]),t.replace(/\\0a/ig,`
560
+ `).replace(/\\0d/ig,"\r").replace(/\\0g/ig," ").replace(/\\(.)/g,"$1")}toArrayBuffer(){return Ue.serialize(this.asn)}async getThumbprint(t,r){let o,i="SHA-1";return t&&(typeof t=="object"&&"subtle"in t?o=t:(i=t,o=r)),o??(o=zn.get()),await o.subtle.digest(i,this.toArrayBuffer())}}const s1="Cannot initialize GeneralName from ASN.1 data.",l1=`${s1} Unsupported string format in use.`,jK=`${s1} Value doesn't match to GUID regular expression.`,c1=/^([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})$/i,u1="1.3.6.1.4.1.311.25.1",d1="1.3.6.1.4.1.311.20.2.3",ed="dns",td="dn",nd="email",rd="ip",od="url",id="guid",ad="upn",$s="id";class Yr extends zr{constructor(...t){let r;if(t.length===2)switch(t[0]){case td:{const o=new co(t[1]).toArrayBuffer(),i=Ue.parse(o,Wt);r=new ot({directoryName:i});break}case ed:r=new ot({dNSName:t[1]});break;case nd:r=new ot({rfc822Name:t[1]});break;case id:{const o=new RegExp(c1,"i").exec(t[1]);if(!o)throw new Error("Cannot parse GUID value. Value doesn't match to regular expression");const i=o.slice(1).map((a,s)=>s<3?Je.ToHex(new Uint8Array(Je.FromHex(a)).reverse()):a).join("");r=new ot({otherName:new ms({typeId:u1,value:Ue.serialize(new mt(Je.FromHex(i)))})});break}case rd:r=new ot({iPAddress:t[1]});break;case $s:r=new ot({registeredID:t[1]});break;case ad:{r=new ot({otherName:new ms({typeId:d1,value:Ue.serialize(c0.toASN(t[1]))})});break}case od:r=new ot({uniformResourceIdentifier:t[1]});break;default:throw new Error("Cannot create GeneralName. Unsupported type of the name")}else qe.isBufferSource(t[0])?r=Ue.parse(t[0],ot):r=t[0];super(r)}onInit(t){if(t.dNSName!=null)this.type=ed,this.value=t.dNSName;else if(t.rfc822Name!=null)this.type=nd,this.value=t.rfc822Name;else if(t.iPAddress!=null)this.type=rd,this.value=t.iPAddress;else if(t.uniformResourceIdentifier!=null)this.type=od,this.value=t.uniformResourceIdentifier;else if(t.registeredID!=null)this.type=$s,this.value=t.registeredID;else if(t.directoryName!=null)this.type=td,this.value=new co(t.directoryName).toString();else if(t.otherName!=null)if(t.otherName.typeId===u1){this.type=id;const r=Ue.parse(t.otherName.value,mt),o=new RegExp(c1,"i").exec(Je.ToHex(r));if(!o)throw new Error(jK);this.value=o.slice(1).map((i,a)=>a<3?Je.ToHex(new Uint8Array(Je.FromHex(i)).reverse()):i).join("-")}else if(t.otherName.typeId===d1)this.type=ad,this.value=Ue.parse(t.otherName.value,rn).toString();else throw new Error(l1);else throw new Error(l1)}toJSON(){return{type:this.type,value:this.value}}toTextObject(){let t;switch(this.type){case td:case ed:case id:case rd:case $s:case ad:case od:t=this.type.toUpperCase();break;case nd:t="Email";break;default:throw new Error("Unsupported GeneralName type")}let r=this.value;return this.type===$s&&(r=Hr.toString(r)),new gt(t,void 0,r)}}class uo extends zr{constructor(t){let r;if(t instanceof sn)r=t;else if(Array.isArray(t)){const o=[];for(const i of t)if(i instanceof ot)o.push(i);else{const a=Ue.parse(new Yr(i.type,i.value).rawData,ot);o.push(a)}r=new sn(o)}else if(qe.isBufferSource(t))r=Ue.parse(t,sn);else throw new Error("Cannot initialize GeneralNames. Incorrect incoming arguments");super(r)}onInit(t){const r=[];for(const o of t){let i=null;try{i=new Yr(o)}catch{continue}r.push(i)}this.items=r}toJSON(){return this.items.map(t=>t.toJSON())}toTextObject(){const t=super.toTextObjectEmpty();for(const r of this.items){const o=r.toTextObject();let i=t[o[gt.NAME]];Array.isArray(i)||(i=[],t[o[gt.NAME]]=i),i.push(o)}return t}}uo.NAME="GeneralNames";const Rs="-{5}",Ls="\\n",FK=`[^${Ls}]+`,UK=`${Rs}BEGIN (${FK}(?=${Rs}))${Rs}`,KK=`${Rs}END \\1${Rs}`,fa="\\n",qK=`[^:${Ls}]+`,GK=`(?:[^${Ls}]+${fa}(?: +[^${Ls}]+${fa})*)`,HK=`(?:[a-zA-Z0-9=+/]+${fa})+`,f1=`${UK}${fa}(?:((?:${qK}: ${GK})+))?${fa}?(${HK})${KK}`,zK=new RegExp(`[${Ls}]+`,"g");class xn{static isPem(t){return typeof t=="string"&&new RegExp(f1,"g").test(t.replace(/\r/g,""))}static decodeWithHeaders(t){t=t.replace(/\r/g,"");const r=new RegExp(f1,"g"),o=[];let i=null;for(;i=r.exec(t);){const a=i[3].replace(zK,""),s={type:i[1],headers:[],rawData:Je.FromBase64(a)},c=i[2];if(c){const l=c.split(new RegExp(fa,"g"));let u=null;for(const p of l){const[d,f]=p.split(/:(.*)/);if(f===void 0){if(!u)throw new Error("Cannot parse PEM string. Incorrect header value");u.value+=d.trim()}else u&&s.headers.push(u),u={key:d,value:f.trim()}}u&&s.headers.push(u)}o.push(s)}return o}static decode(t){return this.decodeWithHeaders(t).map(o=>o.rawData)}static decodeFirst(t){const r=this.decode(t);if(!r.length)throw new RangeError("PEM string doesn't contain any objects");return r[0]}static encode(t,r){if(Array.isArray(t)){const o=new Array;return r?t.forEach(i=>{if(!qe.isBufferSource(i))throw new TypeError("Cannot encode array of BufferSource in PEM format. Not all items of the array are BufferSource");o.push(this.encodeStruct({type:r,rawData:qe.toArrayBuffer(i)}))}):t.forEach(i=>{if(!("type"in i))throw new TypeError("Cannot encode array of PemStruct in PEM format. Not all items of the array are PemStrut");o.push(this.encodeStruct(i))}),o.join(`
561
+ `)}else{if(!r)throw new Error("Required argument 'tag' is missed");return this.encodeStruct({type:r,rawData:qe.toArrayBuffer(t)})}}static encodeStruct(t){var r;const o=t.type.toLocaleUpperCase(),i=[];if(i.push(`-----BEGIN ${o}-----`),!((r=t.headers)===null||r===void 0)&&r.length){for(const s of t.headers)i.push(`${s.key}: ${s.value}`);i.push("")}const a=Je.ToBase64(t.rawData);for(let s=0;s<a.length;s+=64)i.push(a.substring(s,s+64));return i.push(`-----END ${o}-----`),i.join(`
562
+ `)}}xn.CertificateTag="CERTIFICATE",xn.CrlTag="CRL",xn.CertificateRequestTag="CERTIFICATE REQUEST",xn.PublicKeyTag="PUBLIC KEY",xn.PrivateKeyTag="PRIVATE KEY";class Sr extends zr{static isAsnEncoded(t){return qe.isBufferSource(t)||typeof t=="string"}static toArrayBuffer(t){if(typeof t=="string"){if(xn.isPem(t))return xn.decode(t)[0];if(Je.isHex(t))return Je.FromHex(t);if(Je.isBase64(t))return Je.FromBase64(t);if(Je.isBase64Url(t))return Je.FromBase64Url(t);throw new TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url")}else{const r=qe.toUint8Array(t);if(r.length>0&&r[0]===48)return qe.toArrayBuffer(t);const o=Je.ToBinary(t);if(xn.isPem(o))return xn.decode(o)[0];if(Je.isHex(o))return Je.FromHex(o);if(Je.isBase64(o))return Je.FromBase64(o);if(Je.isBase64Url(o))return Je.FromBase64Url(o);throw new TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url")}}constructor(...t){Sr.isAsnEncoded(t[0])?super(Sr.toArrayBuffer(t[0]),t[1]):super(t[0])}toString(t="pem"){switch(t){case"pem":return xn.encode(this.rawData,this.tag);default:return super.toString(t)}}}class sr extends Sr{static async create(t,r=zn.get()){if(t instanceof sr)return t;if(Wr.isCryptoKey(t)){if(t.type!=="public")throw new TypeError("Public key is required");const o=await r.subtle.exportKey("spki",t);return new sr(o)}else{if(t.publicKey)return t.publicKey;if(qe.isBufferSource(t))return new sr(t);throw new TypeError("Unsupported PublicKeyType")}}constructor(t){Sr.isAsnEncoded(t)?super(t,wr):super(t),this.tag=xn.PublicKeyTag}async export(t,r,o){let i,a=["verify"],s={hash:"SHA-256",...this.algorithm};r?(s=t,a=r,i=o):i=t,i??(i=zn.get());let c=this.rawData;const l=Ue.parse(this.rawData,wr);return l.algorithm.algorithm===Ts&&(c=WK(l,c)),i.subtle.importKey("spki",c,s,!0,a)}onInit(t){const r=pn.resolve(Wo),o=this.algorithm=r.toWebAlgorithm(t.algorithm);switch(t.algorithm.algorithm){case qo:{const i=Ue.parse(t.subjectPublicKey,ig),a=qe.toUint8Array(i.modulus);o.publicExponent=qe.toUint8Array(i.publicExponent),o.modulusLength=(a[0]?a:a.slice(1)).byteLength<<3;break}}}async getThumbprint(t,r){let o,i="SHA-1";return t&&(typeof t=="object"&&"subtle"in t?o=t:(i=t,o=r)),o??(o=zn.get()),await o.subtle.digest(i,this.rawData)}async getKeyIdentifier(t,r){let o,i="SHA-1";t&&(typeof t=="object"&&"subtle"in t?o=t:(i=t,o=r)),o??(o=zn.get());const a=Ue.parse(this.rawData,wr);return await o.subtle.digest(i,a.subjectPublicKey)}toTextObject(){const t=this.toTextObjectEmpty(),r=Ue.parse(this.rawData,wr);switch(t.Algorithm=lo.serializeAlgorithm(r.algorithm),r.algorithm.algorithm){case vs:t["EC Point"]=r.subjectPublicKey;break;case qo:default:t["Raw Data"]=r.subjectPublicKey}return t}}function WK(n,t){return n.algorithm=new He({algorithm:qo,parameters:null}),t=Ue.serialize(n),t}class pa extends Nn{static async create(t,r=!1,o=zn.get()){if("name"in t&&"serialNumber"in t)return new pa(t,r);const a=await(await sr.create(t,o)).getKeyIdentifier(o);return new pa(Je.ToHex(a),r)}constructor(...t){if(qe.isBufferSource(t[0]))super(t[0]);else if(typeof t[0]=="string"){const r=new Do({keyIdentifier:new tm(Je.FromHex(t[0]))});super(em,t[1],Ue.serialize(r))}else{const r=t[0],o=r.name instanceof uo?Ue.parse(r.name.rawData,sn):r.name,i=new Do({authorityCertIssuer:o,authorityCertSerialNumber:Je.FromHex(r.serialNumber)});super(em,t[1],Ue.serialize(i))}}onInit(t){super.onInit(t);const r=Ue.parse(t.extnValue,Do);r.keyIdentifier&&(this.keyId=Je.ToHex(r.keyIdentifier)),(r.authorityCertIssuer||r.authorityCertSerialNumber)&&(this.certId={name:r.authorityCertIssuer||[],serialNumber:r.authorityCertSerialNumber?Je.ToHex(r.authorityCertSerialNumber):""})}toTextObject(){const t=this.toTextObjectWithoutValue(),r=Ue.parse(this.value,Do);return r.authorityCertIssuer&&(t["Authority Issuer"]=new uo(r.authorityCertIssuer).toTextObject()),r.authorityCertSerialNumber&&(t["Authority Serial Number"]=r.authorityCertSerialNumber),r.keyIdentifier&&(t[""]=r.keyIdentifier),t}}pa.NAME="Authority Key Identifier";class Bg extends Nn{constructor(...t){if(qe.isBufferSource(t[0])){super(t[0]);const r=Ue.parse(this.value,Yc);this.ca=r.cA,this.pathLength=r.pathLenConstraint}else{const r=new Yc({cA:t[0],pathLenConstraint:t[1]});super(_0,t[2],Ue.serialize(r)),this.ca=t[0],this.pathLength=t[1]}}toTextObject(){const t=this.toTextObjectWithoutValue();return this.ca&&(t.CA=this.ca),this.pathLength!==void 0&&(t["Path Length"]=this.pathLength),t}}Bg.NAME="Basic Constraints";var Tg;(function(n){n.serverAuth="1.3.6.1.5.5.7.3.1",n.clientAuth="1.3.6.1.5.5.7.3.2",n.codeSigning="1.3.6.1.5.5.7.3.3",n.emailProtection="1.3.6.1.5.5.7.3.4",n.timeStamping="1.3.6.1.5.5.7.3.8",n.ocspSigning="1.3.6.1.5.5.7.3.9"})(Tg||(Tg={}));class Og extends Nn{constructor(...t){if(qe.isBufferSource(t[0])){super(t[0]);const r=Ue.parse(this.value,eu);this.usages=r.map(o=>o)}else{const r=new eu(t[0]);super(N0,t[1],Ue.serialize(r)),this.usages=t[0]}}toTextObject(){const t=this.toTextObjectWithoutValue();return t[""]=this.usages.map(r=>Hr.toString(r)).join(", "),t}}Og.NAME="Extended Key Usages";var Pg;(function(n){n[n.digitalSignature=1]="digitalSignature",n[n.nonRepudiation=2]="nonRepudiation",n[n.keyEncipherment=4]="keyEncipherment",n[n.dataEncipherment=8]="dataEncipherment",n[n.keyAgreement=16]="keyAgreement",n[n.keyCertSign=32]="keyCertSign",n[n.cRLSign=64]="cRLSign",n[n.encipherOnly=128]="encipherOnly",n[n.decipherOnly=256]="decipherOnly"})(Pg||(Pg={}));class Vg extends Nn{constructor(...t){if(qe.isBufferSource(t[0])){super(t[0]);const r=Ue.parse(this.value,hm);this.usages=r.toNumber()}else{const r=new hm(t[0]);super(A0,t[1],Ue.serialize(r)),this.usages=t[0]}}toTextObject(){const t=this.toTextObjectWithoutValue(),r=Ue.parse(this.value,hm);return t[""]=r.toJSON().join(", "),t}}Vg.NAME="Key Usages";class Ds extends Nn{static async create(t,r=!1,o=zn.get()){const a=await(await sr.create(t,o)).getKeyIdentifier(o);return new Ds(Je.ToHex(a),r)}constructor(...t){if(qe.isBufferSource(t[0])){super(t[0]);const r=Ue.parse(this.value,io);this.keyId=Je.ToHex(r)}else{const r=typeof t[0]=="string"?Je.FromHex(t[0]):t[0],o=new io(r);super(P0,t[1],Ue.serialize(o)),this.keyId=Je.ToHex(r)}}toTextObject(){const t=this.toTextObjectWithoutValue(),r=Ue.parse(this.value,io);return t[""]=r,t}}Ds.NAME="Subject Key Identifier";class $g extends Nn{constructor(...t){qe.isBufferSource(t[0])?super(t[0]):super(T0,t[1],new uo(t[0]||[]).rawData)}onInit(t){super.onInit(t);const r=Ue.parse(t.extnValue,km);this.names=new uo(r)}toTextObject(){const t=this.toTextObjectWithoutValue(),r=this.names.toTextObject();for(const o in r)t[o]=r[o];return t}}$g.NAME="Subject Alternative Name";class An{static register(t,r){this.items.set(t,r)}static create(t){const r=new Nn(t),o=this.items.get(r.type);return o?new o(t):r}}An.items=new Map;class Rg extends Nn{constructor(...t){var r;if(qe.isBufferSource(t[0])){super(t[0]);const o=Ue.parse(this.value,Zc);this.policies=o.map(i=>i.policyIdentifier)}else{const o=t[0],i=(r=t[1])!==null&&r!==void 0?r:!1,a=new Zc(o.map(s=>new Xc({policyIdentifier:s})));super(w0,i,Ue.serialize(a)),this.policies=o}}toTextObject(){const t=this.toTextObjectWithoutValue();return t.Policy=this.policies.map(r=>new gt("",{},Hr.toString(r))),t}}Rg.NAME="Certificate Policies",An.register(w0,Rg);class Lg extends Nn{constructor(...t){var r;if(qe.isBufferSource(t[0]))super(t[0]);else if(Array.isArray(t[0])&&typeof t[0][0]=="string"){const i=t[0].map(s=>new Gi({distributionPoint:new Mo({fullName:[new ot({uniformResourceIdentifier:s})]})})),a=new Hi(i);super(cm,t[1],Ue.serialize(a))}else{const o=new Hi(t[0]);super(cm,t[1],Ue.serialize(o))}(r=this.distributionPoints)!==null&&r!==void 0||(this.distributionPoints=[])}onInit(t){super.onInit(t);const r=Ue.parse(t.extnValue,Hi);this.distributionPoints=r}toTextObject(){const t=this.toTextObjectWithoutValue();return t["Distribution Point"]=this.distributionPoints.map(r=>{var o;const i=new gt("");return!((o=r.distributionPoint)===null||o===void 0)&&o.fullName&&(i[""]=r.distributionPoint.fullName.map(a=>new Yr(a).toString()).join(", ")),r.reasons&&(i.Reasons=r.reasons.toString()),r.cRLIssuer&&(i["CRL Issuer"]=r.cRLIssuer.map(a=>a.toString()).join(", ")),i}),t}}Lg.NAME="CRL Distribution Points";class Dg extends Nn{constructor(...t){var r,o,i,a;if(qe.isBufferSource(t[0]))super(t[0]);else if(t[0]instanceof qi){const s=new qi(t[0]);super(Qp,t[1],Ue.serialize(s))}else{const s=t[0],c=new qi;ld(c,s,m0,"ocsp"),ld(c,s,g0,"caIssuers"),ld(c,s,h0,"timeStamping"),ld(c,s,y0,"caRepository"),super(Qp,t[1],Ue.serialize(c))}(r=this.ocsp)!==null&&r!==void 0||(this.ocsp=[]),(o=this.caIssuers)!==null&&o!==void 0||(this.caIssuers=[]),(i=this.timeStamping)!==null&&i!==void 0||(this.timeStamping=[]),(a=this.caRepository)!==null&&a!==void 0||(this.caRepository=[])}onInit(t){super.onInit(t),this.ocsp=[],this.caIssuers=[],this.timeStamping=[],this.caRepository=[],Ue.parse(t.extnValue,qi).forEach(o=>{switch(o.accessMethod){case m0:this.ocsp.push(new Yr(o.accessLocation));break;case g0:this.caIssuers.push(new Yr(o.accessLocation));break;case h0:this.timeStamping.push(new Yr(o.accessLocation));break;case y0:this.caRepository.push(new Yr(o.accessLocation));break}})}toTextObject(){const t=this.toTextObjectWithoutValue();return this.ocsp.length&&sd(t,"OCSP",this.ocsp),this.caIssuers.length&&sd(t,"CA Issuers",this.caIssuers),this.timeStamping.length&&sd(t,"Time Stamping",this.timeStamping),this.caRepository.length&&sd(t,"CA Repository",this.caRepository),t}}Dg.NAME="Authority Info Access";function sd(n,t,r){if(r.length===1)n[t]=r[0].toTextObject();else{const o=new gt("");r.forEach((i,a)=>{const s=i.toTextObject(),c=`${s[gt.NAME]} ${a+1}`;let l=o[c];Array.isArray(l)||(l=[],o[c]=l),l.push(s)}),n[t]=o}}function ld(n,t,r,o){const i=t[o];i&&(Array.isArray(i)?i:[i]).forEach(s=>{typeof s=="string"&&(s=new Yr("url",s)),n.push(new gs({accessMethod:r,accessLocation:Ue.parse(s.rawData,ot)}))})}class Mg extends Nn{constructor(...t){qe.isBufferSource(t[0])?super(t[0]):super(S0,t[1],new uo(t[0]||[]).rawData)}onInit(t){super.onInit(t);const r=Ue.parse(t.extnValue,sn);this.names=new uo(r)}toTextObject(){const t=this.toTextObjectWithoutValue(),r=this.names.toTextObject();for(const o in r)t[o]=r[o];return t}}Mg.NAME="Issuer Alternative Name";class Yo extends zr{constructor(...t){let r;if(qe.isBufferSource(t[0]))r=qe.toArrayBuffer(t[0]);else{const o=t[0],i=Array.isArray(t[1])?t[1].map(a=>qe.toArrayBuffer(a)):[];r=Ue.serialize(new Ur({type:o,values:i}))}super(r,Ur)}onInit(t){this.type=t.type,this.values=t.values}toTextObject(){const t=this.toTextObjectWithoutValue();return t.Value=this.values.map(r=>new gt("",{"":r})),t}toTextObjectWithoutValue(){const t=this.toTextObjectEmpty();return t[gt.NAME]===Yo.NAME&&(t[gt.NAME]=Hr.toString(this.type)),t}}Yo.NAME="Attribute";class jg extends Yo{constructor(...t){var r;if(qe.isBufferSource(t[0]))super(t[0]);else{const o=new Xu({printableString:t[0]});super(mC,[Ue.serialize(o)])}(r=this.password)!==null&&r!==void 0||(this.password="")}onInit(t){if(super.onInit(t),this.values[0]){const r=Ue.parse(this.values[0],Xu);this.password=r.toString()}}toTextObject(){const t=this.toTextObjectWithoutValue();return t[gt.VALUE]=this.password,t}}jg.NAME="Challenge Password";class cd extends Yo{constructor(...t){var r;if(qe.isBufferSource(t[0]))super(t[0]);else{const o=t[0],i=new jo;for(const a of o)i.push(Ue.parse(a.rawData,kr));super(wg,[Ue.serialize(i)])}(r=this.items)!==null&&r!==void 0||(this.items=[])}onInit(t){if(super.onInit(t),this.values[0]){const r=Ue.parse(this.values[0],jo);this.items=r.map(o=>An.create(Ue.serialize(o)))}}toTextObject(){const t=this.toTextObjectWithoutValue(),r=this.items.map(o=>o.toTextObject());for(const o of r)t[o[gt.NAME]]=o;return t}}cd.NAME="Extensions";class Ms{static register(t,r){this.items.set(t,r)}static create(t){const r=new Yo(t),o=this.items.get(r.type);return o?new o(t):r}}Ms.items=new Map;const js="crypto.signatureFormatter";class p1{toAsnSignature(t,r){return qe.toArrayBuffer(r)}toWebSignature(t,r){return qe.toArrayBuffer(r)}}var ud;let dd=ud=class{static createPssParams(t,r){const o=ud.getHashAlgorithm(t);return o?new Ho({hashAlgorithm:o,maskGenAlgorithm:new He({algorithm:$u,parameters:Ue.serialize(o)}),saltLength:r}):null}static getHashAlgorithm(t){const r=pn.resolve(Wo);return typeof t=="string"?r.toAsnAlgorithm({name:t}):typeof t=="object"&&t&&"name"in t?r.toAsnAlgorithm(t):null}toAsnAlgorithm(t){switch(t.name.toLowerCase()){case"rsassa-pkcs1-v1_5":if("hash"in t){let r;if(typeof t.hash=="string")r=t.hash;else if(t.hash&&typeof t.hash=="object"&&"name"in t.hash&&typeof t.hash.name=="string")r=t.hash.name.toUpperCase();else throw new Error("Cannot get hash algorithm name");switch(r.toLowerCase()){case"sha-1":return new He({algorithm:vu,parameters:null});case"sha-256":return new He({algorithm:ng,parameters:null});case"sha-384":return new He({algorithm:Iu,parameters:null});case"sha-512":return new He({algorithm:Bu,parameters:null})}}else return new He({algorithm:qo,parameters:null});break;case"rsa-pss":if("hash"in t){if(!("saltLength"in t&&typeof t.saltLength=="number"))throw new Error("Cannot get 'saltLength' from 'alg' argument");const r=ud.createPssParams(t.hash,t.saltLength);if(!r)throw new Error("Cannot create PSS parameters");return new He({algorithm:Ts,parameters:Ue.serialize(r)})}else return new He({algorithm:Ts,parameters:null})}return null}toWebAlgorithm(t){switch(t.algorithm){case qo:return{name:"RSASSA-PKCS1-v1_5"};case vu:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case ng:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case Iu:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case Bu:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case Ts:if(t.parameters){const r=Ue.parse(t.parameters,Ho);return{name:"RSA-PSS",hash:pn.resolve(Wo).toWebAlgorithm(r.hashAlgorithm),saltLength:r.saltLength}}else return{name:"RSA-PSS"}}return null}};dd=ud=B([qu()],dd),pn.registerSingleton(ca,dd);let fd=class{toAsnAlgorithm(t){switch(t.name.toLowerCase()){case"sha-1":return new He({algorithm:Tu});case"sha-256":return new He({algorithm:Ou});case"sha-384":return new He({algorithm:Pu});case"sha-512":return new He({algorithm:Vu})}return null}toWebAlgorithm(t){switch(t.algorithm){case Tu:return{name:"SHA-1"};case Ou:return{name:"SHA-256"};case Pu:return{name:"SHA-384"};case Vu:return{name:"SHA-512"}}return null}};fd=B([qu()],fd),pn.registerSingleton(ca,fd);class On{addPadding(t,r){const o=qe.toUint8Array(r),i=new Uint8Array(t);return i.set(o,t-o.length),i.buffer}removePadding(t,r=!1){let o=qe.toUint8Array(t);for(let i=0;i<o.length;i++)if(o[i]){o=o.slice(i);break}if(r&&o[0]>127){const i=new Uint8Array(o.length+1);return i.set(o,1),i.buffer}return o.buffer}toAsnSignature(t,r){if(t.name==="ECDSA"){const o=t.namedCurve,i=On.namedCurveSize.get(o)||On.defaultNamedCurveSize,a=new Au,s=qe.toUint8Array(r);return a.r=this.removePadding(s.slice(0,i),!0),a.s=this.removePadding(s.slice(i,i+i),!0),Ue.serialize(a)}return null}toWebSignature(t,r){if(t.name==="ECDSA"){const o=Ue.parse(r,Au),i=t.namedCurve,a=On.namedCurveSize.get(i)||On.defaultNamedCurveSize,s=this.addPadding(a,this.removePadding(o.r)),c=this.addPadding(a,this.removePadding(o.s));return XU(s,c)}return null}}On.namedCurveSize=new Map,On.defaultNamedCurveSize=32;const pd="1.3.101.110",Fg="1.3.101.111",md="1.3.101.112",Ug="1.3.101.113";let gd=class{toAsnAlgorithm(t){let r=null;switch(t.name.toLowerCase()){case"ed25519":r=md;break;case"x25519":r=pd;break;case"eddsa":switch(t.namedCurve.toLowerCase()){case"ed25519":r=md;break;case"ed448":r=Ug;break}break;case"ecdh-es":switch(t.namedCurve.toLowerCase()){case"x25519":r=pd;break;case"x448":r=Fg;break}}return r?new He({algorithm:r}):null}toWebAlgorithm(t){switch(t.algorithm){case md:return{name:"Ed25519"};case Ug:return{name:"EdDSA",namedCurve:"Ed448"};case pd:return{name:"X25519"};case Fg:return{name:"ECDH-ES",namedCurve:"X448"}}return null}};gd=B([qu()],gd),pn.registerSingleton(ca,gd);var Fs,Us,Ks,qs,Gs,Hs,zs,ma;class m1 extends Sr{get subjectName(){return at(this,Us,"f")||Vt(this,Us,new co(this.asn.certificationRequestInfo.subject),"f"),at(this,Us,"f")}get subject(){return at(this,Ks,"f")||Vt(this,Ks,this.subjectName.toString(),"f"),at(this,Ks,"f")}get signatureAlgorithm(){if(!at(this,qs,"f")){const t=pn.resolve(Wo);Vt(this,qs,t.toWebAlgorithm(this.asn.signatureAlgorithm),"f")}return at(this,qs,"f")}get signature(){return at(this,Gs,"f")||Vt(this,Gs,this.asn.signature,"f"),at(this,Gs,"f")}get publicKey(){return at(this,Hs,"f")||Vt(this,Hs,new sr(this.asn.certificationRequestInfo.subjectPKInfo),"f"),at(this,Hs,"f")}get attributes(){return at(this,zs,"f")||Vt(this,zs,this.asn.certificationRequestInfo.attributes.map(t=>Ms.create(Ue.serialize(t))),"f"),at(this,zs,"f")}get extensions(){if(!at(this,ma,"f")){Vt(this,ma,[],"f");const t=this.getAttribute(wg);t instanceof cd&&Vt(this,ma,t.items,"f")}return at(this,ma,"f")}get tbs(){return at(this,Fs,"f")||Vt(this,Fs,this.asn.certificationRequestInfoRaw||Ue.serialize(this.asn.certificationRequestInfo),"f"),at(this,Fs,"f")}constructor(t){const r=Sr.isAsnEncoded(t)?[t,Vs]:[t];super(r[0],r[1]),Fs.set(this,void 0),Us.set(this,void 0),Ks.set(this,void 0),qs.set(this,void 0),Gs.set(this,void 0),Hs.set(this,void 0),zs.set(this,void 0),ma.set(this,void 0),this.tag=xn.CertificateRequestTag}onInit(t){}getAttribute(t){for(const r of this.attributes)if(r.type===t)return r;return null}getAttributes(t){return this.attributes.filter(r=>r.type===t)}getExtension(t){for(const r of this.extensions)if(r.type===t)return r;return null}getExtensions(t){return this.extensions.filter(r=>r.type===t)}async verify(t=zn.get()){const r={...this.publicKey.algorithm,...this.signatureAlgorithm},o=await this.publicKey.export(r,["verify"],t),i=pn.resolveAll(js).reverse();let a=null;for(const c of i)if(a=c.toWebSignature(r,this.signature),a)break;if(!a)throw Error("Cannot convert WebCrypto signature value to ASN.1 format");return await t.subtle.verify(this.signatureAlgorithm,o,a,this.tbs)}toTextObject(){const t=this.toTextObjectEmpty(),r=Ue.parse(this.rawData,Vs),o=r.certificationRequestInfo,i=new gt("",{Version:`${zi[o.version]} (${o.version})`,Subject:this.subject,"Subject Public Key Info":this.publicKey});if(this.attributes.length){const a=new gt("");for(const s of this.attributes){const c=s.toTextObject();a[c[gt.NAME]]=c}i.Attributes=a}return t.Data=i,t.Signature=new gt("",{Algorithm:lo.serializeAlgorithm(r.signatureAlgorithm),"":r.signature}),t}}Fs=new WeakMap,Us=new WeakMap,Ks=new WeakMap,qs=new WeakMap,Gs=new WeakMap,Hs=new WeakMap,zs=new WeakMap,ma=new WeakMap,m1.NAME="PKCS#10 Certificate Request";var Ws,Ys,Js,Xs,Zs,Qs,el,tl,nl,rl,ga,ol;class g1 extends Sr{get publicKey(){return at(this,ol,"f")||Vt(this,ol,new sr(this.asn.tbsCertificate.subjectPublicKeyInfo),"f"),at(this,ol,"f")}get serialNumber(){if(!at(this,Ys,"f")){const t=this.asn.tbsCertificate;let r=new Uint8Array(t.serialNumber);r.length>1&&r[0]===0&&r[1]>127&&(r=r.slice(1)),Vt(this,Ys,Je.ToHex(r),"f")}return at(this,Ys,"f")}get subjectName(){return at(this,Js,"f")||Vt(this,Js,new co(this.asn.tbsCertificate.subject),"f"),at(this,Js,"f")}get subject(){return at(this,Xs,"f")||Vt(this,Xs,this.subjectName.toString(),"f"),at(this,Xs,"f")}get issuerName(){return at(this,Zs,"f")||Vt(this,Zs,new co(this.asn.tbsCertificate.issuer),"f"),at(this,Zs,"f")}get issuer(){return at(this,Qs,"f")||Vt(this,Qs,this.issuerName.toString(),"f"),at(this,Qs,"f")}get notBefore(){if(!at(this,el,"f")){const t=this.asn.tbsCertificate.validity.notBefore.utcTime||this.asn.tbsCertificate.validity.notBefore.generalTime;if(!t)throw new Error("Cannot get 'notBefore' value");Vt(this,el,t,"f")}return at(this,el,"f")}get notAfter(){if(!at(this,tl,"f")){const t=this.asn.tbsCertificate.validity.notAfter.utcTime||this.asn.tbsCertificate.validity.notAfter.generalTime;if(!t)throw new Error("Cannot get 'notAfter' value");Vt(this,tl,t,"f")}return at(this,tl,"f")}get signatureAlgorithm(){if(!at(this,nl,"f")){const t=pn.resolve(Wo);Vt(this,nl,t.toWebAlgorithm(this.asn.signatureAlgorithm),"f")}return at(this,nl,"f")}get signature(){return at(this,rl,"f")||Vt(this,rl,this.asn.signatureValue,"f"),at(this,rl,"f")}get extensions(){return at(this,ga,"f")||(Vt(this,ga,[],"f"),this.asn.tbsCertificate.extensions&&Vt(this,ga,this.asn.tbsCertificate.extensions.map(t=>An.create(Ue.serialize(t))),"f")),at(this,ga,"f")}get tbs(){return at(this,Ws,"f")||Vt(this,Ws,this.asn.tbsCertificateRaw||Ue.serialize(this.asn.tbsCertificate),"f"),at(this,Ws,"f")}constructor(t){const r=Sr.isAsnEncoded(t)?[t,Wi]:[t];super(r[0],r[1]),Ws.set(this,void 0),Ys.set(this,void 0),Js.set(this,void 0),Xs.set(this,void 0),Zs.set(this,void 0),Qs.set(this,void 0),el.set(this,void 0),tl.set(this,void 0),nl.set(this,void 0),rl.set(this,void 0),ga.set(this,void 0),ol.set(this,void 0),this.tag=xn.CertificateTag}onInit(t){}getExtension(t){for(const r of this.extensions)if(typeof t=="string"){if(r.type===t)return r}else if(r instanceof t)return r;return null}getExtensions(t){return this.extensions.filter(r=>typeof t=="string"?r.type===t:r instanceof t)}async verify(t={},r=zn.get()){let o,i;const a=t.publicKey;try{if(!a)o={...this.publicKey.algorithm,...this.signatureAlgorithm},i=await this.publicKey.export(o,["verify"],r);else if("publicKey"in a)o={...a.publicKey.algorithm,...this.signatureAlgorithm},i=await a.publicKey.export(o,["verify"],r);else if(a instanceof sr)o={...a.algorithm,...this.signatureAlgorithm},i=await a.export(o,["verify"],r);else if(qe.isBufferSource(a)){const u=new sr(a);o={...u.algorithm,...this.signatureAlgorithm},i=await u.export(o,["verify"],r)}else o={...a.algorithm,...this.signatureAlgorithm},i=a}catch{return!1}const s=pn.resolveAll(js).reverse();let c=null;for(const u of s)if(c=u.toWebSignature(o,this.signature),c)break;if(!c)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");const l=await r.subtle.verify(this.signatureAlgorithm,i,c,this.tbs);if(t.signatureOnly)return l;{const p=(t.date||new Date).getTime();return l&&this.notBefore.getTime()<p&&p<this.notAfter.getTime()}}async getThumbprint(t,r){let o,i="SHA-1";return t&&(typeof t=="object"&&"subtle"in t?o=t:(i=t,o=r)),o??(o=zn.get()),await o.subtle.digest(i,this.rawData)}async isSelfSigned(t=zn.get()){return this.subject===this.issuer&&await this.verify({signatureOnly:!0},t)}toTextObject(){const t=this.toTextObjectEmpty(),r=Ue.parse(this.rawData,Wi),o=r.tbsCertificate,i=new gt("",{Version:`${zi[o.version]} (${o.version})`,"Serial Number":o.serialNumber,"Signature Algorithm":lo.serializeAlgorithm(o.signature),Issuer:this.issuer,Validity:new gt("",{"Not Before":o.validity.notBefore.getTime(),"Not After":o.validity.notAfter.getTime()}),Subject:this.subject,"Subject Public Key Info":this.publicKey});if(o.issuerUniqueID&&(i["Issuer Unique ID"]=o.issuerUniqueID),o.subjectUniqueID&&(i["Subject Unique ID"]=o.subjectUniqueID),this.extensions.length){const a=new gt("");for(const s of this.extensions){const c=s.toTextObject();a[c[gt.NAME]]=c}i.Extensions=a}return t.Data=i,t.Signature=new gt("",{Algorithm:lo.serializeAlgorithm(r.signatureAlgorithm),"":r.signatureValue}),t}}Ws=new WeakMap,Ys=new WeakMap,Js=new WeakMap,Xs=new WeakMap,Zs=new WeakMap,Qs=new WeakMap,el=new WeakMap,tl=new WeakMap,nl=new WeakMap,rl=new WeakMap,ga=new WeakMap,ol=new WeakMap,g1.NAME="Certificate";var Kg;(function(n){n[n.unspecified=0]="unspecified",n[n.keyCompromise=1]="keyCompromise",n[n.cACompromise=2]="cACompromise",n[n.affiliationChanged=3]="affiliationChanged",n[n.superseded=4]="superseded",n[n.cessationOfOperation=5]="cessationOfOperation",n[n.certificateHold=6]="certificateHold",n[n.removeFromCRL=8]="removeFromCRL",n[n.privilegeWithdrawn=9]="privilegeWithdrawn",n[n.aACompromise=10]="aACompromise"})(Kg||(Kg={})),An.register(_0,Bg),An.register(N0,Og),An.register(A0,Vg),An.register(P0,Ds),An.register(em,pa),An.register(T0,$g),An.register(cm,Lg),An.register(Qp,Dg),An.register(S0,Mg),Ms.register(mC,jg),Ms.register(wg,cd),pn.registerSingleton(js,p1),pn.registerSingleton(js,On),On.namedCurveSize.set("P-256",32),On.namedCurveSize.set("K-256",32),On.namedCurveSize.set("P-384",48),On.namedCurveSize.set("P-521",66);const YK=Object.freeze(Object.defineProperty({__proto__:null,AlgorithmProvider:vC,AsnData:zr,AsnDefaultSignatureFormatter:p1,AsnEcSignatureFormatter:On,Attribute:Yo,AttributeFactory:Ms,AuthorityInfoAccessExtension:Dg,AuthorityKeyIdentifierExtension:pa,BasicConstraintsExtension:Bg,CRLDistributionPointsExtension:Lg,CertificatePolicyExtension:Rg,ChallengePasswordAttribute:jg,CryptoProvider:Wr,DN:td,DNS:ed,DefaultAlgorithmSerializer:i1,EMAIL:nd,get EcAlgorithm(){return ua},get EdAlgorithm(){return gd},get ExtendedKeyUsage(){return Tg},ExtendedKeyUsageExtension:Og,Extension:Nn,ExtensionFactory:An,ExtensionsAttribute:cd,GUID:id,GeneralName:Yr,GeneralNames:uo,IP:rd,IssuerAlternativeNameExtension:Mg,get KeyUsageFlags(){return Pg},KeyUsagesExtension:Vg,Name:co,NameIdentifier:Ig,OidSerializer:Hr,PemConverter:xn,PemData:Sr,Pkcs10CertificateRequest:m1,PublicKey:sr,REGISTERED_ID:$s,get RsaAlgorithm(){return dd},get ShaAlgorithm(){return fd},SubjectAlternativeNameExtension:$g,SubjectKeyIdentifierExtension:Ds,TextConverter:lo,TextObject:gt,UPN:ad,URL:od,X509Certificate:g1,get X509CrlReason(){return Kg},cryptoProvider:zn,diAlgorithm:ca,diAlgorithmProvider:Wo,diAsnSignatureFormatter:js,idEd25519:md,idEd448:Ug,idX25519:pd,idX448:Fg},Symbol.toStringTag,{value:"Module"}));Object.defineProperty(ve,"PluginIcon",{enumerable:!0,get:()=>xr.PluginIcon}),Object.defineProperty(ve,"getPluginIconURL",{enumerable:!0,get:()=>xr.getPluginIconURL}),Object.defineProperty(ve,"PluginGroup",{enumerable:!0,get:()=>fe.PluginGroup}),Object.defineProperty(ve,"PluginScope",{enumerable:!0,get:()=>fe.PluginScope}),ve.ArrayField=zt,ve.BooleanField=hn,ve.CommonForm=sp,ve.CustomPluginForm=Bj,ve.DynamicLayout=er,ve.EXPERIMENTAL_FREE_FORM_PROVIDER=Yd,ve.EntityTypeIdField=wo,ve.EnumField=Dt,ve.FEATURE_FLAGS=fr,ve.FIELD_PATH_KEY=wf,ve.FIELD_RENDERERS=So,ve.FIELD_RENDERER_SLOTS=Kl,ve.FIELD_RESET_LABEL_PATH_SETTING=kf,ve.FREE_FORM_SCHEMA_MAP_KEY=oi,ve.Field=it,ve.FieldRenderer=Rt,ve.FlowCanvas=pf,ve.ForeignField=$_,ve.Form=Zt,ve.JsonField=V_,ve.MapField=pr,ve.NodeBadge=ff,ve.NumberField=Ht,ve.ObjectField=Ut,ve.PluginCatalog=CU,ve.PluginConfigCard=RU,ve.PluginConfigurationForm=rw,ve.PluginFeaturedArray=Ml,ve.PluginForm=Qj,ve.PluginGroupArray=mf,ve.PluginGroupArraySortedAlphabetically=jl,ve.PluginList=lF,ve.PluginPartialType=Dl,ve.PluginSelect=VF,ve.PluginSelectCard=wp,ve.PluginSelectGrid=Ep,ve.StringArrayField=hi,ve.StringField=Xe,ve.SwitchField=O_,ve.TOASTER_PROVIDER=Ly,ve.buildAncestor=E_,ve.buildArraySchemaMap=Fa,ve.buildMapSchemaMap=Ua,ve.buildRecordSchemaMap=ja,ve.buildSchemaMap=N_,ve.defaultLabelFormatter=Gl,ve.generalizePath=pi,ve.pluginConfigRegistry=yp,ve.pluginEndpoints=tt,ve.provideEditorStore=uf,ve.provideFormShared=x_,ve.renderRuleExactMatch=ZT,ve.replaceByDictionary=Sf,ve.replaceByDictionaryInFieldName=xf,ve.useEditorStore=$t,ve.useField=Ft,ve.useFieldAncestors=bf,ve.useFieldAttrs=ln,ve.useFieldLabel=T_,ve.useFieldPath=Ef,ve.useFieldRenderer=v_,ve.useFormData=Nf,ve.useFormShared=pt,ve.useItemKeys=ql,ve.useLabelPath=B_,ve.useMapField=Hl,ve.useOptionalFormShared=A_,ve.usePluginMetaData=LU,ve.useProvideExperimentalFreeForms=DU,ve.useProvideFreeFormPluginLayout=JV,ve.useSchemaExposer=I_,ve.useSchemaHelpers=S_,Object.defineProperty(ve,Symbol.toStringTag,{value:"Module"})});