{
	"$schema": "https://playground.wordpress.net/blueprint-schema.json",
	"meta": {
		"title": "Affiliates for WooCommerce demo",
		"description": "A homeware store with a running affiliate program: creators, referral visits, commissions and payouts.",
		"author": "devdiggers",
		"categories": [
			"WooCommerce"
		]
	},
	"landingPage": "/wp-admin/admin.php?page=ddwcaf-dashboard",
	"preferredVersions": {
		"php": "8.2",
		"wp": "latest"
	},
	"features": {
		"networking": true
	},
	"steps": [
		{
			"step": "installPlugin",
			"pluginData": {
				"resource": "wordpress.org/plugins",
				"slug": "woocommerce"
			},
			"options": {
				"activate": true
			}
		},
		{
			"step": "installPlugin",
			"pluginData": {
				"resource": "wordpress.org/plugins",
				"slug": "affiliates-for-woocommerce"
			},
			"options": {
				"activate": true
			}
		},
		{
			"step": "installTheme",
			"themeData": {
				"resource": "wordpress.org/themes",
				"slug": "kadence"
			},
			"options": {
				"activate": true
			}
		},
		{
			"step": "setSiteOptions",
			"options": {
				"woocommerce_onboarding_profile": {
					"skipped": true
				},
				"woocommerce_task_list_hidden": "yes",
				"woocommerce_task_list_complete": "yes",
				"woocommerce_show_marketplace_suggestions": "no",
				"woocommerce_allow_tracking": "no",
				"woocommerce_coming_soon": "no",
				"_ddwcaf_enabled": "yes",
				"ddfw_setup_wizard_completed_affiliates-for-woocommerce": true
			}
		},
		{
			"step": "runPHP",
			"code": "<?php\nrequire '/wordpress/wp-load.php';\nrequire_once ABSPATH . 'wp-admin/includes/image.php';\nglobal $wpdb;\n\ndelete_transient( '_wc_activation_redirect' );\ndelete_transient( 'ddfw_activation_redirect_affiliates-for-woocommerce' );\n\n$faces = [\n\t'admin@localhost.com'           => 'https://randomuser.me/api/portraits/women/68.jpg',\n\t'zara.ahmed@example.com'        => 'https://randomuser.me/api/portraits/women/44.jpg',\n\t'jordan.reyes@example.com'      => 'https://randomuser.me/api/portraits/men/32.jpg',\n\t'mei.chen@example.com'          => 'https://randomuser.me/api/portraits/women/65.jpg',\n\t'tobias.lindqvist@example.com'  => 'https://randomuser.me/api/portraits/men/75.jpg',\n\t'aisha.bello@example.com'       => 'https://randomuser.me/api/portraits/women/90.jpg',\n\t'diego.morales@example.com'     => 'https://randomuser.me/api/portraits/men/46.jpg',\n\t'hannah.kim@example.com'        => 'https://randomuser.me/api/portraits/women/24.jpg',\n\t'oliver.grant@example.com'      => 'https://randomuser.me/api/portraits/men/86.jpg',\n\t'amara.okafor@example.com'      => 'https://randomuser.me/api/portraits/women/12.jpg',\n\t'liam.carter@example.com'       => 'https://randomuser.me/api/portraits/men/11.jpg',\n\t'sofia.romero@example.com'      => 'https://randomuser.me/api/portraits/women/33.jpg',\n\t'kenji.watanabe@example.com'    => 'https://randomuser.me/api/portraits/men/52.jpg',\n\t'priya.sharma@example.com'      => 'https://randomuser.me/api/portraits/women/57.jpg',\n\t'noah.mueller@example.com'      => 'https://randomuser.me/api/portraits/men/64.jpg',\n\t'chloe.dubois@example.com'      => 'https://randomuser.me/api/portraits/women/79.jpg',\n\t'marcus.bell@example.com'       => 'https://randomuser.me/api/portraits/men/22.jpg',\n];\nwp_mkdir_p( WPMU_PLUGIN_DIR );\nfile_put_contents(\n\tWPMU_PLUGIN_DIR . '/demo-avatars.php',\n\t\"<?php\\n// Live Preview only: show a portrait for each demo person.\\nadd_filter( 'pre_get_avatar_data', function ( \\$args, \\$id ) {\\n\\t\\$faces = \" . var_export( $faces, true ) . \";\\n\\t\\$email = '';\\n\\tif ( is_numeric( \\$id ) ) { \\$u = get_userdata( (int) \\$id ); \\$email = \\$u ? \\$u->user_email : ''; }\\n\\telseif ( is_string( \\$id ) ) { \\$email = \\$id; }\\n\\telseif ( \\$id instanceof WP_User ) { \\$email = \\$id->user_email; }\\n\\telseif ( \\$id instanceof WP_Comment ) { \\$email = \\$id->comment_author_email; }\\n\\t\\$email = strtolower( \\$email );\\n\\tif ( isset( \\$faces[ \\$email ] ) ) { \\$args['url'] = \\$faces[ \\$email ]; \\$args['found_avatar'] = true; }\\n\\treturn \\$args;\\n}, 10, 2 );\\n\"\n);\n\nupdate_option( 'blogname', 'Oak & Ember' );\nupdate_option( 'blogdescription', 'Modern homeware, shared by the creators we love' );\nupdate_option( 'woocommerce_currency', 'USD' );\nupdate_option( 'woocommerce_store_address', '418 Larch Street' );\nupdate_option( 'woocommerce_store_city', 'Portland' );\nupdate_option( 'woocommerce_default_country', 'US:OR' );\nupdate_option( 'woocommerce_store_postcode', '97209' );\nwp_update_user( [ 'ID' => 1, 'display_name' => 'Maya Lin', 'first_name' => 'Maya', 'last_name' => 'Lin', 'user_email' => 'admin@localhost.com' ] );\n\n// Free settings, configured.\nforeach ( [\n\t'_ddwcaf_enabled'                  => 'yes',\n\t'_ddwcaf_default_commission_rate'  => 12,\n\t'_ddwcaf_query_variable_name'      => 'ref',\n\t'_ddwcaf_referral_cookie_expires'  => 30,\n\t'_ddwcaf_register_visits_enabled'  => 'yes',\n\t'_ddwcaf_my_account_enabled'       => 'yes',\n\t'_ddwcaf_exclude_taxes_enabled'    => 'yes',\n\t'_ddwcaf_exclude_discounts_enabled'=> 'yes',\n] as $k => $v ) {\n\tupdate_option( $k, $v );\n}\n$rate = 12;\n\n// Products with real photos that ship inside WooCommerce.\n$img_dir = WP_PLUGIN_DIR . '/woocommerce/assets/images/pattern-placeholders/';\n$catalog = [\n\t[ 'Sage Ceramic Vase', 48, 'sun-glass-vase-green-ceramic-shelf.jpg', 'Wheel-thrown stoneware vase in a soft sage glaze.', 'Ceramics' ],\n\t[ 'Ivory Pattern Table Lamp', 129, 'white-vase-decoration-pattern-ceramic-lamp.jpg', 'Hand-carved ceramic base with a linen shade.', 'Ceramics' ],\n\t[ 'Oak Bistro Stool', 185, 'Image-table-wood-chair-stool-interior-restaurant.jpg', 'Solid white oak with a hand-rubbed oil finish.', 'Furniture' ],\n\t[ 'Blown Glass Carafe Set', 64, 'drinkware-liquid-tableware-dishware-bottle-fluid.jpg', 'A one litre carafe with two matching tumblers.', 'Glass & Kitchen' ],\n\t[ 'Green Glass Pantry Jars', 42, 'green-glass-jars-on-stairs.jpg', 'Set of three recycled glass jars with cork lids.', 'Glass & Kitchen' ],\n\t[ 'Eucalyptus Bud Vase', 36, 'plant-white-leaf-flower-vase-green.jpg', 'Matte white porcelain, styled with dried eucalyptus.', 'Ceramics' ],\n\t[ 'Window Reading Chair', 420, 'table-wood-house-chair-floor-window.jpg', 'Ash frame with a woven paper cord seat.', 'Furniture' ],\n\t[ 'Platinum Mesh Watch', 240, 'watch-hand-brand-jewellery-strap-platinum.jpg', 'Minimal dial on a brushed platinum mesh strap.', 'Accessories' ],\n\t[ 'Walnut Record Player', 349, 'music-needle-turntable-black-and-white-white-photography.jpg', 'Belt drive turntable in a walnut plinth.', 'Accessories' ],\n];\n$cats = [];\nforeach ( [ 'Ceramics', 'Furniture', 'Glass & Kitchen', 'Accessories' ] as $c ) {\n\t$cats[ $c ] = wp_insert_term( $c, 'product_cat' )['term_id'];\n}\n$products = [];\nforeach ( $catalog as $p ) {\n\tif ( ! file_exists( $img_dir . $p[2] ) ) {\n\t\tcontinue;\n\t}\n\t$upload = wp_upload_bits( $p[2], null, file_get_contents( $img_dir . $p[2] ) );\n\t$att_id = wp_insert_attachment( [ 'post_mime_type' => 'image/jpeg', 'post_title' => $p[0], 'post_status' => 'inherit' ], $upload['file'] );\n\twp_update_attachment_metadata( $att_id, wp_generate_attachment_metadata( $att_id, $upload['file'] ) );\n\t$prod = new WC_Product_Simple();\n\t$prod->set_name( $p[0] );\n\t$prod->set_regular_price( $p[1] );\n\t$prod->set_short_description( $p[3] );\n\t$prod->set_description( $p[3] );\n\t$prod->set_image_id( $att_id );\n\t$prod->set_category_ids( [ $cats[ $p[4] ] ] );\n\t$prod->set_status( 'publish' );\n\t$products[] = $prod->save();\n}\n\n$day = DAY_IN_SECONDS;\n$now = time();\n$dt  = function ( $ts ) { return gmdate( 'Y-m-d H:i:s', $ts ); };\n\n// Affiliates: [login, first, last, email, status, days since joined, weight, referrer source, method].\n$aff_people = [\n\t[ 'zara', 'Zara', 'Ahmed', 'zara.ahmed@example.com', 'approved', 58, 9, 'https://www.instagram.com/zara.at.home/', 'paypal_email' ],\n\t[ 'jordan', 'Jordan', 'Reyes', 'jordan.reyes@example.com', 'approved', 52, 7, 'https://www.youtube.com/@jordanbuildsrooms', 'bacs' ],\n\t[ 'mei', 'Mei', 'Chen', 'mei.chen@example.com', 'approved', 45, 6, 'https://www.pinterest.com/meichenstyle/', 'paypal_email' ],\n\t[ 'tobias', 'Tobias', 'Lindqvist', 'tobias.lindqvist@example.com', 'approved', 33, 4, 'https://nordicnest-journal.com/best-ceramics/', 'bacs' ],\n\t[ 'aisha', 'Aisha', 'Bello', 'aisha.bello@example.com', 'approved', 21, 3, 'https://www.tiktok.com/@aishadecorates', 'paypal_email' ],\n\t[ 'diego', 'Diego', 'Morales', 'diego.morales@example.com', 'approved', 12, 2, 'https://www.reddit.com/r/malelivingspace/', 'paypal_email' ],\n\t[ 'hannah', 'Hannah', 'Kim', 'hannah.kim@example.com', 'pending', 3, 0, '', 'paypal_email' ],\n\t[ 'oliver', 'Oliver', 'Grant', 'oliver.grant@example.com', 'rejected', 9, 0, '', 'bacs' ],\n];\n$affiliates = [];\n$pool       = [];\nforeach ( $aff_people as $a ) {\n\t$uid = wp_insert_user( [ 'user_login' => $a[0], 'user_pass' => 'password', 'user_email' => $a[3], 'first_name' => $a[1], 'last_name' => $a[2], 'display_name' => $a[1] . ' ' . $a[2], 'role' => 'customer', 'user_registered' => $dt( $now - $a[5] * $day ) ] );\n\t$user = new WP_User( $uid );\n\t$user->add_role( 'ddwcaf_affiliate' );\n\tupdate_user_meta( $uid, '_ddwcaf_affiliate_status', $a[4] );\n\tupdate_user_meta( $uid, '_ddwcaf_affiliate_default_withdrawal_method', $a[8] );\n\tupdate_user_meta( $uid, '_ddwcaf_affiliate_withdrawal_methods', [\n\t\t'bacs'         => [ 'account_name' => $a[1] . ' ' . $a[2], 'iban' => 'GB29NWBK6016133192' . wp_rand( 1000, 9999 ), 'swift_code' => 'NWBKGB2L' ],\n\t\t'paypal_email' => $a[3],\n\t] );\n\t$affiliates[ $a[0] ] = [ 'id' => $uid, 'src' => $a[7], 'joined' => $a[5] ];\n\tfor ( $i = 0; $i < $a[6]; $i++ ) {\n\t\t$pool[] = $a[0];\n\t}\n}\n\n// Customers.\n$people = [\n\t[ 'amara', 'Amara', 'Okafor', 'amara.okafor@example.com', 'Seattle', 'WA', '98101' ],\n\t[ 'liam', 'Liam', 'Carter', 'liam.carter@example.com', 'Denver', 'CO', '80203' ],\n\t[ 'sofia', 'Sofia', 'Romero', 'sofia.romero@example.com', 'San Diego', 'CA', '92101' ],\n\t[ 'kenji', 'Kenji', 'Watanabe', 'kenji.watanabe@example.com', 'San Francisco', 'CA', '94104' ],\n\t[ 'priya', 'Priya', 'Sharma', 'priya.sharma@example.com', 'Austin', 'TX', '78701' ],\n\t[ 'noah', 'Noah', 'Mueller', 'noah.mueller@example.com', 'Chicago', 'IL', '60601' ],\n\t[ 'chloe', 'Chloe', 'Dubois', 'chloe.dubois@example.com', 'Boston', 'MA', '02108' ],\n\t[ 'marcus', 'Marcus', 'Bell', 'marcus.bell@example.com', 'Miami', 'FL', '33139' ],\n];\nforeach ( $people as &$p ) {\n\t$p['id'] = wp_insert_user( [ 'user_login' => $p[0], 'user_pass' => 'password', 'user_email' => $p[3], 'first_name' => $p[1], 'last_name' => $p[2], 'display_name' => $p[1] . ' ' . $p[2], 'role' => 'customer', 'user_registered' => $dt( $now - wp_rand( 20, 80 ) * $day ) ] );\n}\nunset( $p );\n\nmt_srand( 42 );\n$visit = function ( $aff, $ts, $order_id = null ) use ( $wpdb, $affiliates, $dt ) {\n\t$pages = [ '/', '/shop/', '/product/sage-ceramic-vase/', '/product/walnut-record-player/', '/product/window-reading-chair/' ];\n\t$wpdb->insert( $wpdb->prefix . 'ddwcaf_visits', [\n\t\t'affiliate_id'    => $affiliates[ $aff ]['id'],\n\t\t'url'             => home_url( $pages[ mt_rand( 0, 4 ) ] . '?ref=' . $affiliates[ $aff ]['id'] ),\n\t\t'referrer_url'    => $affiliates[ $aff ]['src'],\n\t\t'ip'              => '203.0.' . mt_rand( 1, 254 ) . '.' . mt_rand( 1, 254 ),\n\t\t'date'            => $dt( $ts ),\n\t\t'order_id'        => $order_id,\n\t\t'conversion_date' => $order_id ? $dt( $ts + 1800 ) : null,\n\t] );\n\treturn $wpdb->insert_id;\n};\n\n// Orders over the last 28 days, most of them referred by an affiliate.\n$commission_ids = [];\nfor ( $n = 0; $n < 46; $n++ ) {\n\t$c     = $people[ mt_rand( 0, count( $people ) - 1 ) ];\n\t$ago   = mt_rand( 0, 27 ) * $day + mt_rand( 0, 20 ) * HOUR_IN_SECONDS;\n\t$ts    = $now - $ago - 3600;\n\t$aff   = mt_rand( 1, 100 ) <= 68 ? $pool[ mt_rand( 0, count( $pool ) - 1 ) ] : null;\n\tif ( $aff && $affiliates[ $aff ]['joined'] * $day < $ago ) {\n\t\t$aff = 'zara';\n\t}\n\t$roll   = mt_rand( 1, 100 );\n\t$status = $ago < 3 * $day ? ( $roll <= 60 ? 'processing' : ( $roll <= 85 ? 'completed' : 'on-hold' ) ) : ( $roll <= 93 ? 'completed' : 'cancelled' );\n\n\t$addr  = [ 'first_name' => $c[1], 'last_name' => $c[2], 'email' => $c[3], 'address_1' => mt_rand( 10, 900 ) . ' Main Street', 'city' => $c[4], 'state' => $c[5], 'postcode' => $c[6], 'country' => 'US' ];\n\t$order = wc_create_order( [ 'customer_id' => $c['id'] ] );\n\t$picks = array_rand( $products, mt_rand( 1, 2 ) );\n\tforeach ( (array) $picks as $pi ) {\n\t\t$order->add_product( wc_get_product( $products[ $pi ] ), mt_rand( 1, 10 ) > 8 ? 2 : 1 );\n\t}\n\t$order->set_address( $addr, 'billing' );\n\t$order->set_address( $addr, 'shipping' );\n\t$order->set_payment_method_title( 'Credit card' );\n\t$order->set_date_created( $ts );\n\t$order->calculate_totals();\n\t$order->set_status( $status );\n\t$order->save();\n\n\tif ( ! $aff ) {\n\t\tcontinue;\n\t}\n\t$aid      = $affiliates[ $aff ]['id'];\n\t$visit_id = $visit( $aff, $ts - 1800, $order->get_id() );\n\t$order->update_meta_data( '_ddwcaf_referral_token', (string) $aid );\n\t$order->update_meta_data( '_ddwcaf_visit_id', $visit_id );\n\t$cstatus = [ 'completed' => 'pending', 'processing' => 'pending', 'on-hold' => 'not_confirmed', 'cancelled' => 'cancelled' ][ $status ];\n\tforeach ( $order->get_items() as $item_id => $item ) {\n\t\t$line = (float) $item->get_subtotal();\n\t\t$wpdb->insert( $wpdb->prefix . 'ddwcaf_commissions', [\n\t\t\t'affiliate_id' => $aid,\n\t\t\t'order_id'     => $order->get_id(),\n\t\t\t'line_item_id' => $item_id,\n\t\t\t'product_id'   => $item->get_product_id(),\n\t\t\t'quantity'     => $item->get_quantity(),\n\t\t\t'line_total'   => $line,\n\t\t\t'commission'   => round( $line * $rate / 100, 2 ),\n\t\t\t'refund'       => 0,\n\t\t\t'status'       => $cstatus,\n\t\t\t'created_at'   => $dt( $ts ),\n\t\t\t'updated_at'   => $dt( $ts ),\n\t\t] );\n\t\t$cid = $wpdb->insert_id;\n\t\t$item->update_meta_data( '_ddwcaf_commission_id', $cid );\n\t\t$item->save();\n\t\tif ( 'pending' === $cstatus && 'completed' === $status ) {\n\t\t\t$commission_ids[ $aff ][] = [ $cid, $ago, round( $line * $rate / 100, 2 ) ];\n\t\t}\n\t}\n\t$order->save();\n}\n\n// Clicks that did not convert, so visits and conversion rate look real.\nforeach ( $affiliates as $key => $a ) {\n\tif ( ! $a['src'] ) {\n\t\tcontinue;\n\t}\n\t$weight = count( array_keys( $pool, $key, true ) );\n\tfor ( $i = 0; $i < $weight * 14; $i++ ) {\n\t\t$visit( $key, $now - mt_rand( 0, min( 28, $a['joined'] ) * $day ) );\n\t}\n}\n\n// Payouts: older commissions paid out, one batch waiting to be paid.\n$pay = function ( $aff, $rows, $status, $ts ) use ( $wpdb, $affiliates, $dt, $aff_people ) {\n\t$method = array_column( $aff_people, 8, 0 )[ $aff ];\n\t$wpdb->insert( $wpdb->prefix . 'ddwcaf_payouts', [\n\t\t'affiliate_id'   => $affiliates[ $aff ]['id'],\n\t\t'payment_method' => $method,\n\t\t'amount'         => array_sum( wp_list_pluck( $rows, 2 ) ),\n\t\t'transaction_id' => 'completed' === $status ? strtoupper( wp_generate_password( 12, false ) ) : '',\n\t\t'reference'      => 'manually_by_admin',\n\t\t'status'         => $status,\n\t\t'payment_info'   => maybe_serialize( get_user_meta( $affiliates[ $aff ]['id'], '_ddwcaf_affiliate_withdrawal_methods', true )[ $method ] ),\n\t\t'created_at'     => $dt( $ts ),\n\t\t'completed_at'   => 'completed' === $status ? $dt( $ts + 2 * DAY_IN_SECONDS ) : null,\n\t] );\n\t$pid = $wpdb->insert_id;\n\tforeach ( $rows as $r ) {\n\t\t$wpdb->insert( $wpdb->prefix . 'ddwcaf_commissionsmeta', [ 'commission_id' => $r[0], 'meta_key' => '_ddwcaf_payout_id', 'meta_value' => $pid ] );\n\t\t$wpdb->update( $wpdb->prefix . 'ddwcaf_commissions', [ 'status' => 'completed' === $status ? 'paid' : 'pending_payment', 'updated_at' => $dt( $ts ) ], [ 'id' => $r[0] ] );\n\t}\n};\nforeach ( [ 'zara', 'jordan', 'mei', 'tobias' ] as $i => $aff ) {\n\t$rows = $commission_ids[ $aff ] ?? [];\n\t$old  = array_values( array_filter( $rows, function ( $r ) { return $r[1] > 14 * DAY_IN_SECONDS; } ) );\n\tif ( $old ) {\n\t\t$pay( $aff, $old, 'completed', $now - ( 12 - $i ) * $day );\n\t}\n\tif ( 'jordan' === $aff ) {\n\t\t$mid = array_values( array_filter( $rows, function ( $r ) { return $r[1] > 5 * DAY_IN_SECONDS && $r[1] <= 14 * DAY_IN_SECONDS; } ) );\n\t\tif ( $mid ) {\n\t\t\t$pay( $aff, $mid, 'pending', $now - $day );\n\t\t}\n\t}\n}\n\n\n// ---- Storefront (Kadence + DevDiggers demo kit) ----\n\n// ---- DevDiggers Live Preview demo kit (Apple design language on Kadence) ----\n/**\n * Inserted by build.py where a seed says // @kit. Call, after products and users exist:\n *   ddwc_demo_kit_style( [ 'accent' => '#0071e3', 'css' => '' ] )  Kadence + global CSS.\n *   ddwc_demo_kit_home( [...] )                                     Home page, set as front page.\n *   ddwc_demo_kit_menu( [ 'Shop' => url, ... ] )                    Primary menu.\n *   ddwc_demo_kit_switcher( $views_php )                            \"View as\" switcher mu-plugin.\n *   ddwc_demo_kit_icon( 'chat' )                                    SVG line icon (names in the list below).\n * Widget classes for the hero showcase: dk-widget, dk-w-head, dk-w-app, dk-w-label, dk-w-title,\n * dk-w-big, dk-w-row, dk-w-pill, dk-w-avatar, dk-w-bubble, dk-w-note.\n */\n\nfunction ddwc_demo_kit_icon( $name, $size = 24 ) {\n\t$paths = [\n\t\t'admin'    => '<rect x=\"3\" y=\"3\" width=\"7\" height=\"9\" rx=\"1.5\"/><rect x=\"14\" y=\"3\" width=\"7\" height=\"5\" rx=\"1.5\"/><rect x=\"14\" y=\"12\" width=\"7\" height=\"9\" rx=\"1.5\"/><rect x=\"3\" y=\"16\" width=\"7\" height=\"5\" rx=\"1.5\"/>',\n\t\t'customer' => '<circle cx=\"12\" cy=\"8\" r=\"4\"/><path d=\"M4 21c0-4 3.6-7 8-7s8 3 8 7\"/>',\n\t\t'store'    => '<path d=\"M3 9l1.5-5h15L21 9\"/><path d=\"M3 9h18v2a3 3 0 0 1-6 0 3 3 0 0 1-6 0 3 3 0 0 1-6 0z\"/><path d=\"M5 13v8h14v-8\"/><path d=\"M10 21v-5h4v5\"/>',\n\t\t'product'  => '<path d=\"M20.6 13.4 13.4 20.6a2 2 0 0 1-2.8 0L3 13V3h10l7.6 7.6a2 2 0 0 1 0 2.8z\"/><circle cx=\"7.5\" cy=\"7.5\" r=\"1.5\"/>',\n\t\t'cart'     => '<circle cx=\"9\" cy=\"20\" r=\"1.5\"/><circle cx=\"18\" cy=\"20\" r=\"1.5\"/><path d=\"M2 3h3l2.7 12.4a2 2 0 0 0 2 1.6h8.6a2 2 0 0 0 2-1.5L22 7H6\"/>',\n\t\t'chat'     => '<path d=\"M21 12a8 8 0 0 1-11.6 7.1L4 20l1-4.6A8 8 0 1 1 21 12z\"/>',\n\t\t'wallet'   => '<path d=\"M3 7a2 2 0 0 1 2-2h13v4\"/><rect x=\"3\" y=\"7\" width=\"18\" height=\"13\" rx=\"2\"/><circle cx=\"16.5\" cy=\"13.5\" r=\"1.3\"/>',\n\t\t'star'     => '<path d=\"m12 3 2.8 5.7 6.2.9-4.5 4.4 1.1 6.2L12 17.3 6.4 20.2l1.1-6.2L3 9.6l6.2-.9z\"/>',\n\t\t'register' => '<rect x=\"3\" y=\"4\" width=\"18\" height=\"12\" rx=\"2\"/><path d=\"M7 20h10M12 16v4M7 8h4M7 11h2\"/>',\n\t\t'link'     => '<path d=\"M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1\"/><path d=\"M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1\"/>',\n\t\t'cube'     => '<path d=\"M12 2 21 7v10l-9 5-9-5V7z\"/><path d=\"m3 7 9 5 9-5M12 12v10\"/>',\n\t\t'ar'       => '<path d=\"M3 7V4h3M21 7V4h-3M3 17v3h3M21 17v3h-3\"/><rect x=\"8\" y=\"8\" width=\"8\" height=\"8\" rx=\"1.5\"/>',\n\t\t'rx'       => '<path d=\"M9 3h6v4H9z\"/><path d=\"M7 5H5v16h14V5h-2\"/><path d=\"M9 12h6M9 16h4\"/>',\n\t\t'phone'    => '<rect x=\"6\" y=\"2\" width=\"12\" height=\"20\" rx=\"3\"/><path d=\"M11 18h2\"/>',\n\t\t'orders'   => '<path d=\"M4 7 12 3l8 4v10l-8 4-8-4z\"/><path d=\"m4 7 8 4 8-4M12 11v10\"/>',\n\t\t'calendar' => '<rect x=\"3\" y=\"5\" width=\"18\" height=\"16\" rx=\"2\"/><path d=\"M3 10h18M8 3v4M16 3v4\"/>',\n\t\t'clock'    => '<circle cx=\"12\" cy=\"13\" r=\"8\"/><path d=\"M12 9v4l2.5 2.5M9 2h6\"/>',\n\t\t'mail'     => '<rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\"/><path d=\"m3 7 9 6 9-6\"/>',\n\t\t'chart'    => '<path d=\"M3 3v18h18\"/><path d=\"m7 15 4-4 3 3 5-6\"/>',\n\t\t'card'     => '<rect x=\"2\" y=\"5\" width=\"20\" height=\"14\" rx=\"2\"/><path d=\"M2 10h20M6 15h4\"/>',\n\t\t'scan'     => '<path d=\"M3 7V5a2 2 0 0 1 2-2h2M17 3h2a2 2 0 0 1 2 2v2M21 17v2a2 2 0 0 1-2 2h-2M7 21H5a2 2 0 0 1-2-2v-2M7 8v8M11 8v8M14 8v8M17 8v8\"/>',\n\t\t'receipt'  => '<path d=\"M5 3h14v18l-3-2-2 2-2-2-2 2-2-2-3 2z\"/><path d=\"M9 8h6M9 12h6\"/>',\n\t\t'heart'    => '<path d=\"M12 21s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 11c0 5.6-7 10-7 10z\"/>',\n\t\t'upload'   => '<path d=\"M12 16V4M7 9l5-5 5 5\"/><path d=\"M4 16v3a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-3\"/>',\n\t\t'lock'     => '<rect x=\"4\" y=\"11\" width=\"16\" height=\"10\" rx=\"2\"/><path d=\"M8 11V7a4 4 0 0 1 8 0v4\"/>',\n\t\t'shield'   => '<path d=\"M12 3 4 6v6c0 4.5 3.4 8 8 9 4.6-1 8-4.5 8-9V6z\"/><path d=\"m8.5 12 2.5 2.5 4.5-5\"/>',\n\t\t'wifi'     => '<path d=\"M2 8.8a15 15 0 0 1 20 0M5 12.5a10 10 0 0 1 14 0M8.5 16a5 5 0 0 1 7 0\"/><circle cx=\"12\" cy=\"19.5\" r=\"1\"/>',\n\t\t'bell'     => '<path d=\"M6 8a6 6 0 0 1 12 0c0 7 3 8 3 8H3s3-1 3-8\"/><path d=\"M10.3 21a1.9 1.9 0 0 0 3.4 0\"/>',\n\t\t'gift'     => '<rect x=\"3\" y=\"8\" width=\"18\" height=\"13\" rx=\"2\"/><path d=\"M3 12h18M12 8v13M12 8C10 5 7 5 7 7s3 1 5 1c2 0 5 1 5-1s-3-2-5 1\"/>',\n\t\t'bolt'     => '<path d=\"M13 2 4 14h7l-1 8 9-12h-7z\"/>',\n\t\t'ask'      => '<circle cx=\"12\" cy=\"12\" r=\"9\"/><path d=\"M9.5 9.5a2.5 2.5 0 1 1 3.5 2.3c-.7.3-1 .9-1 1.7M12 17h.01\"/>',\n\t\t'check'    => '<path d=\"m5 12 5 5 9-10\"/>',\n\t\t'pay'      => '<rect x=\"3\" y=\"6\" width=\"18\" height=\"13\" rx=\"2\"/><path d=\"M3 10h18M7 15h3\"/>',\n\t];\n\treturn '<svg viewBox=\"0 0 24 24\" width=\"' . (int) $size . '\" height=\"' . (int) $size . '\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">' . ( $paths[ $name ] ?? $paths['store'] ) . '</svg>';\n}\n\n/** Product photo URL (for hero_img and tile img). */\nfunction ddwc_demo_kit_img( $product_id, $size = 'large' ) {\n\treturn wp_get_attachment_image_url( get_post_thumbnail_id( $product_id ), $size );\n}\n\n/**\n * Brand the store: Apple's neutral system (SF Pro via the system font stack, #1d1d1f / #6e6e73 / #f5f5f7)\n * with one accent colour per brand. Global CSS goes in an mu-plugin so the seed may still use Additional CSS.\n *\n * @param array $a accent (hex), css (extra CSS appended after the kit CSS).\n */\nfunction ddwc_demo_kit_style( $a ) {\n\t$a      = array_merge( [ 'accent' => '#0071e3', 'css' => '' ], $a );\n\t$accent = $a['accent'];\n\t$rgb    = sscanf( $accent, '#%02x%02x%02x' );\n\t$dark   = vsprintf( '#%02x%02x%02x', array_map( function ( $c ) { return (int) round( $c * 0.84 ); }, $rgb ) );\n\t$tint   = vsprintf( 'rgba(%d,%d,%d,.1)', $rgb );\n\t$stack  = '-apple-system,BlinkMacSystemFont,\"SF Pro Text\",\"SF Pro Display\",\"Helvetica Neue\",Helvetica,Arial,sans-serif';\n\n\t$colors  = [ $accent, $dark, '#1d1d1f', '#1d1d1f', '#6e6e73', '#86868b', '#d2d2d7', '#f5f5f7', '#ffffff', '#ffffff', '#248a3d', '#0071e3', '#d70015', '#bf4800', '#b25e09' ];\n\t$palette = [];\n\tforeach ( $colors as $i => $color ) {\n\t\t$palette[] = [ 'color' => $color, 'slug' => 'palette' . ( $i + 1 ), 'name' => 'Palette Color ' . ( $i + 1 ) ];\n\t}\n\tupdate_option( 'kadence_global_palette', wp_json_encode( [ 'palette' => $palette, 'second-palette' => $palette, 'third-palette' => $palette, 'active' => 'palette' ] ) );\n\n\tset_theme_mod( 'base_font', [ 'family' => $stack, 'google' => false, 'weight' => '400', 'variant' => 'regular', 'size' => [ 'desktop' => 17 ], 'lineHeight' => [ 'desktop' => 1.47 ], 'color' => 'palette4' ] );\n\tset_theme_mod( 'heading_font', [ 'family' => $stack, 'google' => false, 'weight' => '600', 'variant' => [ '600' ] ] );\n\tforeach ( [ 'h1_font' => [ 48, 1.08 ], 'h2_font' => [ 40, 1.1 ], 'h3_font' => [ 28, 1.14 ], 'h4_font' => [ 21, 1.2 ], 'h5_font' => [ 17, 1.3 ], 'h6_font' => [ 14, 1.4 ] ] as $mod => $size ) {\n\t\tset_theme_mod( $mod, [ 'size' => [ 'desktop' => $size[0] ], 'lineHeight' => [ 'desktop' => $size[1] ], 'family' => 'inherit', 'google' => false, 'weight' => '600', 'variant' => '600', 'color' => 'palette3' ] );\n\t}\n\tset_theme_mod( 'load_fonts_local', false );\n\n\tset_theme_mod( 'site_background', [ 'desktop' => [ 'color' => 'palette9' ] ] );\n\tset_theme_mod( 'content_background', [ 'desktop' => [ 'color' => 'palette9' ] ] );\n\tset_theme_mod( 'page_content_style', 'unboxed' );\n\tset_theme_mod( 'product_archive_content_style', 'unboxed' );\n\tset_theme_mod( 'product_content_style', 'unboxed' );\n\tset_theme_mod( 'product_archive_columns', '4' );\n\tset_theme_mod( 'buttons_border_radius', [ 'size' => [ 980, 980, 980, 980 ], 'unit' => 'px', 'locked' => true ] );\n\tset_theme_mod( 'buttons_typography', [ 'size' => [ 'desktop' => 15 ], 'family' => 'inherit', 'weight' => '400', 'variant' => 'regular', 'letterSpacing' => [ 'desktop' => -0.01 ], 'letterType' => 'em' ] );\n\tset_theme_mod( 'buttons_padding', [ 'size' => [ 'desktop' => [ 11, 22, 11, 22 ] ], 'unit' => [ 'desktop' => 'px' ], 'locked' => [ 'desktop' => false ] ] );\n\n\t// Header: one slim frosted bar, logo left, menu and bag right.\n\tset_theme_mod(\n\t\t'header_desktop_items',\n\t\t[\n\t\t\t'top'    => [ 'top_left' => [], 'top_left_center' => [], 'top_center' => [], 'top_right_center' => [], 'top_right' => [] ],\n\t\t\t'main'   => [ 'main_left' => [ 'logo' ], 'main_left_center' => [], 'main_center' => [], 'main_right_center' => [], 'main_right' => [ 'navigation', 'cart' ] ],\n\t\t\t'bottom' => [ 'bottom_left' => [], 'bottom_left_center' => [], 'bottom_center' => [], 'bottom_right_center' => [], 'bottom_right' => [] ],\n\t\t]\n\t);\n\tset_theme_mod( 'header_sticky', 'main' );\n\tset_theme_mod( 'header_main_height', [ 'size' => [ 'mobile' => 52, 'tablet' => 52, 'desktop' => 52 ], 'unit' => [ 'mobile' => 'px', 'tablet' => 'px', 'desktop' => 'px' ] ] );\n\tset_theme_mod( 'header_main_background', [ 'desktop' => [ 'color' => 'rgba(255,255,255,0.8)' ] ] );\n\tset_theme_mod( 'header_sticky_background', [ 'desktop' => [ 'color' => 'rgba(255,255,255,0.8)' ] ] );\n\tset_theme_mod( 'header_main_bottom_border', [ 'desktop' => [ 'width' => 1, 'unit' => 'px', 'style' => 'solid', 'color' => 'rgba(0,0,0,0.08)' ] ] );\n\tset_theme_mod( 'brand_typography', [ 'size' => [ 'desktop' => 19 ], 'family' => 'inherit', 'google' => false, 'weight' => '600', 'variant' => '600', 'letterSpacing' => [ 'desktop' => -0.02 ], 'letterType' => 'em', 'color' => 'palette3' ] );\n\tset_theme_mod( 'primary_navigation_typography', [ 'size' => [ 'desktop' => 13 ], 'family' => 'inherit', 'weight' => '400', 'variant' => 'regular' ] );\n\tset_theme_mod( 'primary_navigation_color', [ 'color' => 'palette4', 'hover' => 'palette1', 'active' => 'palette3' ] );\n\n\tset_theme_mod( 'page_title_layout', 'above' );\n\tset_theme_mod( 'page_title_background', [ 'desktop' => [ 'color' => 'palette8' ] ] );\n\tset_theme_mod( 'product_archive_title_background', [ 'desktop' => [ 'color' => 'palette8' ] ] );\n\tset_theme_mod( 'footer_html_content', '{copyright} {year} {site-title}. A DevDiggers live demo store.' );\n\tset_theme_mod( 'footer_bottom_background', [ 'desktop' => [ 'color' => 'palette8' ] ] );\n\n\t$css = <<<'DDWCCSS'\n:root{--dk-accent:__A__;--dk-accent-dark:__D__;--dk-tint:__T__;--dk-ink:#1d1d1f;--dk-gray:#6e6e73;--dk-line:#d2d2d7;--dk-fog:#f5f5f7;--dk-ease:cubic-bezier(.25,.1,.25,1)}\nbody{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;letter-spacing:-.022em;color:var(--dk-ink)}\nh1,h2,h3,h4{letter-spacing:-.015em}\na{color:var(--dk-accent)}\n#masthead .site-main-header-wrap,#masthead .item-is-fixed{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px)}\n.main-navigation .primary-menu-container>ul>li.menu-item>a{padding-left:.9em;padding-right:.9em;opacity:.85}\n.main-navigation .primary-menu-container>ul>li.menu-item>a:hover{opacity:1}\n.button,button.button,.wp-element-button,input[type=submit],.woocommerce a.button,.woocommerce button.button{background:var(--dk-accent);color:#fff;border:0;box-shadow:none!important;transition:background .2s var(--dk-ease)}\n.button:hover,.wp-element-button:hover,input[type=submit]:hover,.woocommerce a.button:hover,.woocommerce button.button:hover{background:var(--dk-accent-dark);color:#fff}\ninput[type=text],input[type=email],input[type=tel],input[type=password],input[type=number],input[type=search],textarea,select{border:1px solid var(--dk-line)!important;border-radius:12px!important;padding:12px 14px!important;background:#fff!important;font-size:17px;transition:border-color .2s,box-shadow .2s}\ninput:focus,textarea:focus,select:focus{border-color:var(--dk-accent)!important;box-shadow:0 0 0 4px var(--dk-tint)!important;outline:0}\n.entry-hero .entry-header,.page-title{padding-top:56px;padding-bottom:40px}\n.entry-hero h1,.page-title h1,.woocommerce-products-header__title{font-size:48px;letter-spacing:-.02em}\n.woocommerce-store-notice{display:none!important}\n.woocommerce-message,.woocommerce-info,.woocommerce-error{border:0!important;border-radius:14px;background:var(--dk-fog)!important;color:var(--dk-ink)}\n/* Product cards, Apple Store style. */\nul.products li.product{background:#fff;border-radius:18px;padding:0 0 22px;overflow:hidden;box-shadow:0 2px 12px rgba(0,0,0,.08);transition:box-shadow .3s var(--dk-ease),transform .3s var(--dk-ease)}\nul.products li.product:hover{box-shadow:0 10px 34px rgba(0,0,0,.14);transform:translateY(-2px)}\nul.products li.product img{border-radius:0!important;aspect-ratio:1/1;object-fit:cover;margin:0!important}\nul.products li.product .woocommerce-loop-product__title,ul.products li.product .product-details,ul.products li.product .entry-content-wrap{padding-left:20px;padding-right:20px}\nul.products li.product .woocommerce-loop-product__title{font-size:17px;font-weight:600;margin-top:16px}\nul.products li.product .price{color:var(--dk-gray);font-size:15px;font-weight:400}\nul.products li.product .button{font-size:14px;padding:8px 16px}\nul.products li.product .onsale{border-radius:980px;background:var(--dk-accent);font-weight:600;font-size:12px}\n.single-product div.product .product_title{font-size:40px;letter-spacing:-.02em}\n.single-product div.product .price{font-size:21px;color:var(--dk-ink)}\n.single-product div.product .woocommerce-product-gallery img{border-radius:24px}\n/* My account, as a settings sidebar. */\n.woocommerce-MyAccount-navigation ul{background:var(--dk-fog);border-radius:18px;padding:8px!important}\n.woocommerce-MyAccount-navigation ul li{border:0!important}\n.woocommerce-MyAccount-navigation ul li a{display:block;padding:10px 14px!important;border-radius:10px;color:var(--dk-ink)!important;font-size:15px}\n.woocommerce-MyAccount-navigation ul li.is-active a{background:#fff;font-weight:600;box-shadow:0 1px 4px rgba(0,0,0,.08)}\ntable.shop_table{border-radius:18px!important;border-color:var(--dk-line)!important;overflow:hidden}\n.site-footer{font-size:12px;color:var(--dk-gray)}\n/* Home page building blocks. */\n.dk-wrap{max-width:1180px;margin:0 auto;padding-left:22px;padding-right:22px}\n.dk-hero{text-align:center;padding-top:72px}\n.dk-eyebrow{display:inline-block;color:var(--dk-accent);font-size:17px;font-weight:600;letter-spacing:-.01em;margin-bottom:10px}\n.dk-hero h1{font-size:clamp(44px,7vw,80px);line-height:1.05;letter-spacing:-.025em;margin:0 auto 14px!important;max-width:16ch;text-wrap:balance}\n.dk-lead{font-size:clamp(19px,2.2vw,24px);line-height:1.38;color:var(--dk-gray);max-width:36em;margin:0 auto 28px!important;text-wrap:pretty;letter-spacing:-.015em}\n.dk-ctas{display:flex;gap:28px;justify-content:center;align-items:center;flex-wrap:wrap}\n.dk-btn{display:inline-flex;align-items:center;padding:12px 24px;border-radius:980px;background:var(--dk-accent);color:#fff!important;font-size:17px;text-decoration:none!important;transition:background .2s var(--dk-ease)}\n.dk-btn:hover{background:var(--dk-accent-dark)}\n.dk-btn.is-light{background:#fff;color:var(--dk-ink)!important}.dk-btn.is-light:hover{background:#e8e8ed}\n.dk-more{font-size:17px;color:var(--dk-accent)!important;text-decoration:none!important}\n.dk-more:after{content:\"\\203A\";display:inline-block;margin-left:6px;font-size:1.2em;line-height:0;transition:transform .2s var(--dk-ease)}\n.dk-more:hover{text-decoration:underline!important}.dk-more:hover:after{transform:translateX(3px)}\n.dk-stage{position:relative;margin:56px auto 0;max-width:1180px;border-radius:32px;overflow:hidden;background:var(--dk-fog);aspect-ratio:16/9}\n.dk-stage>img{width:100%;height:100%;object-fit:cover;display:block}\n.dk-stage.is-trio{display:grid;grid-template-columns:repeat(3,1fr);gap:4px;background:#fff}\n.dk-stage.is-trio>img{min-width:0}\n.dk-stage .dk-widget{position:absolute;right:32px;bottom:32px}\n.dk-widget{width:330px;max-width:calc(100% - 32px);text-align:left;padding:18px;border-radius:22px;background:rgba(255,255,255,.78);-webkit-backdrop-filter:saturate(180%) blur(24px);backdrop-filter:saturate(180%) blur(24px);box-shadow:0 22px 60px rgba(0,0,0,.18),inset 0 0 0 .5px rgba(255,255,255,.6);color:var(--dk-ink);font-size:15px;line-height:1.35}\n.dk-w-head{display:flex;align-items:center;gap:10px;margin-bottom:12px}\n.dk-w-app{flex:none;display:grid;place-items:center;width:34px;height:34px;border-radius:9px;background:var(--dk-accent);color:#fff}\n.dk-w-app svg{width:19px;height:19px}\n.dk-w-label{display:block;font-size:12px;font-weight:600;color:var(--dk-gray);letter-spacing:0;text-transform:uppercase}\n.dk-w-title{display:block;font-size:16px;font-weight:600;letter-spacing:-.02em}\n.dk-w-big{display:block;font-size:40px;font-weight:600;letter-spacing:-.03em;line-height:1.1;margin:4px 0}\n.dk-w-row{display:flex;justify-content:space-between;gap:12px;padding:9px 0;border-top:.5px solid rgba(0,0,0,.12);font-size:14px}\n.dk-w-row span:last-child{color:var(--dk-gray)}\n.dk-w-row.is-total{font-weight:600}.dk-w-row.is-total span:last-child{color:var(--dk-ink)}\n.dk-w-pill{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:980px;background:var(--dk-tint);color:var(--dk-accent);font-size:13px;font-weight:600}\n.dk-w-avatar{flex:none;width:34px;height:34px;border-radius:50%;object-fit:cover}\n.dk-w-bubble{padding:10px 14px;border-radius:18px 18px 18px 6px;background:#e9e9eb;font-size:15px;margin-top:6px}\n.dk-w-bubble.is-me{border-radius:18px 18px 6px 18px;background:var(--dk-accent);color:#fff;margin-left:30px}\n.dk-w-note{display:block;font-size:12px;color:var(--dk-gray);margin-top:10px}\n.dk-cd{display:flex;gap:8px;margin:10px 0 4px}.dk-cd span{flex:1;text-align:center;padding:10px 0 8px;border-radius:12px;background:var(--dk-ink);color:#fff;font-size:22px;font-weight:600;font-variant-numeric:tabular-nums;letter-spacing:-.02em}\n.dk-cd small{display:block;font-size:10px;font-weight:500;color:#a1a1a6;letter-spacing:.04em;text-transform:uppercase;margin-top:3px}\n.dk-band{background:var(--dk-fog);margin-top:96px;padding:88px 0}\n.dk-title{text-align:center!important;font-size:clamp(34px,4.6vw,56px);letter-spacing:-.025em;line-height:1.08;margin:0 auto 48px!important;max-width:20ch;text-wrap:balance}\n.dk-shelf-title{font-size:clamp(28px,3.4vw,40px);letter-spacing:-.02em;line-height:1.1;margin:0 0 28px}\n.dk-shelf-title span{color:var(--dk-gray)}\n.dk-features{display:grid;grid-template-columns:repeat(3,1fr);gap:20px}\n.dk-feature{background:#fff;border-radius:28px;padding:36px 32px 40px}\n.dk-feature svg{color:var(--dk-accent);width:36px;height:36px}\n.dk-feature h3{font-size:24px;letter-spacing:-.02em;margin:18px 0 8px}\n.dk-feature p{margin:0;font-size:17px;color:var(--dk-gray)}\n.dk-shelf{padding-top:96px}\n.dk-shelf-head{display:flex;justify-content:space-between;align-items:baseline;gap:16px;flex-wrap:wrap}\n.dk-tile{margin:96px auto 104px;display:grid;grid-template-columns:1fr 1fr;align-items:center;border-radius:32px;overflow:hidden;background:#000;color:#f5f5f7}\n.dk-tile-copy{padding:64px}\n.dk-tile h2{color:#f5f5f7;font-size:clamp(32px,3.8vw,48px);letter-spacing:-.025em;line-height:1.08;margin:0 0 16px}\n.dk-tile p{color:#a1a1a6;font-size:19px;line-height:1.42}\n.dk-tile .dk-more{color:#2997ff!important}\n.dk-tile img{width:100%;height:100%;min-height:440px;max-height:600px;object-fit:cover;display:block}\n.dk-stats{display:flex;gap:36px;margin:28px 0}.dk-stats b{display:block;font-size:32px;font-weight:600;letter-spacing:-.02em;color:#f5f5f7}.dk-stats span{font-size:14px;color:#a1a1a6}\n.dk-list{list-style:none;padding:0;margin:24px 0}.dk-list li{display:flex;gap:12px;align-items:center;padding:10px 0;border-top:.5px solid rgba(255,255,255,.16);color:#f5f5f7;font-size:17px}\n.dk-list li b{display:grid;place-items:center;flex:none;width:26px;height:26px;border-radius:50%;background:#f5f5f7;color:#000;font-size:13px}\n@media(max-width:900px){.dk-features,.dk-tile{grid-template-columns:1fr}.dk-stage{aspect-ratio:4/5;border-radius:24px}.dk-stage .dk-widget{left:16px;right:16px;bottom:16px;width:auto}.dk-stage.is-trio{grid-template-columns:1fr 1fr}.dk-stage.is-trio>img:nth-child(3){display:none}.dk-tile-copy{padding:40px 28px}.dk-tile img{min-height:300px}.dk-band{padding:64px 0}}\n@media(prefers-reduced-motion:reduce){*{transition:none!important}}\nDDWCCSS;\n\t$css  = str_replace( [ '__A__', '__D__', '__T__' ], [ $accent, $dark, $tint ], $css ) . $a['css'];\n\t$code = \"<?php\\n// Live Preview only: the demo kit's global stylesheet.\\nadd_action( 'wp_head', function () { echo '<style id=\\\"ddwc-demo-kit\\\">' . \" . var_export( $css, true ) . \" . '</style>'; }, 99 );\\n\";\n\twp_mkdir_p( WPMU_PLUGIN_DIR );\n\tfile_put_contents( WPMU_PLUGIN_DIR . '/demo-style.php', $code );\n}\n\n/**\n * Build the home page and make it the front page.\n *\n * @param array $h eyebrow, title, lead, ctas [ [label, url], [label, url] ] (first is the filled button),\n *                 hero_img (url, or three urls for a photo trio), hero_alt, widget (HTML on the hero stage), after_ctas (HTML, e.g. a shortcode),\n *                 features_title, features [ [title, text, icon] ], shelf_title, shelf_sub, shelf (shortcode),\n *                 shelf_more [label, url], tile [title, text, cta [label, url], img, alt, extra HTML], script.\n * @return int Page ID.\n */\nfunction ddwc_demo_kit_home( $h ) {\n\t$ctas = '';\n\tforeach ( $h['ctas'] as $i => $cta ) {\n\t\t$ctas .= '<a class=\"' . ( $i ? 'dk-more' : 'dk-btn' ) . '\" href=\"' . esc_url( $cta[1] ) . '\">' . esc_html( $cta[0] ) . '</a>';\n\t}\n\t$features = '';\n\tforeach ( $h['features'] as $f ) {\n\t\t$features .= '<div class=\"dk-feature\">' . ddwc_demo_kit_icon( $f[2], 36 ) . '<h3>' . $f[0] . '</h3><p>' . $f[1] . '</p></div>';\n\t}\n\t// One wide photo, or three product photos side by side (works with portrait shots).\n\t$trio = is_array( $h['hero_img'] );\n\t$imgs = '';\n\tforeach ( (array) $h['hero_img'] as $src ) {\n\t\t$imgs .= '<img src=\"' . esc_url( $src ) . '\" alt=\"' . esc_attr( $h['hero_alt'] ) . '\"/>';\n\t}\n\t$t    = $h['tile'];\n\t$more = $h['shelf_more'] ?? [ 'View all products', wc_get_page_permalink( 'shop' ) ];\n\t$html = '<!-- wp:html --><section class=\"dk-hero dk-wrap\"><span class=\"dk-eyebrow\">' . $h['eyebrow'] . '</span><h1>' . $h['title'] . '</h1><p class=\"dk-lead\">' . $h['lead'] . '</p><div class=\"dk-ctas\">' . $ctas . ( $h['after_ctas'] ?? '' ) . '</div>'\n\t\t. '<div class=\"dk-stage' . ( $trio ? ' is-trio' : '' ) . '\">' . $imgs . $h['widget'] . '</div></section><!-- /wp:html -->'\n\t\t. '<!-- wp:html --><section class=\"dk-band\"><div class=\"dk-wrap\"><h2 class=\"dk-title\">' . $h['features_title'] . '</h2><div class=\"dk-features\">' . $features . '</div></div></section><!-- /wp:html -->'\n\t\t. '<!-- wp:html --><section class=\"dk-shelf dk-wrap\"><div class=\"dk-shelf-head\"><h2 class=\"dk-shelf-title\">' . $h['shelf_title'] . ' <span>' . $h['shelf_sub'] . '</span></h2><a class=\"dk-more\" href=\"' . esc_url( $more[1] ) . '\">' . esc_html( $more[0] ) . '</a></div><!-- /wp:html -->'\n\t\t. '<!-- wp:shortcode -->' . $h['shelf'] . '<!-- /wp:shortcode -->'\n\t\t. '<!-- wp:html --></section><!-- /wp:html -->'\n\t\t. '<!-- wp:html --><section class=\"dk-wrap\"><div class=\"dk-tile\"><div class=\"dk-tile-copy\"><h2>' . $t['title'] . '</h2><p>' . $t['text'] . '</p>' . ( $t['extra'] ?? '' ) . '<p><a class=\"dk-btn is-light\" href=\"' . esc_url( $t['cta'][1] ) . '\">' . esc_html( $t['cta'][0] ) . '</a></p></div><img src=\"' . esc_url( $t['img'] ) . '\" alt=\"' . esc_attr( $t['alt'] ) . '\"/></div></section>' . ( $h['script'] ?? '' ) . '<!-- /wp:html -->';\n\n\t$id = wp_insert_post( [ 'post_type' => 'page', 'post_status' => 'publish', 'post_title' => 'Home', 'post_content' => $html ] );\n\tforeach ( [ '_kad_post_title' => 'hide', '_kad_post_layout' => 'fullwidth', '_kad_post_content_style' => 'unboxed', '_kad_post_vertical_padding' => 'hide', '_kad_post_feature' => 'hide' ] as $k => $v ) {\n\t\tupdate_post_meta( $id, $k, $v );\n\t}\n\tupdate_option( 'show_on_front', 'page' );\n\tupdate_option( 'page_on_front', $id );\n\twp_delete_post( 2, true ); // Sample Page.\n\twp_delete_post( 1, true ); // Hello world.\n\tupdate_option( 'permalink_structure', '/%postname%/' );\n\tflush_rewrite_rules();\n\treturn $id;\n}\n\n/**\n * Primary menu.\n *\n * @param array $items label => url.\n */\nfunction ddwc_demo_kit_menu( $items ) {\n\t$menu_id = wp_create_nav_menu( 'Main menu' );\n\tif ( is_wp_error( $menu_id ) ) {\n\t\t$menu_id = wp_get_nav_menu_object( 'Main menu' )->term_id;\n\t}\n\tforeach ( $items as $label => $url ) {\n\t\twp_update_nav_menu_item( $menu_id, 0, [ 'menu-item-title' => $label, 'menu-item-url' => $url, 'menu-item-status' => 'publish', 'menu-item-type' => 'custom' ] );\n\t}\n\t$locations            = get_theme_mod( 'nav_menu_locations', [] );\n\t$locations['primary'] = $menu_id;\n\t$locations['mobile']  = $menu_id;\n\tset_theme_mod( 'nav_menu_locations', $locations );\n}\n\n/**\n * Write the \"View as\" switcher mu-plugin.\n *\n * Pass a PHP expression string that returns the views array; each view:\n *   [ 'label' => 'Store admin', 'hint' => 'Dashboard & settings', 'icon' => 'admin', 'user' => 'admin', 'url' => admin_url(...) ]\n * user '' logs the visitor out. icon: any ddwc_demo_kit_icon() name.\n *\n * @param string $views_php PHP code (no <?php) that returns the array.\n */\nfunction ddwc_demo_kit_switcher( $views_php ) {\n\t$icons = [];\n\tforeach ( [ 'admin', 'customer', 'store', 'product', 'cart', 'chat', 'wallet', 'star', 'register', 'link', 'cube', 'rx', 'phone', 'orders', 'calendar' ] as $n ) {\n\t\t$icons[ $n ] = ddwc_demo_kit_icon( $n, 18 );\n\t}\n\t$code = <<<'DDWCKIT'\n<?php\n/**\n * Live Preview only: \"View as\" switcher so visitors can jump between the store owner's\n * admin and the shopper's side without any password.\n */\nfunction ddwc_demo_switcher_views() {\n\t__VIEWS__\n}\n\nadd_action(\n\t'init',\n\tfunction () {\n\t\tif ( ! isset( $_GET['ddwc_demo_view'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification -- demo site only.\n\t\t\treturn;\n\t\t}\n\t\t$views = ddwc_demo_switcher_views();\n\t\t$view  = $views[ absint( $_GET['ddwc_demo_view'] ) ] ?? null; // phpcs:ignore WordPress.Security.NonceVerification\n\t\tif ( ! $view ) {\n\t\t\treturn;\n\t\t}\n\t\twp_clear_auth_cookie();\n\t\twp_set_current_user( 0 );\n\t\t$user = $view['user'] ? get_user_by( 'login', $view['user'] ) : null;\n\t\tif ( $user ) {\n\t\t\twp_set_current_user( $user->ID );\n\t\t\twp_set_auth_cookie( $user->ID, true );\n\t\t}\n\t\twp_safe_redirect( $view['url'] );\n\t\texit;\n\t},\n\t1\n);\n\n// Live Preview: keep the storefront clean, the admin bar only appears in wp-admin.\nadd_filter( 'show_admin_bar', '__return_false' );\n\nfunction ddwc_demo_switcher_render() {\n\t$icons   = __ICONS__;\n\t$views   = ddwc_demo_switcher_views();\n\t$current = wp_get_current_user();\n\t$here    = untrailingslashit( set_url_scheme( 'http://' . ( $_SERVER['HTTP_HOST'] ?? '' ) . ( $_SERVER['REQUEST_URI'] ?? '' ) ) ); // phpcs:ignore\n\t$items   = '';\n\t$label   = '';\n\tforeach ( $views as $i => $view ) {\n\t\t$active = untrailingslashit( set_url_scheme( $view['url'] ) ) === $here && ( ! $view['user'] || ( $current->exists() && $current->user_login === $view['user'] ) );\n\t\tif ( $active ) {\n\t\t\t$label = $view['label'];\n\t\t}\n\t\t$items .= sprintf(\n\t\t\t'<a href=\"%s\" class=\"ddwc-ds-item%s\"><span class=\"ddwc-ds-ico\">%s</span><span class=\"ddwc-ds-text\"><strong>%s</strong><small>%s</small></span></a>',\n\t\t\tesc_url( add_query_arg( 'ddwc_demo_view', $i, home_url( '/' ) ) ),\n\t\t\t$active ? ' is-active' : '',\n\t\t\t$icons[ $view['icon'] ?? 'store' ] ?? $icons['store'],\n\t\t\tesc_html( $view['label'] ),\n\t\t\tesc_html( $view['hint'] ?? '' )\n\t\t);\n\t}\n\t?>\n\t<div id=\"ddwc-demo-switcher\">\n\t\t<div class=\"ddwc-ds-panel\" role=\"menu\">\n\t\t\t<div class=\"ddwc-ds-head\">Explore this live demo</div>\n\t\t\t<?php echo $items; // phpcs:ignore WordPress.Security.EscapeOutput -- escaped above. ?>\n\t\t</div>\n\t\t<button type=\"button\" class=\"ddwc-ds-toggle\" aria-expanded=\"false\">\n\t\t\t<span class=\"ddwc-ds-dot\"></span>\n\t\t\t<span>View as<?php echo $label ? ' <b>' . esc_html( $label ) . '</b>' : ''; ?></span>\n\t\t\t<svg viewBox=\"0 0 24 24\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" aria-hidden=\"true\"><path d=\"m6 15 6-6 6 6\"/></svg>\n\t\t</button>\n\t</div>\n\t<style>\n\t\t#ddwc-demo-switcher{position:fixed;left:20px;bottom:20px;z-index:999999;font:400 14px/1.3 -apple-system,BlinkMacSystemFont,\"SF Pro Text\",\"Helvetica Neue\",Arial,sans-serif;letter-spacing:-.01em;color:#1d1d1f;-webkit-font-smoothing:antialiased}\n\t\t#ddwc-demo-switcher .ddwc-ds-toggle{display:flex;align-items:center;gap:9px;padding:10px 16px;border:0;border-radius:980px;background:rgba(29,29,31,.82);-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);color:#f5f5f7;font:inherit;cursor:pointer;box-shadow:0 10px 30px rgba(0,0,0,.24)}\n\t\t#ddwc-demo-switcher .ddwc-ds-toggle b{font-weight:600;color:#fff}\n\t\t#ddwc-demo-switcher .ddwc-ds-toggle svg{transition:transform .25s cubic-bezier(.25,.1,.25,1);opacity:.7}\n\t\t#ddwc-demo-switcher.is-open .ddwc-ds-toggle svg{transform:rotate(180deg)}\n\t\t#ddwc-demo-switcher .ddwc-ds-dot{width:7px;height:7px;border-radius:50%;background:#30d158;box-shadow:0 0 0 3px rgba(48,209,88,.28)}\n\t\t#ddwc-demo-switcher .ddwc-ds-panel{position:absolute;left:0;bottom:calc(100% + 10px);width:300px;max-width:calc(100vw - 40px);padding:6px;border-radius:18px;background:rgba(255,255,255,.82);-webkit-backdrop-filter:saturate(180%) blur(24px);backdrop-filter:saturate(180%) blur(24px);box-shadow:0 24px 70px rgba(0,0,0,.22),inset 0 0 0 .5px rgba(0,0,0,.08);opacity:0;visibility:hidden;transform:translateY(6px) scale(.98);transform-origin:bottom left;transition:opacity .2s,transform .25s cubic-bezier(.25,.1,.25,1),visibility .2s}\n\t\t#ddwc-demo-switcher.is-open .ddwc-ds-panel{opacity:1;visibility:visible;transform:none}\n\t\t#ddwc-demo-switcher .ddwc-ds-head{padding:10px 12px 8px;font-size:12px;font-weight:600;color:#6e6e73}\n\t\t#ddwc-demo-switcher .ddwc-ds-item{display:flex;align-items:center;gap:12px;padding:9px 10px;border-radius:12px;color:#1d1d1f;text-decoration:none}\n\t\t#ddwc-demo-switcher .ddwc-ds-item:hover{background:rgba(0,0,0,.05)}\n\t\t#ddwc-demo-switcher .ddwc-ds-item.is-active{background:rgba(0,113,227,.1)}\n\t\t#ddwc-demo-switcher .ddwc-ds-ico{flex:none;display:grid;place-items:center;width:32px;height:32px;border-radius:9px;background:#e8e8ed;color:#1d1d1f}\n\t\t#ddwc-demo-switcher .ddwc-ds-item.is-active .ddwc-ds-ico{background:#0071e3;color:#fff}\n\t\t#ddwc-demo-switcher .ddwc-ds-text{display:flex;flex-direction:column;min-width:0}\n\t\t#ddwc-demo-switcher .ddwc-ds-text strong{font-weight:600;font-size:14px}\n\t\t#ddwc-demo-switcher .ddwc-ds-text small{font-size:12px;color:#6e6e73}\n\t\t@media (max-width:782px){#ddwc-demo-switcher{left:12px;bottom:auto;top:58px}#ddwc-demo-switcher .ddwc-ds-panel{bottom:auto;top:calc(100% + 10px);transform-origin:top left}}\n\t</style>\n\t<script>\n\t\t(function(){var w=document.getElementById('ddwc-demo-switcher');if(!w)return;var b=w.querySelector('.ddwc-ds-toggle');b.addEventListener('click',function(e){e.stopPropagation();var o=w.classList.toggle('is-open');b.setAttribute('aria-expanded',o)});document.addEventListener('click',function(e){if(!w.contains(e.target)){w.classList.remove('is-open');b.setAttribute('aria-expanded','false')}});try{if(!sessionStorage.getItem('ddwcDemoSeen')){w.classList.add('is-open');sessionStorage.setItem('ddwcDemoSeen','1');setTimeout(function(){w.classList.remove('is-open');b.setAttribute('aria-expanded','false')},5000)}}catch(e){}})();\n\t</script>\n\t<?php\n}\nadd_action( 'wp_footer', 'ddwc_demo_switcher_render' );\nadd_action( 'admin_footer', 'ddwc_demo_switcher_render' );\nDDWCKIT;\n\twp_mkdir_p( WPMU_PLUGIN_DIR );\n\tfile_put_contents( WPMU_PLUGIN_DIR . '/demo-switcher.php', str_replace( [ '__VIEWS__', '__ICONS__' ], [ $views_php, var_export( $icons, true ) ], $code ) );\n}\n\n\nwp_set_current_user( 1 );\nddwc_demo_kit_style( [ 'accent' => '#d4380d' ] );\n\n$shop     = wc_get_page_permalink( 'shop' );\n$account  = wc_get_page_permalink( 'myaccount' );\n$aff_page = get_permalink( get_option( '_ddwcaf_affiliate_dashboard_page_id' ) );\n$home_id  = ddwc_demo_kit_home( [\n\t'eyebrow'        => 'Creator program now open',\n\t'title'          => 'Homeware worth sharing.',\n\t'lead'           => 'Stoneware, glass and oak from small studios. Love what you bought? Share your link and earn 12% on every order it brings in.',\n\t'ctas'           => [ [ 'Become an affiliate', $aff_page ], [ 'Shop the collection', $shop ] ],\n\t'hero_img'       => [ ddwc_demo_kit_img( $products[0] ), ddwc_demo_kit_img( $products[6] ), ddwc_demo_kit_img( $products[1] ) ],\n\t'hero_alt'       => 'Oak & Ember homeware',\n\t'widget'         => '<div class=\"dk-widget\"><div class=\"dk-w-head\"><img class=\"dk-w-avatar\" src=\"https://randomuser.me/api/portraits/women/44.jpg\" alt=\"\"/><span><span class=\"dk-w-label\">Zara earned today</span><span class=\"dk-w-title\">New referral via Instagram</span></span></div>'\n\t\t. '<span class=\"dk-w-big\">$42.60</span><span class=\"dk-w-pill\">+12% commission</span>'\n\t\t. '<div class=\"dk-w-row\" style=\"margin-top:12px\"><span>Visits this month</span><span>1,284</span></div><div class=\"dk-w-row\"><span>Paid out</span><span>$318.40</span></div></div>',\n\t'features_title' => 'Share what you love. Get paid for it.',\n\t'features'       => [\n\t\t[ 'Your own referral link', 'Every affiliate gets a personal link and a link generator for any product page, tracked for 30 days.', 'link' ],\n\t\t[ 'Live earnings dashboard', 'Visits, conversions, commissions and payouts the moment they happen, right in your account.', 'chart' ],\n\t\t[ 'Paid your way', 'PayPal or bank transfer. Payouts come straight from our store, no middleman.', 'pay' ],\n\t],\n\t'shelf_title'    => 'Most shared.',\n\t'shelf_sub'      => 'What our creators link to.',\n\t'shelf'          => '[products limit=\"8\" columns=\"4\" orderby=\"popularity\"]',\n\t'tile'           => [\n\t\t'title' => 'Turn your taste into income.',\n\t\t'text'  => 'Sign up, get approved and start sharing in minutes.',\n\t\t'extra' => '<div class=\"dk-stats\"><div><b>12%</b><span>commission</span></div><div><b>30 days</b><span>cookie window</span></div><div><b>6</b><span>active creators</span></div></div>',\n\t\t'cta'   => [ 'Open the affiliate dashboard', $aff_page ],\n\t\t'img'   => ddwc_demo_kit_img( $products[7] ),\n\t\t'alt'   => 'Platinum mesh watch',\n\t],\n] );\nddwc_demo_kit_menu( [ 'Shop' => $shop, 'Become an affiliate' => $aff_page, 'My account' => $account ] );\n\nddwc_demo_kit_switcher( <<<'DDWCVIEWS'\n$product = get_page_by_path( 'window-reading-chair', OBJECT, 'product' );\n\t$zara    = get_user_by( 'login', 'zara' );\n\treturn [\n\t\t[ 'label' => 'Affiliate program admin', 'hint' => 'Dashboard, commissions and payouts', 'icon' => 'admin', 'user' => 'admin', 'url' => admin_url( 'admin.php?page=ddwcaf-dashboard' ) ],\n\t\t[ 'label' => 'Affiliate: Zara', 'hint' => 'Her earnings, visits and links', 'icon' => 'wallet', 'user' => 'zara', 'url' => get_permalink( get_option( '_ddwcaf_affiliate_dashboard_page_id' ) ) ],\n\t\t[ 'label' => 'Shopper via referral link', 'hint' => 'Arrive from Zara\\'s link', 'icon' => 'link', 'user' => '', 'url' => add_query_arg( 'ref', $zara ? $zara->ID : 2, $product ? get_permalink( $product ) : home_url( '/' ) ) ],\n\t\t[ 'label' => 'Storefront', 'hint' => 'The shop your customers see', 'icon' => 'store', 'user' => '', 'url' => home_url( '/' ) ],\n\t];\nDDWCVIEWS\n);\n"
		},
		{
			"step": "login",
			"username": "admin",
			"password": "password"
		}
	]
}