2024-06-23 09:25:48 +00:00
import { r as run _all , p as blank _object , e as current _component , d as set _current _component } from './lifecycle-px-3doLe.js' ;
2024-06-21 23:07:37 +00:00
function ensure _array _like ( array _like _or _iterator ) {
return array _like _or _iterator ? . length !== void 0 ? array _like _or _iterator : Array . from ( array _like _or _iterator ) ;
}
const _boolean _attributes = (
/** @type {const} */
[
"allowfullscreen" ,
"allowpaymentrequest" ,
"async" ,
"autofocus" ,
"autoplay" ,
"checked" ,
"controls" ,
"default" ,
"defer" ,
"disabled" ,
"formnovalidate" ,
"hidden" ,
"inert" ,
"ismap" ,
"loop" ,
"multiple" ,
"muted" ,
"nomodule" ,
"novalidate" ,
"open" ,
"playsinline" ,
"readonly" ,
"required" ,
"reversed" ,
"selected"
]
) ;
const boolean _attributes = /* @__PURE__ */ new Set ( [ ... _boolean _attributes ] ) ;
const invalid _attribute _name _character = /[\s'">/=\u{FDD0}-\u{FDEF}\u{FFFE}\u{FFFF}\u{1FFFE}\u{1FFFF}\u{2FFFE}\u{2FFFF}\u{3FFFE}\u{3FFFF}\u{4FFFE}\u{4FFFF}\u{5FFFE}\u{5FFFF}\u{6FFFE}\u{6FFFF}\u{7FFFE}\u{7FFFF}\u{8FFFE}\u{8FFFF}\u{9FFFE}\u{9FFFF}\u{AFFFE}\u{AFFFF}\u{BFFFE}\u{BFFFF}\u{CFFFE}\u{CFFFF}\u{DFFFE}\u{DFFFF}\u{EFFFE}\u{EFFFF}\u{FFFFE}\u{FFFFF}\u{10FFFE}\u{10FFFF}]/u ;
function spread ( args , attrs _to _add ) {
const attributes = Object . assign ( { } , ... args ) ;
if ( attrs _to _add ) {
const classes _to _add = attrs _to _add . classes ;
const styles _to _add = attrs _to _add . styles ;
if ( classes _to _add ) {
if ( attributes . class == null ) {
attributes . class = classes _to _add ;
} else {
attributes . class += " " + classes _to _add ;
}
}
if ( styles _to _add ) {
if ( attributes . style == null ) {
attributes . style = style _object _to _string ( styles _to _add ) ;
} else {
attributes . style = style _object _to _string (
merge _ssr _styles ( attributes . style , styles _to _add )
) ;
}
}
}
let str = "" ;
Object . keys ( attributes ) . forEach ( ( name ) => {
if ( invalid _attribute _name _character . test ( name ) )
return ;
const value = attributes [ name ] ;
if ( value === true )
str += " " + name ;
else if ( boolean _attributes . has ( name . toLowerCase ( ) ) ) {
if ( value )
str += " " + name ;
} else if ( value != null ) {
str += ` ${ name } =" ${ value } " ` ;
}
} ) ;
return str ;
}
function merge _ssr _styles ( style _attribute , style _directive ) {
const style _object = { } ;
for ( const individual _style of style _attribute . split ( ";" ) ) {
const colon _index = individual _style . indexOf ( ":" ) ;
const name = individual _style . slice ( 0 , colon _index ) . trim ( ) ;
const value = individual _style . slice ( colon _index + 1 ) . trim ( ) ;
if ( ! name )
continue ;
style _object [ name ] = value ;
}
for ( const name in style _directive ) {
const value = style _directive [ name ] ;
if ( value ) {
style _object [ name ] = value ;
} else {
delete style _object [ name ] ;
}
}
return style _object ;
}
const ATTR _REGEX = /[&"]/g ;
const CONTENT _REGEX = /[&<]/g ;
function escape ( value , is _attr = false ) {
const str = String ( value ) ;
const pattern = is _attr ? ATTR _REGEX : CONTENT _REGEX ;
pattern . lastIndex = 0 ;
let escaped = "" ;
let last = 0 ;
while ( pattern . test ( str ) ) {
const i = pattern . lastIndex - 1 ;
const ch = str [ i ] ;
escaped += str . substring ( last , i ) + ( ch === "&" ? "&" : ch === '"' ? """ : "<" ) ;
last = i + 1 ;
}
return escaped + str . substring ( last ) ;
}
function escape _attribute _value ( value ) {
const should _escape = typeof value === "string" || value && typeof value === "object" ;
return should _escape ? escape ( value , true ) : value ;
}
function escape _object ( obj ) {
const result = { } ;
for ( const key in obj ) {
result [ key ] = escape _attribute _value ( obj [ key ] ) ;
}
return result ;
}
function each ( items , fn ) {
items = ensure _array _like ( items ) ;
let str = "" ;
for ( let i = 0 ; i < items . length ; i += 1 ) {
str += fn ( items [ i ] , i ) ;
}
return str ;
}
const missing _component = {
$$render : ( ) => ""
} ;
function validate _component ( component , name ) {
if ( ! component || ! component . $$render ) {
if ( name === "svelte:component" )
name += " this={...}" ;
throw new Error (
` < ${ name } > is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than imported as pre-compiled modules. Otherwise you may need to fix a < ${ name } >. `
) ;
}
return component ;
}
let on _destroy ;
function create _ssr _component ( fn ) {
function $$render ( result , props , bindings , slots , context ) {
const parent _component = current _component ;
const $$ = {
on _destroy ,
context : new Map ( context || ( parent _component ? parent _component . $$ . context : [ ] ) ) ,
// these will be immediately discarded
on _mount : [ ] ,
before _update : [ ] ,
after _update : [ ] ,
callbacks : blank _object ( )
} ;
set _current _component ( { $$ } ) ;
const html = fn ( result , props , bindings , slots ) ;
set _current _component ( parent _component ) ;
return html ;
}
return {
render : ( props = { } , { $$slots = { } , context = /* @__PURE__ */ new Map ( ) } = { } ) => {
on _destroy = [ ] ;
const result = { title : "" , head : "" , css : /* @__PURE__ */ new Set ( ) } ;
const html = $$render ( result , props , { } , $$slots , context ) ;
run _all ( on _destroy ) ;
return {
html ,
css : {
code : Array . from ( result . css ) . map ( ( css ) => css . code ) . join ( "\n" ) ,
map : null
// TODO
} ,
head : result . title + result . head
} ;
} ,
$$render
} ;
}
function add _attribute ( name , value , boolean ) {
if ( value == null || boolean && ! value )
return "" ;
const assignment = boolean && value === true ? "" : ` =" ${ escape ( value , true ) } " ` ;
return ` ${ name } ${ assignment } ` ;
}
function style _object _to _string ( style _object ) {
return Object . keys ( style _object ) . filter ( ( key ) => style _object [ key ] ) . map ( ( key ) => ` ${ key } : ${ escape _attribute _value ( style _object [ key ] ) } ; ` ) . join ( " " ) ;
}
function add _styles ( style _object ) {
const styles = style _object _to _string ( style _object ) ;
return styles ? ` style=" ${ styles } " ` : "" ;
}
export { each as a , add _attribute as b , create _ssr _component as c , escape _attribute _value as d , escape as e , escape _object as f , add _styles as g , merge _ssr _styles as h , missing _component as m , spread as s , validate _component as v } ;
2024-06-23 09:25:48 +00:00
//# sourceMappingURL=ssr-ipqebOFl.js.map