( function ( global , factory ) { typeof exports === 'object' && typeof module !== 'undefined' ? module . exports = factory ( ) : typeof define === 'function' && define . amd ? define ( factory ) : ( global = typeof globalThis !== 'undefined' ? globalThis : global || self , global . Examples = factory ( ) ) ; } ( this , ( function ( ) { 'use strict' ; function noop ( ) { } function run ( fn ) { return fn ( ) ; } function blank_object ( ) { return Object . create ( null ) ; } function run_all ( fns ) { fns . forEach ( run ) ; } function is_function ( thing ) { return typeof thing === 'function' ; } function safe_not_equal ( a , b ) { return a != a ? b == b : a !== b || ( ( a && typeof a === 'object' ) || typeof a === 'function' ) ; } function is_empty ( obj ) { return Object . keys ( obj ) . length === 0 ; } function append ( target , node ) { target . appendChild ( node ) ; } function insert ( target , node , anchor ) { target . insertBefore ( node , anchor || null ) ; } function detach ( node ) { node . parentNode . removeChild ( node ) ; } function element ( name ) { return document . createElement ( name ) ; } function text ( data ) { return document . createTextNode ( data ) ; } function space ( ) { return text ( ' ' ) ; } function listen ( node , event , handler , options ) { node . addEventListener ( event , handler , options ) ; return ( ) => node . removeEventListener ( event , handler , options ) ; } function attr ( node , attribute , value ) { if ( value == null ) node . removeAttribute ( attribute ) ; else if ( node . getAttribute ( attribute ) !== value ) node . setAttribute ( attribute , value ) ; } function children ( element ) { return Array . from ( element . childNodes ) ; } function set_data ( text , data ) { data = '' + data ; if ( text . wholeText !== data ) text . data = data ; } function custom_event ( type , detail ) { const e = document . createEvent ( 'CustomEvent' ) ; e . initCustomEvent ( type , false , false , detail ) ; return e ; } let current_component ; function set_current_component ( component ) { current_component = component ; } function get_current_component ( ) { if ( ! current_component ) throw new Error ( 'Function called outside component initialization' ) ; return current_component ; } function createEventDispatcher ( ) { const component = get_current_component ( ) ; return ( type , detail ) => { const callbacks = component . $$ . callbacks [ type ] ; if ( callbacks ) { const event = custom_event ( type , detail ) ; callbacks . slice ( ) . forEach ( fn => { fn . call ( component , event ) ; } ) ; } } ; } const dirty_components = [ ] ; const binding_callbacks = [ ] ; const render_callbacks = [ ] ; const flush_callbacks = [ ] ; const resolved_promise = Promise . resolve ( ) ; let update_scheduled = false ; function schedule_update ( ) { if ( ! update_scheduled ) { update_scheduled = true ; resolved_promise . then ( flush ) ; } } function add_render_callback ( fn ) { render_callbacks . push ( fn ) ; } let flushing = false ; const seen_callbacks = new Set ( ) ; function flush ( ) { if ( flushing ) return ; flushing = true ; do { for ( let i = 0 ; i < dirty_components . length ; i += 1 ) { const component = dirty_components [ i ] ; set_current_component ( component ) ; update ( component . $$ ) ; } set_current_component ( null ) ; dirty_components . length = 0 ; while ( binding_callbacks . length ) binding_callbacks . pop ( ) ( ) ; for ( let i = 0 ; i < render_callbacks . length ; i += 1 ) { const callback = render_callbacks [ i ] ; if ( ! seen_callbacks . has ( callback ) ) { seen_callbacks . add ( callback ) ; callback ( ) ; } } render_callbacks . length = 0 ; } while ( dirty_components . length ) ; while ( flush_callbacks . length ) { flush_callbacks . pop ( ) ( ) ; } update_scheduled = false ; flushing = false ; seen_callbacks . clear ( ) ; } function update ( $$ ) { if ( $$ . fragment !== null ) { $$ . update ( ) ; run_all ( $$ . before_update ) ; const dirty = $$ . dirty ; $$ . dirty = [ - 1 ] ; $$ . fragment && $$ . fragment . p ( $$ . ctx , dirty ) ; $$ . after_update . forEach ( add_render_callback ) ; } } const outroing = new Set ( ) ; function transition_in ( block , local ) { if ( block && block . i ) { outroing . delete ( block ) ; block . i ( local ) ; } } function mount_component ( component , target , anchor , customElement ) { const { fragment , on_mount , on_destroy , after_update } = component . $$ ; fragment && fragment . m ( target , anchor ) ; if ( ! customElement ) { add_render_callback ( ( ) => { const new_on_destroy = on_mount . map ( run ) . filter ( is_function ) ; if ( on_destroy ) { on_destroy . push ( ... new_on_destroy ) ; } else { run_all ( new_on_destroy ) ; } component . $$ . on_mount = [ ] ; } ) ; } after_update . forEach ( add_render_callback ) ; } function destroy_component ( component , detaching ) { const $$ = component . $$ ; if ( $$ . fragment !== null ) { run_all ( $$ . on_destroy ) ; $$ . fragment && $$ . fragment . d ( detaching ) ; $$ . on_destroy = $$ . fragment = null ; $$ . ctx = [ ] ; } } function make_dirty ( component , i ) { if ( component . $$ . dirty [ 0 ] === - 1 ) { dirty_components . push ( component ) ; schedule_update ( ) ; component . $$ . dirty . fill ( 0 ) ; } component . $$ . dirty [ ( i / 31 ) | 0 ] |= ( 1 << ( i % 31 ) ) ; } function init ( component , options , instance , create_fragment , not_equal , props , dirty = [ - 1 ] ) { const parent_component = current_component ; set_current_component ( component ) ; const $$ = component . $$ = { fragment : null , ctx : null , props , update : noop , not_equal , bound : blank_object ( ) , on_mount : [ ] , on_destroy : [ ] , on_disconnect : [ ] , before_update : [ ] , after_update : [ ] , context : new Map ( parent_component ? parent_component . $$ . context : options . context || [ ] ) , callbacks : blank_object ( ) , dirty , skip_bound : false } ; let ready = false ; $$ . ctx = instance ? instance ( component , options . props || { } , ( i , ret , ... rest ) => { const value = rest . length ? rest [ 0 ] : ret ; if ( $$ . ctx && not_equal ( $$ . ctx [ i ] , $$ . ctx [ i ] = value ) ) { if ( ! $$ . skip_bound && $$ . bound [ i ] ) $$ . bound [ i ] ( value ) ; if ( ready ) make_dirty ( component , i ) ; } return ret ; } ) : [ ] ; $$ . update ( ) ; ready = true ; run_all ( $$ . before_update ) ; $$ . fragment = create_fragment ? create_fragment ( $$ . ctx ) : false ; if ( options . target ) { if ( options . hydrate ) { const nodes = children ( options . target ) ; $$ . fragment && $$ . fragment . l ( nodes ) ; nodes . forEach ( detach ) ; } else { $$ . fragment && $$ . fragment . c ( ) ; } if ( options . intro ) transition_in ( component . $$ . fragment ) ; mount_component ( component , options . target , options . anchor , options . customElement ) ; flush ( ) ; } set_current_component ( parent_component ) ; } /**
     * Base class for Svelte components. Used when dev=false.
     */ class SvelteComponent { $destroy ( ) { destroy_component ( this , 1 ) ; this . $destroy = noop ; } $on ( type , callback ) { const callbacks = ( this . $$ . callbacks [ type ] || ( this . $$ . callbacks [ type ] = [ ] ) ) ; callbacks . push ( callback ) ; return ( ) => { const index = callbacks . indexOf ( callback ) ; if ( index !== - 1 ) callbacks . splice ( index , 1 ) ; } ; } $set ( $$props ) { if ( this . $$set && ! is_empty ( $$props ) ) { this . $$ . skip_bound = true ; this . $$set ( $$props ) ; this . $$ . skip_bound = false ; } } } function add_css ( ) { var style = element ( "style" ) ; style . id = "svelte-4hq7sh-style" ; style . textContent = "main.svelte-4hq7sh{text-align:center;padding:1em;max-width:240px;margin:0 auto}h1.svelte-4hq7sh{color:#ff3e00;text-transform:uppercase;font-size:4em;font-weight:100}" ; append ( document . head , style ) ; } function create_fragment ( ctx ) { let main ; let h1 ; let t0 ; let t1 ; let t2 ; let t3 ; let button0 ; let t4 ; let t5 ; let t6 ; let button1 ; let t7 ; let t8 ; let mounted ; let dispose ; return { c ( ) { main = element ( "main" ) ; h1 = element ( "h1" ) ; t0 = text ( "Hello " ) ; t1 = text ( ctx [ 0 ] ) ; t2 = text ( "!" ) ; t3 = space ( ) ; button0 = element ( "button" ) ; t4 = text ( "add count: " ) ; t5 = text ( ctx [ 1 ] ) ; t6 = space ( ) ; button1 = element ( "button" ) ; t7 = text ( "update name: " ) ; t8 = text ( ctx [ 0 ] ) ; attr ( h1 , "class" , "svelte-4hq7sh" ) ; attr ( main , "class" , "svelte-4hq7sh" ) ; } , m ( target , anchor ) { insert ( target , main , anchor ) ; append ( main , h1 ) ; append ( h1 , t0 ) ; append ( h1 , t1 ) ; append ( h1 , t2 ) ; append ( main , t3 ) ; append ( main , button0 ) ; append ( button0 , t4 ) ; append ( button0 , t5 ) ; append ( main , t6 ) ; append ( main , button1 ) ; append ( button1 , t7 ) ; append ( button1 , t8 ) ; if ( ! mounted ) { dispose = [ listen ( button0 , "click" , ctx [ 2 ] ) , listen ( button1 , "click" , ctx [ 3 ] ) ] ; mounted = true ; } } , p ( ctx , [ dirty ] ) { if ( dirty & 1 ) set_data ( t1 , ctx [ 0 ] ) ; if ( dirty & 2 ) set_data ( t5 , ctx [ 1 ] ) ; if ( dirty & 1 ) set_data ( t8 , ctx [ 0 ] ) ; } , i : noop , o : noop , d ( detaching ) { if ( detaching ) detach ( main ) ; mounted = false ; run_all ( dispose ) ; } } ; } function instance ( $$self , $$props , $$invalidate ) { const dispatch = createEventDispatcher ( ) ; let { name } = $$props ; let count = 0 ; function handleChangeCount ( event ) { $$invalidate ( 1 , count += 1 ) ; dispatch ( "someEvent" , count ) ; } function handleChangeName ( ) { $$invalidate ( 0 , name = "boss" ) ; } $$self . $$set = $$props => { if ( "name" in $$props ) $$invalidate ( 0 , name = $$props . name ) ; } ; return [ name , count , handleChangeCount , handleChangeName ] ; } class Component extends SvelteComponent { constructor ( options ) { super ( ) ; if ( ! document . getElementById ( "svelte-4hq7sh-style" ) ) add_css ( ) ; init ( this , options , instance , create_fragment , safe_not_equal , { name : 0 } ) ; } } return Component ; } ) ) ) ;