{"version":3,"file":"static/js/259.93313359.js","sources":["webpack://@jotforminc/inbox/../../../node_modules/.pnpm/sanitize-html@2.13.0/node_modules/sanitize-html/index.js","webpack://@jotforminc/inbox/../../../node_modules/.pnpm/sanitize-html@2.7.0/node_modules/sanitize-html/index.js","webpack://@jotforminc/inbox/../../../node_modules/.pnpm/@headlessui+react@1.5.0_react-dom@17.0.2_react@17.0.2__react@17.0.2/node_modules/@headlessui/react/dist/headlessui.esm.js","webpack://@jotforminc/inbox/../../../node_modules/.pnpm/@sentry+core@8.8.0/node_modules/@sentry/core/esm/tracing/logSpans.js","webpack://@jotforminc/inbox/../../../node_modules/.pnpm/@sentry-internal+browser-utils@8.8.0/node_modules/@sentry-internal/browser-utils/esm/metrics/instrument.js","webpack://@jotforminc/inbox/../../../node_modules/.pnpm/@sentry+core@8.8.0/node_modules/@sentry/core/esm/integrations/inboundfilters.js","webpack://@jotforminc/inbox/../../../node_modules/.pnpm/@sentry+core@8.8.0/node_modules/@sentry/core/esm/baseclient.js","webpack://@jotforminc/inbox/../../../node_modules/.pnpm/@sentry+utils@8.8.0/node_modules/@sentry/utils/esm/envelope.js","webpack://@jotforminc/inbox/../../../node_modules/.pnpm/@sentry+utils@8.8.0/node_modules/@sentry/utils/esm/instrument/handlers.js","webpack://@jotforminc/inbox/../../../node_modules/.pnpm/css-select@5.1.0/node_modules/css-select/lib/esm/pseudo-selectors/aliases.js"],"sourcesContent":["const htmlparser = require('htmlparser2');\nconst escapeStringRegexp = require('escape-string-regexp');\nconst { isPlainObject } = require('is-plain-object');\nconst deepmerge = require('deepmerge');\nconst parseSrcset = require('parse-srcset');\nconst { parse: postcssParse } = require('postcss');\n// Tags that can conceivably represent stand-alone media.\nconst mediaTags = [\n 'img', 'audio', 'video', 'picture', 'svg',\n 'object', 'map', 'iframe', 'embed'\n];\n// Tags that are inherently vulnerable to being used in XSS attacks.\nconst vulnerableTags = [ 'script', 'style' ];\n\nfunction each(obj, cb) {\n if (obj) {\n Object.keys(obj).forEach(function (key) {\n cb(obj[key], key);\n });\n }\n}\n\n// Avoid false positives with .__proto__, .hasOwnProperty, etc.\nfunction has(obj, key) {\n return ({}).hasOwnProperty.call(obj, key);\n}\n\n// Returns those elements of `a` for which `cb(a)` returns truthy\nfunction filter(a, cb) {\n const n = [];\n each(a, function(v) {\n if (cb(v)) {\n n.push(v);\n }\n });\n return n;\n}\n\nfunction isEmptyObject(obj) {\n for (const key in obj) {\n if (has(obj, key)) {\n return false;\n }\n }\n return true;\n}\n\nfunction stringifySrcset(parsedSrcset) {\n return parsedSrcset.map(function(part) {\n if (!part.url) {\n throw new Error('URL missing');\n }\n\n return (\n part.url +\n (part.w ? ` ${part.w}w` : '') +\n (part.h ? ` ${part.h}h` : '') +\n (part.d ? ` ${part.d}x` : '')\n );\n }).join(', ');\n}\n\nmodule.exports = sanitizeHtml;\n\n// A valid attribute name.\n// We use a tolerant definition based on the set of strings defined by\n// html.spec.whatwg.org/multipage/parsing.html#before-attribute-name-state\n// and html.spec.whatwg.org/multipage/parsing.html#attribute-name-state .\n// The characters accepted are ones which can be appended to the attribute\n// name buffer without triggering a parse error:\n// * unexpected-equals-sign-before-attribute-name\n// * unexpected-null-character\n// * unexpected-character-in-attribute-name\n// We exclude the empty string because it's impossible to get to the after\n// attribute name state with an empty attribute name buffer.\nconst VALID_HTML_ATTRIBUTE_NAME = /^[^\\0\\t\\n\\f\\r /<=>]+$/;\n\n// Ignore the _recursing flag; it's there for recursive\n// invocation as a guard against this exploit:\n// https://github.com/fb55/htmlparser2/issues/105\n\nfunction sanitizeHtml(html, options, _recursing) {\n if (html == null) {\n return '';\n }\n if (typeof html === 'number') {\n html = html.toString();\n }\n\n let result = '';\n // Used for hot swapping the result variable with an empty string in order to \"capture\" the text written to it.\n let tempResult = '';\n\n function Frame(tag, attribs) {\n const that = this;\n this.tag = tag;\n this.attribs = attribs || {};\n this.tagPosition = result.length;\n this.text = ''; // Node inner text\n this.mediaChildren = [];\n\n this.updateParentNodeText = function() {\n if (stack.length) {\n const parentFrame = stack[stack.length - 1];\n parentFrame.text += that.text;\n }\n };\n\n this.updateParentNodeMediaChildren = function() {\n if (stack.length && mediaTags.includes(this.tag)) {\n const parentFrame = stack[stack.length - 1];\n parentFrame.mediaChildren.push(this.tag);\n }\n };\n }\n\n options = Object.assign({}, sanitizeHtml.defaults, options);\n options.parser = Object.assign({}, htmlParserDefaults, options.parser);\n\n const tagAllowed = function (name) {\n return options.allowedTags === false || (options.allowedTags || []).indexOf(name) > -1;\n };\n\n // vulnerableTags\n vulnerableTags.forEach(function (tag) {\n if (tagAllowed(tag) && !options.allowVulnerableTags) {\n console.warn(`\\n\\n⚠️ Your \\`allowedTags\\` option includes, \\`${tag}\\`, which is inherently\\nvulnerable to XSS attacks. Please remove it from \\`allowedTags\\`.\\nOr, to disable this warning, add the \\`allowVulnerableTags\\` option\\nand ensure you are accounting for this risk.\\n\\n`);\n }\n });\n\n // Tags that contain something other than HTML, or where discarding\n // the text when the tag is disallowed makes sense for other reasons.\n // If we are not allowing these tags, we should drop their content too.\n // For other tags you would drop the tag but keep its content.\n const nonTextTagsArray = options.nonTextTags || [\n 'script',\n 'style',\n 'textarea',\n 'option'\n ];\n let allowedAttributesMap;\n let allowedAttributesGlobMap;\n if (options.allowedAttributes) {\n allowedAttributesMap = {};\n allowedAttributesGlobMap = {};\n each(options.allowedAttributes, function(attributes, tag) {\n allowedAttributesMap[tag] = [];\n const globRegex = [];\n attributes.forEach(function(obj) {\n if (typeof obj === 'string' && obj.indexOf('*') >= 0) {\n globRegex.push(escapeStringRegexp(obj).replace(/\\\\\\*/g, '.*'));\n } else {\n allowedAttributesMap[tag].push(obj);\n }\n });\n if (globRegex.length) {\n allowedAttributesGlobMap[tag] = new RegExp('^(' + globRegex.join('|') + ')$');\n }\n });\n }\n const allowedClassesMap = {};\n const allowedClassesGlobMap = {};\n const allowedClassesRegexMap = {};\n each(options.allowedClasses, function(classes, tag) {\n // Implicitly allows the class attribute\n if (allowedAttributesMap) {\n if (!has(allowedAttributesMap, tag)) {\n allowedAttributesMap[tag] = [];\n }\n allowedAttributesMap[tag].push('class');\n }\n\n allowedClassesMap[tag] = classes;\n\n if (Array.isArray(classes)) {\n const globRegex = [];\n allowedClassesMap[tag] = [];\n allowedClassesRegexMap[tag] = [];\n classes.forEach(function(obj) {\n if (typeof obj === 'string' && obj.indexOf('*') >= 0) {\n globRegex.push(escapeStringRegexp(obj).replace(/\\\\\\*/g, '.*'));\n } else if (obj instanceof RegExp) {\n allowedClassesRegexMap[tag].push(obj);\n } else {\n allowedClassesMap[tag].push(obj);\n }\n });\n if (globRegex.length) {\n allowedClassesGlobMap[tag] = new RegExp('^(' + globRegex.join('|') + ')$');\n }\n }\n });\n\n const transformTagsMap = {};\n let transformTagsAll;\n each(options.transformTags, function(transform, tag) {\n let transFun;\n if (typeof transform === 'function') {\n transFun = transform;\n } else if (typeof transform === 'string') {\n transFun = sanitizeHtml.simpleTransform(transform);\n }\n if (tag === '*') {\n transformTagsAll = transFun;\n } else {\n transformTagsMap[tag] = transFun;\n }\n });\n\n let depth;\n let stack;\n let skipMap;\n let transformMap;\n let skipText;\n let skipTextDepth;\n let addedText = false;\n\n initializeState();\n\n const parser = new htmlparser.Parser({\n onopentag: function(name, attribs) {\n // If `enforceHtmlBoundary` is `true` and this has found the opening\n // `html` tag, reset the state.\n if (options.enforceHtmlBoundary && name === 'html') {\n initializeState();\n }\n\n if (skipText) {\n skipTextDepth++;\n return;\n }\n const frame = new Frame(name, attribs);\n stack.push(frame);\n\n let skip = false;\n const hasText = !!frame.text;\n let transformedTag;\n if (has(transformTagsMap, name)) {\n transformedTag = transformTagsMap[name](name, attribs);\n\n frame.attribs = attribs = transformedTag.attribs;\n\n if (transformedTag.text !== undefined) {\n frame.innerText = transformedTag.text;\n }\n\n if (name !== transformedTag.tagName) {\n frame.name = name = transformedTag.tagName;\n transformMap[depth] = transformedTag.tagName;\n }\n }\n if (transformTagsAll) {\n transformedTag = transformTagsAll(name, attribs);\n\n frame.attribs = attribs = transformedTag.attribs;\n if (name !== transformedTag.tagName) {\n frame.name = name = transformedTag.tagName;\n transformMap[depth] = transformedTag.tagName;\n }\n }\n\n if (!tagAllowed(name) || (options.disallowedTagsMode === 'recursiveEscape' && !isEmptyObject(skipMap)) || (options.nestingLimit != null && depth >= options.nestingLimit)) {\n skip = true;\n skipMap[depth] = true;\n if (options.disallowedTagsMode === 'discard' || options.disallowedTagsMode === 'completelyDiscard') {\n if (nonTextTagsArray.indexOf(name) !== -1) {\n skipText = true;\n skipTextDepth = 1;\n }\n }\n skipMap[depth] = true;\n }\n depth++;\n if (skip) {\n if (options.disallowedTagsMode === 'discard' || options.disallowedTagsMode === 'completelyDiscard') {\n // We want the contents but not this tag\n return;\n }\n tempResult = result;\n result = '';\n }\n result += '<' + name;\n\n if (name === 'script') {\n if (options.allowedScriptHostnames || options.allowedScriptDomains) {\n frame.innerText = '';\n }\n }\n\n if (!allowedAttributesMap || has(allowedAttributesMap, name) || allowedAttributesMap['*']) {\n each(attribs, function(value, a) {\n if (!VALID_HTML_ATTRIBUTE_NAME.test(a)) {\n // This prevents part of an attribute name in the output from being\n // interpreted as the end of an attribute, or end of a tag.\n delete frame.attribs[a];\n return;\n }\n // If the value is empty, check if the attribute is in the allowedEmptyAttributes array.\n // If it is not in the allowedEmptyAttributes array, and it is a known non-boolean attribute, delete it\n // List taken from https://html.spec.whatwg.org/multipage/indices.html#attributes-3\n if (value === '' && (!options.allowedEmptyAttributes.includes(a)) &&\n (options.nonBooleanAttributes.includes(a) || options.nonBooleanAttributes.includes('*'))) {\n delete frame.attribs[a];\n return;\n }\n // check allowedAttributesMap for the element and attribute and modify the value\n // as necessary if there are specific values defined.\n let passedAllowedAttributesMapCheck = false;\n if (!allowedAttributesMap ||\n (has(allowedAttributesMap, name) && allowedAttributesMap[name].indexOf(a) !== -1) ||\n (allowedAttributesMap['*'] && allowedAttributesMap['*'].indexOf(a) !== -1) ||\n (has(allowedAttributesGlobMap, name) && allowedAttributesGlobMap[name].test(a)) ||\n (allowedAttributesGlobMap['*'] && allowedAttributesGlobMap['*'].test(a))) {\n passedAllowedAttributesMapCheck = true;\n } else if (allowedAttributesMap && allowedAttributesMap[name]) {\n for (const o of allowedAttributesMap[name]) {\n if (isPlainObject(o) && o.name && (o.name === a)) {\n passedAllowedAttributesMapCheck = true;\n let newValue = '';\n if (o.multiple === true) {\n // verify the values that are allowed\n const splitStrArray = value.split(' ');\n for (const s of splitStrArray) {\n if (o.values.indexOf(s) !== -1) {\n if (newValue === '') {\n newValue = s;\n } else {\n newValue += ' ' + s;\n }\n }\n }\n } else if (o.values.indexOf(value) >= 0) {\n // verified an allowed value matches the entire attribute value\n newValue = value;\n }\n value = newValue;\n }\n }\n }\n if (passedAllowedAttributesMapCheck) {\n if (options.allowedSchemesAppliedToAttributes.indexOf(a) !== -1) {\n if (naughtyHref(name, value)) {\n delete frame.attribs[a];\n return;\n }\n }\n\n if (name === 'script' && a === 'src') {\n\n let allowed = true;\n\n try {\n const parsed = parseUrl(value);\n\n if (options.allowedScriptHostnames || options.allowedScriptDomains) {\n const allowedHostname = (options.allowedScriptHostnames || []).find(function (hostname) {\n return hostname === parsed.url.hostname;\n });\n const allowedDomain = (options.allowedScriptDomains || []).find(function(domain) {\n return parsed.url.hostname === domain || parsed.url.hostname.endsWith(`.${domain}`);\n });\n allowed = allowedHostname || allowedDomain;\n }\n } catch (e) {\n allowed = false;\n }\n\n if (!allowed) {\n delete frame.attribs[a];\n return;\n }\n }\n\n if (name === 'iframe' && a === 'src') {\n let allowed = true;\n try {\n const parsed = parseUrl(value);\n\n if (parsed.isRelativeUrl) {\n // default value of allowIframeRelativeUrls is true\n // unless allowedIframeHostnames or allowedIframeDomains specified\n allowed = has(options, 'allowIframeRelativeUrls')\n ? options.allowIframeRelativeUrls\n : (!options.allowedIframeHostnames && !options.allowedIframeDomains);\n } else if (options.allowedIframeHostnames || options.allowedIframeDomains) {\n const allowedHostname = (options.allowedIframeHostnames || []).find(function (hostname) {\n return hostname === parsed.url.hostname;\n });\n const allowedDomain = (options.allowedIframeDomains || []).find(function(domain) {\n return parsed.url.hostname === domain || parsed.url.hostname.endsWith(`.${domain}`);\n });\n allowed = allowedHostname || allowedDomain;\n }\n } catch (e) {\n // Unparseable iframe src\n allowed = false;\n }\n if (!allowed) {\n delete frame.attribs[a];\n return;\n }\n }\n if (a === 'srcset') {\n try {\n let parsed = parseSrcset(value);\n parsed.forEach(function(value) {\n if (naughtyHref('srcset', value.url)) {\n value.evil = true;\n }\n });\n parsed = filter(parsed, function(v) {\n return !v.evil;\n });\n if (!parsed.length) {\n delete frame.attribs[a];\n return;\n } else {\n value = stringifySrcset(filter(parsed, function(v) {\n return !v.evil;\n }));\n frame.attribs[a] = value;\n }\n } catch (e) {\n // Unparseable srcset\n delete frame.attribs[a];\n return;\n }\n }\n if (a === 'class') {\n const allowedSpecificClasses = allowedClassesMap[name];\n const allowedWildcardClasses = allowedClassesMap['*'];\n const allowedSpecificClassesGlob = allowedClassesGlobMap[name];\n const allowedSpecificClassesRegex = allowedClassesRegexMap[name];\n const allowedWildcardClassesGlob = allowedClassesGlobMap['*'];\n const allowedClassesGlobs = [\n allowedSpecificClassesGlob,\n allowedWildcardClassesGlob\n ]\n .concat(allowedSpecificClassesRegex)\n .filter(function (t) {\n return t;\n });\n if (allowedSpecificClasses && allowedWildcardClasses) {\n value = filterClasses(value, deepmerge(allowedSpecificClasses, allowedWildcardClasses), allowedClassesGlobs);\n } else {\n value = filterClasses(value, allowedSpecificClasses || allowedWildcardClasses, allowedClassesGlobs);\n }\n if (!value.length) {\n delete frame.attribs[a];\n return;\n }\n }\n if (a === 'style') {\n if (options.parseStyleAttributes) {\n try {\n const abstractSyntaxTree = postcssParse(name + ' {' + value + '}', { map: false });\n const filteredAST = filterCss(abstractSyntaxTree, options.allowedStyles);\n\n value = stringifyStyleAttributes(filteredAST);\n\n if (value.length === 0) {\n delete frame.attribs[a];\n return;\n }\n } catch (e) {\n if (typeof window !== 'undefined') {\n console.warn('Failed to parse \"' + name + ' {' + value + '}' + '\", If you\\'re running this in a browser, we recommend to disable style parsing: options.parseStyleAttributes: false, since this only works in a node environment due to a postcss dependency, More info: https://github.com/apostrophecms/sanitize-html/issues/547');\n }\n delete frame.attribs[a];\n return;\n }\n } else if (options.allowedStyles) {\n throw new Error('allowedStyles option cannot be used together with parseStyleAttributes: false.');\n }\n }\n result += ' ' + a;\n if (value && value.length) {\n result += '=\"' + escapeHtml(value, true) + '\"';\n } else if (options.allowedEmptyAttributes.includes(a)) {\n result += '=\"\"';\n }\n } else {\n delete frame.attribs[a];\n }\n });\n }\n if (options.selfClosing.indexOf(name) !== -1) {\n result += ' />';\n } else {\n result += '>';\n if (frame.innerText && !hasText && !options.textFilter) {\n result += escapeHtml(frame.innerText);\n addedText = true;\n }\n }\n if (skip) {\n result = tempResult + escapeHtml(result);\n tempResult = '';\n }\n },\n ontext: function(text) {\n if (skipText) {\n return;\n }\n const lastFrame = stack[stack.length - 1];\n let tag;\n\n if (lastFrame) {\n tag = lastFrame.tag;\n // If inner text was set by transform function then let's use it\n text = lastFrame.innerText !== undefined ? lastFrame.innerText : text;\n }\n\n if (options.disallowedTagsMode === 'completelyDiscard' && !tagAllowed(tag)) {\n text = '';\n } else if ((options.disallowedTagsMode === 'discard' || options.disallowedTagsMode === 'completelyDiscard') && ((tag === 'script') || (tag === 'style'))) {\n // htmlparser2 gives us these as-is. Escaping them ruins the content. Allowing\n // script tags is, by definition, game over for XSS protection, so if that's\n // your concern, don't allow them. The same is essentially true for style tags\n // which have their own collection of XSS vectors.\n result += text;\n } else {\n const escaped = escapeHtml(text, false);\n if (options.textFilter && !addedText) {\n result += options.textFilter(escaped, tag);\n } else if (!addedText) {\n result += escaped;\n }\n }\n if (stack.length) {\n const frame = stack[stack.length - 1];\n frame.text += text;\n }\n },\n onclosetag: function(name, isImplied) {\n\n if (skipText) {\n skipTextDepth--;\n if (!skipTextDepth) {\n skipText = false;\n } else {\n return;\n }\n }\n\n const frame = stack.pop();\n if (!frame) {\n // Do not crash on bad markup\n return;\n }\n\n if (frame.tag !== name) {\n // Another case of bad markup.\n // Push to stack, so that it will be used in future closing tags.\n stack.push(frame);\n return;\n }\n\n skipText = options.enforceHtmlBoundary ? name === 'html' : false;\n depth--;\n const skip = skipMap[depth];\n if (skip) {\n delete skipMap[depth];\n if (options.disallowedTagsMode === 'discard' || options.disallowedTagsMode === 'completelyDiscard') {\n frame.updateParentNodeText();\n return;\n }\n tempResult = result;\n result = '';\n }\n\n if (transformMap[depth]) {\n name = transformMap[depth];\n delete transformMap[depth];\n }\n\n if (options.exclusiveFilter && options.exclusiveFilter(frame)) {\n result = result.substr(0, frame.tagPosition);\n return;\n }\n\n frame.updateParentNodeMediaChildren();\n frame.updateParentNodeText();\n\n if (\n // Already output />\n options.selfClosing.indexOf(name) !== -1 ||\n // Escaped tag, closing tag is implied\n (isImplied && !tagAllowed(name) && [ 'escape', 'recursiveEscape' ].indexOf(options.disallowedTagsMode) >= 0)\n ) {\n if (skip) {\n result = tempResult;\n tempResult = '';\n }\n return;\n }\n\n result += '';\n if (skip) {\n result = tempResult + escapeHtml(result);\n tempResult = '';\n }\n addedText = false;\n }\n }, options.parser);\n parser.write(html);\n parser.end();\n\n return result;\n\n function initializeState() {\n result = '';\n depth = 0;\n stack = [];\n skipMap = {};\n transformMap = {};\n skipText = false;\n skipTextDepth = 0;\n }\n\n function escapeHtml(s, quote) {\n if (typeof (s) !== 'string') {\n s = s + '';\n }\n if (options.parser.decodeEntities) {\n s = s.replace(/&/g, '&').replace(//g, '>');\n if (quote) {\n s = s.replace(/\"/g, '"');\n }\n }\n // TODO: this is inadequate because it will pass `&0;`. This approach\n // will not work, each & must be considered with regard to whether it\n // is followed by a 100% syntactically valid entity or not, and escaped\n // if it is not. If this bothers you, don't set parser.decodeEntities\n // to false. (The default is true.)\n s = s.replace(/&(?![a-zA-Z0-9#]{1,20};)/g, '&') // Match ampersands not part of existing HTML entity\n .replace(//g, '>');\n if (quote) {\n s = s.replace(/\"/g, '"');\n }\n return s;\n }\n\n function naughtyHref(name, href) {\n // Browsers ignore character codes of 32 (space) and below in a surprising\n // number of situations. Start reading here:\n // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet#Embedded_tab\n // eslint-disable-next-line no-control-regex\n href = href.replace(/[\\x00-\\x20]+/g, '');\n // Clobber any comments in URLs, which the browser might\n // interpret inside an XML data island, allowing\n // a javascript: URL to be snuck through\n while (true) {\n const firstIndex = href.indexOf('', firstIndex + 4);\n if (lastIndex === -1) {\n break;\n }\n href = href.substring(0, firstIndex) + href.substring(lastIndex + 3);\n }\n // Case insensitive so we don't get faked out by JAVASCRIPT #1\n // Allow more characters after the first so we don't get faked\n // out by certain schemes browsers accept\n const matches = href.match(/^([a-zA-Z][a-zA-Z0-9.\\-+]*):/);\n if (!matches) {\n // Protocol-relative URL starting with any combination of '/' and '\\'\n if (href.match(/^[/\\\\]{2}/)) {\n return !options.allowProtocolRelative;\n }\n\n // No scheme\n return false;\n }\n const scheme = matches[1].toLowerCase();\n\n if (has(options.allowedSchemesByTag, name)) {\n return options.allowedSchemesByTag[name].indexOf(scheme) === -1;\n }\n\n return !options.allowedSchemes || options.allowedSchemes.indexOf(scheme) === -1;\n }\n\n function parseUrl(value) {\n value = value.replace(/^(\\w+:)?\\s*[\\\\/]\\s*[\\\\/]/, '$1//');\n if (value.startsWith('relative:')) {\n // An attempt to exploit our workaround for base URLs being\n // mandatory for relative URL validation in the WHATWG\n // URL parser, reject it\n throw new Error('relative: exploit attempt');\n }\n // naughtyHref is in charge of whether protocol relative URLs\n // are cool. Here we are concerned just with allowed hostnames and\n // whether to allow relative URLs.\n //\n // Build a placeholder \"base URL\" against which any reasonable\n // relative URL may be parsed successfully\n let base = 'relative://relative-site';\n for (let i = 0; (i < 100); i++) {\n base += `/${i}`;\n }\n\n const parsed = new URL(value, base);\n\n const isRelativeUrl = parsed && parsed.hostname === 'relative-site' && parsed.protocol === 'relative:';\n return {\n isRelativeUrl,\n url: parsed\n };\n }\n /**\n * Filters user input css properties by allowlisted regex attributes.\n * Modifies the abstractSyntaxTree object.\n *\n * @param {object} abstractSyntaxTree - Object representation of CSS attributes.\n * @property {array[Declaration]} abstractSyntaxTree.nodes[0] - Each object cointains prop and value key, i.e { prop: 'color', value: 'red' }.\n * @param {object} allowedStyles - Keys are properties (i.e color), value is list of permitted regex rules (i.e /green/i).\n * @return {object} - The modified tree.\n */\n function filterCss(abstractSyntaxTree, allowedStyles) {\n if (!allowedStyles) {\n return abstractSyntaxTree;\n }\n\n const astRules = abstractSyntaxTree.nodes[0];\n let selectedRule;\n\n // Merge global and tag-specific styles into new AST.\n if (allowedStyles[astRules.selector] && allowedStyles['*']) {\n selectedRule = deepmerge(\n allowedStyles[astRules.selector],\n allowedStyles['*']\n );\n } else {\n selectedRule = allowedStyles[astRules.selector] || allowedStyles['*'];\n }\n\n if (selectedRule) {\n abstractSyntaxTree.nodes[0].nodes = astRules.nodes.reduce(filterDeclarations(selectedRule), []);\n }\n\n return abstractSyntaxTree;\n }\n\n /**\n * Extracts the style attributes from an AbstractSyntaxTree and formats those\n * values in the inline style attribute format.\n *\n * @param {AbstractSyntaxTree} filteredAST\n * @return {string} - Example: \"color:yellow;text-align:center !important;font-family:helvetica;\"\n */\n function stringifyStyleAttributes(filteredAST) {\n return filteredAST.nodes[0].nodes\n .reduce(function(extractedAttributes, attrObject) {\n extractedAttributes.push(\n `${attrObject.prop}:${attrObject.value}${attrObject.important ? ' !important' : ''}`\n );\n return extractedAttributes;\n }, [])\n .join(';');\n }\n\n /**\n * Filters the existing attributes for the given property. Discards any attributes\n * which don't match the allowlist.\n *\n * @param {object} selectedRule - Example: { color: red, font-family: helvetica }\n * @param {array} allowedDeclarationsList - List of declarations which pass the allowlist.\n * @param {object} attributeObject - Object representing the current css property.\n * @property {string} attributeObject.type - Typically 'declaration'.\n * @property {string} attributeObject.prop - The CSS property, i.e 'color'.\n * @property {string} attributeObject.value - The corresponding value to the css property, i.e 'red'.\n * @return {function} - When used in Array.reduce, will return an array of Declaration objects\n */\n function filterDeclarations(selectedRule) {\n return function (allowedDeclarationsList, attributeObject) {\n // If this property is allowlisted...\n if (has(selectedRule, attributeObject.prop)) {\n const matchesRegex = selectedRule[attributeObject.prop].some(function(regularExpression) {\n return regularExpression.test(attributeObject.value);\n });\n\n if (matchesRegex) {\n allowedDeclarationsList.push(attributeObject);\n }\n }\n return allowedDeclarationsList;\n };\n }\n\n function filterClasses(classes, allowed, allowedGlobs) {\n if (!allowed) {\n // The class attribute is allowed without filtering on this tag\n return classes;\n }\n classes = classes.split(/\\s+/);\n return classes.filter(function(clss) {\n return allowed.indexOf(clss) !== -1 || allowedGlobs.some(function(glob) {\n return glob.test(clss);\n });\n }).join(' ');\n }\n}\n\n// Defaults are accessible to you so that you can use them as a starting point\n// programmatically if you wish\n\nconst htmlParserDefaults = {\n decodeEntities: true\n};\nsanitizeHtml.defaults = {\n allowedTags: [\n // Sections derived from MDN element categories and limited to the more\n // benign categories.\n // https://developer.mozilla.org/en-US/docs/Web/HTML/Element\n // Content sectioning\n 'address', 'article', 'aside', 'footer', 'header',\n 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hgroup',\n 'main', 'nav', 'section',\n // Text content\n 'blockquote', 'dd', 'div', 'dl', 'dt', 'figcaption', 'figure',\n 'hr', 'li', 'main', 'ol', 'p', 'pre', 'ul',\n // Inline text semantics\n 'a', 'abbr', 'b', 'bdi', 'bdo', 'br', 'cite', 'code', 'data', 'dfn',\n 'em', 'i', 'kbd', 'mark', 'q',\n 'rb', 'rp', 'rt', 'rtc', 'ruby',\n 's', 'samp', 'small', 'span', 'strong', 'sub', 'sup', 'time', 'u', 'var', 'wbr',\n // Table content\n 'caption', 'col', 'colgroup', 'table', 'tbody', 'td', 'tfoot', 'th',\n 'thead', 'tr'\n ],\n // Tags that cannot be boolean\n nonBooleanAttributes: [\n 'abbr', 'accept', 'accept-charset', 'accesskey', 'action',\n 'allow', 'alt', 'as', 'autocapitalize', 'autocomplete',\n 'blocking', 'charset', 'cite', 'class', 'color', 'cols',\n 'colspan', 'content', 'contenteditable', 'coords', 'crossorigin',\n 'data', 'datetime', 'decoding', 'dir', 'dirname', 'download',\n 'draggable', 'enctype', 'enterkeyhint', 'fetchpriority', 'for',\n 'form', 'formaction', 'formenctype', 'formmethod', 'formtarget',\n 'headers', 'height', 'hidden', 'high', 'href', 'hreflang',\n 'http-equiv', 'id', 'imagesizes', 'imagesrcset', 'inputmode',\n 'integrity', 'is', 'itemid', 'itemprop', 'itemref', 'itemtype',\n 'kind', 'label', 'lang', 'list', 'loading', 'low', 'max',\n 'maxlength', 'media', 'method', 'min', 'minlength', 'name',\n 'nonce', 'optimum', 'pattern', 'ping', 'placeholder', 'popover',\n 'popovertarget', 'popovertargetaction', 'poster', 'preload',\n 'referrerpolicy', 'rel', 'rows', 'rowspan', 'sandbox', 'scope',\n 'shape', 'size', 'sizes', 'slot', 'span', 'spellcheck', 'src',\n 'srcdoc', 'srclang', 'srcset', 'start', 'step', 'style',\n 'tabindex', 'target', 'title', 'translate', 'type', 'usemap',\n 'value', 'width', 'wrap',\n // Event handlers\n 'onauxclick', 'onafterprint', 'onbeforematch', 'onbeforeprint',\n 'onbeforeunload', 'onbeforetoggle', 'onblur', 'oncancel',\n 'oncanplay', 'oncanplaythrough', 'onchange', 'onclick', 'onclose',\n 'oncontextlost', 'oncontextmenu', 'oncontextrestored', 'oncopy',\n 'oncuechange', 'oncut', 'ondblclick', 'ondrag', 'ondragend',\n 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart',\n 'ondrop', 'ondurationchange', 'onemptied', 'onended',\n 'onerror', 'onfocus', 'onformdata', 'onhashchange', 'oninput',\n 'oninvalid', 'onkeydown', 'onkeypress', 'onkeyup',\n 'onlanguagechange', 'onload', 'onloadeddata', 'onloadedmetadata',\n 'onloadstart', 'onmessage', 'onmessageerror', 'onmousedown',\n 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmouseout',\n 'onmouseover', 'onmouseup', 'onoffline', 'ononline', 'onpagehide',\n 'onpageshow', 'onpaste', 'onpause', 'onplay', 'onplaying',\n 'onpopstate', 'onprogress', 'onratechange', 'onreset', 'onresize',\n 'onrejectionhandled', 'onscroll', 'onscrollend',\n 'onsecuritypolicyviolation', 'onseeked', 'onseeking', 'onselect',\n 'onslotchange', 'onstalled', 'onstorage', 'onsubmit', 'onsuspend',\n 'ontimeupdate', 'ontoggle', 'onunhandledrejection', 'onunload',\n 'onvolumechange', 'onwaiting', 'onwheel'\n ],\n disallowedTagsMode: 'discard',\n allowedAttributes: {\n a: [ 'href', 'name', 'target' ],\n // We don't currently allow img itself by default, but\n // these attributes would make sense if we did.\n img: [ 'src', 'srcset', 'alt', 'title', 'width', 'height', 'loading' ]\n },\n allowedEmptyAttributes: [\n 'alt'\n ],\n // Lots of these won't come up by default because we don't allow them\n selfClosing: [ 'img', 'br', 'hr', 'area', 'base', 'basefont', 'input', 'link', 'meta' ],\n // URL schemes we permit\n allowedSchemes: [ 'http', 'https', 'ftp', 'mailto', 'tel' ],\n allowedSchemesByTag: {},\n allowedSchemesAppliedToAttributes: [ 'href', 'src', 'cite' ],\n allowProtocolRelative: true,\n enforceHtmlBoundary: false,\n parseStyleAttributes: true\n};\n\nsanitizeHtml.simpleTransform = function(newTagName, newAttribs, merge) {\n merge = (merge === undefined) ? true : merge;\n newAttribs = newAttribs || {};\n\n return function(tagName, attribs) {\n let attrib;\n if (merge) {\n for (attrib in newAttribs) {\n attribs[attrib] = newAttribs[attrib];\n }\n } else {\n attribs = newAttribs;\n }\n\n return {\n tagName: newTagName,\n attribs: attribs\n };\n };\n};\n","const htmlparser = require('htmlparser2');\nconst escapeStringRegexp = require('escape-string-regexp');\nconst { isPlainObject } = require('is-plain-object');\nconst deepmerge = require('deepmerge');\nconst parseSrcset = require('parse-srcset');\nconst { parse: postcssParse } = require('postcss');\n// Tags that can conceivably represent stand-alone media.\nconst mediaTags = [\n 'img', 'audio', 'video', 'picture', 'svg',\n 'object', 'map', 'iframe', 'embed'\n];\n// Tags that are inherently vulnerable to being used in XSS attacks.\nconst vulnerableTags = [ 'script', 'style' ];\n\nfunction each(obj, cb) {\n if (obj) {\n Object.keys(obj).forEach(function (key) {\n cb(obj[key], key);\n });\n }\n}\n\n// Avoid false positives with .__proto__, .hasOwnProperty, etc.\nfunction has(obj, key) {\n return ({}).hasOwnProperty.call(obj, key);\n}\n\n// Returns those elements of `a` for which `cb(a)` returns truthy\nfunction filter(a, cb) {\n const n = [];\n each(a, function(v) {\n if (cb(v)) {\n n.push(v);\n }\n });\n return n;\n}\n\nfunction isEmptyObject(obj) {\n for (const key in obj) {\n if (has(obj, key)) {\n return false;\n }\n }\n return true;\n}\n\nfunction stringifySrcset(parsedSrcset) {\n return parsedSrcset.map(function(part) {\n if (!part.url) {\n throw new Error('URL missing');\n }\n\n return (\n part.url +\n (part.w ? ` ${part.w}w` : '') +\n (part.h ? ` ${part.h}h` : '') +\n (part.d ? ` ${part.d}x` : '')\n );\n }).join(', ');\n}\n\nmodule.exports = sanitizeHtml;\n\n// A valid attribute name.\n// We use a tolerant definition based on the set of strings defined by\n// html.spec.whatwg.org/multipage/parsing.html#before-attribute-name-state\n// and html.spec.whatwg.org/multipage/parsing.html#attribute-name-state .\n// The characters accepted are ones which can be appended to the attribute\n// name buffer without triggering a parse error:\n// * unexpected-equals-sign-before-attribute-name\n// * unexpected-null-character\n// * unexpected-character-in-attribute-name\n// We exclude the empty string because it's impossible to get to the after\n// attribute name state with an empty attribute name buffer.\nconst VALID_HTML_ATTRIBUTE_NAME = /^[^\\0\\t\\n\\f\\r /<=>]+$/;\n\n// Ignore the _recursing flag; it's there for recursive\n// invocation as a guard against this exploit:\n// https://github.com/fb55/htmlparser2/issues/105\n\nfunction sanitizeHtml(html, options, _recursing) {\n if (html == null) {\n return '';\n }\n\n let result = '';\n // Used for hot swapping the result variable with an empty string in order to \"capture\" the text written to it.\n let tempResult = '';\n\n function Frame(tag, attribs) {\n const that = this;\n this.tag = tag;\n this.attribs = attribs || {};\n this.tagPosition = result.length;\n this.text = ''; // Node inner text\n this.mediaChildren = [];\n\n this.updateParentNodeText = function() {\n if (stack.length) {\n const parentFrame = stack[stack.length - 1];\n parentFrame.text += that.text;\n }\n };\n\n this.updateParentNodeMediaChildren = function() {\n if (stack.length && mediaTags.includes(this.tag)) {\n const parentFrame = stack[stack.length - 1];\n parentFrame.mediaChildren.push(this.tag);\n }\n };\n }\n\n options = Object.assign({}, sanitizeHtml.defaults, options);\n options.parser = Object.assign({}, htmlParserDefaults, options.parser);\n\n // vulnerableTags\n vulnerableTags.forEach(function (tag) {\n if (\n options.allowedTags && options.allowedTags.indexOf(tag) > -1 &&\n !options.allowVulnerableTags\n ) {\n console.warn(`\\n\\n⚠️ Your \\`allowedTags\\` option includes, \\`${tag}\\`, which is inherently\\nvulnerable to XSS attacks. Please remove it from \\`allowedTags\\`.\\nOr, to disable this warning, add the \\`allowVulnerableTags\\` option\\nand ensure you are accounting for this risk.\\n\\n`);\n }\n });\n\n // Tags that contain something other than HTML, or where discarding\n // the text when the tag is disallowed makes sense for other reasons.\n // If we are not allowing these tags, we should drop their content too.\n // For other tags you would drop the tag but keep its content.\n const nonTextTagsArray = options.nonTextTags || [\n 'script',\n 'style',\n 'textarea',\n 'option'\n ];\n let allowedAttributesMap;\n let allowedAttributesGlobMap;\n if (options.allowedAttributes) {\n allowedAttributesMap = {};\n allowedAttributesGlobMap = {};\n each(options.allowedAttributes, function(attributes, tag) {\n allowedAttributesMap[tag] = [];\n const globRegex = [];\n attributes.forEach(function(obj) {\n if (typeof obj === 'string' && obj.indexOf('*') >= 0) {\n globRegex.push(escapeStringRegexp(obj).replace(/\\\\\\*/g, '.*'));\n } else {\n allowedAttributesMap[tag].push(obj);\n }\n });\n if (globRegex.length) {\n allowedAttributesGlobMap[tag] = new RegExp('^(' + globRegex.join('|') + ')$');\n }\n });\n }\n const allowedClassesMap = {};\n const allowedClassesGlobMap = {};\n const allowedClassesRegexMap = {};\n each(options.allowedClasses, function(classes, tag) {\n // Implicitly allows the class attribute\n if (allowedAttributesMap) {\n if (!has(allowedAttributesMap, tag)) {\n allowedAttributesMap[tag] = [];\n }\n allowedAttributesMap[tag].push('class');\n }\n\n allowedClassesMap[tag] = [];\n allowedClassesRegexMap[tag] = [];\n const globRegex = [];\n classes.forEach(function(obj) {\n if (typeof obj === 'string' && obj.indexOf('*') >= 0) {\n globRegex.push(escapeStringRegexp(obj).replace(/\\\\\\*/g, '.*'));\n } else if (obj instanceof RegExp) {\n allowedClassesRegexMap[tag].push(obj);\n } else {\n allowedClassesMap[tag].push(obj);\n }\n });\n if (globRegex.length) {\n allowedClassesGlobMap[tag] = new RegExp('^(' + globRegex.join('|') + ')$');\n }\n });\n\n const transformTagsMap = {};\n let transformTagsAll;\n each(options.transformTags, function(transform, tag) {\n let transFun;\n if (typeof transform === 'function') {\n transFun = transform;\n } else if (typeof transform === 'string') {\n transFun = sanitizeHtml.simpleTransform(transform);\n }\n if (tag === '*') {\n transformTagsAll = transFun;\n } else {\n transformTagsMap[tag] = transFun;\n }\n });\n\n let depth;\n let stack;\n let skipMap;\n let transformMap;\n let skipText;\n let skipTextDepth;\n let addedText = false;\n\n initializeState();\n\n const parser = new htmlparser.Parser({\n onopentag: function(name, attribs) {\n // If `enforceHtmlBoundary` is `true` and this has found the opening\n // `html` tag, reset the state.\n if (options.enforceHtmlBoundary && name === 'html') {\n initializeState();\n }\n\n if (skipText) {\n skipTextDepth++;\n return;\n }\n const frame = new Frame(name, attribs);\n stack.push(frame);\n\n let skip = false;\n const hasText = !!frame.text;\n let transformedTag;\n if (has(transformTagsMap, name)) {\n transformedTag = transformTagsMap[name](name, attribs);\n\n frame.attribs = attribs = transformedTag.attribs;\n\n if (transformedTag.text !== undefined) {\n frame.innerText = transformedTag.text;\n }\n\n if (name !== transformedTag.tagName) {\n frame.name = name = transformedTag.tagName;\n transformMap[depth] = transformedTag.tagName;\n }\n }\n if (transformTagsAll) {\n transformedTag = transformTagsAll(name, attribs);\n\n frame.attribs = attribs = transformedTag.attribs;\n if (name !== transformedTag.tagName) {\n frame.name = name = transformedTag.tagName;\n transformMap[depth] = transformedTag.tagName;\n }\n }\n\n if ((options.allowedTags && options.allowedTags.indexOf(name) === -1) || (options.disallowedTagsMode === 'recursiveEscape' && !isEmptyObject(skipMap)) || (options.nestingLimit != null && depth >= options.nestingLimit)) {\n skip = true;\n skipMap[depth] = true;\n if (options.disallowedTagsMode === 'discard') {\n if (nonTextTagsArray.indexOf(name) !== -1) {\n skipText = true;\n skipTextDepth = 1;\n }\n }\n skipMap[depth] = true;\n }\n depth++;\n if (skip) {\n if (options.disallowedTagsMode === 'discard') {\n // We want the contents but not this tag\n return;\n }\n tempResult = result;\n result = '';\n }\n result += '<' + name;\n\n if (name === 'script') {\n if (options.allowedScriptHostnames || options.allowedScriptDomains) {\n frame.innerText = '';\n }\n }\n\n if (!allowedAttributesMap || has(allowedAttributesMap, name) || allowedAttributesMap['*']) {\n each(attribs, function(value, a) {\n if (!VALID_HTML_ATTRIBUTE_NAME.test(a)) {\n // This prevents part of an attribute name in the output from being\n // interpreted as the end of an attribute, or end of a tag.\n delete frame.attribs[a];\n return;\n }\n let parsed;\n // check allowedAttributesMap for the element and attribute and modify the value\n // as necessary if there are specific values defined.\n let passedAllowedAttributesMapCheck = false;\n if (!allowedAttributesMap ||\n (has(allowedAttributesMap, name) && allowedAttributesMap[name].indexOf(a) !== -1) ||\n (allowedAttributesMap['*'] && allowedAttributesMap['*'].indexOf(a) !== -1) ||\n (has(allowedAttributesGlobMap, name) && allowedAttributesGlobMap[name].test(a)) ||\n (allowedAttributesGlobMap['*'] && allowedAttributesGlobMap['*'].test(a))) {\n passedAllowedAttributesMapCheck = true;\n } else if (allowedAttributesMap && allowedAttributesMap[name]) {\n for (const o of allowedAttributesMap[name]) {\n if (isPlainObject(o) && o.name && (o.name === a)) {\n passedAllowedAttributesMapCheck = true;\n let newValue = '';\n if (o.multiple === true) {\n // verify the values that are allowed\n const splitStrArray = value.split(' ');\n for (const s of splitStrArray) {\n if (o.values.indexOf(s) !== -1) {\n if (newValue === '') {\n newValue = s;\n } else {\n newValue += ' ' + s;\n }\n }\n }\n } else if (o.values.indexOf(value) >= 0) {\n // verified an allowed value matches the entire attribute value\n newValue = value;\n }\n value = newValue;\n }\n }\n }\n if (passedAllowedAttributesMapCheck) {\n if (options.allowedSchemesAppliedToAttributes.indexOf(a) !== -1) {\n if (naughtyHref(name, value)) {\n delete frame.attribs[a];\n return;\n }\n }\n\n if (name === 'script' && a === 'src') {\n\n let allowed = true;\n\n try {\n const parsed = new URL(value);\n\n if (options.allowedScriptHostnames || options.allowedScriptDomains) {\n const allowedHostname = (options.allowedScriptHostnames || []).find(function (hostname) {\n return hostname === parsed.hostname;\n });\n const allowedDomain = (options.allowedScriptDomains || []).find(function(domain) {\n return parsed.hostname === domain || parsed.hostname.endsWith(`.${domain}`);\n });\n allowed = allowedHostname || allowedDomain;\n }\n } catch (e) {\n allowed = false;\n }\n\n if (!allowed) {\n delete frame.attribs[a];\n return;\n }\n }\n\n if (name === 'iframe' && a === 'src') {\n let allowed = true;\n try {\n // Chrome accepts \\ as a substitute for / in the // at the\n // start of a URL, so rewrite accordingly to prevent exploit.\n // Also drop any whitespace at that point in the URL\n value = value.replace(/^(\\w+:)?\\s*[\\\\/]\\s*[\\\\/]/, '$1//');\n if (value.startsWith('relative:')) {\n // An attempt to exploit our workaround for base URLs being\n // mandatory for relative URL validation in the WHATWG\n // URL parser, reject it\n throw new Error('relative: exploit attempt');\n }\n // naughtyHref is in charge of whether protocol relative URLs\n // are cool. Here we are concerned just with allowed hostnames and\n // whether to allow relative URLs.\n //\n // Build a placeholder \"base URL\" against which any reasonable\n // relative URL may be parsed successfully\n let base = 'relative://relative-site';\n for (let i = 0; (i < 100); i++) {\n base += `/${i}`;\n }\n const parsed = new URL(value, base);\n const isRelativeUrl = parsed && parsed.hostname === 'relative-site' && parsed.protocol === 'relative:';\n if (isRelativeUrl) {\n // default value of allowIframeRelativeUrls is true\n // unless allowedIframeHostnames or allowedIframeDomains specified\n allowed = has(options, 'allowIframeRelativeUrls')\n ? options.allowIframeRelativeUrls\n : (!options.allowedIframeHostnames && !options.allowedIframeDomains);\n } else if (options.allowedIframeHostnames || options.allowedIframeDomains) {\n const allowedHostname = (options.allowedIframeHostnames || []).find(function (hostname) {\n return hostname === parsed.hostname;\n });\n const allowedDomain = (options.allowedIframeDomains || []).find(function(domain) {\n return parsed.hostname === domain || parsed.hostname.endsWith(`.${domain}`);\n });\n allowed = allowedHostname || allowedDomain;\n }\n } catch (e) {\n // Unparseable iframe src\n allowed = false;\n }\n if (!allowed) {\n delete frame.attribs[a];\n return;\n }\n }\n if (a === 'srcset') {\n try {\n parsed = parseSrcset(value);\n parsed.forEach(function(value) {\n if (naughtyHref('srcset', value.url)) {\n value.evil = true;\n }\n });\n parsed = filter(parsed, function(v) {\n return !v.evil;\n });\n if (!parsed.length) {\n delete frame.attribs[a];\n return;\n } else {\n value = stringifySrcset(filter(parsed, function(v) {\n return !v.evil;\n }));\n frame.attribs[a] = value;\n }\n } catch (e) {\n // Unparseable srcset\n delete frame.attribs[a];\n return;\n }\n }\n if (a === 'class') {\n const allowedSpecificClasses = allowedClassesMap[name];\n const allowedWildcardClasses = allowedClassesMap['*'];\n const allowedSpecificClassesGlob = allowedClassesGlobMap[name];\n const allowedSpecificClassesRegex = allowedClassesRegexMap[name];\n const allowedWildcardClassesGlob = allowedClassesGlobMap['*'];\n const allowedClassesGlobs = [\n allowedSpecificClassesGlob,\n allowedWildcardClassesGlob\n ]\n .concat(allowedSpecificClassesRegex)\n .filter(function (t) {\n return t;\n });\n if (allowedSpecificClasses && allowedWildcardClasses) {\n value = filterClasses(value, deepmerge(allowedSpecificClasses, allowedWildcardClasses), allowedClassesGlobs);\n } else {\n value = filterClasses(value, allowedSpecificClasses || allowedWildcardClasses, allowedClassesGlobs);\n }\n if (!value.length) {\n delete frame.attribs[a];\n return;\n }\n }\n if (a === 'style') {\n try {\n const abstractSyntaxTree = postcssParse(name + ' {' + value + '}');\n const filteredAST = filterCss(abstractSyntaxTree, options.allowedStyles);\n\n value = stringifyStyleAttributes(filteredAST);\n\n if (value.length === 0) {\n delete frame.attribs[a];\n return;\n }\n } catch (e) {\n delete frame.attribs[a];\n return;\n }\n }\n result += ' ' + a;\n if (value && value.length) {\n result += '=\"' + escapeHtml(value, true) + '\"';\n }\n } else {\n delete frame.attribs[a];\n }\n });\n }\n if (options.selfClosing.indexOf(name) !== -1) {\n result += ' />';\n } else {\n result += '>';\n if (frame.innerText && !hasText && !options.textFilter) {\n result += escapeHtml(frame.innerText);\n addedText = true;\n }\n }\n if (skip) {\n result = tempResult + escapeHtml(result);\n tempResult = '';\n }\n },\n ontext: function(text) {\n if (skipText) {\n return;\n }\n const lastFrame = stack[stack.length - 1];\n let tag;\n\n if (lastFrame) {\n tag = lastFrame.tag;\n // If inner text was set by transform function then let's use it\n text = lastFrame.innerText !== undefined ? lastFrame.innerText : text;\n }\n\n if (options.disallowedTagsMode === 'discard' && ((tag === 'script') || (tag === 'style'))) {\n // htmlparser2 gives us these as-is. Escaping them ruins the content. Allowing\n // script tags is, by definition, game over for XSS protection, so if that's\n // your concern, don't allow them. The same is essentially true for style tags\n // which have their own collection of XSS vectors.\n result += text;\n } else {\n const escaped = escapeHtml(text, false);\n if (options.textFilter && !addedText) {\n result += options.textFilter(escaped, tag);\n } else if (!addedText) {\n result += escaped;\n }\n }\n if (stack.length) {\n const frame = stack[stack.length - 1];\n frame.text += text;\n }\n },\n onclosetag: function(name) {\n\n if (skipText) {\n skipTextDepth--;\n if (!skipTextDepth) {\n skipText = false;\n } else {\n return;\n }\n }\n\n const frame = stack.pop();\n if (!frame) {\n // Do not crash on bad markup\n return;\n }\n skipText = options.enforceHtmlBoundary ? name === 'html' : false;\n depth--;\n const skip = skipMap[depth];\n if (skip) {\n delete skipMap[depth];\n if (options.disallowedTagsMode === 'discard') {\n frame.updateParentNodeText();\n return;\n }\n tempResult = result;\n result = '';\n }\n\n if (transformMap[depth]) {\n name = transformMap[depth];\n delete transformMap[depth];\n }\n\n if (options.exclusiveFilter && options.exclusiveFilter(frame)) {\n result = result.substr(0, frame.tagPosition);\n return;\n }\n\n frame.updateParentNodeMediaChildren();\n frame.updateParentNodeText();\n\n if (options.selfClosing.indexOf(name) !== -1) {\n // Already output />\n if (skip) {\n result = tempResult;\n tempResult = '';\n }\n return;\n }\n\n result += '';\n if (skip) {\n result = tempResult + escapeHtml(result);\n tempResult = '';\n }\n addedText = false;\n }\n }, options.parser);\n parser.write(html);\n parser.end();\n\n return result;\n\n function initializeState() {\n result = '';\n depth = 0;\n stack = [];\n skipMap = {};\n transformMap = {};\n skipText = false;\n skipTextDepth = 0;\n }\n\n function escapeHtml(s, quote) {\n if (typeof (s) !== 'string') {\n s = s + '';\n }\n if (options.parser.decodeEntities) {\n s = s.replace(/&/g, '&').replace(//g, '>');\n if (quote) {\n s = s.replace(/\"/g, '"');\n }\n }\n // TODO: this is inadequate because it will pass `&0;`. This approach\n // will not work, each & must be considered with regard to whether it\n // is followed by a 100% syntactically valid entity or not, and escaped\n // if it is not. If this bothers you, don't set parser.decodeEntities\n // to false. (The default is true.)\n s = s.replace(/&(?![a-zA-Z0-9#]{1,20};)/g, '&') // Match ampersands not part of existing HTML entity\n .replace(//g, '>');\n if (quote) {\n s = s.replace(/\"/g, '"');\n }\n return s;\n }\n\n function naughtyHref(name, href) {\n // Browsers ignore character codes of 32 (space) and below in a surprising\n // number of situations. Start reading here:\n // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet#Embedded_tab\n // eslint-disable-next-line no-control-regex\n href = href.replace(/[\\x00-\\x20]+/g, '');\n // Clobber any comments in URLs, which the browser might\n // interpret inside an XML data island, allowing\n // a javascript: URL to be snuck through\n href = href.replace(//g, '');\n // Case insensitive so we don't get faked out by JAVASCRIPT #1\n // Allow more characters after the first so we don't get faked\n // out by certain schemes browsers accept\n const matches = href.match(/^([a-zA-Z][a-zA-Z0-9.\\-+]*):/);\n if (!matches) {\n // Protocol-relative URL starting with any combination of '/' and '\\'\n if (href.match(/^[/\\\\]{2}/)) {\n return !options.allowProtocolRelative;\n }\n\n // No scheme\n return false;\n }\n const scheme = matches[1].toLowerCase();\n\n if (has(options.allowedSchemesByTag, name)) {\n return options.allowedSchemesByTag[name].indexOf(scheme) === -1;\n }\n\n return !options.allowedSchemes || options.allowedSchemes.indexOf(scheme) === -1;\n }\n\n /**\n * Filters user input css properties by allowlisted regex attributes.\n * Modifies the abstractSyntaxTree object.\n *\n * @param {object} abstractSyntaxTree - Object representation of CSS attributes.\n * @property {array[Declaration]} abstractSyntaxTree.nodes[0] - Each object cointains prop and value key, i.e { prop: 'color', value: 'red' }.\n * @param {object} allowedStyles - Keys are properties (i.e color), value is list of permitted regex rules (i.e /green/i).\n * @return {object} - The modified tree.\n */\n function filterCss(abstractSyntaxTree, allowedStyles) {\n if (!allowedStyles) {\n return abstractSyntaxTree;\n }\n\n const astRules = abstractSyntaxTree.nodes[0];\n let selectedRule;\n\n // Merge global and tag-specific styles into new AST.\n if (allowedStyles[astRules.selector] && allowedStyles['*']) {\n selectedRule = deepmerge(\n allowedStyles[astRules.selector],\n allowedStyles['*']\n );\n } else {\n selectedRule = allowedStyles[astRules.selector] || allowedStyles['*'];\n }\n\n if (selectedRule) {\n abstractSyntaxTree.nodes[0].nodes = astRules.nodes.reduce(filterDeclarations(selectedRule), []);\n }\n\n return abstractSyntaxTree;\n }\n\n /**\n * Extracts the style attributes from an AbstractSyntaxTree and formats those\n * values in the inline style attribute format.\n *\n * @param {AbstractSyntaxTree} filteredAST\n * @return {string} - Example: \"color:yellow;text-align:center !important;font-family:helvetica;\"\n */\n function stringifyStyleAttributes(filteredAST) {\n return filteredAST.nodes[0].nodes\n .reduce(function(extractedAttributes, attrObject) {\n extractedAttributes.push(\n `${attrObject.prop}:${attrObject.value}${attrObject.important ? ' !important' : ''}`\n );\n return extractedAttributes;\n }, [])\n .join(';');\n }\n\n /**\n * Filters the existing attributes for the given property. Discards any attributes\n * which don't match the allowlist.\n *\n * @param {object} selectedRule - Example: { color: red, font-family: helvetica }\n * @param {array} allowedDeclarationsList - List of declarations which pass the allowlist.\n * @param {object} attributeObject - Object representing the current css property.\n * @property {string} attributeObject.type - Typically 'declaration'.\n * @property {string} attributeObject.prop - The CSS property, i.e 'color'.\n * @property {string} attributeObject.value - The corresponding value to the css property, i.e 'red'.\n * @return {function} - When used in Array.reduce, will return an array of Declaration objects\n */\n function filterDeclarations(selectedRule) {\n return function (allowedDeclarationsList, attributeObject) {\n // If this property is allowlisted...\n if (has(selectedRule, attributeObject.prop)) {\n const matchesRegex = selectedRule[attributeObject.prop].some(function(regularExpression) {\n return regularExpression.test(attributeObject.value);\n });\n\n if (matchesRegex) {\n allowedDeclarationsList.push(attributeObject);\n }\n }\n return allowedDeclarationsList;\n };\n }\n\n function filterClasses(classes, allowed, allowedGlobs) {\n if (!allowed) {\n // The class attribute is allowed without filtering on this tag\n return classes;\n }\n classes = classes.split(/\\s+/);\n return classes.filter(function(clss) {\n return allowed.indexOf(clss) !== -1 || allowedGlobs.some(function(glob) {\n return glob.test(clss);\n });\n }).join(' ');\n }\n}\n\n// Defaults are accessible to you so that you can use them as a starting point\n// programmatically if you wish\n\nconst htmlParserDefaults = {\n decodeEntities: true\n};\nsanitizeHtml.defaults = {\n allowedTags: [\n // Sections derived from MDN element categories and limited to the more\n // benign categories.\n // https://developer.mozilla.org/en-US/docs/Web/HTML/Element\n // Content sectioning\n 'address', 'article', 'aside', 'footer', 'header',\n 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hgroup',\n 'main', 'nav', 'section',\n // Text content\n 'blockquote', 'dd', 'div', 'dl', 'dt', 'figcaption', 'figure',\n 'hr', 'li', 'main', 'ol', 'p', 'pre', 'ul',\n // Inline text semantics\n 'a', 'abbr', 'b', 'bdi', 'bdo', 'br', 'cite', 'code', 'data', 'dfn',\n 'em', 'i', 'kbd', 'mark', 'q',\n 'rb', 'rp', 'rt', 'rtc', 'ruby',\n 's', 'samp', 'small', 'span', 'strong', 'sub', 'sup', 'time', 'u', 'var', 'wbr',\n // Table content\n 'caption', 'col', 'colgroup', 'table', 'tbody', 'td', 'tfoot', 'th',\n 'thead', 'tr'\n ],\n disallowedTagsMode: 'discard',\n allowedAttributes: {\n a: [ 'href', 'name', 'target' ],\n // We don't currently allow img itself by default, but\n // these attributes would make sense if we did.\n img: [ 'src', 'srcset', 'alt', 'title', 'width', 'height', 'loading' ]\n },\n // Lots of these won't come up by default because we don't allow them\n selfClosing: [ 'img', 'br', 'hr', 'area', 'base', 'basefont', 'input', 'link', 'meta' ],\n // URL schemes we permit\n allowedSchemes: [ 'http', 'https', 'ftp', 'mailto', 'tel' ],\n allowedSchemesByTag: {},\n allowedSchemesAppliedToAttributes: [ 'href', 'src', 'cite' ],\n allowProtocolRelative: true,\n enforceHtmlBoundary: false\n};\n\nsanitizeHtml.simpleTransform = function(newTagName, newAttribs, merge) {\n merge = (merge === undefined) ? true : merge;\n newAttribs = newAttribs || {};\n\n return function(tagName, attribs) {\n let attrib;\n if (merge) {\n for (attrib in newAttribs) {\n attribs[attrib] = newAttribs[attrib];\n }\n } else {\n attribs = newAttribs;\n }\n\n return {\n tagName: newTagName,\n attribs: attribs\n };\n };\n};\n","import xt,{Fragment as Cr,createContext as lo,createRef as Ge,useCallback as B,useContext as ao,useMemo as oe,useReducer as Sr,useRef as He}from\"react\";import{useState as Yo,useEffect as Xo}from\"react\";function k(){let e=[],t=[],r={enqueue(o){t.push(o)},requestAnimationFrame(...o){let n=requestAnimationFrame(...o);r.add(()=>cancelAnimationFrame(n))},nextFrame(...o){r.requestAnimationFrame(()=>{r.requestAnimationFrame(...o)})},setTimeout(...o){let n=setTimeout(...o);r.add(()=>clearTimeout(n))},add(o){e.push(o)},dispose(){for(let o of e.splice(0))o()},async workQueue(){for(let o of t.splice(0))await o()}};return r}function Q(){let[e]=Yo(k);return Xo(()=>()=>e.dispose(),[e]),e}import{useState as tr}from\"react\";import{useLayoutEffect as Jo,useEffect as Zo}from\"react\";var x=typeof window!=\"undefined\"?Jo:Zo;import{useState as er,useEffect as eo}from\"react\";var yt={serverHandoffComplete:!1};function q(){let[e,t]=er(yt.serverHandoffComplete);return eo(()=>{e!==!0&&t(!0)},[e]),eo(()=>{yt.serverHandoffComplete===!1&&(yt.serverHandoffComplete=!0)},[]),e}var or=0;function to(){return++or}function A(){let e=q(),[t,r]=tr(e?to:null);return x(()=>{t===null&&r(to())},[t]),t!=null?\"\"+t:void 0}import{useState as ir}from\"react\";import{useRef as rr,useEffect as nr}from\"react\";function ke(e){let t=rr(e);return nr(()=>{t.current=e},[e]),t}function ee(e,t){let[r,o]=ir(e),n=ke(e);return x(()=>o(n.current),[n,o,...t]),r}import{useRef as lr,useEffect as ar,useCallback as sr}from\"react\";function I(...e){let t=lr(e);return ar(()=>{t.current=e},[e]),sr(r=>{for(let o of t.current)o!=null&&(typeof o==\"function\"?o(r):o.current=r)},[t])}import{Fragment as oo,cloneElement as ur,createElement as pr,forwardRef as dr,isValidElement as cr}from\"react\";function S(e,t,...r){if(e in t){let n=t[e];return typeof n==\"function\"?n(...r):n}let o=new Error(`Tried to handle \"${e}\" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(n=>`\"${n}\"`).join(\", \")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(o,S),o}function E({props:e,slot:t,defaultTag:r,features:o,visible:n=!0,name:i}){if(n)return _e(e,t,r,i);let a=o!=null?o:0;if(a&2){let{static:l=!1,...s}=e;if(l)return _e(s,t,r,i)}if(a&1){let{unmount:l=!0,...s}=e;return S(l?0:1,{[0](){return null},[1](){return _e({...s,hidden:!0,style:{display:\"none\"}},t,r,i)}})}return _e(e,t,r,i)}function _e(e,t={},r,o){let{as:n=r,children:i,refName:a=\"ref\",...l}=gt(e,[\"unmount\",\"static\"]),s=e.ref!==void 0?{[a]:e.ref}:{},u=typeof i==\"function\"?i(t):i;if(l.className&&typeof l.className==\"function\"&&(l.className=l.className(t)),n===oo&&Object.keys(l).length>0){if(!cr(u)||Array.isArray(u)&&u.length>1)throw new Error(['Passing props on \"Fragment\"!',\"\",`The current component <${o} /> is rendering a \"Fragment\".`,\"However we need to passthrough the following props:\",Object.keys(l).map(c=>` - ${c}`).join(`\n`),\"\",\"You can apply a few solutions:\",['Add an `as=\"...\"` prop, to ensure that we render an actual element instead of a \"Fragment\".',\"Render a single element as the child so that we can forward the props onto that element.\"].map(c=>` - ${c}`).join(`\n`)].join(`\n`));return ur(u,Object.assign({},fr(mr(gt(l,[\"ref\"])),u.props,[\"onClick\"]),s))}return pr(n,Object.assign({},gt(l,[\"ref\"]),n!==oo&&s),u)}function fr(e,t,r){let o=Object.assign({},e);for(let n of r)e[n]!==void 0&&t[n]!==void 0&&Object.assign(o,{[n](i){i.defaultPrevented||e[n](i),i.defaultPrevented||t[n](i)}});return o}function D(e){var t;return Object.assign(dr(e),{displayName:(t=e.displayName)!=null?t:e.name})}function mr(e){let t=Object.assign({},e);for(let r in t)t[r]===void 0&&delete t[r];return t}function gt(e,t=[]){let r=Object.assign({},e);for(let o of t)o in r&&delete r[o];return r}function br(e){throw new Error(\"Unexpected object: \"+e)}function ae(e,t){let r=t.resolveItems();if(r.length<=0)return null;let o=t.resolveActiveIndex(),n=o!=null?o:-1,i=(()=>{switch(e.focus){case 0:return r.findIndex(a=>!t.resolveDisabled(a));case 1:{let a=r.slice().reverse().findIndex((l,s,u)=>n!==-1&&u.length-s-1>=n?!1:!t.resolveDisabled(l));return a===-1?a:r.length-1-a}case 2:return r.findIndex((a,l)=>l<=n?!1:!t.resolveDisabled(a));case 3:{let a=r.slice().reverse().findIndex(l=>!t.resolveDisabled(l));return a===-1?a:r.length-1-a}case 4:return r.findIndex(a=>t.resolveId(a)===e.id);case 5:return null;default:br(e)}})();return i===-1?o:i}function G(e){let t=e.parentElement,r=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(r=t),t=t.parentElement;let o=(t==null?void 0:t.getAttribute(\"disabled\"))===\"\";return o&&Tr(r)?!1:o}function Tr(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}import{useEffect as yr,useRef as gr}from\"react\";function w(e,t,r){let o=gr(t);o.current=t,yr(()=>{function n(i){o.current.call(window,i)}return window.addEventListener(e,n,r),()=>window.removeEventListener(e,n,r)},[e,r])}import Pr,{createContext as xr,useContext as vr}from\"react\";var Pt=xr(null);Pt.displayName=\"OpenClosedContext\";function _(){return vr(Pt)}function W({value:e,children:t}){return Pr.createElement(Pt.Provider,{value:e},t)}import{useState as Rr}from\"react\";function ro(e){var r;if(e.type)return e.type;let t=(r=e.as)!=null?r:\"button\";if(typeof t==\"string\"&&t.toLowerCase()===\"button\")return\"button\"}function U(e,t){let[r,o]=Rr(()=>ro(e));return x(()=>{o(ro(e))},[e.type,e.as]),x(()=>{r||!t.current||t.current instanceof HTMLButtonElement&&!t.current.hasAttribute(\"type\")&&o(\"button\")},[r,t]),r}import{useRef as no,useEffect as Er}from\"react\";function se({container:e,accept:t,walk:r,enabled:o=!0}){let n=no(t),i=no(r);Er(()=>{n.current=t,i.current=r},[t,r]),x(()=>{if(!e||!o)return;let a=n.current,l=i.current,s=Object.assign(c=>a(c),{acceptNode:a}),u=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,s,!1);for(;u.nextNode();)l(u.currentNode)},[e,o,n,i])}var Ar={[1](e){return e.disabled||e.comboboxState===1?e:{...e,activeOptionIndex:null,comboboxState:1}},[0](e){return e.disabled||e.comboboxState===0?e:{...e,comboboxState:0}},[2](e,t){return e.disabled===t.disabled?e:{...e,disabled:t.disabled}},[3](e,t){if(e.disabled||e.optionsRef.current&&!e.optionsPropsRef.current.static&&e.comboboxState===1)return e;let r=ae(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled});return e.activeOptionIndex===r?e:{...e,activeOptionIndex:r}},[4]:(e,t)=>{var i;let r=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,o=Array.from((i=e.optionsRef.current)==null?void 0:i.querySelectorAll('[id^=\"headlessui-combobox-option-\"]')).reduce((a,l,s)=>Object.assign(a,{[l.id]:s}),{}),n=[...e.options,{id:t.id,dataRef:t.dataRef}].sort((a,l)=>o[a.id]-o[l.id]);return{...e,options:n,activeOptionIndex:(()=>r===null?null:n.indexOf(r))()}},[5]:(e,t)=>{let r=e.options.slice(),o=e.activeOptionIndex!==null?r[e.activeOptionIndex]:null,n=r.findIndex(i=>i.id===t.id);return n!==-1&&r.splice(n,1),{...e,options:r,activeOptionIndex:(()=>n===e.activeOptionIndex||o===null?null:r.indexOf(o))()}}},vt=lo(null);vt.displayName=\"ComboboxContext\";function pe(e){let t=ao(vt);if(t===null){let r=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,pe),r}return t}var Rt=lo(null);Rt.displayName=\"ComboboxActions\";function Ue(){let e=ao(Rt);if(e===null){let t=new Error(\"ComboboxActions is missing a parent component.\");throw Error.captureStackTrace&&Error.captureStackTrace(t,Ue),t}return e}function hr(e,t){return S(t.type,Ar,e,t)}var Or=Cr,Ir=D(function(t,r){let{value:o,onChange:n,disabled:i=!1,...a}=t,l=He({value:o,onChange:n}),s=He({static:!1,hold:!1}),u=He({displayValue:void 0}),c=Sr(hr,{comboboxState:1,comboboxPropsRef:l,optionsPropsRef:s,inputPropsRef:u,labelRef:Ge(),inputRef:Ge(),buttonRef:Ge(),optionsRef:Ge(),disabled:i,options:[],activeOptionIndex:null}),[{comboboxState:m,options:b,activeOptionIndex:T,optionsRef:y,inputRef:p,buttonRef:f},d]=c;x(()=>{l.current.value=o},[o,l]),x(()=>{l.current.onChange=n},[n,l]),x(()=>d({type:2,disabled:i}),[i]),w(\"mousedown\",O=>{var N,K,V;let L=O.target;m===0&&(((N=f.current)==null?void 0:N.contains(L))||((K=p.current)==null?void 0:K.contains(L))||((V=y.current)==null?void 0:V.contains(L))||d({type:1}))});let P=T===null?null:b[T].dataRef.current.value,C=oe(()=>({open:m===0,disabled:i,activeIndex:T,activeOption:P}),[m,i,b,T]),R=B(()=>{if(!p.current||o===void 0)return;let O=u.current.displayValue;typeof O==\"function\"?p.current.value=O(o):typeof o==\"string\"&&(p.current.value=o)},[o,p,u]),g=B(O=>{let L=b.find(K=>K.id===O);if(!L)return;let{dataRef:N}=L;l.current.onChange(N.current.value),R()},[b,l,p]),v=B(()=>{if(T!==null){let{dataRef:O}=b[T];l.current.onChange(O.current.value),R()}},[T,b,l,p]),h=oe(()=>({selectOption:g,selectActiveOption:v}),[g,v]);return x(()=>{m===1&&R()},[R,m]),x(R,[R]),xt.createElement(Rt.Provider,{value:h},xt.createElement(vt.Provider,{value:c},xt.createElement(W,{value:S(m,{[0]:0,[1]:1})},E({props:r===null?a:{...a,ref:r},slot:C,defaultTag:Or,name:\"Combobox\"}))))}),Lr=\"input\",Dr=D(function(t,r){var R,g;let{value:o,onChange:n,displayValue:i,...a}=t,[l,s]=pe(\"Combobox.Input\"),u=Ue(),c=I(l.inputRef,r),m=l.inputPropsRef,b=`headlessui-combobox-input-${A()}`,T=Q(),y=ke(n);x(()=>{m.current.displayValue=i},[i,m]);let p=B(v=>{switch(v.key){case\"Enter\":v.preventDefault(),v.stopPropagation(),u.selectActiveOption(),s({type:1});break;case\"ArrowDown\":return v.preventDefault(),v.stopPropagation(),S(l.comboboxState,{[0]:()=>s({type:3,focus:2}),[1]:()=>{s({type:0}),T.nextFrame(()=>{l.comboboxPropsRef.current.value||s({type:3,focus:0})})}});case\"ArrowUp\":return v.preventDefault(),v.stopPropagation(),S(l.comboboxState,{[0]:()=>s({type:3,focus:1}),[1]:()=>{s({type:0}),T.nextFrame(()=>{l.comboboxPropsRef.current.value||s({type:3,focus:3})})}});case\"Home\":case\"PageUp\":return v.preventDefault(),v.stopPropagation(),s({type:3,focus:0});case\"End\":case\"PageDown\":return v.preventDefault(),v.stopPropagation(),s({type:3,focus:3});case\"Escape\":return v.preventDefault(),l.optionsRef.current&&!l.optionsPropsRef.current.static&&v.stopPropagation(),s({type:1});case\"Tab\":u.selectActiveOption(),s({type:1});break}},[T,s,l,u]),f=B(v=>{var h;s({type:0}),(h=y.current)==null||h.call(y,v)},[s,y]),d=ee(()=>{if(!!l.labelRef.current)return[l.labelRef.current.id].join(\" \")},[l.labelRef.current]),P=oe(()=>({open:l.comboboxState===0,disabled:l.disabled}),[l]),C={ref:c,id:b,role:\"combobox\",type:\"text\",\"aria-controls\":(R=l.optionsRef.current)==null?void 0:R.id,\"aria-expanded\":l.disabled?void 0:l.comboboxState===0,\"aria-activedescendant\":l.activeOptionIndex===null||(g=l.options[l.activeOptionIndex])==null?void 0:g.id,\"aria-labelledby\":d,disabled:l.disabled,onKeyDown:p,onChange:f};return E({props:{...a,...C},slot:P,defaultTag:Lr,name:\"Combobox.Input\"})}),Mr=\"button\",Fr=D(function(t,r){var p;let[o,n]=pe(\"Combobox.Button\"),i=Ue(),a=I(o.buttonRef,r),l=`headlessui-combobox-button-${A()}`,s=Q(),u=B(f=>{switch(f.key){case\"ArrowDown\":return f.preventDefault(),f.stopPropagation(),o.comboboxState===1&&(n({type:0}),s.nextFrame(()=>{o.comboboxPropsRef.current.value||n({type:3,focus:0})})),s.nextFrame(()=>{var d;return(d=o.inputRef.current)==null?void 0:d.focus({preventScroll:!0})});case\"ArrowUp\":return f.preventDefault(),f.stopPropagation(),o.comboboxState===1&&(n({type:0}),s.nextFrame(()=>{o.comboboxPropsRef.current.value||n({type:3,focus:3})})),s.nextFrame(()=>{var d;return(d=o.inputRef.current)==null?void 0:d.focus({preventScroll:!0})});case\"Escape\":return f.preventDefault(),o.optionsRef.current&&!o.optionsPropsRef.current.static&&f.stopPropagation(),n({type:1}),s.nextFrame(()=>{var d;return(d=o.inputRef.current)==null?void 0:d.focus({preventScroll:!0})})}},[s,n,o,i]),c=B(f=>{if(G(f.currentTarget))return f.preventDefault();o.comboboxState===0?n({type:1}):(f.preventDefault(),n({type:0})),s.nextFrame(()=>{var d;return(d=o.inputRef.current)==null?void 0:d.focus({preventScroll:!0})})},[n,s,o]),m=ee(()=>{if(!!o.labelRef.current)return[o.labelRef.current.id,l].join(\" \")},[o.labelRef.current,l]),b=oe(()=>({open:o.comboboxState===0,disabled:o.disabled}),[o]),T=t,y={ref:a,id:l,type:U(t,o.buttonRef),tabIndex:-1,\"aria-haspopup\":!0,\"aria-controls\":(p=o.optionsRef.current)==null?void 0:p.id,\"aria-expanded\":o.disabled?void 0:o.comboboxState===0,\"aria-labelledby\":m,disabled:o.disabled,onClick:c,onKeyDown:u};return E({props:{...T,...y},slot:b,defaultTag:Mr,name:\"Combobox.Button\"})}),wr=\"label\";function kr(e){let[t]=pe(\"Combobox.Label\"),r=`headlessui-combobox-label-${A()}`,o=B(()=>{var a;return(a=t.inputRef.current)==null?void 0:a.focus({preventScroll:!0})},[t.inputRef]),n=oe(()=>({open:t.comboboxState===0,disabled:t.disabled}),[t]),i={ref:t.labelRef,id:r,onClick:o};return E({props:{...e,...i},slot:n,defaultTag:wr,name:\"Combobox.Label\"})}var _r=\"ul\",Gr=1|2,Hr=D(function(t,r){var y;let{hold:o=!1,...n}=t,[i]=pe(\"Combobox.Options\"),{optionsPropsRef:a}=i,l=I(i.optionsRef,r),s=`headlessui-combobox-options-${A()}`,u=_(),c=(()=>u!==null?u===0:i.comboboxState===0)();x(()=>{var p;a.current.static=(p=t.static)!=null?p:!1},[a,t.static]),x(()=>{a.current.hold=o},[o,a]),se({container:i.optionsRef.current,enabled:i.comboboxState===0,accept(p){return p.getAttribute(\"role\")===\"option\"?NodeFilter.FILTER_REJECT:p.hasAttribute(\"role\")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(p){p.setAttribute(\"role\",\"none\")}});let m=ee(()=>{var p,f,d;return(d=(p=i.labelRef.current)==null?void 0:p.id)!=null?d:(f=i.buttonRef.current)==null?void 0:f.id},[i.labelRef.current,i.buttonRef.current]),b=oe(()=>({open:i.comboboxState===0}),[i]),T={\"aria-activedescendant\":i.activeOptionIndex===null||(y=i.options[i.activeOptionIndex])==null?void 0:y.id,\"aria-labelledby\":m,role:\"listbox\",id:s,ref:l};return E({props:{...n,...T},slot:b,defaultTag:_r,features:Gr,visible:c,name:\"Combobox.Options\"})}),Ur=\"li\";function Br(e){let{disabled:t=!1,value:r,...o}=e,[n,i]=pe(\"Combobox.Option\"),a=Ue(),l=`headlessui-combobox-option-${A()}`,s=n.activeOptionIndex!==null?n.options[n.activeOptionIndex].id===l:!1,u=n.comboboxPropsRef.current.value===r,c=He({disabled:t,value:r});x(()=>{c.current.disabled=t},[c,t]),x(()=>{c.current.value=r},[c,r]),x(()=>{var P,C;c.current.textValue=(C=(P=document.getElementById(l))==null?void 0:P.textContent)==null?void 0:C.toLowerCase()},[c,l]);let m=B(()=>a.selectOption(l),[a,l]);x(()=>(i({type:4,id:l,dataRef:c}),()=>i({type:5,id:l})),[c,l]),x(()=>{n.comboboxState===0&&(!u||i({type:3,focus:4,id:l}))},[n.comboboxState,u,l]),x(()=>{if(n.comboboxState!==0||!s)return;let P=k();return P.requestAnimationFrame(()=>{var C,R;(R=(C=document.getElementById(l))==null?void 0:C.scrollIntoView)==null||R.call(C,{block:\"nearest\"})}),P.dispose},[l,s,n.comboboxState,n.activeOptionIndex]);let b=B(P=>{if(t)return P.preventDefault();m(),i({type:1}),k().nextFrame(()=>{var C;return(C=n.inputRef.current)==null?void 0:C.focus({preventScroll:!0})})},[i,n.inputRef,t,m]),T=B(()=>{if(t)return i({type:3,focus:5});i({type:3,focus:4,id:l})},[t,l,i]),y=B(()=>{t||s||i({type:3,focus:4,id:l})},[t,s,l,i]),p=B(()=>{t||!s||n.optionsPropsRef.current.hold||i({type:3,focus:5})},[t,s,i,n.comboboxState,n.comboboxPropsRef]),f=oe(()=>({active:s,selected:u,disabled:t}),[s,u,t]);return E({props:{...o,...{id:l,role:\"option\",tabIndex:t===!0?void 0:-1,\"aria-disabled\":t===!0?!0:void 0,\"aria-selected\":u===!0?!0:void 0,disabled:void 0,onClick:b,onFocus:T,onPointerMove:y,onMouseMove:y,onPointerLeave:p,onMouseLeave:p}},slot:f,defaultTag:Ur,name:\"Combobox.Option\"})}var Na=Object.assign(Ir,{Input:Dr,Button:Fr,Label:kr,Options:Hr,Option:Br});import ne,{createContext as mn,useCallback as Ke,useContext as Co,useEffect as Ot,useMemo as je,useReducer as bn,useRef as So,useState as Tn}from\"react\";import{useRef as uo,useEffect as St}from\"react\";var Et=[\"[contentEditable=true]\",\"[tabindex]\",\"a[href]\",\"area[href]\",\"button:not([disabled])\",\"iframe\",\"input:not([disabled])\",\"select:not([disabled])\",\"textarea:not([disabled])\"].map(e=>`${e}:not([tabindex='-1'])`).join(\",\");function xe(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Et))}function de(e,t=0){return e===document.body?!1:S(t,{[0](){return e.matches(Et)},[1](){let r=e;for(;r!==null;){if(r.matches(Et))return!0;r=r.parentElement}return!1}})}function ce(e){e==null||e.focus({preventScroll:!0})}function M(e,t){let r=Array.isArray(e)?e.slice().sort((c,m)=>{let b=c.compareDocumentPosition(m);return b&Node.DOCUMENT_POSITION_FOLLOWING?-1:b&Node.DOCUMENT_POSITION_PRECEDING?1:0}):xe(e),o=document.activeElement,n=(()=>{if(t&(1|4))return 1;if(t&(2|8))return-1;throw new Error(\"Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last\")})(),i=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,r.indexOf(o))-1;if(t&4)return Math.max(0,r.indexOf(o))+1;if(t&8)return r.length-1;throw new Error(\"Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last\")})(),a=t&32?{preventScroll:!0}:{},l=0,s=r.length,u;do{if(l>=s||l+s<=0)return 0;let c=i+l;if(t&16)c=(c+s)%s;else{if(c<0)return 3;if(c>=s)return 1}u=r[c],u==null||u.focus(a),l+=n}while(u!==document.activeElement);return u.hasAttribute(\"tabindex\")||u.setAttribute(\"tabindex\",\"0\"),2}import{useRef as Nr,useEffect as Wr}from\"react\";function Be(){let e=Nr(!1);return Wr(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Ne(e,t=30,{initialFocus:r,containers:o}={}){let n=uo(typeof window!=\"undefined\"?document.activeElement:null),i=uo(null),a=Be(),l=Boolean(t&16),s=Boolean(t&2);St(()=>{!l||(n.current=document.activeElement)},[l]),St(()=>{if(!!l)return()=>{ce(n.current),n.current=null}},[l]),St(()=>{if(!s||!e.current)return;let u=document.activeElement;if(r==null?void 0:r.current){if((r==null?void 0:r.current)===u){i.current=u;return}}else if(e.current.contains(u)){i.current=u;return}(r==null?void 0:r.current)?ce(r.current):M(e.current,1)===0&&console.warn(\"There are no focusable elements inside the \"),i.current=document.activeElement},[e,r,s]),w(\"keydown\",u=>{!(t&4)||!e.current||u.key===\"Tab\"&&(u.preventDefault(),M(e.current,(u.shiftKey?2:4)|16)===2&&(i.current=document.activeElement))}),w(\"focus\",u=>{if(!(t&8))return;let c=new Set(o==null?void 0:o.current);if(c.add(e),!c.size)return;let m=i.current;if(!m||!a.current)return;let b=u.target;b&&b instanceof HTMLElement?Kr(c,b)?(i.current=b,ce(b)):(u.preventDefault(),u.stopPropagation(),ce(m)):ce(i.current)},!0)}function Kr(e,t){var r;for(let o of e)if((r=o.current)==null?void 0:r.contains(t))return!0;return!1}var fe=new Set,J=new Map;function po(e){e.setAttribute(\"aria-hidden\",\"true\"),e.inert=!0}function co(e){let t=J.get(e);!t||(t[\"aria-hidden\"]===null?e.removeAttribute(\"aria-hidden\"):e.setAttribute(\"aria-hidden\",t[\"aria-hidden\"]),e.inert=t.inert)}function fo(e,t=!0){x(()=>{if(!t||!e.current)return;let r=e.current;fe.add(r);for(let o of J.keys())o.contains(r)&&(co(o),J.delete(o));return document.querySelectorAll(\"body > *\").forEach(o=>{if(o instanceof HTMLElement){for(let n of fe)if(o.contains(n))return;fe.size===1&&(J.set(o,{\"aria-hidden\":o.getAttribute(\"aria-hidden\"),inert:o.inert}),po(o))}}),()=>{if(fe.delete(r),fe.size>0)document.querySelectorAll(\"body > *\").forEach(o=>{if(o instanceof HTMLElement&&!J.has(o)){for(let n of fe)if(o.contains(n))return;J.set(o,{\"aria-hidden\":o.getAttribute(\"aria-hidden\"),inert:o.inert}),po(o)}});else for(let o of J.keys())co(o),J.delete(o)}},[t])}import Qr,{Fragment as To,createContext as qr,useContext as zr,useEffect as yo,useState as go}from\"react\";import{createPortal as Yr}from\"react-dom\";import jr,{createContext as Vr,useContext as $r}from\"react\";var mo=Vr(!1);function bo(){return $r(mo)}function At(e){return jr.createElement(mo.Provider,{value:e.force},e.children)}function Xr(){let e=bo(),t=zr(Po),[r,o]=go(()=>{if(!e&&t!==null||typeof window==\"undefined\")return null;let n=document.getElementById(\"headlessui-portal-root\");if(n)return n;let i=document.createElement(\"div\");return i.setAttribute(\"id\",\"headlessui-portal-root\"),document.body.appendChild(i)});return yo(()=>{r!==null&&(document.body.contains(r)||document.body.appendChild(r))},[r]),yo(()=>{e||t!==null&&o(t.current)},[t,o,e]),r}var Jr=To;function We(e){let t=e,r=Xr(),[o]=go(()=>typeof window==\"undefined\"?null:document.createElement(\"div\")),n=q();return x(()=>{if(!!r&&!!o)return r.appendChild(o),()=>{var i;!r||!o||(r.removeChild(o),r.childNodes.length<=0&&((i=r.parentElement)==null||i.removeChild(r)))}},[r,o]),n?!r||!o?null:Yr(E({props:t,defaultTag:Jr,name:\"Portal\"}),o):null}var Zr=To,Po=qr(null);function en(e){let{target:t,...r}=e;return Qr.createElement(Po.Provider,{value:t},E({props:r,defaultTag:Zr,name:\"Popover.Group\"}))}We.Group=en;import tn,{createContext as on,useCallback as rn,useContext as nn,useMemo as xo,useState as ln}from\"react\";var vo=on(null);function Ro(){let e=nn(vo);if(e===null){let t=new Error(\"You used a component, but it is not inside a relevant parent.\");throw Error.captureStackTrace&&Error.captureStackTrace(t,Ro),t}return e}function re(){let[e,t]=ln([]);return[e.length>0?e.join(\" \"):void 0,xo(()=>function(o){let n=rn(a=>(t(l=>[...l,a]),()=>t(l=>{let s=l.slice(),u=s.indexOf(a);return u!==-1&&s.splice(u,1),s})),[]),i=xo(()=>({register:n,slot:o.slot,name:o.name,props:o.props}),[n,o.slot,o.name,o.props]);return tn.createElement(vo.Provider,{value:i},o.children)},[t])]}var an=\"p\";function me(e){let t=Ro(),r=`headlessui-description-${A()}`;x(()=>t.register(r),[r,t.register]);let o=e,n={...t.props,id:r};return E({props:{...o,...n},slot:t.slot||{},defaultTag:an,name:t.name||\"Description\"})}import sn,{createContext as un,useCallback as pn,useContext as dn}from\"react\";var ht=un(()=>{});ht.displayName=\"StackContext\";function cn(){return dn(ht)}function Eo({children:e,onUpdate:t,type:r,element:o}){let n=cn(),i=pn((...a)=>{t==null||t(...a),n(...a)},[n,t]);return x(()=>(i(0,r,o),()=>i(1,r,o)),[i,r,o]),sn.createElement(ht.Provider,{value:i},e)}var yn={[0](e,t){return e.titleId===t.id?e:{...e,titleId:t.id}}},Ve=mn(null);Ve.displayName=\"DialogContext\";function It(e){let t=Co(Ve);if(t===null){let r=new Error(`<${e} /> is missing a parent <${An.displayName} /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,It),r}return t}function gn(e,t){return S(t.type,yn,e,t)}var Pn=\"div\",xn=1|2,vn=D(function(t,r){let{open:o,onClose:n,initialFocus:i,...a}=t,[l,s]=Tn(0),u=_();o===void 0&&u!==null&&(o=S(u,{[0]:!0,[1]:!1}));let c=So(new Set),m=So(null),b=I(m,r),T=t.hasOwnProperty(\"open\")||u!==null,y=t.hasOwnProperty(\"onClose\");if(!T&&!y)throw new Error(\"You have to provide an `open` and an `onClose` prop to the `Dialog` component.\");if(!T)throw new Error(\"You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.\");if(!y)throw new Error(\"You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.\");if(typeof o!=\"boolean\")throw new Error(`You provided an \\`open\\` prop to the \\`Dialog\\`, but the value is not a boolean. Received: ${o}`);if(typeof n!=\"function\")throw new Error(`You provided an \\`onClose\\` prop to the \\`Dialog\\`, but the value is not a function. Received: ${n}`);let p=o?0:1,f=(()=>u!==null?u===0:p===0)(),[d,P]=bn(gn,{titleId:null,descriptionId:null}),C=Ke(()=>n(!1),[n]),R=Ke(F=>P({type:0,id:F}),[P]),v=q()&&p===0,h=l>1,O=Co(Ve)!==null;Ne(m,v?S(h?\"parent\":\"leaf\",{parent:16,leaf:30}):1,{initialFocus:i,containers:c}),fo(m,h?v:!1),w(\"mousedown\",F=>{var H;let $=F.target;p===0&&(h||((H=m.current)==null?void 0:H.contains($))||C())}),w(\"keydown\",F=>{F.key===\"Escape\"&&p===0&&(h||(F.preventDefault(),F.stopPropagation(),C()))}),Ot(()=>{if(p!==0||O)return;let F=document.documentElement.style.overflow,$=document.documentElement.style.paddingRight,H=window.innerWidth-document.documentElement.clientWidth;return document.documentElement.style.overflow=\"hidden\",document.documentElement.style.paddingRight=`${H}px`,()=>{document.documentElement.style.overflow=F,document.documentElement.style.paddingRight=$}},[p,O]),Ot(()=>{if(p!==0||!m.current)return;let F=new IntersectionObserver($=>{for(let H of $)H.boundingClientRect.x===0&&H.boundingClientRect.y===0&&H.boundingClientRect.width===0&&H.boundingClientRect.height===0&&C()});return F.observe(m.current),()=>F.disconnect()},[p,m,C]);let[N,K]=re(),V=`headlessui-dialog-${A()}`,Fe=je(()=>[{dialogState:p,close:C,setTitleId:R},d],[p,d,C,R]),ge=je(()=>({open:p===0}),[p]),we={ref:b,id:V,role:\"dialog\",\"aria-modal\":p===0?!0:void 0,\"aria-labelledby\":d.titleId,\"aria-describedby\":N,onClick(F){F.stopPropagation()}},X=a;return ne.createElement(Eo,{type:\"Dialog\",element:m,onUpdate:Ke((F,$,H)=>{$===\"Dialog\"&&S(F,{[0](){c.current.add(H),s(Pe=>Pe+1)},[1](){c.current.add(H),s(Pe=>Pe-1)}})},[])},ne.createElement(At,{force:!0},ne.createElement(We,null,ne.createElement(Ve.Provider,{value:Fe},ne.createElement(We.Group,{target:m},ne.createElement(At,{force:!1},ne.createElement(K,{slot:ge,name:\"Dialog.Description\"},E({props:{...X,...we},slot:ge,defaultTag:Pn,features:xn,visible:f,name:\"Dialog\"}))))))))}),Rn=\"div\",En=D(function(t,r){let[{dialogState:o,close:n}]=It(\"Dialog.Overlay\"),i=I(r),a=`headlessui-dialog-overlay-${A()}`,l=Ke(m=>{if(m.target===m.currentTarget){if(G(m.currentTarget))return m.preventDefault();m.preventDefault(),m.stopPropagation(),n()}},[n]),s=je(()=>({open:o===0}),[o]);return E({props:{...t,...{ref:i,id:a,\"aria-hidden\":!0,onClick:l}},slot:s,defaultTag:Rn,name:\"Dialog.Overlay\"})}),Cn=\"h2\";function Sn(e){let[{dialogState:t,setTitleId:r}]=It(\"Dialog.Title\"),o=`headlessui-dialog-title-${A()}`;Ot(()=>(r(o),()=>r(null)),[o,r]);let n=je(()=>({open:t===0}),[t]);return E({props:{...e,...{id:o}},slot:n,defaultTag:Cn,name:\"Dialog.Title\"})}var An=Object.assign(vn,{Overlay:En,Title:Sn,Description:me});import $e,{Fragment as hn,createContext as Lt,useCallback as Qe,useContext as Dt,useEffect as qe,useMemo as ze,useReducer as On,useRef as In}from\"react\";var Ln={[0]:e=>({...e,disclosureState:S(e.disclosureState,{[0]:1,[1]:0})}),[1]:e=>e.disclosureState===1?e:{...e,disclosureState:1},[4](e){return e.linkedPanel===!0?e:{...e,linkedPanel:!0}},[5](e){return e.linkedPanel===!1?e:{...e,linkedPanel:!1}},[2](e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},[3](e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}}},Mt=Lt(null);Mt.displayName=\"DisclosureContext\";function Ft(e){let t=Dt(Mt);if(t===null){let r=new Error(`<${e} /> is missing a parent <${Ye.name} /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Ft),r}return t}var wt=Lt(null);wt.displayName=\"DisclosureAPIContext\";function Ao(e){let t=Dt(wt);if(t===null){let r=new Error(`<${e} /> is missing a parent <${Ye.name} /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Ao),r}return t}var kt=Lt(null);kt.displayName=\"DisclosurePanelContext\";function Dn(){return Dt(kt)}function Mn(e,t){return S(t.type,Ln,e,t)}var Fn=hn;function Ye(e){let{defaultOpen:t=!1,...r}=e,o=`headlessui-disclosure-button-${A()}`,n=`headlessui-disclosure-panel-${A()}`,i=On(Mn,{disclosureState:t?0:1,linkedPanel:!1,buttonId:o,panelId:n}),[{disclosureState:a},l]=i;qe(()=>l({type:2,buttonId:o}),[o,l]),qe(()=>l({type:3,panelId:n}),[n,l]);let s=Qe(m=>{l({type:1});let b=(()=>m?m instanceof HTMLElement?m:m.current instanceof HTMLElement?m.current:document.getElementById(o):document.getElementById(o))();b==null||b.focus()},[l,o]),u=ze(()=>({close:s}),[s]),c=ze(()=>({open:a===0,close:s}),[a,s]);return $e.createElement(Mt.Provider,{value:i},$e.createElement(wt.Provider,{value:u},$e.createElement(W,{value:S(a,{[0]:0,[1]:1})},E({props:r,slot:c,defaultTag:Fn,name:\"Disclosure\"}))))}var wn=\"button\",kn=D(function(t,r){let[o,n]=Ft(\"Disclosure.Button\"),i=In(null),a=I(i,r),l=Dn(),s=l===null?!1:l===o.panelId,u=Qe(f=>{var d;if(s){if(o.disclosureState===1)return;switch(f.key){case\" \":case\"Enter\":f.preventDefault(),f.stopPropagation(),n({type:0}),(d=document.getElementById(o.buttonId))==null||d.focus();break}}else switch(f.key){case\" \":case\"Enter\":f.preventDefault(),f.stopPropagation(),n({type:0});break}},[n,s,o.disclosureState,o.buttonId]),c=Qe(f=>{switch(f.key){case\" \":f.preventDefault();break}},[]),m=Qe(f=>{var d;G(f.currentTarget)||t.disabled||(s?(n({type:0}),(d=document.getElementById(o.buttonId))==null||d.focus()):n({type:0}))},[n,t.disabled,o.buttonId,s]),b=ze(()=>({open:o.disclosureState===0}),[o]),T=U(t,i),y=t,p=s?{ref:a,type:T,onKeyDown:u,onClick:m}:{ref:a,id:o.buttonId,type:T,\"aria-expanded\":t.disabled?void 0:o.disclosureState===0,\"aria-controls\":o.linkedPanel?o.panelId:void 0,onKeyDown:u,onKeyUp:c,onClick:m};return E({props:{...y,...p},slot:b,defaultTag:wn,name:\"Disclosure.Button\"})}),_n=\"div\",Gn=1|2,Hn=D(function(t,r){let[o,n]=Ft(\"Disclosure.Panel\"),{close:i}=Ao(\"Disclosure.Panel\"),a=I(r,()=>{o.linkedPanel||n({type:4})}),l=_(),s=(()=>l!==null?l===0:o.disclosureState===0)();qe(()=>()=>n({type:5}),[n]),qe(()=>{var b;o.disclosureState===1&&((b=t.unmount)!=null?b:!0)&&n({type:5})},[o.disclosureState,t.unmount,n]);let u=ze(()=>({open:o.disclosureState===0,close:i}),[o,i]),c={ref:a,id:o.panelId},m=t;return $e.createElement(kt.Provider,{value:o.panelId},E({props:{...m,...c},slot:u,defaultTag:_n,features:Gn,visible:s,name:\"Disclosure.Panel\"}))});Ye.Button=kn;Ye.Panel=Hn;import{useRef as Un}from\"react\";var Bn=\"div\";function yu(e){let t=Un(null),{initialFocus:r,...o}=e,n=q();return Ne(t,n?30:1,{initialFocus:r}),E({props:{...o,...{ref:t}},defaultTag:Bn,name:\"FocusTrap\"})}import Oo,{Fragment as Nn,createContext as Wn,createRef as _t,useCallback as z,useContext as Kn,useMemo as ve,useReducer as jn,useRef as Vn}from\"react\";var $n={[1](e){return e.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,listboxState:1}},[0](e){return e.disabled||e.listboxState===0?e:{...e,listboxState:0}},[2](e,t){return e.disabled===t.disabled?e:{...e,disabled:t.disabled}},[3](e,t){return e.orientation===t.orientation?e:{...e,orientation:t.orientation}},[4](e,t){if(e.disabled||e.listboxState===1)return e;let r=ae(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled});return e.searchQuery===\"\"&&e.activeOptionIndex===r?e:{...e,searchQuery:\"\",activeOptionIndex:r}},[5]:(e,t)=>{if(e.disabled||e.listboxState===1)return e;let o=e.searchQuery!==\"\"?0:1,n=e.searchQuery+t.value.toLowerCase(),a=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+o).concat(e.options.slice(0,e.activeOptionIndex+o)):e.options).find(s=>{var u;return!s.dataRef.current.disabled&&((u=s.dataRef.current.textValue)==null?void 0:u.startsWith(n))}),l=a?e.options.indexOf(a):-1;return l===-1||l===e.activeOptionIndex?{...e,searchQuery:n}:{...e,searchQuery:n,activeOptionIndex:l}},[6](e){return e.disabled||e.listboxState===1||e.searchQuery===\"\"?e:{...e,searchQuery:\"\"}},[7]:(e,t)=>{var n;let r=Array.from((n=e.optionsRef.current)==null?void 0:n.querySelectorAll('[id^=\"headlessui-listbox-option-\"]')).reduce((i,a,l)=>Object.assign(i,{[a.id]:l}),{}),o=[...e.options,{id:t.id,dataRef:t.dataRef}].sort((i,a)=>r[i.id]-r[a.id]);return{...e,options:o}},[8]:(e,t)=>{let r=e.options.slice(),o=e.activeOptionIndex!==null?r[e.activeOptionIndex]:null,n=r.findIndex(i=>i.id===t.id);return n!==-1&&r.splice(n,1),{...e,options:r,activeOptionIndex:(()=>n===e.activeOptionIndex||o===null?null:r.indexOf(o))()}}},Gt=Wn(null);Gt.displayName=\"ListboxContext\";function Re(e){let t=Kn(Gt);if(t===null){let r=new Error(`<${e} /> is missing a parent <${Ee.name} /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Re),r}return t}function Qn(e,t){return S(t.type,$n,e,t)}var qn=Nn;function Ee(e){let{value:t,onChange:r,disabled:o=!1,horizontal:n=!1,...i}=e,a=n?\"horizontal\":\"vertical\",l=jn(Qn,{listboxState:1,propsRef:{current:{value:t,onChange:r}},labelRef:_t(),buttonRef:_t(),optionsRef:_t(),disabled:o,orientation:a,options:[],searchQuery:\"\",activeOptionIndex:null}),[{listboxState:s,propsRef:u,optionsRef:c,buttonRef:m},b]=l;x(()=>{u.current.value=t},[t,u]),x(()=>{u.current.onChange=r},[r,u]),x(()=>b({type:2,disabled:o}),[o]),x(()=>b({type:3,orientation:a}),[a]),w(\"mousedown\",y=>{var f,d,P;let p=y.target;s===0&&(((f=m.current)==null?void 0:f.contains(p))||((d=c.current)==null?void 0:d.contains(p))||(b({type:1}),de(p,1)||(y.preventDefault(),(P=m.current)==null||P.focus())))});let T=ve(()=>({open:s===0,disabled:o}),[s,o]);return Oo.createElement(Gt.Provider,{value:l},Oo.createElement(W,{value:S(s,{[0]:0,[1]:1})},E({props:i,slot:T,defaultTag:qn,name:\"Listbox\"})))}var zn=\"button\",Yn=D(function(t,r){var p;let[o,n]=Re(\"Listbox.Button\"),i=I(o.buttonRef,r),a=`headlessui-listbox-button-${A()}`,l=Q(),s=z(f=>{switch(f.key){case\" \":case\"Enter\":case\"ArrowDown\":f.preventDefault(),n({type:0}),l.nextFrame(()=>{o.propsRef.current.value||n({type:4,focus:0})});break;case\"ArrowUp\":f.preventDefault(),n({type:0}),l.nextFrame(()=>{o.propsRef.current.value||n({type:4,focus:3})});break}},[n,o,l]),u=z(f=>{switch(f.key){case\" \":f.preventDefault();break}},[]),c=z(f=>{if(G(f.currentTarget))return f.preventDefault();o.listboxState===0?(n({type:1}),l.nextFrame(()=>{var d;return(d=o.buttonRef.current)==null?void 0:d.focus({preventScroll:!0})})):(f.preventDefault(),n({type:0}))},[n,l,o]),m=ee(()=>{if(!!o.labelRef.current)return[o.labelRef.current.id,a].join(\" \")},[o.labelRef.current,a]),b=ve(()=>({open:o.listboxState===0,disabled:o.disabled}),[o]),T=t,y={ref:i,id:a,type:U(t,o.buttonRef),\"aria-haspopup\":!0,\"aria-controls\":(p=o.optionsRef.current)==null?void 0:p.id,\"aria-expanded\":o.disabled?void 0:o.listboxState===0,\"aria-labelledby\":m,disabled:o.disabled,onKeyDown:s,onKeyUp:u,onClick:c};return E({props:{...T,...y},slot:b,defaultTag:zn,name:\"Listbox.Button\"})}),Xn=\"label\";function Jn(e){let[t]=Re(\"Listbox.Label\"),r=`headlessui-listbox-label-${A()}`,o=z(()=>{var a;return(a=t.buttonRef.current)==null?void 0:a.focus({preventScroll:!0})},[t.buttonRef]),n=ve(()=>({open:t.listboxState===0,disabled:t.disabled}),[t]),i={ref:t.labelRef,id:r,onClick:o};return E({props:{...e,...i},slot:n,defaultTag:Xn,name:\"Listbox.Label\"})}var Zn=\"ul\",ei=1|2,ti=D(function(t,r){var f;let[o,n]=Re(\"Listbox.Options\"),i=I(o.optionsRef,r),a=`headlessui-listbox-options-${A()}`,l=Q(),s=Q(),u=_(),c=(()=>u!==null?u===0:o.listboxState===0)();x(()=>{let d=o.optionsRef.current;!d||o.listboxState===0&&d!==document.activeElement&&d.focus({preventScroll:!0})},[o.listboxState,o.optionsRef]);let m=z(d=>{switch(s.dispose(),d.key){case\" \":if(o.searchQuery!==\"\")return d.preventDefault(),d.stopPropagation(),n({type:5,value:d.key});case\"Enter\":if(d.preventDefault(),d.stopPropagation(),n({type:1}),o.activeOptionIndex!==null){let{dataRef:P}=o.options[o.activeOptionIndex];o.propsRef.current.onChange(P.current.value)}k().nextFrame(()=>{var P;return(P=o.buttonRef.current)==null?void 0:P.focus({preventScroll:!0})});break;case S(o.orientation,{vertical:\"ArrowDown\",horizontal:\"ArrowRight\"}):return d.preventDefault(),d.stopPropagation(),n({type:4,focus:2});case S(o.orientation,{vertical:\"ArrowUp\",horizontal:\"ArrowLeft\"}):return d.preventDefault(),d.stopPropagation(),n({type:4,focus:1});case\"Home\":case\"PageUp\":return d.preventDefault(),d.stopPropagation(),n({type:4,focus:0});case\"End\":case\"PageDown\":return d.preventDefault(),d.stopPropagation(),n({type:4,focus:3});case\"Escape\":return d.preventDefault(),d.stopPropagation(),n({type:1}),l.nextFrame(()=>{var P;return(P=o.buttonRef.current)==null?void 0:P.focus({preventScroll:!0})});case\"Tab\":d.preventDefault(),d.stopPropagation();break;default:d.key.length===1&&(n({type:5,value:d.key}),s.setTimeout(()=>n({type:6}),350));break}},[l,n,s,o]),b=ee(()=>{var d,P,C;return(C=(d=o.labelRef.current)==null?void 0:d.id)!=null?C:(P=o.buttonRef.current)==null?void 0:P.id},[o.labelRef.current,o.buttonRef.current]),T=ve(()=>({open:o.listboxState===0}),[o]),y={\"aria-activedescendant\":o.activeOptionIndex===null||(f=o.options[o.activeOptionIndex])==null?void 0:f.id,\"aria-labelledby\":b,\"aria-orientation\":o.orientation,id:a,onKeyDown:m,role:\"listbox\",tabIndex:0,ref:i};return E({props:{...t,...y},slot:T,defaultTag:Zn,features:ei,visible:c,name:\"Listbox.Options\"})}),oi=\"li\";function ri(e){let{disabled:t=!1,value:r,...o}=e,[n,i]=Re(\"Listbox.Option\"),a=`headlessui-listbox-option-${A()}`,l=n.activeOptionIndex!==null?n.options[n.activeOptionIndex].id===a:!1,s=n.propsRef.current.value===r,u=Vn({disabled:t,value:r});x(()=>{u.current.disabled=t},[u,t]),x(()=>{u.current.value=r},[u,r]),x(()=>{var d,P;u.current.textValue=(P=(d=document.getElementById(a))==null?void 0:d.textContent)==null?void 0:P.toLowerCase()},[u,a]);let c=z(()=>n.propsRef.current.onChange(r),[n.propsRef,r]);x(()=>(i({type:7,id:a,dataRef:u}),()=>i({type:8,id:a})),[u,a]),x(()=>{var d,P;n.listboxState===0&&(!s||(i({type:4,focus:4,id:a}),(P=(d=document.getElementById(a))==null?void 0:d.focus)==null||P.call(d)))},[n.listboxState]),x(()=>{if(n.listboxState!==0||!l)return;let d=k();return d.requestAnimationFrame(()=>{var P,C;(C=(P=document.getElementById(a))==null?void 0:P.scrollIntoView)==null||C.call(P,{block:\"nearest\"})}),d.dispose},[a,l,n.listboxState,n.activeOptionIndex]);let m=z(d=>{if(t)return d.preventDefault();c(),i({type:1}),k().nextFrame(()=>{var P;return(P=n.buttonRef.current)==null?void 0:P.focus({preventScroll:!0})})},[i,n.buttonRef,t,c]),b=z(()=>{if(t)return i({type:4,focus:5});i({type:4,focus:4,id:a})},[t,a,i]),T=z(()=>{t||l||i({type:4,focus:4,id:a})},[t,l,a,i]),y=z(()=>{t||!l||i({type:4,focus:5})},[t,l,i]),p=ve(()=>({active:l,selected:s,disabled:t}),[l,s,t]);return E({props:{...o,...{id:a,role:\"option\",tabIndex:t===!0?void 0:-1,\"aria-disabled\":t===!0?!0:void 0,\"aria-selected\":s===!0?!0:void 0,disabled:void 0,onClick:m,onFocus:b,onPointerMove:T,onMouseMove:T,onPointerLeave:y,onMouseLeave:y}},slot:p,defaultTag:oi,name:\"Listbox.Option\"})}Ee.Button=Yn;Ee.Label=Jn;Ee.Options=ti;Ee.Option=ri;import Io,{Fragment as Lo,createContext as ni,createRef as Do,useCallback as Y,useContext as ii,useEffect as li,useMemo as Xe,useReducer as ai,useRef as si}from\"react\";var ui={[1](e){return e.menuState===1?e:{...e,activeItemIndex:null,menuState:1}},[0](e){return e.menuState===0?e:{...e,menuState:0}},[2]:(e,t)=>{let r=ae(t,{resolveItems:()=>e.items,resolveActiveIndex:()=>e.activeItemIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled});return e.searchQuery===\"\"&&e.activeItemIndex===r?e:{...e,searchQuery:\"\",activeItemIndex:r}},[3]:(e,t)=>{let o=e.searchQuery!==\"\"?0:1,n=e.searchQuery+t.value.toLowerCase(),a=(e.activeItemIndex!==null?e.items.slice(e.activeItemIndex+o).concat(e.items.slice(0,e.activeItemIndex+o)):e.items).find(s=>{var u;return((u=s.dataRef.current.textValue)==null?void 0:u.startsWith(n))&&!s.dataRef.current.disabled}),l=a?e.items.indexOf(a):-1;return l===-1||l===e.activeItemIndex?{...e,searchQuery:n}:{...e,searchQuery:n,activeItemIndex:l}},[4](e){return e.searchQuery===\"\"?e:{...e,searchQuery:\"\",searchActiveItemIndex:null}},[5]:(e,t)=>{var n;let r=Array.from((n=e.itemsRef.current)==null?void 0:n.querySelectorAll('[id^=\"headlessui-menu-item-\"]')).reduce((i,a,l)=>Object.assign(i,{[a.id]:l}),{}),o=[...e.items,{id:t.id,dataRef:t.dataRef}].sort((i,a)=>r[i.id]-r[a.id]);return{...e,items:o}},[6]:(e,t)=>{let r=e.items.slice(),o=e.activeItemIndex!==null?r[e.activeItemIndex]:null,n=r.findIndex(i=>i.id===t.id);return n!==-1&&r.splice(n,1),{...e,items:r,activeItemIndex:(()=>n===e.activeItemIndex||o===null?null:r.indexOf(o))()}}},Ht=ni(null);Ht.displayName=\"MenuContext\";function Je(e){let t=ii(Ht);if(t===null){let r=new Error(`<${e} /> is missing a parent <${Ze.name} /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Je),r}return t}function pi(e,t){return S(t.type,ui,e,t)}var di=Lo;function Ze(e){let t=ai(pi,{menuState:1,buttonRef:Do(),itemsRef:Do(),items:[],searchQuery:\"\",activeItemIndex:null}),[{menuState:r,itemsRef:o,buttonRef:n},i]=t;w(\"mousedown\",l=>{var u,c,m;let s=l.target;r===0&&(((u=n.current)==null?void 0:u.contains(s))||((c=o.current)==null?void 0:c.contains(s))||(i({type:1}),de(s,1)||(l.preventDefault(),(m=n.current)==null||m.focus())))});let a=Xe(()=>({open:r===0}),[r]);return Io.createElement(Ht.Provider,{value:t},Io.createElement(W,{value:S(r,{[0]:0,[1]:1})},E({props:e,slot:a,defaultTag:di,name:\"Menu\"})))}var ci=\"button\",fi=D(function(t,r){var y;let[o,n]=Je(\"Menu.Button\"),i=I(o.buttonRef,r),a=`headlessui-menu-button-${A()}`,l=Q(),s=Y(p=>{switch(p.key){case\" \":case\"Enter\":case\"ArrowDown\":p.preventDefault(),p.stopPropagation(),n({type:0}),l.nextFrame(()=>n({type:2,focus:0}));break;case\"ArrowUp\":p.preventDefault(),p.stopPropagation(),n({type:0}),l.nextFrame(()=>n({type:2,focus:3}));break}},[n,l]),u=Y(p=>{switch(p.key){case\" \":p.preventDefault();break}},[]),c=Y(p=>{if(G(p.currentTarget))return p.preventDefault();t.disabled||(o.menuState===0?(n({type:1}),l.nextFrame(()=>{var f;return(f=o.buttonRef.current)==null?void 0:f.focus({preventScroll:!0})})):(p.preventDefault(),p.stopPropagation(),n({type:0})))},[n,l,o,t.disabled]),m=Xe(()=>({open:o.menuState===0}),[o]),b=t,T={ref:i,id:a,type:U(t,o.buttonRef),\"aria-haspopup\":!0,\"aria-controls\":(y=o.itemsRef.current)==null?void 0:y.id,\"aria-expanded\":t.disabled?void 0:o.menuState===0,onKeyDown:s,onKeyUp:u,onClick:c};return E({props:{...b,...T},slot:m,defaultTag:ci,name:\"Menu.Button\"})}),mi=\"div\",bi=1|2,Ti=D(function(t,r){var p,f;let[o,n]=Je(\"Menu.Items\"),i=I(o.itemsRef,r),a=`headlessui-menu-items-${A()}`,l=Q(),s=_(),u=(()=>s!==null?s===0:o.menuState===0)();li(()=>{let d=o.itemsRef.current;!d||o.menuState===0&&d!==document.activeElement&&d.focus({preventScroll:!0})},[o.menuState,o.itemsRef]),se({container:o.itemsRef.current,enabled:o.menuState===0,accept(d){return d.getAttribute(\"role\")===\"menuitem\"?NodeFilter.FILTER_REJECT:d.hasAttribute(\"role\")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(d){d.setAttribute(\"role\",\"none\")}});let c=Y(d=>{var P;switch(l.dispose(),d.key){case\" \":if(o.searchQuery!==\"\")return d.preventDefault(),d.stopPropagation(),n({type:3,value:d.key});case\"Enter\":if(d.preventDefault(),d.stopPropagation(),n({type:1}),o.activeItemIndex!==null){let{id:C}=o.items[o.activeItemIndex];(P=document.getElementById(C))==null||P.click()}k().nextFrame(()=>{var C;return(C=o.buttonRef.current)==null?void 0:C.focus({preventScroll:!0})});break;case\"ArrowDown\":return d.preventDefault(),d.stopPropagation(),n({type:2,focus:2});case\"ArrowUp\":return d.preventDefault(),d.stopPropagation(),n({type:2,focus:1});case\"Home\":case\"PageUp\":return d.preventDefault(),d.stopPropagation(),n({type:2,focus:0});case\"End\":case\"PageDown\":return d.preventDefault(),d.stopPropagation(),n({type:2,focus:3});case\"Escape\":d.preventDefault(),d.stopPropagation(),n({type:1}),k().nextFrame(()=>{var C;return(C=o.buttonRef.current)==null?void 0:C.focus({preventScroll:!0})});break;case\"Tab\":d.preventDefault(),d.stopPropagation();break;default:d.key.length===1&&(n({type:3,value:d.key}),l.setTimeout(()=>n({type:4}),350));break}},[n,l,o]),m=Y(d=>{switch(d.key){case\" \":d.preventDefault();break}},[]),b=Xe(()=>({open:o.menuState===0}),[o]),T={\"aria-activedescendant\":o.activeItemIndex===null||(p=o.items[o.activeItemIndex])==null?void 0:p.id,\"aria-labelledby\":(f=o.buttonRef.current)==null?void 0:f.id,id:a,onKeyDown:c,onKeyUp:m,role:\"menu\",tabIndex:0,ref:i};return E({props:{...t,...T},slot:b,defaultTag:mi,features:bi,visible:u,name:\"Menu.Items\"})}),yi=Lo;function gi(e){let{disabled:t=!1,onClick:r,...o}=e,[n,i]=Je(\"Menu.Item\"),a=`headlessui-menu-item-${A()}`,l=n.activeItemIndex!==null?n.items[n.activeItemIndex].id===a:!1;x(()=>{if(n.menuState!==0||!l)return;let p=k();return p.requestAnimationFrame(()=>{var f,d;(d=(f=document.getElementById(a))==null?void 0:f.scrollIntoView)==null||d.call(f,{block:\"nearest\"})}),p.dispose},[a,l,n.menuState,n.activeItemIndex]);let s=si({disabled:t});x(()=>{s.current.disabled=t},[s,t]),x(()=>{var p,f;s.current.textValue=(f=(p=document.getElementById(a))==null?void 0:p.textContent)==null?void 0:f.toLowerCase()},[s,a]),x(()=>(i({type:5,id:a,dataRef:s}),()=>i({type:6,id:a})),[s,a]);let u=Y(p=>{if(t)return p.preventDefault();if(i({type:1}),k().nextFrame(()=>{var f;return(f=n.buttonRef.current)==null?void 0:f.focus({preventScroll:!0})}),r)return r(p)},[i,n.buttonRef,t,r]),c=Y(()=>{if(t)return i({type:2,focus:5});i({type:2,focus:4,id:a})},[t,a,i]),m=Y(()=>{t||l||i({type:2,focus:4,id:a})},[t,l,a,i]),b=Y(()=>{t||!l||i({type:2,focus:5})},[t,l,i]),T=Xe(()=>({active:l,disabled:t}),[l,t]);return E({props:{...o,...{id:a,role:\"menuitem\",tabIndex:t===!0?void 0:-1,\"aria-disabled\":t===!0?!0:void 0,disabled:void 0,onClick:u,onFocus:c,onPointerMove:m,onMouseMove:m,onPointerLeave:b,onMouseLeave:b}},slot:T,defaultTag:yi,name:\"Menu.Item\"})}Ze.Button=fi;Ze.Items=Ti;Ze.Item=gi;import Ce,{createContext as et,useCallback as j,useContext as tt,useEffect as be,useMemo as Z,useReducer as Pi,useRef as Se,useState as xi}from\"react\";var vi={[0]:e=>({...e,popoverState:S(e.popoverState,{[0]:1,[1]:0})}),[1](e){return e.popoverState===1?e:{...e,popoverState:1}},[2](e,t){return e.button===t.button?e:{...e,button:t.button}},[3](e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},[4](e,t){return e.panel===t.panel?e:{...e,panel:t.panel}},[5](e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}}},Ut=et(null);Ut.displayName=\"PopoverContext\";function ot(e){let t=tt(Ut);if(t===null){let r=new Error(`<${e} /> is missing a parent <${Te.name} /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,ot),r}return t}var Bt=et(null);Bt.displayName=\"PopoverAPIContext\";function Mo(e){let t=tt(Bt);if(t===null){let r=new Error(`<${e} /> is missing a parent <${Te.name} /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Mo),r}return t}var Nt=et(null);Nt.displayName=\"PopoverGroupContext\";function Fo(){return tt(Nt)}var Wt=et(null);Wt.displayName=\"PopoverPanelContext\";function Ri(){return tt(Wt)}function Ei(e,t){return S(t.type,vi,e,t)}var Ci=\"div\";function Te(e){let t=`headlessui-popover-button-${A()}`,r=`headlessui-popover-panel-${A()}`,o=Pi(Ei,{popoverState:1,button:null,buttonId:t,panel:null,panelId:r}),[{popoverState:n,button:i,panel:a},l]=o;be(()=>l({type:3,buttonId:t}),[t,l]),be(()=>l({type:5,panelId:r}),[r,l]);let s=Z(()=>({buttonId:t,panelId:r,close:()=>l({type:1})}),[t,r,l]),u=Fo(),c=u==null?void 0:u.registerPopover,m=j(()=>{var p;return(p=u==null?void 0:u.isFocusWithinPopoverGroup())!=null?p:(i==null?void 0:i.contains(document.activeElement))||(a==null?void 0:a.contains(document.activeElement))},[u,i,a]);be(()=>c==null?void 0:c(s),[c,s]),w(\"focus\",()=>{n===0&&(m()||!i||!a||l({type:1}))},!0),w(\"mousedown\",p=>{let f=p.target;n===0&&((i==null?void 0:i.contains(f))||(a==null?void 0:a.contains(f))||(l({type:1}),de(f,1)||(p.preventDefault(),i==null||i.focus())))});let b=j(p=>{l({type:1});let f=(()=>p?p instanceof HTMLElement?p:p.current instanceof HTMLElement?p.current:i:i)();f==null||f.focus()},[l,i]),T=Z(()=>({close:b}),[b]),y=Z(()=>({open:n===0,close:b}),[n,b]);return Ce.createElement(Ut.Provider,{value:o},Ce.createElement(Bt.Provider,{value:T},Ce.createElement(W,{value:S(n,{[0]:0,[1]:1})},E({props:e,slot:y,defaultTag:Ci,name:\"Popover\"}))))}var Si=\"button\",Ai=D(function(t,r){let[o,n]=ot(\"Popover.Button\"),i=Se(null),a=Fo(),l=a==null?void 0:a.closeOthers,s=Ri(),u=s===null?!1:s===o.panelId,c=I(i,r,u?null:g=>n({type:2,button:g})),m=I(i,r),b=Se(null),T=Se(typeof window==\"undefined\"?null:document.activeElement);w(\"focus\",()=>{T.current=b.current,b.current=document.activeElement},!0);let y=j(g=>{var v,h;if(u){if(o.popoverState===1)return;switch(g.key){case\" \":case\"Enter\":g.preventDefault(),g.stopPropagation(),n({type:1}),(v=o.button)==null||v.focus();break}}else switch(g.key){case\" \":case\"Enter\":g.preventDefault(),g.stopPropagation(),o.popoverState===1&&(l==null||l(o.buttonId)),n({type:0});break;case\"Escape\":if(o.popoverState!==0)return l==null?void 0:l(o.buttonId);if(!i.current||!i.current.contains(document.activeElement))return;g.preventDefault(),g.stopPropagation(),n({type:1});break;case\"Tab\":if(o.popoverState!==0||!o.panel||!o.button)return;if(g.shiftKey){if(!T.current||((h=o.button)==null?void 0:h.contains(T.current))||o.panel.contains(T.current))return;let O=xe(),L=O.indexOf(T.current);if(O.indexOf(o.button)>L)return;g.preventDefault(),g.stopPropagation(),M(o.panel,8)}else g.preventDefault(),g.stopPropagation(),M(o.panel,1);break}},[n,o.popoverState,o.buttonId,o.button,o.panel,i,l,u]),p=j(g=>{var v;if(!u&&(g.key===\" \"&&g.preventDefault(),o.popoverState===0&&!!o.panel&&!!o.button))switch(g.key){case\"Tab\":if(!T.current||((v=o.button)==null?void 0:v.contains(T.current))||o.panel.contains(T.current))return;let h=xe(),O=h.indexOf(T.current);if(h.indexOf(o.button)>O)return;g.preventDefault(),g.stopPropagation(),M(o.panel,8);break}},[o.popoverState,o.panel,o.button,u]),f=j(g=>{var v,h;G(g.currentTarget)||t.disabled||(u?(n({type:1}),(v=o.button)==null||v.focus()):(o.popoverState===1&&(l==null||l(o.buttonId)),(h=o.button)==null||h.focus(),n({type:0})))},[n,o.button,o.popoverState,o.buttonId,t.disabled,l,u]),d=Z(()=>({open:o.popoverState===0}),[o]),P=U(t,i),C=t,R=u?{ref:m,type:P,onKeyDown:y,onClick:f}:{ref:c,id:o.buttonId,type:P,\"aria-expanded\":t.disabled?void 0:o.popoverState===0,\"aria-controls\":o.panel?o.panelId:void 0,onKeyDown:y,onKeyUp:p,onClick:f};return E({props:{...C,...R},slot:d,defaultTag:Si,name:\"Popover.Button\"})}),hi=\"div\",Oi=1|2,Ii=D(function(t,r){let[{popoverState:o},n]=ot(\"Popover.Overlay\"),i=I(r),a=`headlessui-popover-overlay-${A()}`,l=_(),s=(()=>l!==null?l===0:o===0)(),u=j(T=>{if(G(T.currentTarget))return T.preventDefault();n({type:1})},[n]),c=Z(()=>({open:o===0}),[o]);return E({props:{...t,...{ref:i,id:a,\"aria-hidden\":!0,onClick:u}},slot:c,defaultTag:hi,features:Oi,visible:s,name:\"Popover.Overlay\"})}),Li=\"div\",Di=1|2,Mi=D(function(t,r){let{focus:o=!1,...n}=t,[i,a]=ot(\"Popover.Panel\"),{close:l}=Mo(\"Popover.Panel\"),s=Se(null),u=I(s,r,p=>{a({type:4,panel:p})}),c=_(),m=(()=>c!==null?c===0:i.popoverState===0)(),b=j(p=>{var f;switch(p.key){case\"Escape\":if(i.popoverState!==0||!s.current||!s.current.contains(document.activeElement))return;p.preventDefault(),p.stopPropagation(),a({type:1}),(f=i.button)==null||f.focus();break}},[i,s,a]);be(()=>()=>a({type:4,panel:null}),[a]),be(()=>{var p;t.static||i.popoverState===1&&((p=t.unmount)!=null?p:!0)&&a({type:4,panel:null})},[i.popoverState,t.unmount,t.static,a]),be(()=>{if(!o||i.popoverState!==0||!s.current)return;let p=document.activeElement;s.current.contains(p)||M(s.current,1)},[o,s,i.popoverState]),w(\"keydown\",p=>{var d;if(i.popoverState!==0||!s.current||p.key!==\"Tab\"||!document.activeElement||!s.current||!s.current.contains(document.activeElement))return;p.preventDefault();let f=M(s.current,p.shiftKey?2:4);if(f===3)return(d=i.button)==null?void 0:d.focus();if(f===1){if(!i.button)return;let P=xe(),C=P.indexOf(i.button),R=P.splice(C+1).filter(g=>{var v;return!((v=s.current)==null?void 0:v.contains(g))});M(R,1)===0&&M(document.body,1)}}),w(\"focus\",()=>{var p;!o||i.popoverState===0&&(!s.current||((p=s.current)==null?void 0:p.contains(document.activeElement))||a({type:1}))},!0);let T=Z(()=>({open:i.popoverState===0,close:l}),[i,l]),y={ref:u,id:i.panelId,onKeyDown:b};return Ce.createElement(Wt.Provider,{value:i.panelId},E({props:{...n,...y},slot:T,defaultTag:Li,features:Di,visible:m,name:\"Popover.Panel\"}))}),Fi=\"div\";function wi(e){let t=Se(null),[r,o]=xi([]),n=j(b=>{o(T=>{let y=T.indexOf(b);if(y!==-1){let p=T.slice();return p.splice(y,1),p}return T})},[o]),i=j(b=>(o(T=>[...T,b]),()=>n(b)),[o,n]),a=j(()=>{var T;let b=document.activeElement;return((T=t.current)==null?void 0:T.contains(b))?!0:r.some(y=>{var p,f;return((p=document.getElementById(y.buttonId))==null?void 0:p.contains(b))||((f=document.getElementById(y.panelId))==null?void 0:f.contains(b))})},[t,r]),l=j(b=>{for(let T of r)T.buttonId!==b&&T.close()},[r]),s=Z(()=>({registerPopover:i,unregisterPopover:n,isFocusWithinPopoverGroup:a,closeOthers:l}),[i,n,a,l]),u=Z(()=>({}),[]),c={ref:t},m=e;return Ce.createElement(Nt.Provider,{value:s},E({props:{...m,...c},slot:u,defaultTag:Fi,name:\"Popover.Group\"}))}Te.Button=Ai;Te.Overlay=Ii;Te.Panel=Mi;Te.Group=wi;import he,{createContext as Wi,useCallback as ye,useContext as Ki,useMemo as it,useReducer as ji,useRef as Kt}from\"react\";import{useState as ki,useCallback as rt}from\"react\";function wo(e=0){let[t,r]=ki(e),o=rt(l=>r(s=>s|l),[r]),n=rt(l=>Boolean(t&l),[t]),i=rt(l=>r(s=>s&~l),[r]),a=rt(l=>r(s=>s^l),[r]);return{addFlag:o,hasFlag:n,removeFlag:i,toggleFlag:a}}import _i,{createContext as Gi,useCallback as Hi,useContext as Ui,useMemo as ko,useState as Bi}from\"react\";var _o=Gi(null);function Go(){let e=Ui(_o);if(e===null){let t=new Error(\"You used a