| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -7,7 +7,7 @@ import { is_ignored } from '../../../../../state.js';
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import { is_event_attribute } from '../../../../../utils/ast.js';
 | 
					 | 
					 | 
					 | 
					import { is_event_attribute } from '../../../../../utils/ast.js';
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import * as b from '#compiler/builders';
 | 
					 | 
					 | 
					 | 
					import * as b from '#compiler/builders';
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import { build_class_directives_object, build_style_directives_object } from '../RegularElement.js';
 | 
					 | 
					 | 
					 | 
					import { build_class_directives_object, build_style_directives_object } from '../RegularElement.js';
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import { build_expression, build_template_chunk, get_expression_id } from './utils.js';
 | 
					 | 
					 | 
					 | 
					import { build_expression, build_template_chunk, Memoizer } from './utils.js';
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					/**
 | 
					 | 
					 | 
					 | 
					/**
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 * @param {Array<AST.Attribute | AST.SpreadAttribute>} attributes
 | 
					 | 
					 | 
					 | 
					 * @param {Array<AST.Attribute | AST.SpreadAttribute>} attributes
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -28,18 +28,12 @@ export function build_attribute_effect(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						/** @type {ObjectExpression['properties']} */
 | 
					 | 
					 | 
					 | 
						/** @type {ObjectExpression['properties']} */
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						const values = [];
 | 
					 | 
					 | 
					 | 
						const values = [];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						/** @type {Expression[]} */
 | 
					 | 
					 | 
					 | 
						const memoizer = new Memoizer();
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						const expressions = [];
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						/** @param {Expression} value */
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						function memoize(value) {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							return b.id(`$${expressions.push(value) - 1}`);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						}
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						for (const attribute of attributes) {
 | 
					 | 
					 | 
					 | 
						for (const attribute of attributes) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							if (attribute.type === 'Attribute') {
 | 
					 | 
					 | 
					 | 
							if (attribute.type === 'Attribute') {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								const { value } = build_attribute_value(attribute.value, context, (value, metadata) =>
 | 
					 | 
					 | 
					 | 
								const { value } = build_attribute_value(attribute.value, context, (value, metadata) =>
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									metadata.has_call ? memoize(value) : value
 | 
					 | 
					 | 
					 | 
									metadata.has_call ? memoizer.add(value) : value
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								);
 | 
					 | 
					 | 
					 | 
								);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								if (
 | 
					 | 
					 | 
					 | 
								if (
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -57,7 +51,7 @@ export function build_attribute_effect(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								let value = /** @type {Expression} */ (context.visit(attribute));
 | 
					 | 
					 | 
					 | 
								let value = /** @type {Expression} */ (context.visit(attribute));
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								if (attribute.metadata.expression.has_call) {
 | 
					 | 
					 | 
					 | 
								if (attribute.metadata.expression.has_call) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									value = memoize(value);
 | 
					 | 
					 | 
					 | 
									value = memoizer.add(value);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								}
 | 
					 | 
					 | 
					 | 
								}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								values.push(b.spread(value));
 | 
					 | 
					 | 
					 | 
								values.push(b.spread(value));
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -69,7 +63,7 @@ export function build_attribute_effect(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								b.prop(
 | 
					 | 
					 | 
					 | 
								b.prop(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									'init',
 | 
					 | 
					 | 
					 | 
									'init',
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									b.array([b.id('$.CLASS')]),
 | 
					 | 
					 | 
					 | 
									b.array([b.id('$.CLASS')]),
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									build_class_directives_object(class_directives, expressions, context)
 | 
					 | 
					 | 
					 | 
									build_class_directives_object(class_directives, context, memoizer)
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								)
 | 
					 | 
					 | 
					 | 
								)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							);
 | 
					 | 
					 | 
					 | 
							);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						}
 | 
					 | 
					 | 
					 | 
						}
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -79,21 +73,20 @@ export function build_attribute_effect(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								b.prop(
 | 
					 | 
					 | 
					 | 
								b.prop(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									'init',
 | 
					 | 
					 | 
					 | 
									'init',
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									b.array([b.id('$.STYLE')]),
 | 
					 | 
					 | 
					 | 
									b.array([b.id('$.STYLE')]),
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									build_style_directives_object(style_directives, expressions, context)
 | 
					 | 
					 | 
					 | 
									build_style_directives_object(style_directives, context, memoizer)
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								)
 | 
					 | 
					 | 
					 | 
								)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							);
 | 
					 | 
					 | 
					 | 
							);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						}
 | 
					 | 
					 | 
					 | 
						}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						const ids = memoizer.apply();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						context.state.init.push(
 | 
					 | 
					 | 
					 | 
						context.state.init.push(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							b.stmt(
 | 
					 | 
					 | 
					 | 
							b.stmt(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								b.call(
 | 
					 | 
					 | 
					 | 
								b.call(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									'$.attribute_effect',
 | 
					 | 
					 | 
					 | 
									'$.attribute_effect',
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									element_id,
 | 
					 | 
					 | 
					 | 
									element_id,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									b.arrow(
 | 
					 | 
					 | 
					 | 
									b.arrow(ids, b.object(values)),
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
										expressions.map((_, i) => b.id(`$${i}`)),
 | 
					 | 
					 | 
					 | 
									memoizer.sync_values(),
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
										b.object(values)
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									),
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									expressions.length > 0 && b.array(expressions.map((expression) => b.thunk(expression))),
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									element.metadata.scoped &&
 | 
					 | 
					 | 
					 | 
									element.metadata.scoped &&
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
										context.state.analysis.css.hash !== '' &&
 | 
					 | 
					 | 
					 | 
										context.state.analysis.css.hash !== '' &&
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
										b.literal(context.state.analysis.css.hash),
 | 
					 | 
					 | 
					 | 
										b.literal(context.state.analysis.css.hash),
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -158,7 +151,7 @@ export function build_set_class(element, node_id, attribute, class_directives, c
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								value = b.call('$.clsx', value);
 | 
					 | 
					 | 
					 | 
								value = b.call('$.clsx', value);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							}
 | 
					 | 
					 | 
					 | 
							}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							return metadata.has_call ? get_expression_id(context.state.expressions, value) : value;
 | 
					 | 
					 | 
					 | 
							return metadata.has_call ? context.state.memoizer.add(value) : value;
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						});
 | 
					 | 
					 | 
					 | 
						});
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						/** @type {Identifier | undefined} */
 | 
					 | 
					 | 
					 | 
						/** @type {Identifier | undefined} */
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -171,7 +164,7 @@ export function build_set_class(element, node_id, attribute, class_directives, c
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						let next;
 | 
					 | 
					 | 
					 | 
						let next;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						if (class_directives.length) {
 | 
					 | 
					 | 
					 | 
						if (class_directives.length) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							next = build_class_directives_object(class_directives, context.state.expressions, context);
 | 
					 | 
					 | 
					 | 
							next = build_class_directives_object(class_directives, context);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							has_state ||= class_directives.some((d) => d.metadata.expression.has_state);
 | 
					 | 
					 | 
					 | 
							has_state ||= class_directives.some((d) => d.metadata.expression.has_state);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							if (has_state) {
 | 
					 | 
					 | 
					 | 
							if (has_state) {
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -226,7 +219,7 @@ export function build_set_class(element, node_id, attribute, class_directives, c
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 */
 | 
					 | 
					 | 
					 | 
					 */
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					export function build_set_style(node_id, attribute, style_directives, context) {
 | 
					 | 
					 | 
					 | 
					export function build_set_style(node_id, attribute, style_directives, context) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						let { value, has_state } = build_attribute_value(attribute.value, context, (value, metadata) =>
 | 
					 | 
					 | 
					 | 
						let { value, has_state } = build_attribute_value(attribute.value, context, (value, metadata) =>
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							metadata.has_call ? get_expression_id(context.state.expressions, value) : value
 | 
					 | 
					 | 
					 | 
							metadata.has_call ? context.state.memoizer.add(value) : value
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						);
 | 
					 | 
					 | 
					 | 
						);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						/** @type {Identifier | undefined} */
 | 
					 | 
					 | 
					 | 
						/** @type {Identifier | undefined} */
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -235,11 +228,11 @@ export function build_set_style(node_id, attribute, style_directives, context) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						/** @type {ObjectExpression | Identifier | undefined} */
 | 
					 | 
					 | 
					 | 
						/** @type {ObjectExpression | Identifier | undefined} */
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						let prev;
 | 
					 | 
					 | 
					 | 
						let prev;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						/** @type {ArrayExpression | ObjectExpression | undefined} */
 | 
					 | 
					 | 
					 | 
						/** @type {Expression | undefined} */
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						let next;
 | 
					 | 
					 | 
					 | 
						let next;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						if (style_directives.length) {
 | 
					 | 
					 | 
					 | 
						if (style_directives.length) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							next = build_style_directives_object(style_directives, context.state.expressions, context);
 | 
					 | 
					 | 
					 | 
							next = build_style_directives_object(style_directives, context);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							has_state ||= style_directives.some((d) => d.metadata.expression.has_state);
 | 
					 | 
					 | 
					 | 
							has_state ||= style_directives.some((d) => d.metadata.expression.has_state);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							if (has_state) {
 | 
					 | 
					 | 
					 | 
							if (has_state) {
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
 
 |