import MagicString from 'magic-string' ; import { getSlotName } from '../../utils/svelteAst' ; import { handleSlot } from './slot' ; import { IfScope } from './if-scope' ; import { TemplateScope } from '../nodes/template-scope' ; import { BaseNode } from '../../interfaces' ; /**
 * Handle `<svelte:self>` and slot-specific transformations.
 */ export function handleComponent ( htmlx , str , el , parent , ifScope , templateScope ) { if ( el . name . startsWith ( 'svelte:' ) ) { const colon = htmlx . indexOf ( ':' , el . start ) ; str . remove ( colon , colon + 1 ) ; const closeTag = htmlx . lastIndexOf ( '/' + el . name , el . end ) ; if ( closeTag > el . start ) { const colon = htmlx . indexOf ( ':' , closeTag ) ; str . remove ( colon , colon + 1 ) ; } } const slotName = getSlotName ( el ) || 'default' ; handleSlot ( htmlx , str , el , slotName === 'default' ? el : parent , slotName , ifScope , templateScope ) ; }