/* Sanamo-owned content: exact saved story/advisor/partners markup.
* Uses Custom JavaScript only. No Salla configuration or feature flags are read.
* Keep the former native HTML component disabled through the normal editor UI.
* Place this module before the existing advisor initializer in the saved script.
*/
(() => {
'use strict';
if (window.__snamoContentSection) return;
const contentHTML = "من سنام الجمل إلى مشاويرك من سنام الجمل أخذنا الاسم، ومن مشاويرنا اليومية جتنا الفكرة. سوّينا كرات سنامو بالشوفان والمكسرات، وغلّفنا كل حبة لحالها عشان تاخذ معك على قدّ مشوارك
\n \n
\n
\n
\n
خلّنا نختار الأنسب لك \n
\n
\n
\n \n";
const contentId = 'snamo-custom-content';
const observedRoots = new WeakSet();
let queued = false;
let rootObserver;
function queue() {
if (queued) return;
queued = true;
requestAnimationFrame(() => { queued = false; mount(); });
}
function watchRoot(root) {
if (observedRoots.has(root)) return;
observedRoots.add(root);
new MutationObserver(queue).observe(root, {childList:true, subtree:true});
}
// Look only at rendered DOM. The old component may still render in the editor
// during the transition, so retain just one copy without modifying that component.
function otherStoryExists(scope, own) {
for (const story of scope.querySelectorAll('.snamo-story')) {
if (!own || !own.contains(story)) return true;
}
for (const host of scope.querySelectorAll('[component-name]')) {
if (host === own || !host.shadowRoot) continue;
watchRoot(host.shadowRoot);
if (otherStoryExists(host.shadowRoot, own)) return true;
}
return false;
}
function mount() {
const main = document.querySelector('#main-content') || document.querySelector('main');
if (!main) return;
const faq = main.querySelector('[component-id="101522242"]');
const banners = main.querySelector('[component-id="436770806"]');
// These homepage anchors keep this module inactive on unrelated pages.
if (!faq || !banners) return;
const own = document.getElementById(contentId);
if (otherStoryExists(main, own)) {
if (own) own.remove();
return;
}
if (own) return;
const section = document.createElement('section');
section.id = contentId;
section.className = 's-block';
// This private component name lets the EXISTING advisor discover this open
// shadow root; it is not a native Salla component or an entitlement setting.
section.setAttribute('component-name', 'snamo-owned-content');
section.setAttribute('dir', 'rtl');
section.style.marginTop = '0';
const root = section.attachShadow({mode:'open'});
root.innerHTML = contentHTML;
faq.before(section);
}
function start() {
rootObserver = new MutationObserver(queue);
rootObserver.observe(document.documentElement, {childList:true, subtree:true});
mount();
// Native component shadow roots may attach after their host is inserted.
// This bounded startup retry only discovers rendered DOM; no config is read.
let attempts = 0;
const retry = setInterval(() => {
mount();
if (++attempts >= 80) clearInterval(retry);
}, 250);
}
window.__snamoContentSection = {refresh:queue};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', start, {once:true});
} else {
start();
}
})();
/* Sanamo presentation refinements. Catalog prices, stock and cart behavior remain native. */
(() => {
'use strict';
const logo = 'https://cdn.files.salla.network/other/524067722/31752a84-ef8d-47f9-9c3a-aebbc97de000-original.png';
const description = 'السنام هو مصدر قوة يرافق الجمل في مسافات لا يستطيع أحد غيره تحملها. لكل شخص رحلته الخاصة ويحتاج إلى سنامه. سنامي هو الطاقة التي تمكنك من إكمال رحلتك';
if(!document.getElementById('snamo-google-font')){const font=document.createElement('link');font.id='snamo-google-font';font.rel='stylesheet';font.href='https://fonts.googleapis.com/css2?family=Beiruti:wght@400;500;600;700;800&display=swap';document.head.append(font);}
let queued = false;
function decorate() {
queued = false;
const heroSources=['https://cdn.files.salla.network/other/524067722/a3273ad7-ef95-410d-bc66-81e17482d716-original.jpg','https://cdn.files.salla.network/other/524067722/5564759b-783b-4890-aa09-46412f19858d-original.jpg'];
document.querySelectorAll('[component-id="862804323"] img').forEach((img,index)=>{if(!img.dataset.snamoOriginal&&heroSources[index]){img.srcset=img.src+' 1440w, '+heroSources[index]+' 2880w';img.sizes='100vw';img.dataset.snamoOriginal='true';}});
const products = document.querySelector('[component-id="1280827981"]');
if (products && !products.id) products.id = 'sanamo-products';
const faq = document.querySelector('[component-id="101522242"]');
if (faq) {
if (!faq.id) faq.id = 'sanamo-faq';
faq.querySelectorAll('.faq-item label').forEach(label => {
if (label.dataset.snamoAccessible) return;
label.dataset.snamoAccessible = 'true';
label.tabIndex = 0;
label.setAttribute('role','button');
const input = label.closest('.faq-item').querySelector('input[type="checkbox"]');
if (!input) return;
const update = () => label.setAttribute('aria-expanded',String(input.checked));
input.addEventListener('change',update);update();
label.addEventListener('keydown',event => {if(event.key==='Enter'||event.key===' '){event.preventDefault();label.click();}});
});
}
const search=document.querySelector('.header-search');
const navRow=document.querySelector('#mainnav>.inner>.container>.flex');
if(search&&navRow&&search.parentElement!==navRow)navRow.append(search);
const actions=document.querySelector('#mainnav>.inner>.container>.flex>.justify-end');
const home=document.querySelector('#mainnav .navbar-brand')?.href;
if(actions&&home&&!actions.querySelector('.snamo-wishlist')){const link=document.createElement('a');link.className='snamo-wishlist';link.href=home.replace(/\/$/,'')+'/account/wishlist';link.setAttribute('aria-label','المفضلة');link.title='المفضلة';link.innerHTML=' ';actions.append(link);}
const mark = document.querySelector('#mainnav .navbar-brand img');
if (mark && !mark.dataset.snamoLogo) {mark.src=logo;mark.removeAttribute('srcset');mark.dataset.snamoLogo='true';}
const footer = document.querySelector('.store-footer');
if (footer) {
const brand = footer.querySelector('.store-footer__inner>.container>div:first-child>a');
if(brand&&!brand.querySelector('.snamo-footer-logo')){
const img=document.createElement('img');img.src=logo;img.alt='سنامو | Sanamo';img.className='snamo-footer-logo';img.width=155;img.height=78;img.loading='lazy';brand.replaceChildren(img);
}
const intro=footer.querySelector('.max-w-sm');
if(intro&&!intro.dataset.snamoDescription){intro.textContent=description;intro.dataset.snamoDescription='true';}
const copy=footer.querySelector('.copyright-text');
if(copy&&!copy.dataset.snamoCopy){copy.textContent='جميع الحقوق محفوظة لسنامو';copy.dataset.snamoCopy='true';}
const columns=footer.querySelector('.store-footer__inner>.container');
const legal=columns?.querySelector('div:first-child>.flex.gap-4');
if(legal&&!legal.classList.contains('snamo-footer-legal')){legal.classList.add('snamo-footer-legal');columns.append(legal);}
const menuTitle=footer.querySelector('salla-menu')?.previousElementSibling;
if(menuTitle&&menuTitle.textContent!=='روابط المتجر')menuTitle.textContent='روابط المتجر';
const menu=footer.querySelector('.s-menu-footer-list');
if(menu&&!menu.querySelector('a[href="#sanamo-faq"]')){const link=document.createElement('a');link.href='#sanamo-faq';link.textContent='الأسئلة الشائعة';link.addEventListener('click',event=>{const el=document.getElementById('sanamo-faq');if(el){event.preventDefault();el.scrollIntoView({behavior:matchMedia('(prefers-reduced-motion:reduce)').matches?'auto':'smooth'});}});menu.append(link);}
}
document.querySelectorAll('[component-id="436770806"] a[href=""],[component-id="103773553"] a[href=""],[component-id="862804323"] a[href=""]').forEach(a=>{a.removeAttribute('href');a.removeAttribute('role');});
}
const schedule=()=>{if(!queued){queued=true;requestAnimationFrame(decorate);}};
if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',decorate,{once:true});else decorate();
const observer=new MutationObserver(records=>{if(records.some(r=>r.addedNodes.length))schedule();});
observer.observe(document.documentElement,{childList:true,subtree:true});
})();
(function () {
'use strict';
const CSS = "/* Injected only into component-id 74335106's product-features-list shadow root. */\n:host{display:block;font-family:Beiruti,sans-serif;color:#143c47;min-width:0}\n.s-block--features-center-img{padding:0!important;margin:0!important;background:transparent!important;overflow:visible!important}\n.s-block--features-center-img .lp-container{direction:ltr;display:grid!important;grid-template-columns:repeat(16,minmax(0,1fr));grid-template-rows:auto minmax(112px,auto) minmax(112px,auto);column-gap:14px;row-gap:18px;max-width:1600px!important;width:calc(100% - 64px)!important;min-width:0!important;height:auto!important;max-height:none!important;margin:0 auto!important;padding:0!important;border:0!important;border-radius:0!important;overflow:visible!important;box-sizing:border-box!important;background:#fff}\n.s-block--features-center-img .lp-container>.grid,.s-block--features-center-img .grid>.col{display:contents!important}\n.s-block--features-center-img .lp-title{grid-column:9/17;grid-row:1;min-width:0!important;width:100%!important;max-width:none!important;height:auto!important;max-height:none!important;margin:0!important;padding:38px 0 8px 14px!important;text-align:right!important;direction:rtl;align-self:center;justify-self:stretch;box-sizing:border-box!important;overflow:visible!important}\n.s-block--features-center-img .lp-title__main{display:block!important;min-width:0!important;width:auto!important;max-width:none!important;font-family:inherit!important;color:#143c47!important;font-size:48px!important;font-weight:800!important;line-height:1.2!important;margin:0 0 20px!important;letter-spacing:0!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important;-webkit-line-clamp:unset!important}\n.s-block--features-center-img .lp-title__sub{display:block!important;min-width:0!important;width:auto!important;max-width:none!important;height:auto!important;max-height:none!important;font-family:inherit!important;color:#143c47!important;font-size:27px!important;line-height:1.55!important;font-weight:500!important;margin:0!important;padding:0!important;opacity:1!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important;-webkit-line-clamp:unset!important;line-clamp:unset!important;word-break:normal!important;overflow-wrap:break-word!important;box-sizing:border-box!important}\n.s-block--features-center-img .center-img{grid-column:1/9;grid-row:1/4;align-self:stretch!important;min-width:0;width:auto!important;height:100%!important;min-height:560px!important;padding:0!important;margin:0!important;position:relative;overflow:hidden;border-radius:24px 0 0 24px!important}\n.s-block--features-center-img .center-img>img{position:absolute!important;inset:0;width:100%!important;height:100%!important;max-width:none!important;max-height:none!important;object-fit:cover!important;object-position:center!important;border-radius:inherit!important;display:block!important}\n.s-block--features-center-img .feature-card{direction:rtl;display:flex!important;flex-direction:column!important;justify-content:center!important;align-items:center!important;text-align:center!important;gap:10px!important;min-width:0!important;width:auto!important;margin:0!important;padding:13px 5px!important;background:#fff!important;border:1px solid #c9e6ec!important;border-radius:14px!important;box-shadow:none!important;box-sizing:border-box!important}\n.s-block--features-center-img .feature-card__img{display:block!important;width:44px!important;height:44px!important;max-width:44px!important;max-height:44px!important;object-fit:contain!important;margin:0!important;border-radius:50%!important;flex:0 0 44px!important}\n.s-block--features-center-img .feature-card__body{margin:0!important;padding:0!important;min-width:0!important;width:100%!important;max-width:none!important}\n.s-block--features-center-img .feature-card__title{display:block!important;min-width:0!important;width:100%!important;max-width:none!important;font-family:inherit!important;font-size:22px!important;font-weight:800!important;line-height:1.25!important;margin:0!important;color:#143c47!important;white-space:normal!important;overflow:visible!important;overflow-wrap:normal!important;word-break:normal!important;text-overflow:clip!important;-webkit-line-clamp:unset!important}\n.s-block--features-center-img .feature-card[data-sa-ingredient=\"1\"]{grid-column:9/11;grid-row:2;margin-left:14px!important}\n.s-block--features-center-img .feature-card[data-sa-ingredient=\"2\"]{grid-column:11/13;grid-row:2}\n.s-block--features-center-img .feature-card[data-sa-ingredient=\"3\"]{grid-column:13/15;grid-row:2}\n.s-block--features-center-img .feature-card[data-sa-ingredient=\"4\"]{grid-column:15/17;grid-row:2;margin-right:20px!important}\n.s-block--features-center-img .feature-card[data-sa-ingredient=\"5\"]{grid-column:15/17;grid-row:3;margin-right:20px!important}\n.s-block--features-center-img .feature-card[data-sa-ingredient=\"6\"]{grid-column:13/15;grid-row:3}\n.s-block--features-center-img .feature-card[data-sa-ingredient=\"7\"]{grid-column:11/13;grid-row:3}\n@media(max-width:1200px){.s-block--features-center-img .lp-container{column-gap:9px;row-gap:12px;grid-template-rows:auto minmax(110px,auto) minmax(110px,auto)}.s-block--features-center-img .lp-title{padding:24px 0 8px 10px!important}.s-block--features-center-img .lp-title__main{font-size:40px!important}.s-block--features-center-img .lp-title__sub{font-size:23px!important}.s-block--features-center-img .feature-card__title{font-size:19px!important}.s-block--features-center-img .center-img{min-height:520px!important}}\n@media(min-width:768px) and (max-width:1023px){\n .s-block--features-center-img .lp-container{max-width:740px!important;width:calc(100% - 48px)!important;grid-template-columns:repeat(12,minmax(0,1fr));grid-template-rows:auto auto minmax(112px,auto) minmax(112px,auto);gap:18px 12px}\n .s-block--features-center-img .lp-title{grid-column:1/13;grid-row:1;padding:0!important}\n .s-block--features-center-img .center-img{grid-column:1/13;grid-row:2;min-height:0!important;height:auto!important;aspect-ratio:780/560;width:100%!important;margin:8px 0!important;border-radius:20px!important}\n .s-block--features-center-img .feature-card[data-sa-ingredient=\"1\"]{grid-column:9/13;grid-row:3;margin:0!important}\n .s-block--features-center-img .feature-card[data-sa-ingredient=\"2\"]{grid-column:5/9;grid-row:3}\n .s-block--features-center-img .feature-card[data-sa-ingredient=\"3\"]{grid-column:1/5;grid-row:3}\n .s-block--features-center-img .feature-card[data-sa-ingredient=\"4\"]{grid-column:10/13;grid-row:4;margin:0!important}\n .s-block--features-center-img .feature-card[data-sa-ingredient=\"5\"]{grid-column:4/7;grid-row:4;margin:0!important}\n .s-block--features-center-img .feature-card[data-sa-ingredient=\"6\"]{grid-column:7/10;grid-row:4}\n .s-block--features-center-img .feature-card[data-sa-ingredient=\"7\"]{grid-column:1/4;grid-row:4}\n}\n@media(max-width:767px){\n .s-block--features-center-img .lp-container{width:calc(100% - 32px)!important;grid-template-columns:repeat(12,minmax(0,1fr));grid-template-rows:auto auto minmax(104px,auto) minmax(104px,auto);gap:20px 8px;padding:0!important}\n .s-block--features-center-img .lp-title{grid-column:1/13;grid-row:1;padding:0!important;text-align:right!important}\n .s-block--features-center-img .lp-title__main{font-size:32px!important;line-height:1.25!important;margin-bottom:14px!important}\n .s-block--features-center-img .lp-title__sub{font-size:20px!important;line-height:1.5!important}\n .s-block--features-center-img .center-img{grid-column:1/13;grid-row:2;height:auto!important;min-height:0!important;aspect-ratio:780/560;width:100%!important;margin:0!important;border-radius:20px!important}\n .s-block--features-center-img .feature-card{gap:9px!important;padding:12px 4px!important;border-radius:12px!important}\n .s-block--features-center-img .feature-card__img{width:38px!important;height:38px!important;max-width:38px!important;max-height:38px!important;flex-basis:38px!important}\n .s-block--features-center-img .feature-card__title{font-size:17px!important;line-height:1.25!important}\n .s-block--features-center-img .feature-card[data-sa-ingredient=\"1\"]{grid-column:9/13;grid-row:3;margin:0!important}\n .s-block--features-center-img .feature-card[data-sa-ingredient=\"2\"]{grid-column:5/9;grid-row:3}\n .s-block--features-center-img .feature-card[data-sa-ingredient=\"3\"]{grid-column:1/5;grid-row:3}\n .s-block--features-center-img .feature-card[data-sa-ingredient=\"4\"]{grid-column:10/13;grid-row:4;margin:0!important}\n .s-block--features-center-img .feature-card[data-sa-ingredient=\"5\"]{grid-column:4/7;grid-row:4;margin:0!important}\n .s-block--features-center-img .feature-card[data-sa-ingredient=\"6\"]{grid-column:7/10;grid-row:4}\n .s-block--features-center-img .feature-card[data-sa-ingredient=\"7\"]{grid-column:1/4;grid-row:4}\n}\n@media(max-width:360px){.s-block--features-center-img .lp-container{column-gap:6px}.s-block--features-center-img .feature-card__title{font-size:15px!important}.s-block--features-center-img .lp-title__main{font-size:28px!important}.s-block--features-center-img .lp-title__sub{font-size:18px!important}}\n\n.s-block--features-center-img .lp-title__main{width:100%!important;max-width:none!important}\n";
const PROTEIN_ICON = 'https://cdn.files.salla.network/other/524067722/b8b8e8ff-43c8-4853-9a72-feab30a033d8-original.png';
const watched = new WeakSet();
const waiting = new WeakSet();
const selector = '[component-id="74335106"] [component-name="product-features-list"]';
function enhance(host) {
const shadow = host.shadowRoot;
if (!shadow) {
if (waiting.has(host)) return;
waiting.add(host);
let tries=0;
const retry=()=>{if(host.shadowRoot){waiting.delete(host);enhance(host);}else if(++tries<80&&host.isConnected){setTimeout(retry,250);}else waiting.delete(host);};
setTimeout(retry,250);return;
}
function apply() {
if (!shadow.querySelector('style[data-snamo-ingredients]')) {
const style=document.createElement('style');style.dataset.snamoIngredients='true';style.textContent=CSS;shadow.appendChild(style);
}
const cols=shadow.querySelectorAll('.s-block--features-center-img .grid>.col');
if (!cols.length) return;
let cards=Array.from(shadow.querySelectorAll('.feature-card'));
if (cards.length===6&&!shadow.querySelector('[data-sa-protein]')) {
const card=document.createElement('div');card.className='feature-card';card.dataset.saProtein='true';
const img=document.createElement('img');img.className='feature-card__img';img.src=PROTEIN_ICON;img.alt='';img.width=144;img.height=144;img.loading='lazy';
const body=document.createElement('div');body.className='feature-card__body';
const title=document.createElement('h2');title.className='feature-card__title';title.textContent='6 جرام بروتين طبيعي';
body.appendChild(title);card.append(img,body);cols[cols.length-1].appendChild(card);cards.push(card);
}
cards.forEach((card,index)=>{card.dataset.saIngredient=String(index+1);});
}
apply();
if (!watched.has(shadow)) {
watched.add(shadow);
const observer=new MutationObserver(apply);observer.observe(shadow,{childList:true,subtree:true});
}
}
function mount(){document.querySelectorAll(selector).forEach(enhance);}
if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',mount,{once:true});else mount();
const observer=new MutationObserver(records=>{if(records.some(r=>Array.from(r.addedNodes).some(n=>n.nodeType===1&&(n.matches?.(selector)||n.querySelector?.(selector)))))mount();});
observer.observe(document.documentElement,{childList:true,subtree:true});
})();
(function () {
'use strict';
const e = (value) => String(value ?? '').replace(/[&<>"']/g, (c) => ({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]));
const digits = (value) => Number(value).toLocaleString('ar-SA');
const initialized = new WeakSet();
const observedScopes = new WeakSet();
const pendingHosts = new WeakSet();
const componentScopes = new Set();
function calculateRecommendation(place, people, frequency) {
const needs = Number(people) * Number(frequency) * 4;
const packs = Math.ceil(needs / 50);
return {needs, packs, total:packs * 50, carton:place === 'move'};
}
const paths = {
chat:'M21 11.5a8.5 8.5 0 0 1-8.5 8.5H4l-3 3v-11A8.5 8.5 0 0 1 9.5 3h3a8.5 8.5 0 0 1 8.5 8.5ZM7 9h9M7 14h6',
person:'M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8ZM5 22v-3a7 7 0 0 1 14 0v3M8 17h8',
people:'M9 11a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7ZM3 22v-4a6 6 0 0 1 12 0v4M17 4a3.5 3.5 0 0 1 0 7M18 14a5 5 0 0 1 4 5v3',
building:'M4 22V3h12v19M16 10h5v12M2 22h22M8 7h4M8 11h4M8 15h4M9 22v-3h3v3M19 14h1M19 18h1',
box:'M3 7l9-4 9 4v12l-9 4-9-4V7ZM3 7l9 4 9-4M12 11v12M7 5l9 4',
calendar:'M4 5h16v17H4V5ZM8 2v6M16 2v6M4 11h16M8 15h2M14 15h2M8 18h2'
};
const icon = (name) => ' ';
function init(root) {
if (initialized.has(root)) return;
const stage = root.querySelector('[data-sa-stage]');
const reset = root.querySelector('[data-sa-reset]');
if (!stage || !reset) return;
initialized.add(root);
root.dataset.saReady = 'true';
const cfg = root.dataset;
const state = {screen:'start', place:null, people:null, frequency:null, business:'', city:'', quantity:'', help:false};
const options = {
place:[['desk','مع القهوة وعلى المكتب','','box'],['move','للنادي ومع المشاوير','','box'],['home','للمشاركة في البيت','','box']],
people:[['1','أنا لحالي','اختيار يناسب روتيني','people'],['2','شخصين','لي ولشخص يشاركني','people'],['4','أربعة أشخاص','للعائلة أو المشاركة','people']],
frequency:[['2','مرّتين بالأسبوع','','calendar'],['4','أربع مرّات','','calendar'],['7','كل يوم','','calendar']]
};
const questions = {place:'وين يرافقك سنامو؟',people:'كم شخص بيشاركك سنامو؟',frequency:'كم مرّة بالأسبوع لكل شخص؟'};
function choice(value,title,subtitle,name,key,start) {
const selected = state[key] === value;
return ''+icon(name)+' '+e(title)+' '+(subtitle?''+e(subtitle)+' ':'')+' '+(start?'‹ ':' ')+' ';
}
function primary(text,action,disabled) { return ''+text+'‹ '; }
function back(action) { return '→ رجوع '; }
function show(screen, focus = true) {
state.screen = screen;
reset.hidden = screen === 'start';
let html = '';
if (screen === 'start') {
html = '
تشتري لنفسك أم لمنشأتك؟ '+choice('consumer','لي ولعائلتي','عبوة تناسب استهلاكك','person','mode',true)+choice('business','لمنشأتي','للنوادي والكافيهات والمتاجر','building','mode',true)+'
تصفح العبوات مباشرة ';
} else if (options[screen]) {
const step = ['place','people','frequency'].indexOf(screen)+1;
html = 'اختيار العبوة · '+digits(step)+' من ٣ '+[1,2,3].map(n=>' ').join('')+'
'+questions[screen]+' '+options[screen].map(o=>choice(...o,screen,false)).join('')+'
'+back(step===1?'start':step===2?'place':'people')+primary(step===3?'شوف اقتراحك':'التالي',step===1?'people':step===2?'frequency':'result',!state[screen])+'
';
} else if (screen === 'result') {
const {needs,packs,total,carton} = calculateRecommendation(state.place,state.people,state.frequency);
const title = carton?'كرات سنامو – كرتون 50 حبّة':'كرات سنامو – جار 50 حبّة';
const image = carton?cfg.cartonImage:cfg.jarImage;
const href = carton?cfg.cartonHref:cfg.jarHref;
const amount = packs===1?'عبوة واحدة · ٥٠ حبّة':packs===2?'عبوتان · ١٠٠ حبّة':digits(packs)+' عبوات · '+digits(total)+' حبّة';
html = 'هذا اقتراحنا لك احتياجك التقديري '+digits(needs)+' حبّة خلال أربعة أسابيع.
'+(image?'
':'')+'
حسبة تقريبية لأربعة أسابيع، على أساس حبّة واحدة في كل مرّة. إجمالي العبوات '+digits(total)+' حبّة، منها '+digits(total-needs)+' حبّة إضافية.
';
} else if (screen === 'business') {
html = 'وش تحتاج منشأتك؟ ';
} else if (screen === 'summary') {
const quantity = state.help?'أحتاج مساعدة في تحديد الكمية':digits(Number(state.quantity))+' كرتون';
const text = 'مرحبًا فريق سنامو، أرغب في طلب عرض سعر للجملة.\nنوع المنشأة: '+state.business+'\nالمدينة: '+state.city+'\nالكمية المتوقعة: '+quantity;
const phone = (cfg.whatsapp || '966535067843').replace(/\D/g,'');
html = 'طلبك جاهز راجع التفاصيل، ثم أرسلها لفريق سنامو.
نوع المنشأة '+e(state.business)+'
المدينة '+e(state.city)+'
الكمية المتوقعة '+e(quantity)+' أرسل طلب عرض السعر عبر واتساب ‹ سعر الجملة يتحدد حسب الكمية والمتطلبات.
عدّل بيانات الطلب ';
}
stage.innerHTML = html;
if (focus) stage.querySelector('h3')?.focus({preventScroll:true});
}
function rememberBusiness() {
const form = stage.querySelector('[data-sa-business]');
if (!form) return;
state.city = form.elements.city.value.trim();
state.quantity = form.elements.quantity.value;
state.help = form.elements.help.checked;
}
root.addEventListener('click', event => {
const anchor = event.target.closest('a[href^="#"]');
if (anchor && root.contains(anchor)) {
const fragment=anchor.getAttribute('href');
let id;
try {id=decodeURIComponent(fragment.slice(1));} catch {return;}
if (!id) return;
let target=root.ownerDocument.getElementById(id);
if (!target) for (const scope of componentScopes) {
if (!scope.host?.isConnected) {componentScopes.delete(scope);continue;}
target=scope.getElementById?.(id);
if (target) break;
}
if (!target && id==='sanamo-products') target=root.ownerDocument.querySelector('[component-id="1280827981"]');
if (target) {
event.preventDefault();
const reduced=root.ownerDocument.defaultView?.matchMedia?.('(prefers-reduced-motion: reduce)').matches;
target.scrollIntoView({behavior:reduced?'auto':'smooth',block:'start'});
}
return;
}
const target = event.target.closest('button');
if (!target || !root.contains(target)) return;
if (target.hasAttribute('data-sa-reset')) {
Object.assign(state,{place:null,people:null,frequency:null,business:'',city:'',quantity:'',help:false});
show('start');return;
}
if (target.dataset.saChoice) {
const key = target.dataset.saKey;
if (key === 'mode') {show(target.dataset.saChoice === 'consumer'?'place':'business');return;}
state[key] = target.dataset.saChoice;
stage.querySelectorAll('[data-sa-choice]').forEach(b=>b.setAttribute('aria-checked',String(b===target)));
const next = stage.querySelector('.snamo-advisor__primary');
if (next) next.disabled = false;
} else if (target.dataset.saBusinessType) {
state.business = target.dataset.saBusinessType;
stage.querySelectorAll('[data-sa-business-type]').forEach(b=>b.setAttribute('aria-checked',String(b===target)));
} else if (target.dataset.saAction) {
rememberBusiness(); show(target.dataset.saAction);
}
});
root.addEventListener('change', event => {
if (event.target.name === 'help') {
rememberBusiness();
const quantity = stage.querySelector('[name="quantity"]');
if (quantity) quantity.disabled = state.help;
}
});
root.addEventListener('submit', event => {
if (!event.target.matches('[data-sa-business]')) return;
event.preventDefault(); rememberBusiness();
const quantity = Number(state.quantity);
const message = !state.business?'اختر نوع المنشأة.':!state.city?'اكتب المدينة.':!state.help&&(!Number.isInteger(quantity)||quantity<1||quantity>999999)?'اكتب كمية صحيحة أو اختر المساعدة في تحديد الكمية.':'';
if (message) {const error=stage.querySelector('[data-sa-error]');error.hidden=false;error.textContent=message;return;}
show('summary');
});
root.addEventListener('keydown', event => {
const current = event.target.closest('[role="radio"]');
if (!current || !['ArrowRight','ArrowLeft','ArrowUp','ArrowDown'].includes(event.key)) return;
const group=current.closest('[role="radiogroup"]');
const radios=Array.from(group.querySelectorAll('[role="radio"]'));
const direction=['ArrowDown','ArrowLeft'].includes(event.key)?1:-1;
const next=radios[(radios.indexOf(current)+direction+radios.length)%radios.length];
event.preventDefault();next.focus();next.click();
});
show('start',false);
}
function discoverHost(host) {
if (host.shadowRoot) {watchScope(host.shadowRoot);return;}
if (pendingHosts.has(host)) return;
pendingHosts.add(host);
let attempts=0;
function retry() {
if (host.shadowRoot) {pendingHosts.delete(host);watchScope(host.shadowRoot);}
else if (host.isConnected && ++attempts<80) setTimeout(retry,250);
else pendingHosts.delete(host);
}
setTimeout(retry,0);
}
function scan(scope) {
scope.querySelectorAll('.snamo-advisor').forEach(init);
const selector=scope===document?'[component-name="custom-html"],main [component-name],#main-content [component-name]':'[component-name]';
scope.querySelectorAll(selector).forEach(discoverHost);
}
function watchScope(scope) {
if (scope.host) componentScopes.add(scope);
if (!observedScopes.has(scope)) {
observedScopes.add(scope);
const observer=new MutationObserver(records=>{
if(records.some(record=>record.type==='attributes'||Array.from(record.addedNodes).some(node=>node.nodeType===1))) scan(scope);
});
observer.observe(scope===document?document.documentElement:scope,{childList:true,subtree:true,attributes:true,attributeFilter:['loaded','data-skeleton-rendered']});
}
scan(scope);
}
if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',()=>watchScope(document),{once:true});
else watchScope(document);
})();
(function () {
'use strict';
const CSS = "/* Injected only into the open shadow root of native component 1974603478. */\n:host{display:block;min-width:0;font-family:Beiruti,sans-serif;color:#143c47}\n.s-block-trust-store-features{margin:0!important;padding:80px 24px 136px!important;background:#fff!important;direction:rtl;color:#143c47;box-sizing:border-box}\n.snamo-benefits-heading{margin:0 0 84px!important;text-align:center;color:#143c47!important;font:800 48px/1.2 Beiruti,sans-serif!important;letter-spacing:0!important}\n.s-block-trust-store-features__grid{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:0!important;max-width:1600px!important;width:100%!important;margin:0 auto!important;padding:0!important;box-sizing:border-box}\n.s-block-trust-store-features__item{position:relative;display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:flex-start!important;gap:0!important;min-width:0;margin:0!important;padding:0 24px!important;text-align:center!important;border:0!important;background:transparent!important;box-shadow:none!important;box-sizing:border-box}\n.s-block-trust-store-features__item:not(:last-child)::after{content:\"\";position:absolute;left:0;top:4px;width:1px;height:146px;background:#b8e4ee}\n.s-block-trust-store-features__media{display:flex!important;align-items:center!important;justify-content:center!important;width:88px!important;height:88px!important;min-width:88px!important;min-height:88px!important;margin:0 0 22px!important;padding:0!important;background:transparent!important;border:0!important;border-radius:0!important;box-shadow:none!important}\n.s-block-trust-store-features__image{display:block!important;width:88px!important;height:88px!important;max-width:100%!important;max-height:100%!important;margin:0!important;object-fit:contain!important;border-radius:0!important}\n.s-block-trust-store-features__title{margin:0 0 8px!important;padding:0!important;font:800 32px/1.2 Beiruti,sans-serif!important;letter-spacing:0!important;color:#143c47!important}\n.s-block-trust-store-features__subtitle{margin:0!important;padding:0!important;font:500 24px/1.4 Beiruti,sans-serif!important;color:#143c47!important;opacity:1!important}\n@media(max-width:1023px){.s-block-trust-store-features{padding:64px 24px 88px!important}.snamo-benefits-heading{font-size:40px!important;margin-bottom:56px!important}.s-block-trust-store-features__title{font-size:28px!important}.s-block-trust-store-features__subtitle{font-size:22px!important}}\n@media(max-width:767px){\n .s-block-trust-store-features{padding:48px 16px!important}\n .snamo-benefits-heading{font-size:32px!important;line-height:1.2!important;margin-bottom:16px!important}\n .s-block-trust-store-features__grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:12px!important}\n .s-block-trust-store-features__item{min-height:144px;padding:24px 12px!important;border-radius:16px!important;background:#e8f7fa!important}\n .s-block-trust-store-features__item:last-child{grid-column:1/-1}\n .s-block-trust-store-features__item::after{display:none!important}\n .s-block-trust-store-features__media{width:44px!important;height:44px!important;min-width:44px!important;min-height:44px!important;margin-bottom:12px!important}\n .s-block-trust-store-features__image{width:44px!important;height:44px!important}\n .s-block-trust-store-features__title{font-size:20px!important;line-height:1.2!important;margin-bottom:6px!important}\n .s-block-trust-store-features__subtitle{font-size:16px!important;line-height:1.4!important}\n}\n";
const componentSelector = '[component-id="1974603478"]';
const sectionSelector = '.s-block-trust-store-features';
const watched = new WeakSet();
const waiting = new WeakSet();
function enhance(host) {
const shadow = host.shadowRoot;
if (!shadow) {
if (waiting.has(host)) return;
waiting.add(host);
let attempts = 0;
const retry = function () {
if (host.shadowRoot) { waiting.delete(host); enhance(host); }
else if (++attempts < 80 && host.isConnected) setTimeout(retry, 250);
else waiting.delete(host);
};
setTimeout(retry, 250);
return;
}
const apply = function () {
const section = shadow.querySelector(sectionSelector);
if (!section) return;
if (!shadow.querySelector('style[data-snamo-benefits]')) {
const style = document.createElement('style');
style.dataset.snamoBenefits = 'true';
style.textContent = CSS;
shadow.appendChild(style);
}
if (!section.querySelector('.snamo-benefits-heading')) {
const heading = document.createElement('h2');
heading.id = 'snamo-benefits-title';
heading.className = 'snamo-benefits-heading';
heading.textContent = 'مميزاتنا';
section.prepend(heading);
}
section.setAttribute('aria-labelledby', 'snamo-benefits-title');
};
apply();
if (!watched.has(shadow)) {
watched.add(shadow);
new MutationObserver(apply).observe(shadow, {childList:true, subtree:true});
}
}
function mount() {
document.querySelectorAll(componentSelector).forEach(function (component) {
if (component.shadowRoot || component.hasAttribute('component-name')) enhance(component);
component.querySelectorAll('[component-name]').forEach(enhance);
});
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', mount, {once:true});
else mount();
new MutationObserver(function (records) {
if (records.some(function (record) {
return Array.from(record.addedNodes).some(function (node) {
return node.nodeType === 1 && (node.matches?.(componentSelector + ',[component-name]') || node.querySelector?.(componentSelector));
});
})) mount();
}).observe(document.documentElement, {childList:true, subtree:true});
})();