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YACzB,SAAS;QACX,CAAC;QACD,QAAQ,IAAI,CAAC,KAAK,EAAE,CAAC;YACnB,kGAAkG;YAClG,KAAK,IAAI,CAAC;YACV,KAAK,SAAS,CAAC;YACf,KAAK,EAAE,CAAC;YACR,KAAK,QAAQ,CAAC;YACd,KAAK,iBAAiB,CAAC;YACvB,KAAK,wBAAwB,CAAC;YAC9B,KAAK,wBAAwB,CAAC;YAC9B,KAAK,0BAA0B,CAAC;YAChC,KAAK,0BAA0B,CAAC;YAChC,KAAK,iBAAiB,CAAC;YACvB,KAAK,oBAAoB,CAAC;YAC1B,KAAK,oBAAoB,CAAC;YAC1B,KAAK,oBAAoB,CAAC;YAC1B,KAAK,oBAAoB,CAAC;YAC1B,KAAK,oBAAoB,CAAC;YAC1B,KAAK,oBAAoB,CAAC;YAC1B,KAAK,cAAc,CAAC;YACpB,KAAK,iBAAiB,CAAC;YACvB,KAAK,mBAAmB,CAAC;YACzB,KAAK,mBAAmB;gBACtB,kDAAkD;gBAClD,OAAO,IAAI,CAAC;YACd;gBACE,YAAY,GAAG,IAAI,CAAC;QACxB,CAAC;IACH,CAAC;IACD,4EAA4E;IAC5E,uEAAuE;IACvE,oBAAoB;IACpB,4EAA4E;IAC5E,uBAAuB;IACvB,MAAM,WAAW,GAAG,CAAC,YAAY,CAAC;IAClC,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["/// <reference lib=\"dom\" />\n\n/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport type {TemplateResult, ChildPart, CompiledTemplateResult} from 'lit';\nimport type {Directive} from 'lit/directive.js';\n\nimport {nothing, noChange} from 'lit';\nimport {PartType} from 'lit/directive.js';\nimport {\n isPrimitive,\n isTemplateResult,\n getDirectiveClass,\n TemplateResultType,\n isCompiledTemplateResult,\n} from 'lit/directive-helpers.js';\nimport {_$LH} from 'lit-html/private-ssr-support.js';\n\nconst {\n getTemplateHtml,\n marker,\n markerMatch,\n boundAttributeSuffix,\n patchDirectiveResolve,\n getAttributePartCommittedValue,\n resolveDirective,\n AttributePart,\n PropertyPart,\n BooleanAttributePart,\n EventPart,\n connectedDisconnectable,\n isIterable,\n} = _$LH;\n\nimport {digestForTemplateResult} from '@lit-labs/ssr-client';\nimport {HTMLElement, HTMLElementWithEventMeta} from '@lit-labs/ssr-dom-shim';\n\nimport {\n ElementRenderer,\n ElementRendererConstructor,\n getElementRenderer,\n} from './element-renderer.js';\n\nimport {escapeHtml} from './util/escape-html.js';\n\nimport {parseFragment, parse} from 'parse5';\nimport {\n isElementNode,\n isCommentNode,\n traverse,\n isTextNode,\n isTemplateNode,\n Template,\n Element,\n} from '@parse5/tools';\n\nimport {isRenderLightDirective} from '@lit-labs/ssr-client/directives/render-light.js';\nimport {reflectedAttributeName} from './reflected-attributes.js';\n\nimport type {RenderResult} from './render-result.js';\nimport {isHydratable} from './server-template.js';\nimport type {Part} from 'lit-html';\n\ndeclare module 'parse5/dist/tree-adapters/default.js' {\n interface Element {\n isDefinedCustomElement?: boolean;\n }\n}\n\nfunction ssrResolve(this: Directive, _part: Part, values: unknown[]) {\n // Since the return value may also be a directive result in the case of nested\n // directives, we may need to patch that as well.\n return patchIfDirective(this.render(...values));\n}\n\n/**\n * Looks for values of type `DirectiveResult` and patches its Directive class\n * such that it calls `render` rather than `update`.\n */\nconst patchIfDirective = (value: unknown) => {\n const directiveCtor = getDirectiveClass(value);\n if (directiveCtor !== undefined) {\n patchDirectiveResolve(directiveCtor, ssrResolve);\n }\n return value;\n};\n\n/**\n * Patches `DirectiveResult` `Directive` classes for AttributePart values, which\n * may be an array\n */\nconst patchAnyDirectives = (\n part: InstanceType<typeof AttributePart>,\n value: unknown,\n valueIndex: number\n) => {\n if (part.strings !== undefined) {\n for (let i = 0; i < part.strings.length - 1; i++) {\n patchIfDirective((value as unknown[])[valueIndex + i]);\n }\n } else {\n patchIfDirective(value);\n }\n};\n\nconst templateCache = new WeakMap<TemplateStringsArray, Array<Op>>();\n\n// This is a map for which slots exist for a given custom element.\n// With a named slot, it is represented as a string with the name\n// and the unnamed slot is represented as undefined.\nconst elementSlotMap = new WeakMap<\n HTMLElement,\n Map<string | undefined, HTMLSlotElement>\n>();\n\n// We want the slot element to be able to be identified.\nclass HTMLSlotElement extends HTMLElement {\n name!: string;\n override get localName(): string {\n return 'slot';\n }\n}\n\n/**\n * Operation to output static text\n */\ntype TextOp = {\n type: 'text';\n value: string;\n};\n\n/**\n * Operation to output dynamic text from the associated template result value\n */\ntype ChildPartOp = {\n type: 'child-part';\n index: number;\n useCustomElementInstance?: boolean;\n};\n\n/**\n * Operation to output an attribute with bindings. Includes all bindings for an\n * attribute.\n */\ntype AttributePartOp = {\n type: 'attribute-part';\n index: number;\n name: string;\n ctor: typeof AttributePart;\n strings: Array<string>;\n tagName: string;\n useCustomElementInstance?: boolean;\n};\n\n/**\n * Operation for an element binding. Although we only support directives in\n * element position which cannot emit anything, the opcode needs to index past\n * the part value\n */\ntype ElementPartOp = {\n type: 'element-part';\n index: number;\n};\n\n/**\n * Operator to create a custom element instance.\n */\ntype CustomElementOpenOp = {\n type: 'custom-element-open';\n tagName: string;\n ctor: {new (): HTMLElement};\n staticAttributes: Map<string, string>;\n};\n\n/**\n * Operation to render a custom element's attributes. This is separate from\n * `custom-element-open` because attribute/property parts go in between and need\n * to run and be set on the instance before we render the element's final\n * attributes.\n */\ntype CustomElementAttributesOp = {\n type: 'custom-element-attributes';\n};\n\n/**\n * Operation to render a custom element's children, usually its shadow root.\n */\ntype CustomElementShadowOp = {\n type: 'custom-element-shadow';\n};\n\n/**\n * Operation to close a custom element so that its no longer available for\n * bindings.\n */\ntype CustomElementClosedOp = {\n type: 'custom-element-close';\n};\n\n/**\n * Operation to mark an open slot.\n */\ntype SlotElementOpenOp = {\n type: 'slot-element-open';\n name: string | undefined;\n};\n\n/**\n * Operation to mark a slot as closed.\n */\ntype SlotElementCloseOp = {\n type: 'slot-element-close';\n};\n\n/**\n * Operation to mark a slotted element as open. We do this by checking\n * direct children of custom elements for the absence or presence of\n * the slot attribute. The absence of the slot attribute (i.e. unnamed slot)\n * is represented by undefined.\n */\ntype SlottedElementOpenOp = {\n type: 'slotted-element-open';\n name: string | undefined;\n};\n\n/**\n * Operation to mark a slotted element as closed.\n */\ntype SlottedElementCloseOp = {\n type: 'slotted-element-close';\n};\n\n/**\n * Operation to possibly emit the `<!--lit-node-->` marker; the operation\n * always emits if there were attribute parts, and may emit if the node\n * was a custom element and it needed `defer-hydration` because it was\n * rendered in the shadow root of another custom element host; we don't\n * know the latter at opcode generation time, and so that test is done at\n * runtime in the opcode.\n */\ntype PossibleNodeMarkerOp = {\n type: 'possible-node-marker';\n boundAttributesCount: number;\n nodeIndex: number;\n};\n\ntype Op =\n | TextOp\n | ChildPartOp\n | AttributePartOp\n | ElementPartOp\n | CustomElementOpenOp\n | CustomElementAttributesOp\n | CustomElementShadowOp\n | CustomElementClosedOp\n | SlotElementOpenOp\n | SlotElementCloseOp\n | SlottedElementOpenOp\n | SlottedElementCloseOp\n | PossibleNodeMarkerOp;\n\n/**\n * Any of these top level tags will be removed by parse5's `parseFragment` and\n * will cause part errors if there are any part bindings. For only the `html`,\n * `head`, and `body` tags, we use a page-level template `parse`.\n */\nconst REGEXP_TEMPLATE_HAS_TOP_LEVEL_PAGE_TAG =\n /^(\\s|<!--[^(-->)]*-->)*(<(!doctype|html|head|body))/i;\n\n/**\n * For a given TemplateResult, generates and/or returns a cached list of opcodes\n * for the associated Template. Opcodes are designed to allow emitting\n * contiguous static text from the template as much as possible, with specific\n * non-`text` opcodes interleaved to perform dynamic work, such as emitting\n * values for ChildParts or AttributeParts, and handling custom elements.\n *\n * For the following example template, an opcode list may look like this:\n *\n * ```js\n * html`<div><span>Hello</span><span class=${'bold'}>${template()}</span></div>`\n * ```\n *\n * - `text`\n * - Emit run of static text: `<div><span>Hello</span>`\n * - `possible-node-marker`\n * - Emit `<!--lit-node n-->` marker since there are attribute parts\n * - `text`\n * - Emit run of static text: `<span`\n * - `attribute-part`\n * - Emit an AttributePart's value, e.g. ` class=\"bold\"`\n * - `text`\n * - Emit run of static text: `>`\n * - `child-part`\n * - Emit the ChildPart's value, in this case a TemplateResult, thus we\n * recurse into that template's opcodes\n * - `text`\n * - Emit run of static text: `/span></div>`\n *\n * When a custom-element is encountered, the flow looks like this:\n *\n * ```js\n * html`<x-foo staticAttr dynamicAttr=${value}><div>child</div>...</x-foo>`\n * ```\n *\n * - `possible-node-marker`\n * - Emit `<!--lit-node n-->` marker since there are attribute parts and we\n * may emit the `defer-hydration` attribute on the node that follows\n * - `text`\n * - Emit open tag `<x-foo`\n * - `custom-element-open`\n * - Create the CE `instance`+`renderer` and put on\n * `customElementInstanceStack`\n * - Call `renderer.setAttribute()` for any `staticAttributes` (e.g.\n * 'staticAttr`)\n * - `attribute-part`(s)\n * - Call `renderer.setAttribute()` or `renderer.setProperty()` for\n * `AttributePart`/`PropertyPart`s (e.g. for `dynamicAttr`)\n * - `custom-element-attributes`\n * - Call `renderer.connectedCallback()`\n * - Emit `renderer.renderAttributes()`\n * - `text`\n * - Emit end of open tag `>`\n * - `custom-element-shadow`\n * - Emit `renderer.renderShadow()` (emits `<template shadowroot>` +\n * recurses to emit `render()`)\n * - `text`\n * - Emit run of static text within tag: `<div>child</div>...`\n * - ...(recurse to render more parts/children)...\n * - `custom-element-close`\n * - Pop the CE `instance`+`renderer` off the `customElementInstanceStack`\n */\nconst getTemplateOpcodes = (result: TemplateResult) => {\n const template = templateCache.get(result.strings);\n if (template !== undefined) {\n return template;\n }\n const [html, attrNames] = getTemplateHtml(\n result.strings,\n // SVG TemplateResultType functionality is only required on the client,\n // which instantiates SVG elements within a svg namespace. Using SVG\n // on the server results in unneccesary svg containers being emitted.\n TemplateResultType.HTML\n );\n\n const hydratable = isHydratable(result);\n const htmlString = String(html);\n // Only server templates can use top level document tags such as `<html>`,\n // `<body>`, and `<head>`.\n const isPageLevelTemplate =\n !hydratable && REGEXP_TEMPLATE_HAS_TOP_LEVEL_PAGE_TAG.test(htmlString);\n\n /**\n * The html string is parsed into a parse5 AST with source code information\n * on; this lets us skip over certain ast nodes by string character position\n * while walking the AST.\n *\n * Server Templates may need to use `parse` as they may contain document tags such\n * as `<html>`.\n */\n const ast = (isPageLevelTemplate ? parse : parseFragment)(htmlString, {\n sourceCodeLocationInfo: true,\n });\n\n const ops: Array<Op> = [];\n\n /* The last offset of html written to the stream */\n let lastOffset: number | undefined = 0;\n\n /* Current attribute part index, for indexing attrNames */\n let attrIndex = 0;\n\n /**\n * Sets `lastOffset` to `offset`, skipping a range of characters. This is\n * useful for skipping and re-writing lit-html marker nodes, bound attribute\n * suffix, etc.\n */\n const skipTo = (offset: number) => {\n if (lastOffset === undefined) {\n throw new Error('lastOffset is undefined');\n }\n if (offset < lastOffset) {\n throw new Error(`offset must be greater than lastOffset.\n offset: ${offset}\n lastOffset: ${lastOffset}\n `);\n }\n lastOffset = offset;\n };\n\n /**\n * Records the given string to the output, either by appending to the current\n * opcode (if already `text`) or by creating a new `text` opcode (if the\n * previous opcode was not `text)\n */\n const flush = (value: string) => {\n const op = getLast(ops);\n if (op !== undefined && op.type === 'text') {\n op.value += value;\n } else {\n ops.push({\n type: 'text',\n value,\n });\n }\n };\n\n /**\n * Creates or appends to a text opcode with a substring of the html from the\n * `lastOffset` flushed to `offset`.\n */\n const flushTo = (offset?: number) => {\n if (lastOffset === undefined) {\n throw new Error('lastOffset is undefined');\n }\n const previousLastOffset = lastOffset;\n lastOffset = offset;\n const value = String(html).substring(previousLastOffset, offset);\n flush(value);\n };\n\n // Depth-first node index, counting only comment and element nodes, to match\n // client-side lit-html.\n let nodeIndex = 0;\n\n traverse(ast, {\n 'pre:node'(node, parent) {\n if (isCommentNode(node)) {\n if (node.data === markerMatch) {\n flushTo(node.sourceCodeLocation!.startOffset);\n skipTo(node.sourceCodeLocation!.endOffset);\n ops.push({\n type: 'child-part',\n index: nodeIndex,\n useCustomElementInstance:\n parent && isElementNode(parent) && parent.isDefinedCustomElement,\n });\n }\n nodeIndex++;\n } else if (isElementNode(node)) {\n let boundAttributesCount = 0;\n\n const tagName = node.tagName;\n\n if (\n node.parentNode &&\n isElementNode(node.parentNode) &&\n node.parentNode.isDefinedCustomElement\n ) {\n // When the parent node is a custom element we check for the presence\n // or absence of the slot attribute. This allows us to track the\n // event tree with the association of the slot path.\n ops.push({\n type: 'slotted-element-open',\n name: node.attrs.find((a) => a.name === 'slot')?.value,\n });\n }\n\n if (tagName.indexOf('-') !== -1) {\n // Looking up the constructor here means that custom elements must be\n // registered before rendering the first template that contains them.\n const ctor = customElements.get(tagName);\n if (ctor !== undefined) {\n // Mark that this is a custom element\n node.isDefinedCustomElement = true;\n ops.push({\n type: 'custom-element-open',\n tagName,\n ctor,\n staticAttributes: new Map(\n node.attrs\n .filter((attr) => !attr.name.endsWith(boundAttributeSuffix))\n .map((attr) => [attr.name, attr.value])\n ),\n });\n }\n } else if (tagName === 'slot') {\n ops.push({\n type: 'slot-element-open',\n // Name is either assigned the slot name or undefined for\n // an unnamed slot.\n name: node.attrs.find((a) => a.name === 'name')?.value,\n });\n }\n const attrInfo = node.attrs.map((attr) => {\n const isAttrBinding = attr.name.endsWith(boundAttributeSuffix);\n const isElementBinding = attr.name.startsWith(marker);\n if (isAttrBinding || isElementBinding) {\n boundAttributesCount += 1;\n }\n return [isAttrBinding, isElementBinding, attr] as const;\n });\n if (boundAttributesCount > 0 || node.isDefinedCustomElement) {\n // We (may) need to emit a `<!-- lit-node -->` comment marker to\n // indicate the following node needs to be identified during\n // hydration when it has bindings or if it is a custom element (and\n // thus may need its `defer-hydration` to be removed, depending on\n // the `deferHydration` setting). The marker is emitted as a\n // previous sibling before the node in question, to avoid issues\n // with void elements (which do not have children) and raw text\n // elements (whose children are intepreted as text).\n flushTo(node.sourceCodeLocation!.startTag!.startOffset);\n ops.push({\n type: 'possible-node-marker',\n boundAttributesCount,\n nodeIndex,\n });\n }\n for (const [isAttrBinding, isElementBinding, attr] of attrInfo) {\n if (isAttrBinding || isElementBinding) {\n // Note that although we emit a lit-node comment marker for any\n // nodes with bindings, we don't account for it in the nodeIndex because\n // that will not be injected into the client template\n const strings = attr.value.split(marker);\n const attrSourceLocation =\n node.sourceCodeLocation!.attrs![attr.name]!;\n const attrNameStartOffset = attrSourceLocation.startOffset;\n const attrEndOffset = attrSourceLocation.endOffset;\n flushTo(attrNameStartOffset);\n if (isAttrBinding) {\n // We store the case-sensitive name from `attrNames` (generated\n // while parsing the template strings); note that this assumes\n // parse5 attribute ordering matches string ordering\n const name = attrNames[attrIndex++];\n const [, prefix, caseSensitiveName] = /([.?@])?(.*)/.exec(\n name as string\n )!;\n if (!hydratable) {\n if (prefix === '.') {\n throw new Error(\n `Server-only templates can't bind to properties. Bind to attributes instead, as they can be serialized when the template is rendered and sent to the browser.`\n );\n } else if (prefix === '@') {\n throw new Error(\n `Server-only templates can't bind to events. There's no way to serialize an event listener when generating HTML and sending it to the browser.`\n );\n }\n }\n ops.push({\n type: 'attribute-part',\n index: nodeIndex,\n name: caseSensitiveName,\n ctor:\n prefix === '.'\n ? PropertyPart\n : prefix === '?'\n ? BooleanAttributePart\n : prefix === '@'\n ? EventPart\n : AttributePart,\n strings,\n tagName: tagName.toUpperCase(),\n useCustomElementInstance: node.isDefinedCustomElement,\n });\n } else {\n if (!hydratable) {\n throw new Error(`Server-only templates don't support element parts, as their API does not currently give them any way to render anything on the server. Found in template:\n ${displayTemplateResult(result)}`);\n }\n ops.push({\n type: 'element-part',\n index: nodeIndex,\n });\n }\n skipTo(attrEndOffset);\n } else if (node.isDefinedCustomElement) {\n // For custom elements, all static attributes are stored along\n // with the `custom-element-open` opcode so that we can set them\n // into the custom element instance, and then serialize them back\n // out along with any manually-reflected attributes. As such, we\n // skip over static attribute text here.\n const attrSourceLocation =\n node.sourceCodeLocation!.attrs![attr.name]!;\n flushTo(attrSourceLocation.startOffset);\n skipTo(attrSourceLocation.endOffset);\n }\n }\n\n if (node.isDefinedCustomElement) {\n // For custom elements, add an opcode to write out attributes,\n // close the tag, and then add an opcode to write the shadow\n // root\n flushTo(node.sourceCodeLocation!.startTag!.endOffset - 1);\n ops.push({\n type: 'custom-element-attributes',\n });\n flush('>');\n skipTo(node.sourceCodeLocation!.startTag!.endOffset);\n ops.push({\n type: 'custom-element-shadow',\n });\n } else if (\n !hydratable &&\n /^(title|textarea|script|style)$/.test(node.tagName)\n ) {\n const dangerous = isJavaScriptScriptTag(node);\n // Marker comments in a rawtext element will be parsed as text,\n // so we need to look at the text value of childnodes to try to\n // find them and render child-part opcodes.\n for (const child of node.childNodes) {\n if (!isTextNode(child)) {\n throw new Error(\n `Internal error: Unexpected child node inside raw text node, a ${node.tagName} should only contain text nodes, but found a ${node.nodeName} (tagname: ${node.tagName})`\n );\n }\n const text = child.value;\n const textStart = child.sourceCodeLocation!.startOffset;\n flushTo(textStart);\n const markerRegex = new RegExp(marker.replace(/\\$/g, '\\\\$'), 'g');\n for (const mark of text.matchAll(markerRegex)) {\n flushTo(textStart + mark.index!);\n if (dangerous) {\n throw new Error(\n `Found binding inside an executable <script> tag in a server-only template. For security reasons, this is not supported, as it could allow an attacker to execute arbitrary JavaScript. If you do need to create a script element with dynamic contents, you can use the unsafeHTML directive to make one, as that way the code is clearly marked as unsafe and needing careful handling. The template with the dangerous binding is:\n\n ${displayTemplateResult(result)}`\n );\n }\n if (node.tagName === 'style') {\n throw new Error(\n `Found binding inside a <style> tag in a server-only template. For security reasons, this is not supported, as it could allow an attacker to exfiltrate information from the page. If you do need to create a style element with dynamic contents, you can use the unsafeHTML directive to make one, as that way the code is clearly marked as unsafe and needing careful handling. The template with the dangerous binding is:\n\n ${displayTemplateResult(result)}`\n );\n }\n ops.push({\n type: 'child-part',\n index: nodeIndex,\n useCustomElementInstance: false,\n });\n skipTo(textStart + mark.index! + mark[0].length);\n }\n flushTo(textStart + text.length);\n }\n } else if (!hydratable && isTemplateNode(node)) {\n // Server-only templates look inside of <template> nodes, because\n // we can afford the complexity and cost, and there's way more\n // benefit to be gained from it\n traverse(node.content, this, node);\n }\n\n nodeIndex++;\n }\n },\n node(node) {\n if (!isElementNode(node)) {\n return;\n }\n if (node.isDefinedCustomElement) {\n ops.push({\n type: 'custom-element-close',\n });\n } else if (node.tagName === 'slot') {\n ops.push({\n type: 'slot-element-close',\n });\n }\n if (\n node.parentNode &&\n isElementNode(node.parentNode) &&\n node.parentNode.isDefinedCustomElement\n ) {\n ops.push({\n type: 'slotted-element-close',\n });\n }\n },\n });\n // Flush remaining static text in the template (e.g. closing tags)\n flushTo();\n templateCache.set(result.strings, ops);\n return ops;\n};\n\nexport type RenderInfo = {\n /**\n * Element renderers to use\n */\n elementRenderers: ElementRendererConstructor[];\n\n /**\n * Stack of open custom elements (in light dom or shadow dom)\n */\n customElementInstanceStack: Array<ElementRenderer | undefined>;\n\n /**\n * Stack of open host custom elements (n-1 will be n's host)\n */\n customElementHostStack: Array<ElementRenderer | undefined>;\n\n /**\n * Stack of open event target instances.\n */\n eventTargetStack: Array<HTMLElement | undefined>;\n\n /**\n * Stack of current slot context.\n */\n slotStack: Array<string | undefined>;\n\n /**\n * An optional callback to notify when a custom element has been rendered.\n *\n * This allows servers to know what specific tags were rendered for a given\n * template, even in the case of conditional templates.\n */\n customElementRendered?: (tagName: string) => void;\n\n /**\n * Flag to defer hydration of top level custom element. Defaults to false.\n */\n deferHydration: boolean;\n};\n\ndeclare global {\n interface Array<T> {\n flat(depth: number): Array<T>;\n }\n}\n\nexport function* renderValue(\n value: unknown,\n renderInfo: RenderInfo,\n hydratable = true\n): RenderResult {\n if (renderInfo.customElementHostStack.length === 0) {\n // If the SSR root event target is not at the start of the event target\n // stack, we add it to the beginning of the array.\n // This only applies if we are in the top level document and not in a\n // Shadow DOM.\n const rootEventTarget = renderInfo.eventTargetStack[0];\n if (rootEventTarget !== litServerRoot) {\n renderInfo.eventTargetStack.unshift(litServerRoot);\n if (rootEventTarget) {\n // If an entry in the event target stack was provided and it was not\n // the event root target, we need to connect the given event target\n // to the root event target.\n (rootEventTarget as HTMLElementWithEventMeta).__eventTargetParent =\n rootEventTarget;\n }\n }\n }\n\n patchIfDirective(value);\n if (isRenderLightDirective(value)) {\n // If a value was produced with renderLight(), we want to call and render\n // the renderLight() method.\n const instance = getLast(renderInfo.customElementInstanceStack);\n if (instance !== undefined) {\n const renderLightResult = instance.renderLight(renderInfo);\n if (renderLightResult !== undefined) {\n yield* renderLightResult;\n }\n }\n value = null;\n } else {\n value = resolveDirective(\n connectedDisconnectable({type: PartType.CHILD}) as ChildPart,\n value\n );\n }\n if (value != null && isTemplateResult(value)) {\n if (hydratable) {\n yield `<!--lit-part ${digestForTemplateResult(\n value as TemplateResult\n )}-->`;\n }\n yield* renderTemplateResult(value as TemplateResult, renderInfo);\n if (hydratable) {\n yield `<!--/lit-part-->`;\n }\n } else {\n if (hydratable) {\n yield `<!--lit-part-->`;\n }\n if (\n value === undefined ||\n value === null ||\n value === nothing ||\n value === noChange\n ) {\n // yield nothing\n } else if (!isPrimitive(value) && isIterable(value)) {\n // Check that value is not a primitive, since strings are iterable\n for (const item of value) {\n yield* renderValue(item, renderInfo, hydratable);\n }\n } else {\n yield escapeHtml(String(value));\n }\n if (hydratable) {\n yield `<!--/lit-part-->`;\n }\n }\n}\n\nfunction* renderTemplateResult(\n result: TemplateResult,\n renderInfo: RenderInfo\n): RenderResult {\n // In order to render a TemplateResult we have to handle and stream out\n // different parts of the result separately:\n // - Literal sections of the template\n // - Defined custom element within the literal sections\n // - Values in the result\n //\n // This means we can't just iterate through the template literals and values,\n // we must parse and traverse the template's HTML. But we don't want to pay\n // the cost of serializing the HTML node-by-node when we already have the\n // template in string form. So we parse with location info turned on and use\n // that to index into the HTML string generated by TemplateResult.getHTML().\n // During the tree walk we will handle expression marker nodes and custom\n // elements. For each we will record the offset of the node, and output the\n // previous span of HTML.\n\n const hydratable = isHydratable(result);\n const ops = getTemplateOpcodes(result);\n\n /* The next value in result.values to render */\n let partIndex = 0;\n\n for (const op of ops) {\n switch (op.type) {\n case 'text':\n yield op.value;\n break;\n case 'child-part': {\n const value = result.values[partIndex++];\n let isValueHydratable = hydratable;\n if (isTemplateResult(value)) {\n isValueHydratable = isHydratable(value);\n if (!isValueHydratable && hydratable) {\n throw new Error(\n `A server-only template can't be rendered inside an ordinary, hydratable template. A server-only template can only be rendered at the top level, or within other server-only templates. The outer template was:\n ${displayTemplateResult(result)}\n\nAnd the inner template was:\n ${displayTemplateResult(value)}\n `\n );\n }\n }\n yield* renderValue(value, renderInfo, isValueHydratable);\n break;\n }\n case 'attribute-part': {\n const statics = op.strings;\n const part = new op.ctor(\n // Passing only object with tagName for the element is fine since the\n // directive only gets PartInfo without the node available in the\n // constructor\n {tagName: op.tagName} as HTMLElement,\n op.name,\n statics,\n connectedDisconnectable(),\n {}\n );\n const value =\n part.strings === undefined ? result.values[partIndex] : result.values;\n patchAnyDirectives(part, value, partIndex);\n let committedValue: unknown = noChange;\n // Values for EventParts are never emitted\n if (!(part.type === PartType.EVENT)) {\n committedValue = getAttributePartCommittedValue(\n part,\n value,\n partIndex\n );\n }\n // We don't emit anything on the server when value is `noChange` or\n // `nothing`\n if (committedValue !== noChange) {\n const instance = op.useCustomElementInstance\n ? getLast(renderInfo.customElementInstanceStack)\n : undefined;\n if (part.type === PartType.PROPERTY) {\n yield* renderPropertyPart(instance, op, committedValue);\n } else if (part.type === PartType.BOOLEAN_ATTRIBUTE) {\n // Boolean attribute binding\n yield* renderBooleanAttributePart(instance, op, committedValue);\n } else {\n yield* renderAttributePart(instance, op, committedValue);\n }\n }\n partIndex += statics.length - 1;\n break;\n }\n case 'element-part': {\n // We don't emit anything for element parts (since we only support\n // directives for now; since they can't render, we don't even bother\n // running them), but we still need to advance the part index\n partIndex++;\n break;\n }\n case 'custom-element-open': {\n // Instantiate the element and its renderer\n const instance = getElementRenderer(\n renderInfo,\n op.tagName,\n op.ctor,\n op.staticAttributes\n );\n if (instance.element) {\n // In the case the renderer has created an instance, we want to set\n // the event target parent and the host of the element. Our\n // EventTarget polyfill uses these values to calculate the\n // composedPath of a dispatched event.\n // Note that the event target parent is either the unnamed/named slot\n // in the parent event target if it exists or the parent event target\n // if no matching slot exists.\n const eventTarget = getLast(\n renderInfo.eventTargetStack\n ) as HTMLElementWithEventMeta;\n const slotName = getLast(renderInfo.slotStack);\n (instance.element as HTMLElementWithEventMeta).__eventTargetParent =\n elementSlotMap.get(eventTarget)?.get(slotName) ?? eventTarget;\n (instance.element as HTMLElementWithEventMeta).__host = getLast(\n renderInfo.customElementHostStack\n )?.element;\n renderInfo.eventTargetStack.push(instance.element);\n }\n // Set static attributes to the element renderer\n for (const [name, value] of op.staticAttributes) {\n instance.setAttribute(name, value);\n }\n renderInfo.customElementInstanceStack.push(instance);\n renderInfo.customElementRendered?.(op.tagName);\n break;\n }\n case 'custom-element-attributes': {\n const instance = getLast(renderInfo.customElementInstanceStack);\n if (instance === undefined) {\n throw new Error(\n `Internal error: ${op.type} outside of custom element context`\n );\n }\n // Perform any connect-time work via the renderer (e.g. reflecting any\n // properties to attributes, for example)\n if (instance.connectedCallback) {\n instance.connectedCallback();\n }\n // Render out any attributes on the instance (both static and those\n // that may have been dynamically set by the renderer)\n yield* instance.renderAttributes();\n // If deferHydration flag is true or if this element is nested in\n // another, add the `defer-hydration` attribute, so that it does not\n // enable before the host element hydrates\n if (\n renderInfo.deferHydration ||\n renderInfo.customElementHostStack.length > 0\n ) {\n yield ' defer-hydration';\n }\n break;\n }\n case 'possible-node-marker': {\n // Add a node marker if this element had attribute bindings or if it\n // was nested in another and we rendered the `defer-hydration` attribute\n // since the hydration node walk will need to stop at this element\n // to hydrate it\n if (\n op.boundAttributesCount > 0 ||\n renderInfo.customElementHostStack.length > 0\n ) {\n if (hydratable) {\n yield `<!--lit-node ${op.nodeIndex}-->`;\n }\n }\n break;\n }\n case 'custom-element-shadow': {\n const instance = getLast(renderInfo.customElementInstanceStack);\n if (instance === undefined) {\n throw new Error(\n `Internal error: ${op.type} outside of custom element context`\n );\n }\n renderInfo.customElementHostStack.push(instance);\n const shadowContents = instance.renderShadow(renderInfo);\n // Only emit a DSR if renderShadow() emitted something (returning\n // undefined allows effectively no-op rendering the element)\n if (shadowContents !== undefined) {\n const {mode = 'open', delegatesFocus} =\n instance.shadowRootOptions ?? {};\n // `delegatesFocus` is intentionally allowed to coerce to boolean to\n // match web platform behavior.\n const delegatesfocusAttr = delegatesFocus\n ? ' shadowrootdelegatesfocus'\n : '';\n yield `<template shadowroot=\"${mode}\" shadowrootmode=\"${mode}\"${delegatesfocusAttr}>`;\n yield* shadowContents;\n yield '</template>';\n }\n renderInfo.customElementHostStack.pop();\n break;\n }\n case 'custom-element-close':\n renderInfo.customElementInstanceStack.pop();\n renderInfo.eventTargetStack.pop();\n break;\n case 'slot-element-open': {\n const host = getLast(renderInfo.customElementHostStack);\n if (host === undefined) {\n throw new Error(\n `Internal error: ${op.type} outside of custom element context`\n );\n } else if (host.element) {\n // We need to track which element has which slots. This is necessary\n // to calculate the correct event path by connecting children of the\n // host element to the corresponding slot.\n let slots = elementSlotMap.get(host.element);\n if (slots === undefined) {\n slots = new Map();\n elementSlotMap.set(host.element, slots);\n }\n // op.name is either the slot name or undefined, which represents\n // the unnamed slot case.\n if (!slots.has(op.name)) {\n const element = new HTMLSlotElement() as HTMLSlotElement &\n HTMLElementWithEventMeta;\n element.name = op.name ?? '';\n const eventTarget = getLast(\n renderInfo.eventTargetStack\n ) as HTMLElementWithEventMeta;\n const slotName = getLast(renderInfo.slotStack);\n element.__eventTargetParent =\n elementSlotMap.get(eventTarget)?.get(slotName) ?? eventTarget;\n element.__host = getLast(\n renderInfo.customElementHostStack\n )?.element;\n slots.set(op.name, element);\n renderInfo.eventTargetStack.push(element);\n }\n }\n\n break;\n }\n case 'slot-element-close':\n renderInfo.eventTargetStack.pop();\n break;\n case 'slotted-element-open':\n renderInfo.slotStack.push(op.name);\n break;\n case 'slotted-element-close':\n renderInfo.slotStack.pop();\n break;\n default:\n throw new Error('internal error');\n }\n }\n\n if (partIndex !== result.values.length) {\n throwErrorForPartIndexMismatch(partIndex, result);\n }\n}\n\nfunction throwErrorForPartIndexMismatch(\n partIndex: number,\n result: TemplateResult\n) {\n const errorMsg = `\n Unexpected final partIndex: ${partIndex} !== ${\n result.values.length\n } while processing the following template:\n\n ${displayTemplateResult(result)}\n\n This could be because you're attempting to render an expression in an invalid location. See\n https://lit.dev/docs/templates/expressions/#invalid-locations for more information about invalid expression\n locations.\n `;\n\n throw new Error(errorMsg);\n}\n\nfunction* renderPropertyPart(\n instance: ElementRenderer | undefined,\n op: AttributePartOp,\n value: unknown\n) {\n value = value === nothing ? undefined : value;\n // Property should be reflected to attribute\n const reflectedName = reflectedAttributeName(op.tagName, op.name);\n if (instance !== undefined) {\n instance.setProperty(op.name, value);\n }\n if (reflectedName !== undefined) {\n yield `${reflectedName}=\"${escapeHtml(String(value))}\"`;\n }\n}\n\nfunction* renderBooleanAttributePart(\n instance: ElementRenderer | undefined,\n op: AttributePartOp,\n value: unknown\n) {\n if (value && value !== nothing) {\n if (instance !== undefined) {\n instance.setAttribute(op.name, '');\n } else {\n yield op.name;\n }\n }\n}\n\nfunction* renderAttributePart(\n instance: ElementRenderer | undefined,\n op: AttributePartOp,\n value: unknown\n) {\n if (value !== nothing) {\n if (instance !== undefined) {\n instance.setAttribute(op.name, String(value ?? ''));\n } else {\n yield `${op.name}=\"${escapeHtml(String(value ?? ''))}\"`;\n }\n }\n}\n\n/**\n * Returns a debug string suitable for an error message describing a\n * TemplateResult.\n */\nfunction displayTemplateResult(\n result: TemplateResult | CompiledTemplateResult\n) {\n if (isCompiledTemplateResult(result)) {\n return result._$litType$.h.join('${...}');\n }\n return result.strings.join('${...}');\n}\n\nconst getLast = <T>(a: Array<T>) => a[a.length - 1];\n\n/**\n * Returns true if the given node is a <script> node that the browser will\n * automatically execute if it's rendered on server-side, outside of a\n * <template> tag.\n */\nfunction isJavaScriptScriptTag(node: Element | Template): boolean {\n function isScriptTag(node: Element | Template): node is Element {\n return /script/i.test(node.tagName);\n }\n\n if (!isScriptTag(node)) {\n return false;\n }\n let safeTypeSeen = false;\n for (const attr of node.attrs) {\n if (attr.name !== 'type') {\n continue;\n }\n switch (attr.value) {\n // see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#textjavascript\n case null:\n case undefined:\n case '':\n case 'module':\n case 'text/javascript':\n case 'application/javascript':\n case 'application/ecmascript':\n case 'application/x-ecmascript':\n case 'application/x-javascript':\n case 'text/ecmascript':\n case 'text/javascript1.0':\n case 'text/javascript1.1':\n case 'text/javascript1.2':\n case 'text/javascript1.3':\n case 'text/javascript1.4':\n case 'text/javascript1.5':\n case 'text/jscript':\n case 'text/livescript':\n case 'text/x-ecmascript':\n case 'text/x-javascript':\n // If we see a dangerous type, we can stop looking\n return true;\n default:\n safeTypeSeen = true;\n }\n }\n // So, remember that attributes can be repeated. If we saw a dangerous type,\n // then we would have returned early. However, if there's no type, then\n // that's dangerous.\n // It's only if all types seen were safe, and we saw at least one type, that\n // we can return false.\n const willExecute = !safeTypeSeen;\n return willExecute;\n}\n"]} |