css-inline-stream
Version:
Inline CSS classes into styles from HTML streams
527 lines (495 loc) • 34.9 kB
HTML
page inlined:
<html lang=""><head>
<style>.container{position:relative;width:100%;max-width:960px;margin:0 auto;padding:0 20px;box-sizing:border-box}.column,.columns{width:100%;float:left;box-sizing:border-box}@media (min-width:400px){.container{width:85%;padding:0}}@media (min-width:550px){.container{width:80%}.column,.columns{margin-left:4%}.column:first-child,.columns:first-child{margin-left:0}.one.column,.one.columns{width:4.66666666667%}.two.columns{width:13.3333333333%}.three.columns{width:22%}.four.columns{width:30.6666666667%}.five.columns{width:39.3333333333%}.six.columns{width:48%}.seven.columns{width:56.6666666667%}.eight.columns{width:65.3333333333%}.nine.columns{width:74%}.ten.columns{width:82.6666666667%}.eleven.columns{width:91.3333333333%}.twelve.columns{width:100%;margin-left:0}.one-third.column{width:30.6666666667%}.two-thirds.column{width:65.3333333333%}.one-half.column{width:48%}.offset-by-one.column,.offset-by-one.columns{margin-left:8.66666666667%}.offset-by-two.column,.offset-by-two.columns{margin-left:17.3333333333%}.offset-by-three.column,.offset-by-three.columns{margin-left:26%}.offset-by-four.column,.offset-by-four.columns{margin-left:34.6666666667%}.offset-by-five.column,.offset-by-five.columns{margin-left:43.3333333333%}.offset-by-six.column,.offset-by-six.columns{margin-left:52%}.offset-by-seven.column,.offset-by-seven.columns{margin-left:60.6666666667%}.offset-by-eight.column,.offset-by-eight.columns{margin-left:69.3333333333%}.offset-by-nine.column,.offset-by-nine.columns{margin-left:78%}.offset-by-ten.column,.offset-by-ten.columns{margin-left:86.6666666667%}.offset-by-eleven.column,.offset-by-eleven.columns{margin-left:95.3333333333%}.offset-by-one-third.column,.offset-by-one-third.columns{margin-left:34.6666666667%}.offset-by-two-thirds.column,.offset-by-two-thirds.columns{margin-left:69.3333333333%}.offset-by-one-half.column,.offset-by-one-half.columns{margin-left:52%}}html{font-size:62.5%}body{font-size:1.5em;line-height:1.6;font-weight:400;font-family:Raleway,HelveticaNeue,"Helvetica Neue",Helvetica,Arial,sans-serif;color:#222}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:2rem;font-weight:300}h1{font-size:4rem;line-height:1.2;letter-spacing:-.1rem}h2{font-size:3.6rem;line-height:1.25;letter-spacing:-.1rem}h3{font-size:3rem;line-height:1.3;letter-spacing:-.1rem}h4{font-size:2.4rem;line-height:1.35;letter-spacing:-.08rem}h5{font-size:1.8rem;line-height:1.5;letter-spacing:-.05rem}h6{font-size:1.5rem;line-height:1.6;letter-spacing:0}@media (min-width:550px){h1{font-size:5rem}h2{font-size:4.2rem}h3{font-size:3.6rem}h4{font-size:3rem}h5{font-size:2.4rem}h6{font-size:1.5rem}}p{margin-top:0}a{color:#1EAEDB}a:hover{color:#0FA0CE}.button,button,input[type=button],input[type=reset],input[type=submit]{display:inline-block;height:38px;padding:0 30px;color:#555;text-align:center;font-size:11px;font-weight:600;line-height:38px;letter-spacing:.1rem;text-transform:uppercase;text-decoration:none;white-space:nowrap;background-color:transparent;border-radius:4px;border:1px solid #bbb;cursor:pointer;box-sizing:border-box}.button:focus,.button:hover,button:focus,button:hover,input[type=button]:focus,input[type=button]:hover,input[type=reset]:focus,input[type=reset]:hover,input[type=submit]:focus,input[type=submit]:hover{color:#333;border-color:#888;outline:0}.button.button-primary,button.button-primary,input[type=button].button-primary,input[type=reset].button-primary,input[type=submit].button-primary{color:#FFF;background-color:#33C3F0;border-color:#33C3F0}.button.button-primary:focus,.button.button-primary:hover,button.button-primary:focus,button.button-primary:hover,input[type=button].button-primary:focus,input[type=button].button-primary:hover,input[type=reset].button-primary:focus,input[type=reset].button-primary:hover,input[type=submit].button-primary:focus,input[type=submit].button-primary:hover{color:#FFF;background-color:#1EAEDB;border-color:#1EAEDB}input[type=email],input[type=number],input[type=password],input[type=search],input[type=tel],input[type=text],input[type=url],select,textarea{height:38px;padding:6px 10px;background-color:#fff;border:1px solid #D1D1D1;border-radius:4px;box-shadow:none;box-sizing:border-box}input[type=email],input[type=number],input[type=password],input[type=search],input[type=tel],input[type=text],input[type=url],textarea{-webkit-appearance:none;-moz-appearance:none;appearance:none}textarea{min-height:65px;padding-top:6px;padding-bottom:6px}input[type=email]:focus,input[type=number]:focus,input[type=password]:focus,input[type=search]:focus,input[type=tel]:focus,input[type=text]:focus,input[type=url]:focus,select:focus,textarea:focus{border:1px solid #33C3F0;outline:0}label,legend{display:block;margin-bottom:.5rem;font-weight:600}fieldset{padding:0;border-width:0}input[type=checkbox],input[type=radio]{display:inline}label>.label-body{display:inline-block;margin-left:.5rem;font-weight:400}ul{list-style:circle inside}ol{list-style:decimal inside}ol,ul{padding-left:0;margin-top:0}ol ol,ol ul,ul ol,ul ul{margin:1.5rem 0 1.5rem 3rem;font-size:90%}li{margin-bottom:1rem}code{padding:.2rem .5rem;margin:0 .2rem;font-size:90%;white-space:nowrap;background:#F1F1F1;border:1px solid #E1E1E1;border-radius:4px}pre>code{display:block;padding:1rem 1.5rem;white-space:pre}td,th{padding:12px 15px;text-align:left;border-bottom:1px solid #E1E1E1}td:first-child,th:first-child{padding-left:0}td:last-child,th:last-child{padding-right:0}.button,button{margin-bottom:1rem}fieldset,input,select,textarea{margin-bottom:1.5rem}blockquote,dl,figure,form,ol,p,pre,table,ul{margin-bottom:2.5rem}.u-full-width{width:100%;box-sizing:border-box}.u-max-full-width{max-width:100%;box-sizing:border-box}.u-pull-right{float:right}.u-pull-left{float:left}hr{margin-top:3rem;margin-bottom:3.5rem;border-width:0;border-top:1px solid #E1E1E1}.container:after,.row:after,.u-cf{content:"";display:table;clear:both}</style>
<style>@font-face {
font-family: 'Montserrat';
font-style: normal;
font-weight: 300;
font-display: swap;
src: url(https://fonts.gstatic.com/s/montserrat/v29/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCs16Ew-.ttf) format('truetype');
}
@font-face {
font-family: 'Montserrat';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url(https://fonts.gstatic.com/s/montserrat/v29/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCtr6Ew-.ttf) format('truetype');
}
@font-face {
font-family: 'Montserrat';
font-style: normal;
font-weight: 500;
font-display: swap;
src: url(https://fonts.gstatic.com/s/montserrat/v29/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCtZ6Ew-.ttf) format('truetype');
}
@font-face {
font-family: 'Playfair Display';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url(https://fonts.gstatic.com/s/playfairdisplay/v37/nuFvD-vYSZviVYUb_rj3ij__anPXJzDwcbmjWBN2PKdFvUDQ.ttf) format('truetype');
}
@font-face {
font-family: 'Playfair Display';
font-style: normal;
font-weight: 700;
font-display: swap;
src: url(https://fonts.gstatic.com/s/playfairdisplay/v37/nuFvD-vYSZviVYUb_rj3ij__anPXJzDwcbmjWBN2PKeiukDQ.ttf) format('truetype');
}
</style>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Naturalite Styles LLC - Natural Hair Care Specialist</title>
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/qs/6.13.1/qs.min.js" integrity="sha512-dOI8+lI91wsLJEMBQcZBvatYrawv84SrgkRF/6sIcjhYXgANOvOEkBtCSf/ZkdZ7Mw0u+VUxDgalDZA1qKWTFQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<meta charset="UTF-8">
<style>* { box-sizing: border-box; } body {margin: 0;}:root{--primary:#8B5F6B;--secondary:#6B4746;--accent:#F6E6E4;--dark:#2C1810;--background:#FDF7F7;--light-violet:#9B8095;--deep-mauve:#755B69;--warm-brown:#8B6F5B;}body{font-family:'Montserrat', sans-serif;background-color:var(--background);margin:0;color:var(--dark);background:var(--background);line-height:1.6;}.button.is-primary{background-color:var(--primary);transition:all 0.3s;}.button.is-primary:hover{background-color:var(--secondary);}.service-card{background-color:white;border-radius:8px;background:white;box-shadow:0 2px 15px rgba(0,0,0,0.08);overflow:hidden;transition:transform 0.3s;}.price-range{color:var(--secondary);font-weight:500;margin-bottom:1rem;}.duration{background-color:var(--accent);color:var(--deep-mauve);padding:0.5rem 1.5rem;border-radius:2rem;font-size:1.4rem;display:inline-block;background:var(--accent);}.rating{color:var(--warm-brown);margin-top:1.5rem;}.section-title{font-family:'Playfair Display', serif;color:var(--dark);position:relative;margin-bottom:6rem;text-align:center;}.section-title::after{content:'';position:absolute;bottom:-10px;left:50%;transform:translateX(-50%);width:60px;height:3px;background-color:var(--primary);}.footer{background-color:var(--dark);color:white;padding:4rem 0;text-align:center;background:var(--dark);}.service-grid{display:grid;grid-template-columns:repeat(auto-fill, minmax(300px, 1fr));gap:3rem;margin-bottom:3rem;}.empty-image-placeholder{background-color:var(--accent);height:200px;display:flex;align-items:center;justify-content:center;color:var(--secondary);width:100%;}.nav{background:white;padding:1rem 0;box-shadow:0 2px 15px rgba(0,0,0,0.08);position:fixed;width:100%;top:0;z-index:1000;}.nav-list{list-style:none;margin:0;display:flex;justify-content:flex-end;align-items:center;}.nav-brand{font-family:'Playfair Display', serif;font-size:2.4rem;color:var(--secondary);margin:0;margin-right:auto;}.nav-item{margin:0 20px;}.nav-link{text-decoration:none;color:var(--dark);font-weight:500;}.hero{padding:16rem 0 8rem;background-color:var(--accent);background:linear-gradient(135deg, var(--accent) 0%, #F9EFF4 100%);}.hero h1{font-family:'Playfair Display', serif;font-size:5.2rem;color:var(--dark);margin-bottom:2rem;}.hero p{font-size:2rem;margin-bottom:3rem;color:var(--warm-brown);}.button.button-primary{background-color:var(--primary);border-color:var(--primary);border-radius:30px;padding:12px 30px;height:auto;font-weight:500;transition:all 0.3s;}.button.button-primary:hover{background-color:var(--secondary);border-color:var(--secondary);}.services{padding:8rem 0;}.section-title:after{content:'';position:absolute;bottom:-15px;left:50%;transform:translateX(-50%);width:60px;height:3px;background-color:var(--primary);}.service-card:hover{transform:translateY(-5px);}.card-image{width:100%;height:200px;object-fit:cover;}.card-content{padding:2rem;}.flex-space{display:flex;justify-content:space-between;align-items:center;margin-top:2rem;}.about{background-color:var(--accent);padding:8rem 0;background:linear-gradient(135deg, var(--accent) 0%, #F9EFF4 100%);}.about img{border-radius:0.5rem;max-width:100%;margin-bottom:2rem;}.contact{padding:8rem 0;}.contact-box{background:white;padding:4rem;border-radius:8px;box-shadow:0 2px 15px rgba(0,0,0,0.08);}input[type="email"], input[type="text"], input[type="tel"], textarea{background-color:white;border:1px solid var(--accent);border-radius:4px;margin-bottom:2rem;background:white;}.footer a{color:var(--accent);text-decoration:none;margin:0 1rem;}#iic3fd{max-width:100%;border-radius:50%;}#ijuviu{text-align:center;margin-bottom:4rem;}h1, h2, h3, h4{font-family:'Playfair Display', serif;color:var(--deep-mauve);}.container{max-width:120.0rem;padding:0 2rem;}.navigation .container{display:flex;align-items:center;justify-content:space-between;}.navigation ul{list-style:none;margin:0;display:flex;gap:3rem;}.navigation a{color:var(--dark);text-decoration:none;}.button{background-color:var(--primary);border-color:var(--primary);}.button:hover{background-color:var(--deep-mauve);border-color:var(--deep-mauve);}.card img{width:100%;height:25rem;object-fit:cover;}input[type="email"]:focus, input[type="text"]:focus, input[type="tel"]:focus, textarea:focus{border-color:var(--light-violet);}#iejrfs{width:0px;}#ik3jf5{display:flex;}@keyframes fadeEffect{from{opacity:0;}to{opacity:1;}}@media (max-width: 992px){#iejrfs{width:24px;}.row{display:flex;flex-direction:column;justify-content:center;align-items:center;}}@media (max-width: 750px){.nav-list{flex-direction:column;text-align:center;}.nav-brand{margin-bottom:2rem;}.nav-item{margin:10px 0;}.hero h1{font-size:3.6rem;}}@media (max-width: 480px){.container{max-width:100vw;width:100vw;align-self:stretch;display:flex;justify-content:center;flex-direction:column;align-items:center;align-content:center;}.card-content{padding:2rem 0px 2rem 0rem;margin:1rem 1rem 1rem 1rem;}#i3kx3g{padding:0px 1rem 0px 1rem;}#i1y7nk{padding:0px 8px 0px 8px;}.service-card{margin:1rem 1rem 1rem 0rem;}.button.is-primary.is-medium.is-rounded{font-size:14px;}.row{display:flex;flex-direction:column;align-content:center;align-items:center;justify-content:center;}#iejrfs{width:23px;}}@media (max-width: 40.0rem){.hero h1{font-size:3.6rem;}}</style>
<link href="https://fonts.googleapis.com" rel="preconnect" ><link href="https://fonts.gstatic.com" rel="preconnect" crossorigin >
</head>
<body id="iqu32i" class=""><!-- Navigation --><nav class="nav"><div class="container" x-data="data_iycw3l_527" ><H1 class="nav-brand">Naturalite Styles</H1><div id="ik3jf5" class="" x-bind="bind_ik3jf5_1203" ><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" id="iejrfs"><path fill="#8B5F6B" d="M0 96C0 78.3 14.3 64 32 64l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 128C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 288c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32L32 448c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"></path></svg></div><template x-data="" x-if="$data?.['i0ha69-8zp4u5s8nw6']"><ul id="ienwmk" class="nav-list"><li class="nav-item"><a href="#home" class="nav-link">Home</a></li><li class="nav-item"><a href="#services-2" class="nav-link">Services</a></li><li class="nav-item"><a href="#about-2" class="nav-link">About</a></li><li class="nav-item"><a href="#contact-2" class="nav-link">Contact</a></li></ul></template></div></nav><!-- Hero Section --><section id="home" class="hero"><div class="container"><div class="row"><div class="six columns"><h1>Embrace Your Natural Beauty</h1><p>Experience the artistry of natural hair care with over three decades of expertise.</p><a href="#contact" class="button button-primary">Book Your Appointment</a></div><div class="six columns"><img src="/assets/api/placeholder/600/600" alt="Natural hair styling" id="iic3fd"/></div></div></div></section><!-- Services Section --><section id="services-2" class="services"><div id="i1y7nk" class="container"><h2 class="section-title">Services</h2><div class="service-grid"><!-- Service with image --><div class="service-card"><img src="/assets/api/placeholder/400/300" alt="Natural Hair Styling" class="card-image"/><div class="card-content"><h3>Natural Hair Styling</h3><p class="price-range">$80-150</p><span class="duration">2-3 hours</span><p>Expert styling for all natural hair types and textures</p><div class="flex-space"><div class="rating"><span>★</span><span>4.8 (156)</span></div><small>Tue-Sat: 9AM-7PM</small></div></div></div><!-- Service without image --><div class="service-card"><div class="empty-image-placeholder"><span>Image Coming Soon</span></div><div class="card-content"><h3>Deep Conditioning Treatment</h3><p class="price-range">$45-75</p><span class="duration">1 hour</span><p>Intensive moisture treatment for healthy, vibrant hair</p><div class="flex-space"><div class="rating"><span>★</span><span>4.9 (92)</span></div><small>Tue-Sat: 9AM-7PM</small></div></div></div><!-- Another service with image --><div class="service-card"><img src="/assets/api/placeholder/400/300" alt="Protective Styling" class="card-image"/><div class="card-content"><h3>Protective Styling</h3><p class="price-range">$120-200</p><span class="duration">3-4 hours</span><p>Beautiful protective styles to promote hair growth</p><div class="flex-space"><div class="rating"><span>★</span><span>4.7 (183)</span></div><small>Tue-Sat: 9AM-7PM</small></div></div></div></div></div></section><!-- About Section --><section id="about-2" class="about"><div id="i3kx3g" class="container"><div class="row"><div class="five columns"><img src="/assets/api/placeholder/600/600" alt="Candice Hodge" id="i9q9uf"/></div><div class="six columns offset-by-one"><h2 id="ioipph">Meet Candice Hodge</h2><p>With over three decades of experience in natural hair care, Candice Hodge has been transforming lives through her exceptional styling expertise. As the founder of Naturalite Styles LLC, she brings passion, creativity, and deep knowledge to every client interaction.</p><p>Specializing in natural hair care and styling, Candice has helped countless clients embrace their natural beauty while maintaining healthy hair practices.</p><p>Her commitment to excellence and continuous education in the latest natural hair care techniques has made Naturalite Styles a trusted name in Phoenix.</p></div></div></div></section><!-- Contact Section --><section id="contact-2" class="contact"><div id="ithy2h" class="container"><h2 class="section-title">Book Your Appointment</h2><div class="row"><div class="eight columns offset-by-two"><div class="contact-box"><div id="ijuviu"><h3>Naturalite Styles LLC</h3><p>Phoenix, AZ 85037</p><p>Phone: (555) 123-4567</p><p>Email: contact@naturalitestyles.com</p></div><form method="get"><input type="text" placeholder="Your Name" class="u-full-width"/><input type="email" placeholder="Your Email" class="u-full-width"/><input type="tel" placeholder="Your Phone" class="u-full-width"/><textarea placeholder="Your Message" rows="4" class="u-full-width"></textarea><button type="submit" class="button button-primary u-full-width">Send Message</button></form></div></div></div></div></section><!-- Footer --><footer class="footer"><div class="container"><p>© 2024 Naturalite Styles LLC. All rights reserved.</p><div><a href="#">Privacy Policy</a><a href="#">Terms of Service</a></div></div></footer>
<script id="__csrf" type="text/plain">
<!-- lol you thought you got me -->
</script>
</body>
<script>
document.addEventListener('alpine:init', () => {
Alpine.bind('bind_ik3jf5_1203',() => ({
'x-on:click': async function () {
return this.$store.actions.run_all(() => this.$store.actions?.["toggle_state"]?.({
"$data": this.$data,
"key": "i0ha69-8zp4u5s8nw6"
}));
},
}));
Alpine.data("data_iycw3l_527", function () {
return {
"i0ha69-8zp4u5s8nw6": ""
};
})
const _fetch = window.fetch.bind(window);
let _csrf;
function getCsrf() {
if(_csrf) return _csrf;
const scriptTag = document.querySelector('script#__csrf[type="text/plain"]');
if (scriptTag) {
_csrf = scriptTag.textContent;
}
return _csrf;
}
Alpine.store('csrf', getCsrf)
window.fetch = function(resource, opts) {
if (opts) {
if (resource.charAt(0) === '/' || resource.startsWith(location.origin)) {
const csrf = getCsrf();
if(csrf) {
opts.headers ??= {};
opts.headers['x-csrf'] = getCsrf();
}
}
}
return _fetch(resource, opts);
}
Alpine.directive('rm', (el) => el.remove());
const FILTERS = Symbol('filters');
const FETCH = Symbol('fetch');
function box(primitive) {
return new Proxy({ value: primitive }, {
get(target, prop, receiver) {
if (prop === 'valueOf') return () => primitive?.valueOf?.();
const prim = Reflect.get(target, 'value');
const value = prim?.[prop];
return typeof value === 'function' ? value.bind(prim) : value;
}
});
}
const PROMISE_FNS = ['then', 'catch', 'finally']
function accessible(promise) {
return new Proxy(promise, {
get(target, prop) {
if (PROMISE_FNS.includes(prop)) return target[prop].bind(target);
if (prop === 'withFilter') {
return Object.prototype.withFilter.bind(target);
}
return accessible(target.then(v => v[prop]))
}
});
}
Object.prototype.withFilters = function (filters) {
filters.forEach(f => {
this.withFilter(...f);
});
return this;
}
const EXTENSIBLE_TYPES = ['object', 'function']
Object.prototype.withFilter = function (filter, options) {
let target = !EXTENSIBLE_TYPES.includes(typeof this) ? box(this) : this;
if (!target[FILTERS]) {
if (target instanceof Promise) {
target = target.then(v => {
if (v) {
v = v.withFilters(target[FILTERS]);
}
return v;
});
}
if (target.$FETCH instanceof Function) {
const fetch = target.$FETCH.bind(target);
target.$FETCH = function () {
return fetch()
.then(v => {
if (v) {
v = v.withFilters(target[FILTERS]);
}
return v;
})
}
}
}
target[FILTERS] ??= [];
target[FILTERS].push([filter, options].filter(Boolean));
if (EXTENSIBLE_TYPES.includes(typeof target)) {
const raw = target;
target = new Proxy(target, {
get(_target, prop) {
if (prop === 'valueOf') return () => raw?.valueOf?.();
if (PROMISE_FNS.concat([FILTERS]).includes(prop)) return typeof _target[prop] !== 'function' ?
_target[prop] : _target[prop].bind(_target);
const _v = _target?.filtered?.(false)?.[prop];
const v = typeof _v === 'function' ? _v.bind(_target) : _v;
return v;
}
})
}
return target;
}
Object.prototype.filtered = function (unbox = true) {
let v = this;
if (v[FILTERS] && !v[FILTERS].running) {
v[FILTERS].running = true;
try {
for (const [filter, params] of v[FILTERS]) {
v = filter(v, params)?.filtered?.();
}
} catch (e) {
console.error("Failed to run filter:", e);
}
finally {
delete this[FILTERS].running;
}
}
return unbox ? v?.valueOf?.() : v;
}
const DEFAULT_FILTER = ($key = '$$opts') => (v, opts) => {
const raw = v?.valueOf?.();
if (raw instanceof Array) return !Object.values(opts).length ? raw : raw.find(i => {
for (const key in opts) {
if(!i[$key]) return false;
if (typeof opts[key] === 'function') continue;
if (!(key in i[$key]) || opts[key] !== i?.[$key]?.[key]) {
return false;
}
}
return true;
})?.$$value
return v;
}
function reloadable(obj, _fetch, _ensure, opts = {}, root) {
if (obj === undefined) return obj;
obj[FETCH] = _fetch;
root ??= obj;
_ensure ??= v => v;
const ensure = (v) => {
const r = _ensure(v, opts);
return r;
};
const fetch = () => _fetch(opts).then(v => (delete obj.$$empty, reloadable(v, _fetch, _ensure, opts)));
function _set(newopts) {
for (const key in opts) {
delete opts[key];
}
Object.assign(opts, newopts);
return reloadable(ensure(set), _fetch, _ensure);
}
_set.toJSON = () => obj;
const set = new Proxy(_set, {
get(target, prop) {
if (prop === 'valueOf') return () => obj?.valueOf?.();
if (prop === '$$empty') return obj[prop];
const v = obj[prop] ? typeof obj[prop] === 'function' ?
obj[prop].bind(obj) : obj[prop] :
typeof target[prop] === 'function' ? target[prop].bind(target) : target[prop];
return v;
},
set(target, prop, value) {
const owner = obj[prop] ? obj : target;
return owner[prop] = value;
}
})
const p = new Proxy(set, {
get(target, prop) {
if (prop === 'valueOf') return () => obj?.valueOf?.();
if (prop === "$ENSURE") return function () {
if (root.$$empty) {
return fetch();
}
else return ensure(p);
}
if (prop === '$$empty') return obj[prop];
if (prop === FETCH) return fetch;
if (prop === '$FETCH') return fetch;
if (['withFilter', 'filtered'].includes(prop)) {
return function () {
const ret = target[prop](...arguments);
return reloadable(ret, () => fetch().then(v => {
return v[prop](...arguments)
}), ensure, opts, root);
}
}
const property = target[prop] || obj[prop];
// if (property === undefined || property === null) return property;
let v = typeof property === 'function' ? property.bind(target) : property;
v = maybeBox(v);
const ret = reloadable(v, () => fetch().then(v => {
return v[prop];
}), _ensure, opts, root)
return ret;
}
})
return p;
}
function maybeBox(v) {
if (!EXTENSIBLE_TYPES.includes(typeof v)) {
v = box(v);
}
return v;
}
Alpine.store('actions', {
"run_all": function run_all(...fns/* : Function[] */) {
while (fns.length) {
const fn = fns.shift();
const v = fn();
if (v instanceof Promise) {
return v.then(() => {
return run_all(...fns)
})
}
}
},
"toggle_state": function toggle_state({
$data,
key
}) {
$data[key] = !$data[key];
},
"flag_state": function flag_state({
$data,
key
}) {
$data[key] = true;
},
"unflag_state": function unflag_state({
$data,
key
}) {
$data[key] = false;
},
"subtract_from_state": function subtract_from_state({
$data,
key,
value
}) {
if (value?.$FETCH instanceof Function) {
return value.$FETCH()
.then(value => {
if (value === null || value === undefined) return;
$data[key] -= value.filtered().valueOf();
})
} else if (value instanceof Promise) {
return value.then(value => {
if (value === null || value === undefined) return;
$data[key] -= value.filtered().valueOf();
})
} else {
if (value === null || value === undefined) return;
$data[key] -= value.filtered().valueOf();
}
},
"add_to_state": function add_to_state({
$data,
key,
value
}) {
if (value?.$FETCH instanceof Function) {
return value.$FETCH()
.then(value => {
if (value === null || value === undefined) return;
$data[key] += value.filtered().valueOf();
})
} else if (value instanceof Promise) {
return value.then(value => {
if (value === null || value === undefined) return;
$data[key] += value.filtered().valueOf();
})
} else {
if (value === null || value === undefined) return;
$data[key] += value.filtered().valueOf();
}
},
"prepend_to_state": function prepend_to_state({
$data,
key,
value
}) {
if (value?.$FETCH instanceof Function) {
return value.$FETCH()
.then(value => {
if (value === null || value === undefined) return;
$data[key] = value.filtered().valueOf() + $data[key];
})
} else if (value instanceof Promise) {
return value.then(value => {
if (value === null || value === undefined) return;
$data[key] = value.filtered().valueOf() + $data[key];
})
} else {
if (value === null || value === undefined) return;
$data[key] = value.filtered().valueOf() + $data[key];
}
},
"multiply_state": function multiply_state({
$data,
key,
value
}) {
if (value?.$FETCH instanceof Function) {
return value.$FETCH()
.then(value => {
if (value === null || value === undefined) return;
$data[key] *= value.filtered().valueOf();
})
} else if (value instanceof Promise) {
return value.then(value => {
if (value === null || value === undefined) return;
$data[key] *= value.filtered().valueOf();
})
} else {
if (value === null || value === undefined) return;
$data[key] *= value.filtered().valueOf();
}
},
"divide_state": function divide_state({
$data,
key,
value
}) {
if (value?.$FETCH instanceof Function) {
return value.$FETCH()
.then(value => {
if (value === null || value === undefined) return;
$data[key] /= value.filtered().valueOf();
})
} else if (value instanceof Promise) {
return value.then(value => {
if (value === null || value === undefined) return;
$data[key] /= value.filtered().valueOf();
})
} else {
if (value === null || value === undefined) return;
$data[key] /= value.filtered().valueOf();
}
},
"set_state": function set_state(opts) {
const { $data, key, value } = opts;
if (value?.$FETCH instanceof Function) {
return value.$FETCH()
.then(value => {
$data[key] = value === null ? null : value === undefined ? undefined : value.filtered().valueOf();
})
} else if (value instanceof Promise) {
return value.then(value => {
$data[key] = value === null ? null : value === undefined ? undefined : value.filtered().valueOf();
})
} else {
$data[key] = value === null ? null : value === undefined ? undefined : value.filtered().valueOf();
}
},
"coalesce_w_state": function set_state(opts) {
const { $data, key, value } = opts;
if (!value ) return;
if (value?.$FETCH instanceof Function) {
return value.$FETCH()
.then(value => {
if (value === null || value === undefined) return;
$data[key] = value.filtered().valueOf();
})
} else if (value instanceof Promise) {
return value.then(value => {
if (value === null || value === undefined) return;
$data[key] = value.filtered().valueOf();
})
} else {
$data[key] = value.filtered().valueOf();
}
}
})
Alpine.store('filters', {
"strip_html": function (str) { return str.replace(/<[^>]*>/g, ''); },
"append": function (str, options) { return "".concat(str).concat(options.value); },
"prepend": function (str, options) { return "".concat(options.state).concat(str); },
"where": function (arr, options) {
var _a = options, key = _a.key, value = _a.value;
return arr.filter(function (item) { return item[key] === value; });
},
"find": function (arr, options) {
var _a = options, key = _a.key, value = _a.value;
return arr.find(function (item) { return item[key] === value; });
},
"first": function (arr) { return arr[0]; },
"last": function (arr) { return arr[arr.length - 1]; },
"join": function (arr, options) { var _a; return arr.join((_a = options.separator) !== null && _a !== void 0 ? _a : ','); },
"split": function (str, options) { var _a; return str.split((_a = options.separator) !== null && _a !== void 0 ? _a : ','); },
"map": function (arr, options) { return arr instanceof Array ?
arr
.map(function (item) { return item[options.key]; }) :
arr[options.key]; },
"reverse": function (arr) { return arr.reverse(); },
"size": function (arr) { return arr.length; },
"at": function (arr, options) { return arr[options.index]; },
"slice": function (arr, options) { return arr.slice(options.start, options.end); },
"sort": function (arr, options) { return arr.sort(function (a, b) {
if (a[options.key] < b[options.key]) {
return -1;
}
if (a[options.key] > b[options.key]) {
return 1;
}
return 0;
}); },
"plus": function (num, options) { return num + options.value; },
"minus": function (num, options) { return num - options.value; },
"times": function (num, options) { return num * options.value; },
"divided_by": function (num, options) { return num / options.value; },
"modulo": function (num, options) { return (num % options.value); },
"abs": function (num) { return Math.abs(num); },
"ceil": function (num) { return Math.ceil(num); },
"floor": function (num) { return Math.floor(num); },
"round": function (num) { return Math.round(num); },
"at_least": function (num, options) { return Math.max(num, options.value); },
"at_most": function (num, options) { return Math.min(num, options.value); },
"compact": function (arr) { return arr.filter(function (item) { return !!item; }); },
"default": function (value, options) { return value !== null && value !== void 0 ? value : options.value; },
"escape": function (str) { return str.replace(/"/g, '\\"'); },
"escape_once": function (str) { return str.replace(/"/g, '\\"'); },
"newline_to_br": function (str) { return str.replace(/\n/g, '<br />'); },
"strip_newlines": function (str) { return str.replace(/\n/g, ''); },
"truncate": function (str, options) { return str.slice(0, options.length); },
"truncatewords": function (str, options) { return str.split(' ').slice(0, options.length).join(' '); },
"date": function (date, options) {
var d = new Date(date);
return d.toLocaleDateString(options.format);
}
})
})
</script>
</html>