window.PEYZAX_I18N={
tr: {
appTitle: "Peyzax Akıllı Bitki Mesafe Hesaplayıcı",
subtitle: "Peyzaj, ziraat ve karışık dikimlerde bitki aralığı, adet, yoğunluk ve maliyet hesabı.",
language: "Dil",
dataCount: "bitki verisi",
sourceNote: "PDF kataloglar ve Peyzax kürasyon verisi ile hazırlanmıştır.",
plantSelection: "Bitki seçimi",
searchPlant: "Bitki ara",
searchPlaceholder: "Domates, lavanta, Acer, Begonia...",
category: "Kategori",
allCategories: "Tüm kategoriler",
addPlant: "Ekle",
selectedPlants: "Seçilen bitkiler",
clear: "Temizle",
noSelection: "Henüz bitki seçilmedi.",
primaryPlant: "Hesap ana bitkiye göre yapılır; karışık mesafeler ayrıca hesaplanır.",
dimensions: "Alan ve maliyet",
length: "Uzunluk",
width: "Genişlik",
border: "Dikim dışı kenar payı",
price: "Birim fiyat",
waste: "Fire/yedek",
hedgeRows: "Çit sıra sayısı",
manualSpacing: "Elle mesafe",
optional: "opsiyonel",
plantingType: "Dikim tipi",
results: "Sonuç",
totalPlants: "Toplam bitki",
withWaste: "Fire dahil",
density: "Yoğunluk",
spacing: "Önerilen mesafe",
rowSpacing: "Sıra arası",
rows: "Sıra",
columns: "Sıra başı",
cost: "Tahmini maliyet",
usableArea: "Kullanılabilir alan",
pairwise: "Bitkiler arası mesafe",
recommendations: "Akıllı uyarılar",
noWarnings: "Bu kurgu için belirgin risk görünmüyor.",
noPairs: "Karışık mesafe tablosu için en az iki bitki seçin.",
source: "Kaynak",
confidence: "Güven",
high: "yüksek",
medium: "orta",
low: "düşük",
meter: "m",
cm: "cm",
currency: "TL",
selected: "seçildi",
noMatch: "Eşleşen bitki bulunamadı.",
type_single: "Tekil dikim",
type_mass: "Kitle/kare dikim",
type_row: "Sıra dikimi",
type_triangular: "Üçgen dikim",
type_hedge: "Çit/perde",
type_agriculture: "Ziraat/sebze",
desc_single: "Soliter ağaç, çalı veya vurgu bitkisi.",
desc_mass: "Aynı türle düzenli kare grid.",
desc_row: "Sıra üzeri ve sıra arası ayrı hesap.",
desc_triangular: "Daha sık, şaşırtmalı peyzaj dikimi.",
desc_hedge: "Çit, perdeleme ve sınır bitkileri.",
desc_agriculture: "Sebze, meyve ve üretim dikimi.",
cat_tree: "Ağaç",
cat_small_tree: "Ağaççık",
cat_palm: "Palmiye",
cat_shrub: "Çalı",
cat_hedge: "Çit bitkisi",
cat_perennial: "Çok yıllık",
cat_bulb: "Soğanlı/yumrulu",
cat_groundcover: "Yer örtücü",
cat_grass: "Süs otu",
cat_vine: "Sarılıcı",
cat_vegetable: "Sebze",
cat_fruit: "Meyve/asma",
cat_fruit_tree: "Meyve ağacı",
cat_herb: "Aromatik",
cat_annual: "Mevsimlik",
warnSmallArea: "Kullanılabilir alan çok küçük; kenar boşluğu veya ölçüleri kontrol edin.",
warnWater: "Seçilen bitkilerde su ihtiyacı farklı. Aynı sulama zonunda kullanacaksanız damlama hattını ayırın.",
warnTriVeg: "Üçgen dikim sebzelerde havalanmayı düşürebilir. Mantar riski olan türlerde sıra dikimi daha güvenlidir.",
warnHedge: "Seçilen ana bitki tipik bir çit bitkisi değil. Perdeleme için tür uygunluğunu ayrıca kontrol edin.",
warnManual: "Elle girilen mesafe önerilen değerin oldukça altında. Kök rekabeti ve hastalık riski artabilir.",
warnTreeMix: "Büyük ağaçlarla otsu/çalı bitkileri birlikte kullanırken gölge ve kök rekabeti için ekstra pay bırakın."
},
en: {
appTitle: "Peyzax Smart Plant Spacing Calculator",
subtitle: "Calculate spacing, plant count, density and cost for landscape, crop and mixed planting plans.",
language: "Language",
dataCount: "plants",
sourceNote: "Prepared from PDF catalogs and Peyzax curated data.",
plantSelection: "Plant selection",
searchPlant: "Search plants",
searchPlaceholder: "Tomato, lavender, Acer, Begonia...",
category: "Category",
allCategories: "All categories",
addPlant: "Add",
selectedPlants: "Selected plants",
clear: "Clear",
noSelection: "No plant selected yet.",
primaryPlant: "Area count uses the first plant; mixed distances are calculated separately.",
dimensions: "Area and cost",
length: "Length",
width: "Width",
border: "Non-planting edge margin",
price: "Unit price",
waste: "Waste/spare",
hedgeRows: "Hedge rows",
manualSpacing: "Manual spacing",
optional: "optional",
plantingType: "Planting type",
results: "Result",
totalPlants: "Total plants",
withWaste: "With spare",
density: "Density",
spacing: "Recommended spacing",
rowSpacing: "Row spacing",
rows: "Rows",
columns: "Plants per row",
cost: "Estimated cost",
usableArea: "Usable area",
pairwise: "Plant-to-plant spacing",
recommendations: "Smart warnings",
noWarnings: "No major risk detected for this setup.",
noPairs: "Select at least two plants for a mixed spacing table.",
source: "Source",
confidence: "Confidence",
high: "high",
medium: "medium",
low: "low",
meter: "m",
cm: "cm",
currency: "TRY",
selected: "selected",
noMatch: "No matching plant found.",
type_single: "Single planting",
type_mass: "Mass/square grid",
type_row: "Row planting",
type_triangular: "Triangular grid",
type_hedge: "Hedge/screen",
type_agriculture: "Crop/vegetable",
desc_single: "Solitary tree, shrub or accent plant.",
desc_mass: "Regular square grid of one species.",
desc_row: "Separate in-row and between-row spacing.",
desc_triangular: "Denser staggered landscape planting.",
desc_hedge: "Boundary, hedge and screening layouts.",
desc_agriculture: "Vegetables, orchards and production beds.",
cat_tree: "Tree",
cat_small_tree: "Small tree",
cat_palm: "Palm",
cat_shrub: "Shrub",
cat_hedge: "Hedge plant",
cat_perennial: "Perennial",
cat_bulb: "Bulb/tuber",
cat_groundcover: "Groundcover",
cat_grass: "Ornamental grass",
cat_vine: "Climber",
cat_vegetable: "Vegetable",
cat_fruit: "Fruit/vine",
cat_fruit_tree: "Fruit tree",
cat_herb: "Herb",
cat_annual: "Annual",
warnSmallArea: "The usable area is too small; check border or dimensions.",
warnWater: "Selected plants have different water needs. Separate irrigation zones if possible.",
warnTriVeg: "Triangular grids can reduce airflow for vegetables. Rows are safer for disease-prone crops.",
warnHedge: "The primary plant is not a typical hedge plant. Check screening suitability.",
warnManual: "Manual spacing is far below the recommendation. Competition and disease risk may increase.",
warnTreeMix: "Leave extra room when combining large trees with herbaceous plants or shrubs."
},
ru: {
appTitle: "Peyzax умный калькулятор расстояний",
subtitle: "Расчет расстояния, количества, плотности и стоимости посадки.",
language: "Язык",
dataCount: "растений",
sourceNote: "Данные из PDF-каталогов и базы Peyzax.",
plantSelection: "Выбор растений",
searchPlant: "Поиск растения",
searchPlaceholder: "Томат, лаванда, Acer, Begonia...",
category: "Категория",
allCategories: "Все категории",
addPlant: "Добавить",
selectedPlants: "Выбранные растения",
clear: "Очистить",
noSelection: "Растение еще не выбрано.",
primaryPlant: "Расчет площади идет по первому растению; смешанные расстояния считаются отдельно.",
dimensions: "Площадь и стоимость",
length: "Длина",
width: "Ширина",
border: "Край без посадки",
price: "Цена за растение",
waste: "Запас",
hedgeRows: "Ряды живой изгороди",
manualSpacing: "Свое расстояние",
optional: "необязательно",
plantingType: "Тип посадки",
results: "Результат",
totalPlants: "Всего растений",
withWaste: "С запасом",
density: "Плотность",
spacing: "Рекомендуемое расстояние",
rowSpacing: "Междурядье",
rows: "Ряды",
columns: "В ряду",
cost: "Стоимость",
usableArea: "Полезная площадь",
pairwise: "Расстояния между растениями",
recommendations: "Предупреждения",
noWarnings: "Серьезных рисков не обнаружено.",
noPairs: "Выберите минимум два растения.",
source: "Источник",
confidence: "Надежность",
high: "высокая",
medium: "средняя",
low: "низкая",
meter: "м",
cm: "см",
currency: "TRY",
selected: "выбрано",
noMatch: "Совпадений нет.",
type_single: "Одиночная",
type_mass: "Массив/квадрат",
type_row: "Рядами",
type_triangular: "Треугольная",
type_hedge: "Живая изгородь",
type_agriculture: "Овощи/поле",
desc_single: "Солитерное дерево, куст или акцент.",
desc_mass: "Регулярная квадратная сетка.",
desc_row: "Расчет в ряду и между рядами.",
desc_triangular: "Более плотная шахматная посадка.",
desc_hedge: "Границы, экраны и изгороди.",
desc_agriculture: "Овощи, сады и производственные грядки.",
cat_tree: "Дерево",
cat_small_tree: "Малое дерево",
cat_palm: "Пальма",
cat_shrub: "Кустарник",
cat_hedge: "Изгородь",
cat_perennial: "Многолетник",
cat_bulb: "Луковичное",
cat_groundcover: "Почвопокровное",
cat_grass: "Злак",
cat_vine: "Лиана",
cat_vegetable: "Овощ",
cat_fruit: "Плодовое/лоза",
cat_fruit_tree: "Плодовое дерево",
cat_herb: "Пряное",
cat_annual: "Однолетник",
warnSmallArea: "Полезная площадь слишком мала.",
warnWater: "У растений разные потребности в воде.",
warnTriVeg: "Треугольная схема может ухудшить проветривание овощей.",
warnHedge: "Основное растение не типично для изгороди.",
warnManual: "Введенное расстояние намного меньше рекомендуемого.",
warnTreeMix: "Оставьте больше места рядом с крупными деревьями."
},
de: {
appTitle: "Peyzax Pflanzabstand-Rechner",
subtitle: "Abstand, Pflanzenzahl, Dichte und Kosten für Landschaft und Anbau.",
language: "Sprache",
dataCount: "Pflanzen",
sourceNote: "Aus PDF-Katalogen und Peyzax-Daten erstellt.",
plantSelection: "Pflanzenwahl",
searchPlant: "Pflanze suchen",
searchPlaceholder: "Tomate, Lavendel, Acer, Begonia...",
category: "Kategorie",
allCategories: "Alle Kategorien",
addPlant: "Hinzufügen",
selectedPlants: "Ausgewählte Pflanzen",
clear: "Leeren",
noSelection: "Noch keine Pflanze gewählt.",
primaryPlant: "Die Flächenberechnung nutzt die erste Pflanze; Mischabstände separat.",
dimensions: "Fläche und Kosten",
length: "Länge",
width: "Breite",
border: "Pflanzfreier Rand",
price: "Stückpreis",
waste: "Reserve",
hedgeRows: "Heckenreihen",
manualSpacing: "Eigener Abstand",
optional: "optional",
plantingType: "Pflanztyp",
results: "Ergebnis",
totalPlants: "Pflanzen gesamt",
withWaste: "Mit Reserve",
density: "Dichte",
spacing: "Empfohlener Abstand",
rowSpacing: "Reihenabstand",
rows: "Reihen",
columns: "Pro Reihe",
cost: "Kosten",
usableArea: "Nutzfläche",
pairwise: "Abstand zwischen Pflanzen",
recommendations: "Hinweise",
noWarnings: "Keine deutlichen Risiken erkannt.",
noPairs: "Mindestens zwei Pflanzen wählen.",
source: "Quelle",
confidence: "Sicherheit",
high: "hoch",
medium: "mittel",
low: "niedrig",
meter: "m",
cm: "cm",
currency: "TRY",
selected: "gewählt",
noMatch: "Keine passende Pflanze.",
type_single: "Einzelpflanzung",
type_mass: "Quadratraster",
type_row: "Reihenpflanzung",
type_triangular: "Dreiecksraster",
type_hedge: "Hecke/Sichtschutz",
type_agriculture: "Gemüse/Anbau",
desc_single: "Solitärbaum, Strauch oder Akzent.",
desc_mass: "Regelmäßiges quadratisches Raster.",
desc_row: "In der Reihe und zwischen Reihen.",
desc_triangular: "Dichtere versetzte Pflanzung.",
desc_hedge: "Grenzen, Hecken und Sichtschutz.",
desc_agriculture: "Gemüse, Obst und Beete.",
cat_tree: "Baum",
cat_small_tree: "Kleinbaum",
cat_palm: "Palme",
cat_shrub: "Strauch",
cat_hedge: "Heckenpflanze",
cat_perennial: "Staude",
cat_bulb: "Zwiebel/Knolle",
cat_groundcover: "Bodendecker",
cat_grass: "Ziergras",
cat_vine: "Kletterpflanze",
cat_vegetable: "Gemüse",
cat_fruit: "Obst/Rebe",
cat_fruit_tree: "Obstbaum",
cat_herb: "Kraut",
cat_annual: "Einjährig",
warnSmallArea: "Die Nutzfläche ist zu klein.",
warnWater: "Die Pflanzen haben unterschiedliche Wasseransprüche.",
warnTriVeg: "Dreiecksraster kann bei Gemüse die Luftzirkulation senken.",
warnHedge: "Die Hauptpflanze ist keine typische Heckenpflanze.",
warnManual: "Der eingegebene Abstand liegt deutlich unter der Empfehlung.",
warnTreeMix: "Bei großen Bäumen extra Abstand für Schatten und Wurzeln lassen."
},
fr: {
appTitle: "Calculateur intelligent d'espacement Peyzax",
subtitle: "Espacement, quantité, densité et coût pour paysage et culture.",
language: "Langue",
dataCount: "plantes",
sourceNote: "Données issues des catalogues PDF et de Peyzax.",
plantSelection: "Choix des plantes",
searchPlant: "Rechercher",
searchPlaceholder: "Tomate, lavande, Acer, Begonia...",
category: "Catégorie",
allCategories: "Toutes",
addPlant: "Ajouter",
selectedPlants: "Plantes choisies",
clear: "Effacer",
noSelection: "Aucune plante sélectionnée.",
primaryPlant: "Le calcul utilise la première plante; les distances mixtes sont séparées.",
dimensions: "Surface et coût",
length: "Longueur",
width: "Largeur",
border: "Marge sans plantation",
price: "Prix unitaire",
waste: "Réserve",
hedgeRows: "Rangs de haie",
manualSpacing: "Espacement manuel",
optional: "optionnel",
plantingType: "Type de plantation",
results: "Résultat",
totalPlants: "Total plantes",
withWaste: "Avec réserve",
density: "Densité",
spacing: "Espacement conseillé",
rowSpacing: "Inter-rang",
rows: "Rangs",
columns: "Par rang",
cost: "Coût estimé",
usableArea: "Surface utile",
pairwise: "Distance plante à plante",
recommendations: "Alertes",
noWarnings: "Aucun risque majeur détecté.",
noPairs: "Sélectionnez au moins deux plantes.",
source: "Source",
confidence: "Fiabilité",
high: "haute",
medium: "moyenne",
low: "basse",
meter: "m",
cm: "cm",
currency: "TRY",
selected: "sélectionnée",
noMatch: "Aucune correspondance.",
type_single: "Plantation isolée",
type_mass: "Massif/carré",
type_row: "En rangs",
type_triangular: "Triangle",
type_hedge: "Haie/écran",
type_agriculture: "Culture/légume",
desc_single: "Arbre, arbuste ou accent isolé.",
desc_mass: "Grille carrée régulière.",
desc_row: "Espacement sur rang et inter-rang.",
desc_triangular: "Plantation décalée plus dense.",
desc_hedge: "Haies, limites et écrans.",
desc_agriculture: "Légumes, vergers et production.",
cat_tree: "Arbre",
cat_small_tree: "Petit arbre",
cat_palm: "Palmier",
cat_shrub: "Arbuste",
cat_hedge: "Plante de haie",
cat_perennial: "Vivace",
cat_bulb: "Bulbe/tubercule",
cat_groundcover: "Couvre-sol",
cat_grass: "Graminée",
cat_vine: "Grimpante",
cat_vegetable: "Légume",
cat_fruit: "Fruit/vigne",
cat_fruit_tree: "Arbre fruitier",
cat_herb: "Aromatique",
cat_annual: "Annuelle",
warnSmallArea: "La surface utile est trop petite.",
warnWater: "Les besoins en eau sont différents.",
warnTriVeg: "Le triangle peut réduire l'aération des légumes.",
warnHedge: "La plante principale n'est pas typique pour une haie.",
warnManual: "L'espacement manuel est très inférieur à la recommandation.",
warnTreeMix: "Prévoir plus d'espace avec les grands arbres."
},
ar: {
appTitle: "حاسبة مسافات النباتات الذكية Peyzax",
subtitle: "حساب المسافة والعدد والكثافة والتكلفة للزراعة والتنسيق.",
language: "اللغة",
dataCount: "نبات",
sourceNote: "أعدت من كتالوجات PDF وبيانات Peyzax.",
plantSelection: "اختيار النباتات",
searchPlant: "ابحث عن نبات",
searchPlaceholder: "طماطم، خزامى، Acer، Begonia...",
category: "الفئة",
allCategories: "كل الفئات",
addPlant: "إضافة",
selectedPlants: "النباتات المختارة",
clear: "مسح",
noSelection: "لم يتم اختيار نبات بعد.",
primaryPlant: "الحساب يستخدم أول نبات؛ والمسافات المختلطة تحسب منفصلة.",
dimensions: "المساحة والتكلفة",
length: "الطول",
width: "العرض",
border: "هامش بدون زراعة",
price: "سعر الوحدة",
waste: "احتياط",
hedgeRows: "صفوف السياج",
manualSpacing: "مسافة يدوية",
optional: "اختياري",
plantingType: "نوع الزراعة",
results: "النتيجة",
totalPlants: "إجمالي النباتات",
withWaste: "مع الاحتياط",
density: "الكثافة",
spacing: "المسافة المقترحة",
rowSpacing: "المسافة بين الصفوف",
rows: "صفوف",
columns: "في الصف",
cost: "التكلفة التقديرية",
usableArea: "المساحة الصالحة",
pairwise: "المسافة بين النباتات",
recommendations: "تنبيهات",
noWarnings: "لا توجد مخاطر واضحة.",
noPairs: "اختر نباتين على الأقل.",
source: "المصدر",
confidence: "الثقة",
high: "عالية",
medium: "متوسطة",
low: "منخفضة",
meter: "م",
cm: "سم",
currency: "ليرة",
selected: "مختار",
noMatch: "لا توجد نتيجة.",
type_single: "زراعة فردية",
type_mass: "كتلة/مربع",
type_row: "زراعة صفوف",
type_triangular: "مثلثية",
type_hedge: "سياج/حاجز",
type_agriculture: "خضار/زراعة",
desc_single: "شجرة أو شجيرة منفردة.",
desc_mass: "شبكة مربعة منتظمة.",
desc_row: "مسافة داخل الصف وبين الصفوف.",
desc_triangular: "زراعة متبادلة أكثر كثافة.",
desc_hedge: "حدود وسياج وحواجز.",
desc_agriculture: "خضار وبساتين وأحواض إنتاج.",
cat_tree: "شجرة",
cat_small_tree: "شجرة صغيرة",
cat_palm: "نخيل",
cat_shrub: "شجيرة",
cat_hedge: "نبات سياج",
cat_perennial: "معمر",
cat_bulb: "بصلي/درني",
cat_groundcover: "مغطيات تربة",
cat_grass: "عشب زينة",
cat_vine: "متسلق",
cat_vegetable: "خضار",
cat_fruit: "فاكهة/كرمة",
cat_fruit_tree: "شجرة فاكهة",
cat_herb: "عطري",
cat_annual: "موسمي",
warnSmallArea: "المساحة الصالحة صغيرة جدا.",
warnWater: "احتياجات الماء مختلفة.",
warnTriVeg: "النمط المثلث قد يقلل التهوية للخضار.",
warnHedge: "النبات الرئيسي ليس نبات سياج تقليدي.",
warnManual: "المسافة اليدوية أقل بكثير من المقترح.",
warnTreeMix: "اترك مسافة إضافية مع الأشجار الكبيرة."
},
pt: {
appTitle: "Calculadora inteligente de espaçamento Peyzax",
subtitle: "Calcule distância, quantidade, densidade e custo.",
language: "Idioma",
dataCount: "plantas",
sourceNote: "Dados de catálogos PDF e curadoria Peyzax.",
plantSelection: "Seleção de plantas",
searchPlant: "Buscar planta",
searchPlaceholder: "Tomate, lavanda, Acer, Begonia...",
category: "Categoria",
allCategories: "Todas",
addPlant: "Adicionar",
selectedPlants: "Plantas selecionadas",
clear: "Limpar",
noSelection: "Nenhuma planta selecionada.",
primaryPlant: "A contagem usa a primeira planta; distâncias mistas separadas.",
dimensions: "Área e custo",
length: "Comprimento",
width: "Largura",
border: "Margem sem plantio",
price: "Preço unitário",
waste: "Reserva",
hedgeRows: "Linhas de sebe",
manualSpacing: "Espaçamento manual",
optional: "opcional",
plantingType: "Tipo de plantio",
results: "Resultado",
totalPlants: "Total de plantas",
withWaste: "Com reserva",
density: "Densidade",
spacing: "Espaçamento recomendado",
rowSpacing: "Entre linhas",
rows: "Linhas",
columns: "Por linha",
cost: "Custo estimado",
usableArea: "Área útil",
pairwise: "Distância entre plantas",
recommendations: "Alertas",
noWarnings: "Nenhum risco importante detectado.",
noPairs: "Selecione pelo menos duas plantas.",
source: "Fonte",
confidence: "Confiança",
high: "alta",
medium: "média",
low: "baixa",
meter: "m",
cm: "cm",
currency: "TRY",
selected: "selecionada",
noMatch: "Sem resultados.",
type_single: "Plantio isolado",
type_mass: "Massa/quadrado",
type_row: "Em linhas",
type_triangular: "Triangular",
type_hedge: "Sebe/tela",
type_agriculture: "Horta/cultura",
desc_single: "Árvore, arbusto ou destaque.",
desc_mass: "Grade quadrada regular.",
desc_row: "Na linha e entre linhas.",
desc_triangular: "Plantio alternado mais denso.",
desc_hedge: "Sebes, limites e telas.",
desc_agriculture: "Hortaliças, pomares e produção.",
cat_tree: "Árvore",
cat_small_tree: "Árvore pequena",
cat_palm: "Palmeira",
cat_shrub: "Arbusto",
cat_hedge: "Sebe",
cat_perennial: "Perene",
cat_bulb: "Bulbo/tubérculo",
cat_groundcover: "Forração",
cat_grass: "Grama ornamental",
cat_vine: "Trepadeira",
cat_vegetable: "Hortaliça",
cat_fruit: "Fruta/videira",
cat_fruit_tree: "Frutífera",
cat_herb: "Erva",
cat_annual: "Anual",
warnSmallArea: "A área útil é muito pequena.",
warnWater: "As plantas têm necessidades de água diferentes.",
warnTriVeg: "O triângulo pode reduzir a ventilação em hortaliças.",
warnHedge: "A planta principal não é típica para sebe.",
warnManual: "O espaçamento manual está muito abaixo do recomendado.",
warnTreeMix: "Deixe mais espaço com árvores grandes."
},
bg: {
appTitle: "Peyzax интелигентен калкулатор за разстояния",
subtitle: "Разстояние, брой, гъстота и цена за озеленяване и земеделие.",
language: "Език",
dataCount: "растения",
sourceNote: "Данни от PDF каталози и Peyzax.",
plantSelection: "Избор на растения",
searchPlant: "Търсене",
searchPlaceholder: "Домат, лавандула, Acer, Begonia...",
category: "Категория",
allCategories: "Всички",
addPlant: "Добави",
selectedPlants: "Избрани растения",
clear: "Изчисти",
noSelection: "Няма избрано растение.",
primaryPlant: "Броят се смята по първото растение; смесените разстояния отделно.",
dimensions: "Площ и цена",
length: "Дължина",
width: "Ширина",
border: "Край без засаждане",
price: "Ед. цена",
waste: "Резерв",
hedgeRows: "Редове жив плет",
manualSpacing: "Ръчно разстояние",
optional: "по избор",
plantingType: "Тип засаждане",
results: "Резултат",
totalPlants: "Общо растения",
withWaste: "С резерв",
density: "Гъстота",
spacing: "Препоръчано разстояние",
rowSpacing: "Междуредие",
rows: "Редове",
columns: "В ред",
cost: "Прогнозна цена",
usableArea: "Полезна площ",
pairwise: "Разстояние между растения",
recommendations: "Предупреждения",
noWarnings: "Няма очевиден риск.",
noPairs: "Изберете поне две растения.",
source: "Източник",
confidence: "Надеждност",
high: "висока",
medium: "средна",
low: "ниска",
meter: "м",
cm: "см",
currency: "TRY",
selected: "избрано",
noMatch: "Няма съвпадения.",
type_single: "Единично",
type_mass: "Масив/квадрат",
type_row: "Редово",
type_triangular: "Триъгълно",
type_hedge: "Жив плет",
type_agriculture: "Зеленчуци",
desc_single: "Солитер, храст или акцент.",
desc_mass: "Редовна квадратна схема.",
desc_row: "В ред и между редове.",
desc_triangular: "По-гъсто шахматно засаждане.",
desc_hedge: "Плетове, граници и екрани.",
desc_agriculture: "Зеленчуци и овощни насаждения.",
cat_tree: "Дърво",
cat_small_tree: "Малко дърво",
cat_palm: "Палма",
cat_shrub: "Храст",
cat_hedge: "Жив плет",
cat_perennial: "Многогодишно",
cat_bulb: "Луковично",
cat_groundcover: "Почвопокривно",
cat_grass: "Декоративна трева",
cat_vine: "Катерливо",
cat_vegetable: "Зеленчук",
cat_fruit: "Плод/лоза",
cat_fruit_tree: "Овощно дърво",
cat_herb: "Билка",
cat_annual: "Едногодишно",
warnSmallArea: "Полезната площ е твърде малка.",
warnWater: "Растенията имат различни нужди от вода.",
warnTriVeg: "Триъгълната схема може да намали проветрението.",
warnHedge: "Основното растение не е типично за жив плет.",
warnManual: "Ръчното разстояние е много под препоръката.",
warnTreeMix: "Оставете повече място при големи дървета."
},
es: {
appTitle: "Calculadora inteligente de distancia Peyzax",
subtitle: "Distancia, cantidad, densidad y coste para paisajismo y agricultura.",
language: "Idioma",
dataCount: "plantas",
sourceNote: "Datos de catálogos PDF y curaduría Peyzax.",
plantSelection: "Selección de plantas",
searchPlant: "Buscar planta",
searchPlaceholder: "Tomate, lavanda, Acer, Begonia...",
category: "Categoría",
allCategories: "Todas",
addPlant: "Añadir",
selectedPlants: "Plantas seleccionadas",
clear: "Limpiar",
noSelection: "Aún no hay planta seleccionada.",
primaryPlant: "El conteo usa la primera planta; distancias mixtas aparte.",
dimensions: "Área y coste",
length: "Largo",
width: "Ancho",
border: "Margen sin plantación",
price: "Precio unitario",
waste: "Reserva",
hedgeRows: "Filas de seto",
manualSpacing: "Distancia manual",
optional: "opcional",
plantingType: "Tipo de plantación",
results: "Resultado",
totalPlants: "Total de plantas",
withWaste: "Con reserva",
density: "Densidad",
spacing: "Distancia recomendada",
rowSpacing: "Entre filas",
rows: "Filas",
columns: "Por fila",
cost: "Coste estimado",
usableArea: "Área útil",
pairwise: "Distancia entre plantas",
recommendations: "Alertas",
noWarnings: "No se detectan riesgos claros.",
noPairs: "Seleccione al menos dos plantas.",
source: "Fuente",
confidence: "Confianza",
high: "alta",
medium: "media",
low: "baja",
meter: "m",
cm: "cm",
currency: "TRY",
selected: "seleccionada",
noMatch: "Sin coincidencias.",
type_single: "Plantación aislada",
type_mass: "Masa/cuadrícula",
type_row: "En filas",
type_triangular: "Triangular",
type_hedge: "Seto/pantalla",
type_agriculture: "Cultivo/hortaliza",
desc_single: "Árbol, arbusto o acento aislado.",
desc_mass: "Cuadrícula regular.",
desc_row: "Distancia en fila y entre filas.",
desc_triangular: "Plantación alterna más densa.",
desc_hedge: "Setos, límites y pantallas.",
desc_agriculture: "Hortalizas, frutales y producción.",
cat_tree: "Árbol",
cat_small_tree: "Arbolito",
cat_palm: "Palmera",
cat_shrub: "Arbusto",
cat_hedge: "Seto",
cat_perennial: "Perenne",
cat_bulb: "Bulbo/tubérculo",
cat_groundcover: "Cubresuelo",
cat_grass: "Gramínea ornamental",
cat_vine: "Trepadora",
cat_vegetable: "Hortaliza",
cat_fruit: "Fruta/vid",
cat_fruit_tree: "Frutal",
cat_herb: "Aromática",
cat_annual: "Anual",
warnSmallArea: "El área útil es demasiado pequeña.",
warnWater: "Las plantas tienen necesidades de agua diferentes.",
warnTriVeg: "La cuadrícula triangular puede reducir ventilación en hortalizas.",
warnHedge: "La planta principal no es típica para setos.",
warnManual: "La distancia manual está muy por debajo de la recomendación.",
warnTreeMix: "Deje más espacio con árboles grandes."
}};
(function (){
"use strict";
const DATA=window.PEYZAX_PLANT_DATA||{ plants: [], count: 0, genusNames: {}};
const I18N=window.PEYZAX_I18N||{ tr: {}};
const SETTINGS=window.PEYZAX_PLANT_SETTINGS||{};
const ROOT=document.querySelector("[data-peyzax-bmh]")||document;
const TYPES=["single", "mass", "row", "triangular", "hedge", "agriculture"];
const CATEGORY_ORDER=[
"tree", "small_tree", "palm", "shrub", "hedge", "perennial", "bulb",
"groundcover", "grass", "vine", "vegetable", "fruit", "fruit_tree", "herb", "annual"
];
const LOCALES={
tr: "tr-TR",
en: "en-US",
ru: "ru-RU",
de: "de-DE",
fr: "fr-FR",
ar: "ar-SA",
pt: "pt-PT",
bg: "bg-BG",
es: "es-ES"
};
const state={
lang: localStorage.getItem("peyzaxPlantLang")||SETTINGS.defaultLanguage||"tr",
type: "mass",
selected: [SETTINGS.defaultPlant||"lavandula-angustifolia"],
searchOpen: false
};
const plants=(DATA.plants||[]).slice().sort((a, b)=> a.latin.localeCompare(b.latin));
const byId=new Map(plants.map((plant)=> [plant.id, plant]));
const $=(selector)=> ROOT.querySelector(selector);
const $$=(selector)=> Array.from(ROOT.querySelectorAll(selector));
function t(key){
return (I18N[state.lang]&&I18N[state.lang][key])||I18N.tr[key]||key;
}
function number(value, maxDigits=0){
return new Intl.NumberFormat(LOCALES[state.lang]||state.lang, {
maximumFractionDigits: maxDigits
}).format(value);
}
function money(value){
return new Intl.NumberFormat(LOCALES[state.lang]||state.lang, {
maximumFractionDigits: 0
}).format(value);
}
function normalize(value){
return String(value||"")
.normalize("NFD")
.replace(/[\u0300-\u036f]/g, "")
.replace(/ı/g, "i")
.toLowerCase();
}
function genusOf(plant){
if(plant.latin.toLowerCase().startsWith("saw palmetto")) return "Saw";
return plant.latin.replace(/["']/g, "").split(/\s+/)[0];
}
function cultivarOf(plant){
const genus=genusOf(plant);
if(!plant.latin.startsWith(genus)) return "";
return plant.latin.slice(genus.length).trim();
}
function nameFor(plant, lang=state.lang){
const genus=genusOf(plant);
const genusNames=DATA.genusNames[genus]||{};
let base=(plant.names&&plant.names[lang])||genusNames[lang]||plant.tr||plant.latin;
if(plant.source==="perennial.pdf"){
const cultivar=cultivarOf(plant);
const generic=genusNames[lang]||genus;
if(cultivar&&normalize(base)===normalize(generic)){
base=`${base} ${cultivar}`;
}}
if(lang!=="tr"&&plant.source==="bitki-envanteri.pdf"&&plant.tr&&!normalize(base).includes(normalize(plant.tr))){
base=`${base} (${plant.tr})`;
}
return base;
}
function labelFor(plant){
const local=nameFor(plant);
if(normalize(local)===normalize(plant.latin)) return plant.latin;
return `${local} - ${plant.latin}`;
}
function categoryLabel(category){
return t(`cat_${category}`);
}
function primaryLabel(){
return {
tr: "Ana bitki",
en: "Primary",
ru: "Основное",
de: "Hauptpflanze",
fr: "Principale",
ar: "النبات الرئيسي",
pt: "Principal",
bg: "Основно",
es: "Principal"
}[state.lang]||"Primary";
}
function formatCm(cm, digits=0){
if(!Number.isFinite(cm)) return "-";
if(cm >=100){
return `${number(cm / 100, cm >=1000 ? 1:2)} ${t("meter")}`;
}
return `${number(cm, digits)} ${t("cm")}`;
}
function spacingRange(cm){
const min=roundTo(cm * 0.9, 5);
const max=roundTo(cm * 1.15, 5);
return `${formatCm(min)} - ${formatCm(max)}`;
}
function avgSpread(plant){
return ((plant.spread&&plant.spread[0])||50) / 2 + ((plant.spread&&plant.spread[1])||70) / 2;
}
function roundTo(value, step){
return Math.max(step, Math.round(value / step) * step);
}
function numInput(id, fallback=0){
const value=Number($(id).value);
return Number.isFinite(value) ? value:fallback;
}
function recommendedSpacing(plant, type){
if(!plant) return 0;
switch (type){
case "single":
return plant.singleSpacing||plant.massSpacing||50;
case "row":
return plant.rowIn||plant.massSpacing||50;
case "triangular":
return plant.massSpacing||plant.rowIn||50;
case "hedge":
return plant.hedgeSpacing||plant.rowIn||plant.massSpacing||50;
case "agriculture":
return plant.rowIn||plant.massSpacing||50;
case "mass":
default:
return plant.massSpacing||plant.rowIn||50;
}}
function rowSpacingFor(plant, type, spacing){
if(type==="triangular") return spacing * Math.sqrt(3) / 2;
if(type==="hedge") return plant.rowBetween||Math.max(spacing * 0.75, 40);
if(type==="row"||type==="agriculture") return plant.rowBetween||Math.max(spacing * 1.25, spacing + 20);
return spacing;
}
function manualSpacing(plant, type){
const manual=numInput("#manualSpacing", 0);
const natural=recommendedSpacing(plant, type);
if(manual > 0) return { spacing: manual, natural, manual: true };
return { spacing: natural, natural, manual: false };}
function calculateLayout(plant){
const lengthM=Math.max(0, numInput("#length", 10));
const widthM=Math.max(0, numInput("#width", 5));
const usableLength=Math.max(0, lengthM * 100);
const usableWidth=Math.max(0, widthM * 100);
const usableArea=(usableLength / 100) * (usableWidth / 100);
const spacingInfo=manualSpacing(plant, state.type);
const spacing=spacingInfo.spacing;
const rowSpacing=rowSpacingFor(plant, state.type, spacing);
let rows=0;
let columns=0;
let total=0;
if(!plant||usableLength <=0||(usableWidth <=0&&state.type!=="hedge")){
return { rows, columns, total, spacing, rowSpacing, usableArea, spacingInfo };}
if(state.type==="hedge"){
const hedgeRows=Math.max(1, Math.round(numInput("#hedgeRows", 1)));
columns=Math.ceil(usableLength / spacing) + 1;
rows=hedgeRows;
total=columns * rows;
}else if(state.type==="row"||state.type==="agriculture"){
rows=Math.floor(usableWidth / rowSpacing) + 1;
columns=Math.floor(usableLength / spacing) + 1;
total=rows * columns;
}else if(state.type==="triangular"){
rows=Math.floor(usableWidth / rowSpacing) + 1;
for (let row=0; row < rows; row +=1){
const offset=row % 2===0 ? 0:spacing / 2;
const count=usableLength >=offset ? Math.floor((usableLength - offset) / spacing) + 1:0;
total +=Math.max(0, count);
}
columns=rows ? Math.ceil(total / rows):0;
}else{
rows=Math.floor(usableWidth / spacing) + 1;
columns=Math.floor(usableLength / spacing) + 1;
total=rows * columns;
}
return { rows, columns, total, spacing, rowSpacing, usableArea, spacingInfo };}
function pairDistance(a, b){
const radiusSum=avgSpread(a) / 2 + avgSpread(b) / 2;
const rootBoost={ low: 0, medium: 25, high: 75 };
const airBoost={ low: 0, medium: 10, high: 25 };
const treeCats=new Set(["tree", "fruit_tree", "palm"]);
const softCats=new Set(["perennial", "bulb", "groundcover", "grass", "annual", "herb"]);
let base=Math.max(radiusSum + 20,
a.massSpacing||0,
b.massSpacing||0,
rootBoost[a.root]||0,
rootBoost[b.root]||0
);
if(a.category==="vegetable"&&b.category==="vegetable"){
base=Math.max(base, a.rowBetween||40, b.rowBetween||40, radiusSum + 20);
}
if(treeCats.has(a.category)&&treeCats.has(b.category)){
base=Math.max(base, a.singleSpacing||300, b.singleSpacing||300, radiusSum + 120);
}
if((treeCats.has(a.category)&&softCats.has(b.category))||(treeCats.has(b.category)&&softCats.has(a.category))){
base=Math.max(base, radiusSum + 120);
}
if(softCats.has(a.category)&&softCats.has(b.category)){
base=Math.max(a.massSpacing||30, b.massSpacing||30, radiusSum * 0.75);
}
if(a.water!==b.water&&(a.water==="high"||b.water==="high")&&(a.water==="low"||b.water==="low")){
base +=15;
}
base +=Math.max(airBoost[a.air]||0, airBoost[b.air]||0);
return {
min: roundTo(base * 0.9, 5),
max: roundTo(base * 1.15, 5),
center: roundTo(base, 5)
};}
function buildWarnings(selected, layout){
const warnings=[];
if(layout.usableArea <=0||layout.total <=0) warnings.push(t("warnSmallArea"));
const waterNeeds=new Set(selected.map((plant)=> plant.water));
if(waterNeeds.has("high")&&waterNeeds.has("low")) warnings.push(t("warnWater"));
if(state.type==="triangular"&&selected.some((plant)=> plant.category==="vegetable"||plant.air==="high")){
warnings.push(t("warnTriVeg"));
}
const primary=selected[0];
if(state.type==="hedge"&&primary&&!["hedge", "shrub", "small_tree"].includes(primary.category)){
warnings.push(t("warnHedge"));
}
if(layout.spacingInfo&&layout.spacingInfo.manual&&layout.spacingInfo.spacing < layout.spacingInfo.natural * 0.7){
warnings.push(t("warnManual"));
}
const hasTree=selected.some((plant)=> ["tree", "fruit_tree", "palm"].includes(plant.category));
const hasSoft=selected.some((plant)=> ["perennial", "bulb", "groundcover", "annual", "herb"].includes(plant.category));
if(hasTree&&hasSoft) warnings.push(t("warnTreeMix"));
return Array.from(new Set(warnings));
}
function filteredPlants(limit=12){
const query=normalize($("#plantSearch").value);
const category=$("#categoryFilter").value;
const selected=new Set(state.selected);
const result=[];
for (const plant of plants){
if(selected.has(plant.id)) continue;
if(category!=="all"&&plant.category!==category) continue;
const haystack=normalize([
plant.latin,
plant.tr,
nameFor(plant, state.lang),
Object.values(plant.names||{}).join(" ")
].join(" "));
if(query&&!haystack.includes(query)) continue;
result.push(plant);
if(result.length >=limit) break;
}
return result;
}
function renderStaticText(){
ROOT.setAttribute("lang", state.lang);
ROOT.setAttribute("dir", state.lang==="ar" ? "rtl":"ltr");
$$("[data-i18n]").forEach((node)=> {
node.textContent=t(node.dataset.i18n);
});
$$("[data-i18n-placeholder]").forEach((node)=> {
node.setAttribute("placeholder", t(node.dataset.i18nPlaceholder));
});
if($("#dataCount")){
$("#dataCount").textContent=`${number(plants.length||DATA.count)} ${t("dataCount")}`;
}
renderCategories();
renderTypeCards();
}
function renderLanguageSelect(){
const select=$("#language");
if(!select) return;
select.value=state.lang;
}
function renderCategories(){
const select=$("#categoryFilter");
const current=select.value||"all";
select.innerHTML=`<option value="all">${t("allCategories")}</option>` + CATEGORY_ORDER
.filter((category)=> plants.some((plant)=> plant.category===category))
.map((category)=> `<option value="${escapeAttr(category)}">${escapeHtml(categoryLabel(category))}</option>`)
.join("");
select.value=CATEGORY_ORDER.includes(current) ? current:"all";
}
function renderTypeCards(){
$$(".type-card").forEach((card)=> {
const type=card.dataset.type;
card.classList.toggle("is-active", state.type===type);
card.setAttribute("aria-pressed", state.type===type ? "true":"false");
const title=card.querySelector(".type-title");
const desc=card.querySelector(".type-desc");
title.textContent=t(`type_${type}`);
desc.textContent=t(`desc_${type}`);
});
$("#hedgeRowsField").hidden=state.type!=="hedge";
}
function renderSearchResults(){
const box=$("#searchResults");
if(!state.searchOpen){
box.innerHTML="";
return;
}
const matches=filteredPlants();
if(!matches.length){
box.innerHTML=`<div class="search-empty">${t("noMatch")}</div>`;
return;
}
box.innerHTML=matches.map((plant)=> `
<button class="search-item" type="button" data-id="${escapeAttr(plant.id)}">
<span>
<strong>${escapeHtml(labelFor(plant))}</strong>
<small>${escapeHtml(categoryLabel(plant.category))} · ${escapeHtml(plant.source)}</small>
</span>
</button>
`).join("");
}
function renderSelected(){
const wrap=$("#selectedPlants");
const selected=state.selected.map((id)=> byId.get(id)).filter(Boolean);
if(!selected.length){
wrap.innerHTML=`<p class="muted">${t("noSelection")}</p>`;
return;
}
wrap.innerHTML=selected.map((plant, index)=> `
<span class="plant-chip">
<span>
<strong>${escapeHtml(nameFor(plant))}</strong>
<small>${index===0 ? escapeHtml(primaryLabel()):escapeHtml(plant.latin)}</small>
</span>
<button type="button" aria-label="Remove ${escapeAttr(nameFor(plant))}" data-remove="${escapeAttr(plant.id)}">×</button>
</span>
`).join("");
}
function renderResults(){
const selected=state.selected.map((id)=> byId.get(id)).filter(Boolean);
const primary=selected[0];
if(!primary){
$("#resultCards").innerHTML=`<p class="muted">${t("noSelection")}</p>`;
$("#pairTable").innerHTML=`<p class="muted">${t("noPairs")}</p>`;
$("#warnings").innerHTML=`<li>${t("noWarnings")}</li>`;
return;
}
const layout=calculateLayout(primary);
const waste=Math.max(0, numInput("#waste", 10));
const price=Math.max(0, numInput("#price", 0));
const totalWithWaste=Math.ceil(layout.total * (1 + waste / 100));
const cost=totalWithWaste * price;
const density=layout.usableArea > 0&&state.type!=="hedge" ? layout.total / layout.usableArea:0;
$("#resultCards").innerHTML=`
<article class="metric">
<span>${t("totalPlants")}</span>
<strong>${number(layout.total)}</strong>
</article>
<article class="metric accent">
<span>${t("withWaste")}</span>
<strong>${number(totalWithWaste)}</strong>
</article>
<article class="metric">
<span>${t("spacing")}</span>
<strong>${spacingRange(layout.spacing)}</strong>
</article>
<article class="metric">
<span>${t("rowSpacing")}</span>
<strong>${formatCm(layout.rowSpacing)}</strong>
</article>
<article class="metric">
<span>${t("density")}</span>
<strong>${state.type==="hedge" ? "-":`${number(density, 2)} /m²`}</strong>
</article>
<article class="metric">
<span>${t("rows")} / ${t("columns")}</span>
<strong>${number(layout.rows)} / ${number(layout.columns)}</strong>
</article>
<article class="metric">
<span>${t("usableArea")}</span>
<strong>${number(layout.usableArea, 2)} m²</strong>
</article>
<article class="metric accent">
<span>${t("cost")}</span>
<strong>${money(cost)} ${escapeHtml(SETTINGS.currency||t("currency"))}</strong>
</article>
`;
renderPairTable(selected);
const warnings=buildWarnings(selected, layout);
$("#warnings").innerHTML=warnings.length
? warnings.map((warning)=> `<li>${escapeHtml(warning)}</li>`).join("")
: `<li>${t("noWarnings")}</li>`;
}
function renderPairTable(selected){
const wrap=$("#pairTable");
if(selected.length < 2){
wrap.innerHTML=`<p class="muted">${t("noPairs")}</p>`;
return;
}
const rows=[];
for (let i=0; i < selected.length; i +=1){
for (let j=i + 1; j < selected.length; j +=1){
const a=selected[i];
const b=selected[j];
const distance=pairDistance(a, b);
rows.push(`
<tr>
<td>${escapeHtml(nameFor(a))}</td>
<td>${escapeHtml(nameFor(b))}</td>
<td><strong>${formatCm(distance.min)} - ${formatCm(distance.max)}</strong></td>
</tr>
`);
}}
wrap.innerHTML=`
<div class="table-wrap">
<table>
<thead>
<tr>
<th>${t("plantSelection")}</th>
<th>${t("plantSelection")}</th>
<th>${t("spacing")}</th>
</tr>
</thead>
<tbody>${rows.join("")}</tbody>
</table>
</div>
`;
}
function escapeHtml(value){
return String(value)
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;");
}
function escapeAttr(value){
return escapeHtml(value).replace(/'/g, "&#039;");
}
function addPlant(id){
if(!id||!byId.has(id)||state.selected.includes(id)) return;
state.selected.push(id);
$("#plantSearch").value="";
state.searchOpen=false;
renderAll();
}
function addFirstMatch(){
const first=filteredPlants(1)[0];
if(first) addPlant(first.id);
}
function bindEvents(){
if($("#language")){
$("#language").addEventListener("change", (event)=> {
state.lang=event.target.value;
localStorage.setItem("peyzaxPlantLang", state.lang);
renderAll();
});
}
$("#plantSearch").addEventListener("input", ()=> {
state.searchOpen=true;
renderSearchResults();
});
$("#plantSearch").addEventListener("focus", ()=> {
state.searchOpen=true;
renderSearchResults();
});
$("#plantSearch").addEventListener("keydown", (event)=> {
if(event.key==="Enter"){
event.preventDefault();
addFirstMatch();
}
if(event.key==="Escape"){
state.searchOpen=false;
renderSearchResults();
}});
$("#searchResults").addEventListener("click", (event)=> {
const button=event.target.closest("[data-id]");
if(button) addPlant(button.dataset.id);
});
$("#addPlant").addEventListener("click", addFirstMatch);
$("#categoryFilter").addEventListener("change", ()=> {
state.searchOpen=true;
renderSearchResults();
});
$("#selectedPlants").addEventListener("click", (event)=> {
const button=event.target.closest("[data-remove]");
if(!button) return;
state.selected=state.selected.filter((id)=> id!==button.dataset.remove);
renderAll();
});
$("#clearPlants").addEventListener("click", ()=> {
state.selected=[];
renderAll();
});
$$(".type-card").forEach((card)=> {
card.addEventListener("click", ()=> {
state.type=card.dataset.type;
renderAll();
});
});
["#length", "#width", "#price", "#waste", "#hedgeRows", "#manualSpacing"].forEach((selector)=> {
const input=$(selector);
if(input) input.addEventListener("input", renderResults);
});
document.addEventListener("click", (event)=> {
if(!event.target.closest(".search-box")){
state.searchOpen=false;
renderSearchResults();
}});
}
function renderAll(){
renderLanguageSelect();
renderStaticText();
renderSearchResults();
renderSelected();
renderResults();
}
function init(){
if(!plants.length){
state.selected=[];
bindEvents();
renderAll();
return;
}
if(!byId.has(state.selected[0])){
state.selected=[plants[0].id];
}
bindEvents();
renderAll();
}
init();
})();
window.jQuery&&($=>{function Class(){}var c_init=!1;(Base={base:!(Class.extend=function(members){var val,name,_super=this.prototype,proto=(c_init=!0,new this);for(name in c_init=!1,proto)$.isPlainObject(proto[name])&&(val=$.extend({},proto[name]),proto[name]=val);for(name in members)"function"==typeof members[name]&&"function"==typeof _super[name]?proto[name]=((nm,fn)=>function(){var tmp=this._super,ret=(this._super=_super[nm],fn.apply(this,arguments));return this._super=tmp,ret})(name,members[name]):proto[name]=$.isPlainObject(members[name])?$.extend({},members[name]):members[name];function Class(){c_init||("function"==typeof this._init&&this._init.apply(this,arguments),"function"==typeof this._c&&this._c.apply(this,arguments))}return((Class.prototype=proto).constructor=Class).extend=this.extend,Class}),_parent:null,prefix:"slb",_init:function(){this._set_parent()},_set_parent:function(p){this.util.is_set(p)&&(this._parent=p),this.util._parent=this},attach:function(member,data,simple){var ret=data;return simple=void 0!==simple&&!!simple,"string"===$.type(member)&&($.isPlainObject(data)&&!simple&&(data._parent=this,data=this.Class.extend(data)),this[member]="function"===$.type(data)?new data:data,ret=this[member]),ret},has_child:function(child){if(!this.util.is_string(child))return!1;for(var children=child.split("."),o=(child=null,this),x=0;x<children.length;x++)if(""!==(child=children[x])){if(!this.util.is_obj(o)||!o[child])return!1;o=o[child]}return!0},is_base:function(){return!!this.base},get_parent:function(){return this._parent||(this._parent={}),this._parent}}).attach("util",{_base:null,_parent:null,get_base:function(){if(!this._base){for(var p=this.get_parent(),p_prev=null,methods=["is_base","get_parent"];p_prev!==p&&this.is_method(p,methods)&&!p.is_base();)p=(p_prev=p).get_parent();this._base=p}return this._base},get_parent:function(prop){var ret=(ret=this._parent)||(this._parent={});return ret=this.is_string(prop)?this.in_obj(ret,prop)?ret[prop]:null:ret},get_sep:function(sep){return this.is_string(sep,!1)?sep:"_"},get_prefix:function(){var p=this.get_parent("prefix");return this.is_string(p,!1)?p:""},has_prefix:function(val,sep){return this.is_string(val)&&0===val.indexOf(this.get_prefix()+this.get_sep(sep))},add_prefix:function(val,sep,once){return this.is_string(val)?(sep=this.get_sep(sep),(once=this.is_bool(once)?once:!0)&&this.has_prefix(val,sep)?val:[this.get_prefix(),val].join(sep)):this.get_prefix()},remove_prefix:function(val,sep,once){if(!this.is_string(val,!0))return"";if(sep=this.get_sep(sep),this.is_bool(once)||(once=!0),this.has_prefix(val,sep))for(var prfx=this.get_prefix()+sep;val=val.substr(prfx.length),!once&&this.has_prefix(val,sep););return val},get_attribute:function(attr_base){var attr=["data",this.get_prefix()].join("-");return attr=this.is_string(attr_base)&&0!==attr_base.indexOf(attr+"-")?[attr,attr_base].join("-"):attr},get_context:function(){var b=this.get_base();return $.isArray(b.context)||(b.context=[]),b.context},is_context:function(ctx){return this.is_string(ctx)&&(ctx=[ctx]),this.is_array(ctx)&&0<this.arr_intersect(this.get_context(),ctx).length},is_set:function(val){return void 0!==val},is_type:function(val,type,nonempty){var ret=!1;if(this.is_set(val)&&null!==val&&this.is_set(type))switch($.type(type)){case"function":ret=val instanceof type;break;case"string":ret=$.type(val)===type;break;default:ret=!1}return ret=!ret||this.is_set(nonempty)&&!nonempty?ret:!this.is_empty(val)},is_string:function(value,nonempty){return this.is_type(value,"string",nonempty)},is_array:function(value,nonempty){return this.is_type(value,"array",nonempty)},is_bool:function(value){return this.is_type(value,"boolean",!1)},is_obj:function(value,nonempty){return this.is_type(value,"object",nonempty)},is_func:function(value){return this.is_type(value,"function",!1)},is_method:function(obj,key){var ret=!1;if(this.is_string(key)&&(key=[key]),this.in_obj(obj,key))for(var ret=!0,x=0;ret&&x<key.length;)ret=this.is_func(obj[key[x]]),x++;return ret},is_instance:function(obj,parent){return!!this.is_func(parent)&&this.is_obj(obj)&&obj instanceof parent},is_class:function(cls,parent){var ret=this.is_func(cls)&&"prototype"in cls;return ret=ret&&this.is_set(parent)?this.is_instance(cls.prototype,parent):ret},is_num:function(value,nonempty){var f={nan:Number.isNaN||isNaN,finite:Number.isFinite||isFinite};return this.is_type(value,"number",nonempty)&&!f.nan(value)&&f.finite(value)},is_int:function(value,nonempty){return this.is_num(value,nonempty)&&Math.floor(value)===value},is_scalar:function(value,nonempty){return this.is_num(value,nonempty)||this.is_string(value,nonempty)||this.is_bool(value)},is_empty:function(value,type){var ret=!1;if(this.is_set(value))for(var empties=[null,"",!1,0],x=0;!ret&&x<empties.length;)ret=empties[x]===value,x++;else ret=!0;if(!ret)if(this.is_set(type)||(type=$.type(value)),this.is_type(value,type,!1))switch(type){case"string":case"array":ret=0===value.length;break;case"number":ret=0==value;break;case"object":if($.isPlainObject(value)){if(Object.getOwnPropertyNames)ret=0===Object.getOwnPropertyNames(value).length;else if(value.hasOwnProperty)for(var key in ret=!0,value)if(value.hasOwnProperty(key)){ret=!1;break}}else ret=!1}else ret=!0;return ret},is_promise:function(obj){return this.is_method(obj,["then","done","always","fail","pipe"])},format:function(fmt,val){if(!this.is_string(fmt))return"";function strip(txt){return-1!==txt.indexOf(ph)?txt.replace(ph,""):txt}var params=[],ph="%s";if(arguments.length<2||-1===fmt.indexOf(ph))return strip(fmt);params=Array.prototype.slice.call(arguments,1);for(var x=0;x<params.length;x++)this.is_scalar(params[x],!1)||(params[x]="");if(1===params.length)fmt=fmt.replace(ph,params[0].toString());else{for(var pos,idx=0,len=params.length,rlen=ph.length;(pos=fmt.indexOf(ph))&&-1!==pos&&idx<len;)fmt=fmt.substr(0,pos)+params[idx].toString()+fmt.substr(pos+rlen),idx++;fmt=strip(fmt)}return fmt},esc_html:function(val){val=this.is_empty(val)&&0!==val?"":String(val);var node=document.createElement("div");return node.appendChild(document.createTextNode(val)),node.innerHTML},in_obj:function(obj,key,all){this.is_bool(all)||(all=!0),this.is_string(key)&&(key=[key]);var ret=!1;if(this.is_obj(obj)&&this.is_array(key))for(var val,x=0;x<key.length&&(val=key[x],ret=!!(this.is_string(val)&&val in obj),!(!all&&ret||all&&!ret));x++);return ret},obj_keys:function(obj){var prop,keys=[];if(this.is_obj(obj))if(Object.keys)keys=Object.keys(obj);else for(prop in obj)obj.hasOwnProperty(prop)&&keys.push(prop);return keys},arr_intersect:function(arr1,arr2){var ret=[],params=Array.prototype.slice.call(arguments),arrs=[];for(x=0;x<params.length;x++)this.is_array(params[x],!1)&&arrs.push(params[x]);if(!(arrs.length<2))for(var add,sub,params=null,base=arrs.shift(),x=0;x<base.length;x++){for(add=!0,sub=0;sub<arrs.length;sub++)if(-1===arrs[sub].indexOf(base[x])){add=!1;break}add&&ret.push(base[x])}return ret},guid:function(){function _p8(s){var p=(Math.random().toString(16)+"000000000").substr(2,8);return s?"-"+p.substr(0,4)+"-"+p.substr(4,4):p}return _p8()+_p8(!0)+_p8(!0)+_p8()},parse_uri:function(uri){return $('<a href="'+uri+'"/>').get(0)},parse_query:function(uri){var i,key,temp,delim_vars="&",delim_val="=",query={raw:[],parsed:{},string:""};if(0===(uri=this.parse_uri(uri)).search.indexOf("?"))for(query.raw=uri.search.substr(1).split(delim_vars),i=0;i<query.raw.length;i++)key=(temp=query.raw[i].split(delim_val)).shift(),temp=0<temp.length?temp.join(delim_val):null,query.parsed[key]=temp;return query.parsed},build_query:function(query){var val,key,q=[],delim_vars="&",delim_val="=";for(key in query)val=null!==query[key]?delim_val+query[key]:"",q.push(key+val);return q.join(delim_vars)}},!0);var Base=(Base=Class.extend(Base)).extend({base:!0,context:[],Class:Base,_init:function(){this._super(),$("html").addClass(this.util.get_prefix())}});window.SLB=new Base})(jQuery);
window.SLB&&SLB.attach&&($=>{var View={assets:{},component_defaults:[],loading:[],cache:{},component_temps:{},options:{},_init:function(){this._super(),this.init_refs(),this.init_components()},init_refs:function(){var r,ref,prop;for(prop in this)if(prop=this[prop],this.is_component(prop)&&!this.util.is_empty(prop.prototype._refs))for(r in prop.prototype._refs)ref=prop.prototype._refs[r],this.util.is_string(ref)&&ref in this&&(ref=prop.prototype._refs[r]=this[ref]),this.util.is_class(ref)||delete prop.prototype_refs[r]},init_components:function(){this.component_defaults=[this.Viewer]},init:function(options){var t=this;$.when.apply($,this.loading).always(function(){$.extend(!0,t.options,options),$(window).on("popstate",function(e){var state=e.originalEvent.state;if(t.util.in_obj(state,["item","viewer"]))return t.get_viewer(state.viewer).history_handle(e),e.preventDefault()}),t.init_items()})},can_make_default_component:function(type){return-1!==$.inArray(type,this.component_defaults)},is_component:function(comp){return this.util.is_class(comp,this.Component)},get_components:function(type){var ret={};return this.is_component(type)&&((type=type.prototype._slug+"s")in this.cache||(this.cache[type]={}),ret=this.cache[type]),ret},get_component:function(type,id){var coll,tid,ret=null;return ret=this.util.is_func(type)&&(this.util.is_string(id)||(id=null),coll=this.get_components(type),this.util.is_obj(coll)&&(tid=this.util.is_string(id)?id:this.util.add_prefix("default"))in coll&&(ret=coll[tid]),this.util.is_empty(ret))&&(this.util.is_string(id)||this.can_make_default_component(type))?this.add_component(type,id):ret},add_component:function(type,id,options){if(!this.util.is_func(type))return!1;if(this.util.is_empty(id)&&!this.can_make_default_component(type))return!1;var ret=null,m=(this.util.is_empty(id)&&(id=this.util.add_prefix("default")),this.util.is_obj(options)||(options={}),"component"!==type.prototype._slug?"add_"+type.prototype._slug:null),ret=!this.util.is_empty(m)&&m in this&&this.util.is_func(this[m])?this[m](id,options):new type(id,options);if(this.util.is_type(ret,type)){var coll=this.get_components(type);switch($.type(coll)){case"object":coll[id]=ret;break;case"array":coll.push(ret)}}else ret=null;return ret},add_component_temp:function(type){var ret=null;return this.is_component(type)&&(ret=new type(""),this.component_temps[ret._slug]=ret),ret},get_component_temp:function(type){return this.has_component_temp(type)?this.component_temps[type.prototype._slug]:this.add_component_temp(type)},has_component_temp:function(type){return!!(this.is_component(type)&&type.prototype._slug in this.component_temps)},get_options:function(opts){var ret={};if(this.util.is_string(opts)&&(opts=[opts]),this.util.is_array(opts))for(var x=0;x<opts.length;x++)opts[x]in this.options&&(ret[opts[x]]=this.options[opts[x]]);return ret},get_option:function(opt,def){var ret=this.get_options(opt);return ret=this.util.is_obj(ret)&&opt in ret?ret[opt]:this.util.is_set(def)?def:null},add_viewer:function(id,options){id=new this.Viewer(id,options);return this.get_viewers()[id.get_id()]=id},get_viewers:function(){return this.get_components(this.Viewer)},has_viewer:function(v){return!!(this.util.is_string(v)&&v in this.get_viewers())},get_viewer:function(v){return this.has_viewer(v)||(v=this.util.add_prefix("default"),this.has_viewer(v))||(v=(v=this.add_viewer(v)).get_id()),this.get_viewers()[v]},init_items:function(){var t=this,sel=this.util.format('a[href][%s="%s"]',this.util.get_attribute("active"),1);$(document).on("click",sel,null,function(){var ret=t.show_item(this);return!(ret=t.util.is_bool(ret)?ret:!0)})},get_items:function(){return this.get_components(this.Content_Item)},get_item:function(ref){var item,key;return this.util.is_type(ref,this.Content_Item)?ref:(item=null,this.util.in_obj(ref,"nodeType")?(key=this.get_component_temp(this.Content_Item).get_data_key(),item=$(ref).data(key)):this.util.is_string(ref,!1)&&ref in(key=this.get_items())&&(item=key[ref]),this.util.is_instance(item,this.Content_Item)?item:this.add_item(ref))},add_item:function(el){return new this.Content_Item(el)},show_item:function(el){return this.get_item(el).show()},save_item:function(item){return this.util.is_instance(item,this.Content_Item)&&(this.get_items()[item.get_id()]=item),item},get_content_handlers:function(){return this.get_components(this.Content_Handler)},get_content_handler:function(item){var item=this.util.is_instance(item,this.Content_Item)?item.get_attribute("type",""):item.toString(),types=this.get_content_handlers();return item in types?types[item]:null},extend_content_handler:function(id,attr){var hdl=null;return this.util.is_string(id)&&this.util.is_obj(attr)&&(null===(hdl=this.get_content_handler(id))?this.get_content_handlers()[id]=hdl=new this.Content_Handler(id,attr):hdl.set_attributes(attr),this.util.in_obj(attr,"styles"))&&this.load_styles(attr.styles),hdl},add_group:function(g,attrs){return g=new this.Group(g,attrs),this.get_groups()[g.get_id()]=g},get_groups:function(){return this.get_components(this.Group)},get_group:function(g){return this.has_group(g)?this.get_groups()[g]:this.add_group(g)},has_group:function(g){return this.util.is_string(g)&&g in this.get_groups()},extend_theme:function(id,attr){var dfr,model;return!!this.util.is_string(id)&&(dfr=$.Deferred(),this.loading.push(dfr),model=this.get_theme_model(id),this.util.is_empty(model)&&(model=this.save_theme_model({parent:null,id:id})),this.util.is_obj(attr)&&("id"in attr&&delete attr.id,$.extend(model,attr)),this.util.in_obj(attr,"styles")&&this.load_styles(attr.styles),this.util.is_obj(model.parent)||(model.parent=this.get_theme_model(model.parent)),dfr.resolve(),model)},get_theme_models:function(){return this.Theme.prototype._models},get_theme_model:function(id){var ms=this.get_theme_models();return this.util.in_obj(ms,id)?ms[id]:{}},save_theme_model:function(model){return this.util.in_obj(model,"id")&&this.util.is_string(model.id)&&(this.get_theme_models()[model.id]=model),model},extend_template_tag_handler:function(id,attr){var hdl,hdls;return!(!this.util.is_string(id)||!this.util.is_obj(attr))&&(hdls=this.get_template_tag_handlers(),this.util.in_obj(hdls,id)?(hdl=hdls[id]).set_attributes(attr):hdls[(hdl=new this.Template_Tag_Handler(id,attr)).get_id()]=hdl,this.util.in_obj(attr,"styles")&&this.load_styles(attr.styles),this.util.in_obj(attr,"_hooks")&&attr._hooks.call(hdl),hdl)},get_template_tag_handlers:function(){return this.Template_Tag.prototype.handlers},get_template_tag_handler:function(id){var handlers=this.get_template_tag_handlers();return this.util.in_obj(handlers,id)?handlers[id]:null},load_styles:function(styles){if(this.util.is_array(styles)){for(var style,out=[],x=0;x<styles.length;x++)this.util.in_obj(style=styles[x],"uri")&&this.util.is_string(style.uri)&&out.push('<link rel="stylesheet" type="text/css" href="'+style.uri+'" />');$("head").append(out.join(""))}}},Component={_slug:"component",_ns:null,_refs:{},_reciprocal:!1,_dom:null,_attributes:!1,_attr_default:{},_attr_default_parsed:!1,_attr_init:null,_attr_map:{},_events:{},_status:null,_id:"",_c:function(id,attributes){this._set_id(id),this.util.is_obj(attributes)&&(this._attr_init=attributes),this._hooks()},_set_parent:function(){this._super(View)},_hooks:function(){},_set_id:function(id){return this.util.is_empty(this._id)&&(this._id=this.util.is_string(id)?id:this.util.guid()),this._id},get_id:function(ns){var id=this._id;return id=this.util.is_bool(ns)&&ns?this.add_ns(id):id},get_ns:function(){return null===this._ns&&(this._ns=this.util.add_prefix(this._slug)),this._ns},add_ns:function(val){return this.util.is_string(val)?this.get_ns()+"_"+val:""},get_status:function(id,raw){var ret=!1;return ret=this.util.in_obj(this._status,id)?raw?this._status[id]:!!this._status[id]:ret},set_status:function(id,val){return this.util.is_string(id)?(this.util.is_set(val)||(val=!0),this.util.is_obj(this._status,!1)||(this._status={}),this._status[id]=val):this.util.is_set(val)||(val=!1),val},get_controller:function(){return this.get_parent()},has_reference:function(ref){return!!(this.util.is_string(ref)&&ref in this&&ref in this.get_references())},get_references:function(){return this._refs},get_reference:function(ref){return this.has_reference(ref)?this._refs[ref]:null},get_component:function(cname,options){var c=null;if(this.has_reference(cname)){options=$.extend({},{check_attr:!0,get_default:!1},options);var ctype=this.get_reference(cname);if(this.util.is_type(this[cname],ctype))return this[cname];c=this[cname]=null,options.check_attr&&(c=this.get_attribute(cname),this.util.is_empty(c)||(c=this.set_component(cname,c))),this.util.is_empty(c)&&options.get_default&&(c=this.get_controller().get_component(ctype))}return c},set_component:function(name,ref,validate){var ctype;return this.has_reference(name)?((this.util.is_empty(ref)||(ctype=this.get_reference(name),this.util.is_string(ref,!1)&&(ref=this.get_controller().get_component(ctype,ref)),!this.util.is_type(ref,ctype))||this.util.is_func(validate)&&!validate.call(this,ref))&&(ref=null),this[name]=ref,this[name]):null},clear_component:function(name){this.set_component(name,null)},init_attributes:function(force){!(force=this.util.is_bool(force)?force:!1)&&this.util.is_obj(this._attributes)||(force=this._attributes={},$.extend(force,this.init_default_attributes()),this.util.is_obj(this._attr_init)&&$.extend(force,this._attr_init),$.extend(force,this.get_dom_attributes()))},init_default_attributes:function(){if(!this._attr_default_parsed&&this.util.is_obj(this._attr_map)){var opts=this.get_controller().get_options(this.util.obj_keys(this._attr_map));if(this.util.is_obj(opts)){for(var opt in this._attr_map)opt in opts&&null!==this._attr_map[opt]&&(opts[this._attr_map[opt]]=opts[opt],delete opts[opt]);$.extend(!0,this._attr_default,opts)}this._attr_default_parsed=!0}return this._attr_default},get_dom_attributes:function(){var attrs={},el=this.dom_get(null,{init:!1});if(0<el.length){el=$(el).get(0).attributes;if(this.util.is_obj(el)){var attr_key,attr_prefix=this.util.get_attribute();let t=this;$.each(el,function(idx,attr){if(-1===attr.name.indexOf(attr_prefix))return!0;attr_key=attr.name.substr(attr_prefix.length+1),attrs[attr_key]=t.util.esc_html(attr.value)})}}return attrs},get_attributes:function(){return this.init_attributes(),this._attributes},get_attribute:function(key,def,enforce_type){if(this.util.is_set(def)||(def=null),!this.util.is_string(key))return def;this.util.is_bool(enforce_type)||(enforce_type=!0);key=this.has_attribute(key)?this.get_attributes()[key]:def;return enforce_type&&key!==def&&null!==def&&!this.util.is_type(key,$.type(def),!1)&&(this.util.is_scalar(def,!1)&&this.util.is_scalar(key,!1)?this.util.is_string(def,!1)?key=key.toString():this.util.is_num(def,!1)&&!this.util.is_num(key,!1)?(key=(this.util.is_int(def,!1)?parseInt:parseFloat)(key),this.util.is_num(key,!1)||(key=def)):key=this.util.is_bool(def,!1)?this.util.is_string(key)||this.util.is_num(key):def:key=def),key},call_attribute:function(attr,args){return attr=this.get_attribute(attr),this.util.is_func(attr)&&(args=Array.prototype.slice.call(arguments,1),attr=attr.apply(this,args)),attr},has_attribute:function(key){return this.util.is_string(key)&&key in this.get_attributes()},set_attributes:function(attributes,full){this.util.is_bool(full)||(full=!1),this.init_attributes(full),this.util.is_obj(attributes)&&$.extend(this._attributes,attributes)},set_attribute:function(key,val){return this.util.is_string(key)&&this.util.is_set(val)&&(this.get_attributes()[key]=val),val},dom_get_selector:function(element){return this.util.is_string(element)?"."+this.add_ns(element):""},dom_get_attribute:function(){return this.util.get_attribute(this._slug)},dom_set:function(el){return(el=$(el)).data(this.get_data_key(),this),this._reciprocal&&(this._dom=el),el},dom_get:function(element,options){var ch,opts_default={init:!0,put:!1},opts_default=((options=this.util.is_obj(options)?$.extend({},opts_default,options):opts_default).init&&!this.get_status("dom_init")&&(this.set_status("dom_init"),this.dom_init()),this._dom);return opts_default&&this.util.is_string(element)&&((ch=$(opts_default).find(this.dom_get_selector(element))).length?opts_default=ch:!0!==options.put&&!this.util.is_obj(options.put)||(opts_default=this.dom_put(element,options.put))),$(opts_default)},dom_init:function(){},dom_put:function(element,content){var r=null;if(this.dom_has()&&this.util.is_string(element)){for(var strip=["tag","content","success"],options={tag:"div",content:"",class:this.add_ns(element)},attrs=(this.util.is_empty(content)||(this.util.is_type(content,jQuery,!1)||this.util.is_string(content,!1)?options.content=content:this.util.is_obj(content,!1)&&$.extend(options,content)),$.extend({},options)),x=0;x<strip.length;x++)delete attrs[strip[x]];content=this.dom_get();(r=$(this.dom_get_selector(element),content)).length||(r=$(this.util.format("<%s />",options.tag),attrs).appendTo(content)).length&&this.util.is_method(options,"success")&&options.success.call(r,r),$(r).append(options.content)}return $(r)},dom_has:function(){return!!this.dom_get().length},get_data_key:function(){return this.get_ns()},on:function(event,fn,options){var t,args,es;return this.util.is_string(event)&&this.util.is_func(fn)?(this.util.is_obj(options,!1)||(options={}),options=$.extend({},{clear:!1},options),this.util.is_obj(this._events,!1)||(this._events={}),event in(es=this._events)&&this.util.is_obj(es[event],!1)&&!options.clear||(es[event]=[]),es[event].push(fn)):(t=this,args=Array.prototype.slice.call(arguments,1),this.util.is_array(event)?$.each(event,function(idx,val){t.on.apply(t,[val].concat(args))}):this.util.is_obj(event)&&$.each(event,function(ev,hdl){t.on.apply(t,[ev,hdl].concat(args))})),this},trigger:function(event,data){var ev,dfr=$.Deferred(),dfrs=[],t=this;return this.util.is_array(event)?($.each(event,function(idx,val){dfrs.push(t.trigger(val,data))}),$.when.apply(t,dfrs).done(function(){dfr.resolve()})):this.util.is_string(event)&&event in this._events?(ev={type:event,data:null},this.util.is_set(data)&&(ev.data=data),$.each(this._events[event],function(idx,fn){dfrs.push(fn.call(t,ev,t))}),$.when.apply(this,dfrs).done(function(){dfr.resolve()})):dfr.resolve(),dfr.promise()}},Viewer=(View.Component=Component=SLB.Class.extend(Component),{_slug:"viewer",_refs:{item:"Content_Item",theme:"Theme"},_reciprocal:!0,_attr_default:{loop:!0,animate:!0,autofit:!0,overlay_enabled:!0,overlay_opacity:"0.8",title_default:!1,container:null,slideshow_enabled:!0,slideshow_autostart:!1,slideshow_duration:2,slideshow_active:!1,slideshow_timer:null,labels:{close:"close",nav_prev:"&laquo; prev",nav_next:"next &raquo;",slideshow_start:"start slideshow",slideshow_stop:"stop slideshow",group_status:"Image %current% of %total%",loading:"loading"}},_attr_map:{theme:null,group_loop:"loop",ui_autofit:"autofit",ui_animate:"animate",ui_overlay_opacity:"overlay_opacity",ui_labels:"labels",ui_title_default:"title_default",slideshow_enabled:null,slideshow_autostart:null,slideshow_duration:null},item:null,item_queued:null,theme:null,item_working:null,active:!1,init:!1,open:!1,loading:!1,_hooks:function(){var t=this;this.on(["item-prev","item-next"],function(){t.trigger("item-change")}).on(["close","item-change"],function(){t.unload().done(function(){t.unlock()})})},get_item:function(){return this.get_component("item")},set_item:function(item){this.clear_item(!1);item=this.set_component("item",item,function(item){return item.has_type()});return!this.util.is_empty(item)},clear_item:function(full){this.util.is_bool(full)||(full=!0);var item=this.get_item();item&&item.reset(),full&&this.clear_component("item")},get_theme:function(){var ret=this.get_component("theme",{check_attr:!1});return ret=this.util.is_empty(ret)?this.set_component("theme",new View.Theme(this)):ret},set_theme:function(theme){this.set_component("theme",theme)},lock:function(){return this.set_status("item_working",$.Deferred())},get_lock:function(simple,full){this.util.is_bool(simple)||(simple=!1),this.util.is_bool(full)||(full=!1);var s="item_working";return simple?this.get_status(s):(simple=this.get_status(s,!0),this.util.is_promise(simple)||(simple=this.lock()),full?simple:simple.promise())},is_locked:function(){return this.get_lock(!0)},unlock:function(){return this.get_lock(!1,!0).resolve()},set_active:function(mode){return this.util.is_bool(mode)||(mode=!0),this.set_status("active",mode)},is_active:function(){return this.get_status("active")},set_loading:function(mode){var dfr=$.Deferred(),m=(this.util.is_bool(mode)||(mode=!0),this.loading=mode,this.slideshow_active()&&this.slideshow_pause(mode),mode?"addClass":"removeClass");return $(this.dom_get())[m]("loading"),mode?this.get_theme().transition("load").always(function(){dfr.resolve()}):dfr.resolve(),dfr.promise()},unset_loading:function(){return this.set_loading(!1)},get_loading:function(){return!!this.util.is_bool(this.loading)&&this.loading},is_loading:function(){return this.get_loading()},show:function(item){this.item_queued=item;var fin_set="show_deferred",item="theme_valid",valid=!0;if(this.has_attribute(item)?valid=this.get_attribute(item,!0):(valid=!(!this.get_theme()||""===this.get_theme().get_template().get_layout(!1)),this.set_attribute(item,valid)),!valid)return this.close(),!1;function fin(){if(v.lock(),v.set_status(fin_set,!1),!v.set_item(v.item_queued))return v.close();v.history_add(),v.set_active(),v.render()}var v=this;this.is_locked()?this.get_status(fin_set)||(this.set_status(fin_set),this.get_lock().always(function(){fin()})):fin()},history_handle:function(e){var state=e.originalEvent.state;this.util.is_string(state.item,!1)?(this.get_controller().get_item(state.item).show({event:e}),this.trigger("item-change")):(state=this.history_get(!0),this.history_set(0),-1!==state&&this.close())},history_get:function(full){return this.get_status("history_count",full)},history_set:function(val){return this.set_status("history_count",val)},history_add:function(){if(!history.pushState)return!1;var item=this.get_item(),opts=item.get_attribute("options_show"),count=this.history_get()?this.history_get(!0):0;this.util.in_obj(opts,"event")?(opts=opts.event.originalEvent,this.util.in_obj(opts,"state")&&this.util.in_obj(opts.state,"count")&&(count=opts.state.count)):(opts={viewer:this.get_id(),item:null,count:count},count||history.replaceState(opts,null),opts.item=this.get_controller().save_item(item).get_id(),opts.count=++count,history.pushState(opts,"")),this.history_set(count)},history_reset:function(){var count=this.history_get(!0);count&&(this.history_set(-1),history.go(-1*count))},is_open:function(){return"none"!==this.dom_get().css("display")},render:function(){var v=this,thm=this.get_theme();v.dom_prep(),this.get_status("render-events")||(this.set_status("render-events"),thm.on("render-loading",function(ev,thm){var set_pos,always,dfr=$.Deferred();return v.is_active()?(set_pos=function(){v.dom_get().css("top",$(window).scrollTop())},always=function(){v.set_loading().always(function(){dfr.resolve()})},v.is_open()?thm.transition("unload").fail(function(){set_pos(),thm.dom_get_tag("item","content").attr("style","")}).always(always):thm.transition("open").always(function(){always(),v.events_open(),v.open=!0}).fail(function(){set_pos(),v.get_overlay().show(),v.dom_get().show()})):dfr.reject(),dfr.promise()}).on("render-complete",function(ev,thm){if(!v.is_active())return!1;var d=v.dom_get(),classes=["item_single","item_multi"],ms=["addClass","removeClass"];v.get_item().get_group().is_single()||ms.reverse(),$.each(ms,function(idx,val){d[val](classes[idx])}),v.events_complete(),thm.transition("complete").fail(function(){var dims;v.get_attribute("autofit",!0)&&(dims=$.extend({display:"inline-block"},thm.get_item_dimensions()),thm.dom_get_tag("item","content").css(dims))}).always(function(){v.unset_loading(),v.trigger("render-complete"),v.init=!0})})),thm.render()},dom_get_container:function(){var sel=this.get_attribute("container"),c=(this.util.is_empty(sel)&&(sel="#"+this.add_ns("wrap")),$(sel));return c.length||(sel=0===sel.indexOf("#")?sel.substr(1):sel,c=$("<div />",{id:sel}).appendTo("body")),c},dom_init:function(){var d=this.dom_set($("<div/>",{id:this.get_id(!0),class:this.get_ns()})).appendTo(this.dom_get_container()).hide(),thm=this.get_theme(),v=(d.addClass(thm.get_classes(" ")),this);this.get_status("render-init")||(this.set_status("render-init"),thm.on("render-init",function(ev){v.dom_put("layout",ev.data)})),thm.render(!0)},dom_prep:function(mode){mode=this.util.is_bool(mode)&&!mode?"removeClass":"addClass";$("html")[mode](this.util.add_prefix("overlay"))},dom_restore:function(){this.dom_prep(!1)},get_layout:function(){return this.dom_get("layout",{put:{success:function(){$(this).hide()}}})},animation_enabled:function(){return this.get_attribute("animate",!0)},overlay_enabled:function(){var ov=this.get_attribute("overlay_enabled");return!!this.util.is_bool(ov)&&ov},get_overlay:function(){var o=null,v=this;return this.overlay_enabled()&&(o=this.dom_get("overlay",{put:{success:function(){$(this).hide().css("opacity",v.get_attribute("overlay_opacity"))}}})),$(o)},unload:function(){var dfr=$.Deferred();return this.get_theme().dom_get_tag("item").text(""),dfr.resolve(),dfr.promise()},reset:function(){this.dom_get().hide(),this.dom_restore(),this.history_reset(),this.clear_item(),this.set_active(!1),this.set_loading(!1),this.slideshow_stop(),this.keys_disable(),this.unlock()},get_labels:function(){return this.get_attribute("labels",{})},get_label:function(name){var lbls=this.get_labels();return name in lbls?lbls[name]:""},events_open:function(){if(this.keys_enable(),this.open)return!1;function close(){v.close()}var l=this.get_layout(),v=(l.children().click(function(ev){ev.stopPropagation()}),this);l.click(close),this.get_overlay().click(close),this.trigger("events-open")},events_complete:function(){if(this.init)return!1;this.trigger("events-complete")},keys_enable:function(mode){this.util.is_bool(mode)||(mode=!0);var e=["keyup",this.util.get_prefix()].join("."),v=this;mode?$(document).on(e,function(ev){return v.keys_control(ev)}):$(document).off(e)},keys_disable:function(){this.keys_enable(!1)},keys_control:function(ev){var handlers={27:this.close,37:this.item_prev,39:this.item_next};if("rtl"===document.documentElement.getAttribute("dir")&&(handlers[37]=this.item_next,handlers[39]=this.item_prev),ev.which in handlers)return handlers[ev.which].call(this),!1},slideshow_enabled:function(){var o=this.get_attribute("slideshow_enabled");return!(!(this.util.is_bool(o)&&o&&this.get_item())||this.get_item().get_group().is_single())},slideshow_active:function(){return!(!this.slideshow_enabled()||!(this.get_attribute("slideshow_active")||!this.init&&this.get_attribute("slideshow_autostart")))},slideshow_clear_timer:function(){clearInterval(this.get_attribute("slideshow_timer"))},slideshow_set_timer:function(callback){this.set_attribute("slideshow_timer",setInterval(callback,1e3*this.get_attribute("slideshow_duration")))},slideshow_start:function(){if(!this.slideshow_enabled())return!1;this.set_attribute("slideshow_active",!0),this.dom_get().addClass("slideshow_active"),this.slideshow_clear_timer();var v=this;this.slideshow_set_timer(function(){v.slideshow_pause(),v.item_next()}),this.trigger("slideshow-start")},slideshow_stop:function(full){(full=this.util.is_bool(full)?full:!0)&&(this.set_attribute("slideshow_active",!1),this.dom_get().removeClass("slideshow_active")),this.slideshow_clear_timer(),this.trigger("slideshow-stop")},slideshow_toggle:function(){if(!this.slideshow_enabled())return!1;this.slideshow_active()?this.slideshow_stop():this.slideshow_start(),this.trigger("slideshow-toggle")},slideshow_pause:function(mode){this.util.is_bool(mode)||(mode=!0),this.slideshow_active()&&(mode?this.slideshow_stop(!1):this.slideshow_start()),this.trigger("slideshow-pause")},slideshow_resume:function(){this.slideshow_pause(!1)},item_next:function(){var g=this.get_item().get_group(!0),v=this,ev="item-next",st=["events","viewer",ev].join("_");g.get_status(st)||(g.set_status(st),g.on(ev,function(e){v.trigger(e.type)})),g.show_next()},item_prev:function(){var g=this.get_item().get_group(!0),v=this,ev="item-prev",st=["events","viewer",ev].join("_");g.get_status(st)||(g.set_status(st),g.on(ev,function(){v.trigger(ev)})),g.show_prev()},close:function(){this.set_active(!1);var v=this,thm=this.get_theme();return thm.transition("unload").always(function(){thm.transition("close",!0).always(function(){v.reset(),v.trigger("close")})}).fail(function(){thm.dom_get_tag("item","content").attr("style","")}),!1}}),Viewer=(View.Viewer=Component.extend(Viewer),{_slug:"group",_reciprocal:!0,_refs:{current:"Content_Item"},current:null,selector:null,_hooks:function(){var t=this;this.on(["item-prev","item-next"],function(){t.trigger("item-change")})},get_selector:function(){return this.util.is_empty(this.selector)&&(this.selector=this.util.format('a[%s="%s"]',this.dom_get_attribute(),this.get_id())),this.selector},get_items:function(){var items=$(this.get_selector());return items=0===items.length&&this.has_current()?this.get_current().dom_get():items},get_item:function(idx){this.util.is_int(idx)||(idx=0);var items=this.get_items(),max=this.get_size()-1;return items.get(idx=max<idx?max:idx)},get_pos:function(item){return this.util.is_empty(item)&&(item=this.get_current()),this.util.is_type(item,View.Content_Item)?this.get_items().index(item.dom_get()):-1},has_current:function(){return!this.util.is_empty(this.get_current())},get_current:function(){return null===this.current||this.util.is_type(this.current,View.Content_Item)||(this.current=null),this.current},set_current:function(item){this.util.is_type(item,View.Content_Item)&&(this.current=item)},get_next:function(item){var next,pos;return this.util.is_type(item,View.Content_Item)||(item=this.get_current()),1===this.get_size()?item:(next=null,-1===(pos=this.get_pos(item))||0===(pos=pos+1<this.get_size()?pos+1:0)&&!item.get_viewer().get_attribute("loop")?next:this.get_item(pos))},get_prev:function(item){var prev,pos;return this.util.is_type(item,View.Content_Item)||(item=this.get_current()),1===this.get_size()?item:(prev=null,-1===(pos=this.get_pos(item))||0===pos&&!item.get_viewer().get_attribute("loop")||(0===pos&&(pos=this.get_size()),prev=this.get_item(--pos)),prev)},show_next:function(item){var next;1<this.get_size()&&((next=this.get_next(item))||(item=this.util.is_type(item,View.Content_Item)?item:this.get_current()).get_viewer().close(),item=this.get_controller().get_item(next),this.set_current(item),item.show(),this.trigger("item-next"))},show_prev:function(item){var prev;1<this.get_size()&&((prev=this.get_prev(item))||(item=this.util.is_type(item,View.Content_Item)?item:this.get_current()).get_viewer().close(),item=this.get_controller().get_item(prev),this.set_current(item),item.show(),this.trigger("item-prev"))},get_size:function(){return this.get_items().length},is_single:function(){return 1===this.get_size()}}),Viewer=(View.Group=Component.extend(Viewer),{_slug:"content_handler",_refs:{item:"Content_Item"},item:null,template:"",has_item:function(){return!this.util.is_empty(this.get_item())},get_item:function(){return this.get_component("item")},set_item:function(item){return this.set_component("item",item)},clear_item:function(){this.clear_component("item")},match:function(item){var m=this.get_attribute("match");if(!this.util.is_empty(m)){if(this.util.is_string(m)&&(m=new RegExp(m,"i"),this.set_attribute("match",m)),this.util.is_type(m,RegExp))return m.test(item.get_uri());if(this.util.is_func(m))return!!m.call(this,item)}return!1},load:function(item){var dfr=$.Deferred();return null===this.call_attribute("load",item,dfr)&&dfr.resolve(),dfr.promise()},render:function(item){var dfr=$.Deferred();return this.call_attribute("render",item,dfr),dfr.promise()}}),Viewer=(View.Content_Handler=Component.extend(Viewer),{_slug:"content_item",_reciprocal:!0,_refs:{viewer:"Viewer",group:"Group",type:"Content_Handler"},_attr_default:{source:null,permalink:null,dimensions:null,title:"",group:null,internal:!1,output:null},group:null,viewer:null,type:null,data:null,loaded:null,_c:function(el){this.dom_set(el),this._super()},init_default_attributes:function(){this._super();var t,d=this.dom_get(),key=d.attr(this.util.get_attribute("asset"))||null,assets=this.get_controller().assets||null;return this.util.is_string(key)&&(d=[{},this._attr_default,{permalink:d.attr("href")}],this.util.is_obj(assets)&&(t=this,d.push((key=>{var ret={};return ret=key in assets&&t.util.is_obj(assets[key])?assets[key]:ret})(key))),this._attr_default=$.extend.apply(this,d)),this._attr_default},get_output:function(){var item,dfr=$.Deferred(),ret=this.get_attribute("output");return this.util.is_string(ret)?dfr.resolve(ret):this.has_type()?this.get_type().render(item=this).done(function(output){item.set_output(output),dfr.resolve(output)}):dfr.resolve(""),dfr.promise()},set_output:function(out){this.util.is_string(out,!1)&&this.set_attribute("output",out)},get_content:function(){return this.get_output()},get_uri:function(mode){-1===$.inArray(mode,["source","permalink"])&&(mode="source");var ret=this.get_attribute(mode);return ret=(ret=this.util.is_string(ret)?ret:"source"===mode?this.get_attribute("permalink"):"").replace(/&(#38|amp);/,"&")},get_title:function(){if(this.has_attribute("title_cached"))return this.get_attribute("title_cached","");function validate(title){return"string"!=typeof title||""===title.trim()?"":(title=title.trim(),t.get_viewer().get_attribute("title_default")||title===t.get_title_default()&&(title=""),title)}var title="",dom=this.dom_get(),t=this;if(!(title=dom.length?(title=(title=dom.attr("title"))||dom.closest("figure").find("figcaption").first().html())||dom.closest("figure").find(".wp-caption-text").first().html():title))for(var props=["caption","title"],x=0;x<props.length&&(title=validate(this.get_attribute(props[x],"")),this.util.is_empty(title));x++);return!title&&dom.length&&(title=(title=validate(dom.find("img").first().attr("alt")))||validate(dom.get(0).innerText.trim()),title=this.util.esc_html(title)),title=validate(title),this.set_attribute("title_cached",title),title},get_title_default:function(){var f,i,prop="title_default";return this.has_attribute(prop)?this.get_attribute(prop):(-1!==(i=(f=this.get_uri("source")).lastIndexOf("/"))&&-1!==(i=(f=f.substr(i+1)).lastIndexOf("."))&&(f=f.substr(0,i)),this.set_attribute(prop,f))},get_dimensions:function(){return $.extend({width:0,height:0},this.get_attribute("dimensions"),{})},set_data:function(data){this.data=data},get_data:function(){return this.data},gallery_type:function(){var type,ret=null,types={wp:".gallery-icon",ngg:".ngg-gallery-thumbnail"},dom=this.dom_get();for(type in types)if(0<dom.parent(types[type]).length){ret=type;break}return ret},in_gallery:function(gType){var type=this.gallery_type();return null!==type&&(!this.util.is_string(gType)||gType===type)},get_viewer:function(){return this.get_component("viewer",{get_default:!0})},set_viewer:function(v){return this.set_component("viewer",v)},get_group:function(set_current){var g=this.get_component("group");return g||(g=this.set_component("group",new View.Group),set_current=!0),set_current&&g.set_current(this),g},set_group:function(g){this.util.is_string(g)&&(g=this.get_controller().get_group(g)),this.group=!!this.util.is_type(g,View.Group)&&g},get_type:function(){return this.get_component("type",{check_attr:!1})||this.set_type(this.get_controller().get_content_handler(this))},set_type:function(type){return this.set_component("type",type)},has_type:function(){return!this.util.is_empty(this.get_type())},show:function(options){if(!this.has_type())return!1;this.set_attribute("options_show",options);options=this.get_viewer();return this.load(),options.show(this)},load:function(){return this.util.is_promise(this.loaded)||(this.loaded=this.get_type().load(this)),this.loaded.promise()},reset:function(){this.set_attribute("options_show",null)}}),Viewer=(View.Content_Item=Component.extend(Viewer),{_slug:"modeled_component",get_attribute:function(key,def,check_model,enforce_type){var ret;return!this.util.is_string(key)||(ret=null)===(ret=(check_model=this.util.is_bool(check_model)?check_model:!0)&&(check_model=this.get_ancestor(key,!1),this.util.in_obj(check_model,key))?check_model[key]:ret)?this._super(key,def,enforce_type):ret},get_attribute_recursive:function(key,def,enforce_type){var t,ret=this.get_attribute(key,def,!0,enforce_type);return this.util.is_obj(ret)&&(def=this.get_ancestors(!1),ret=[ret],t=this,$.each(def,function(idx,model){key in model&&t.util.is_obj(model[key])&&ret.push(model[key])}),ret.push({}),ret=$.extend.apply($,ret.reverse())),ret},set_attribute:function(key,val,use_model){return!(!this.util.is_string(key)||!this.util.is_set(val))&&((use_model=this.util.is_bool(use_model)||this.util.is_obj(use_model)?use_model:!0)?(this.util.is_obj(use_model)?use_model:this.get_model())[key]=val:this._super(key,val),val)},get_model:function(){var m=this.get_attribute("model",null,!1);return this.util.is_obj(m)||this.set_attribute("model",m={},!1),m},has_model:function(){return!this.util.is_empty(this.get_model())},in_model:function(key){return!!this.util.in_obj(this.get_model(),key)},get_ancestors:function(inc_current){for(var ret=[],m=this.get_model();this.util.is_obj(m);)ret.push(m),m=this.util.in_obj(m,"parent")&&this.util.is_obj(m.parent)?m.parent:null;return inc_current||ret.shift(),ret},get_ancestor:function(attr,safe_mode){if(!this.util.is_string(attr))return!1;this.util.is_bool(safe_mode)||(safe_mode=!0);for(var mcurr=this.get_model(),m=mcurr,found=!1;this.util.is_obj(m);){if(this.util.in_obj(m,attr)&&!this.util.is_empty(m[attr])){found=!0;break}m=this.util.in_obj(m,"parent")?m.parent:null}return found||(safe_mode?(this.util.is_empty(m)&&(m=mcurr),this.util.in_obj(m,attr)||(m[attr]=null)):m=null),m}}),Viewer=Component.extend(Viewer),Template=(View.Theme=Viewer.extend({_slug:"theme",_refs:{viewer:"Viewer",template:"Template"},_models:{},_attr_default:{template:null,model:null},viewer:null,template:null,_c:function(id,attributes,viewer){1===arguments.length&&this.util.is_type(arguments[0],View.Viewer)&&(viewer=arguments[0],id=null),this._super(id,attributes),this.set_viewer(viewer),this.set_model(id)},get_viewer:function(){return this.get_component("viewer",{check_attr:!1,get_default:!0})},set_viewer:function(v){return this.set_component("viewer",v)},get_template:function(){var attr,ret=this.get_component("template");return this.util.is_empty(ret)&&(attr={theme:this,model:this.get_model()},ret=this.set_component("template",new View.Template(attr))),ret},get_tags:function(name,prop){return this.get_template().get_tags(name,prop)},dom_get_tag:function(tag,prop){return $(this.get_template().dom_get_tag(tag,prop))},get_tag_selector:function(name,prop){return this.get_template().get_tag_selector(name,prop)},get_models:function(){return this._models},get_model:function(id){var models;return!this.util.is_set(id)&&this.util.is_obj(this.get_attribute("model",null,!1))?this._super():(models=this.get_models(),this.util.is_string(id)||(id=this.get_controller().get_option("theme_default")),models[id=this.util.in_obj(models,id)?id:$.map(models,function(v,key){return key})[0]])},set_model:function(id){this.set_attribute("model",this.get_model(id),!1)},get_classes:function(rtype){var cls=[],thm=this,models=this.get_ancestors(!0);return $.each(models,function(idx,model){cls.push(thm.add_ns(model.id))}),cls=this.util.is_string(rtype)?cls.join(rtype):cls},get_measurement:function(attr,def){var meas=null;if(!this.util.is_string(attr))return meas;this.util.is_obj(def,!1)||(def={});var attr_cache=this.util.format("%s_cache",attr),cache=this.get_attribute(attr_cache,{},!1),status="_status",item=this.get_viewer().get_item(),w=$(window),status=(status in cache&&this.util.is_obj(cache._status)&&cache._status.width===w.width()&&cache._status.height===w.height()||(cache={}),this.util.is_empty(cache)&&(cache._status={width:w.width(),height:w.height(),index:[]}),$.inArray(item,cache._status.index));return-1!==status&&status in cache&&(meas=cache[status]),this.util.is_obj(meas)||(meas=this.call_attribute(attr),this.util.is_obj(meas))||(meas=this.get_measurement_default(attr)),meas=this.util.is_obj(meas)?$.extend({},def,meas):def,status=cache._status.index.push(item)-1,cache[status]=meas,this.set_attribute(attr_cache,cache,!1),$.extend({},meas)},get_measurement_default:function(attr){return this.util.is_string(attr)?(attr=this.util.format("get_%s_default",attr),this.util.in_obj(this,attr)?(attr=this[attr],this.util.is_func(attr)&&(attr=attr.call(this))):attr=null,attr):null},get_offset:function(){return this.get_measurement("offset",{width:0,height:0})},get_offset_default:function(){var tags,offset={width:0,height:0},v=this.get_viewer(),vn=v.dom_get(),vn=vn.clone().attr("id","").css({visibility:"hidden",position:"absolute",top:""}).removeClass("loading").appendTo(vn.parent()),l=vn.find(v.dom_get_selector("layout"));return l.length&&(l.find("*").css({width:"",height:"",display:""}),(tags=this.get_tags("item","content")).length&&(v=v.get_item().get_dimensions(),tags=$(l.find(tags[0].get_selector("full")).get(0)).css({width:v.width,height:v.height}),$.each(v,function(key,val){offset[key]=-1*val})),offset.width+=l.width(),offset.height+=l.height(),$.each(offset,function(key,val){val<0&&(offset[key]=0)})),vn.empty().remove(),offset},get_margin:function(){return this.get_measurement("margin",{width:0,height:0})},get_item_dimensions:function(){var offset,factor,v=this.get_viewer(),dims=v.get_item().get_dimensions();return v.get_attribute("autofit",!1)&&(v=this.get_margin(),(offset=this.get_offset()).height+=v.height,offset.width+=v.width,(v={width:$(window).width(),height:$(window).height()}).width>offset.width&&(v.width-=offset.width),v.height>offset.height&&(v.height-=offset.height),(factor=Math.min(v.width/dims.width,v.height/dims.height))<1)&&$.each(dims,function(key){dims[key]=Math.round(dims[key]*factor)}),$.extend({},dims)},get_dimensions:function(){var dims=this.get_item_dimensions(),offset=this.get_offset();return $.each(dims,function(key){dims[key]+=offset[key]}),dims},get_breakpoints:function(){return this.get_attribute_recursive("breakpoints")},get_breakpoint:function(target){var b,ret=0;return ret=this.util.is_string(target)&&(b=this.get_attribute_recursive("breakpoints"),this.util.is_obj(b))&&target in b?b[target]:ret},render:function(init){var thm=this,tpl=this.get_template(),st="events_render";this.get_status(st)||(this.set_status(st),tpl.on(["render-init","render-loading","render-complete"],function(ev){return thm.trigger(ev.type,ev.data)})),tpl.render(init)},transition:function(event,clear_queue){var models,trns,thm,dfr=null,attr="transition",v=this.get_viewer(),fx_temp=null,anim_on=v.animation_enabled();return v.get_attribute(attr,!0)&&this.util.is_string(event)&&(clear_queue&&v.get_layout().find("*").each(function(){for(var el=$(this);el.queue().length;)el.stop(!1,!0)}),clear_queue=[attr,"set"].join("_"),trns=this.get_attribute(clear_queue)?this.get_attribute(attr,{}):(models=this.get_ancestors(!0),trns=[],this.set_attribute(clear_queue,!0),thm=this,$.each(models,function(idx,model){attr in model&&thm.util.is_obj(model[attr])&&trns.push(model[attr])}),trns.push({}),this.set_attribute(attr,$.extend.apply($,trns.reverse()))),this.util.is_method(trns,event))&&(anim_on||(fx_temp=$.fx.off,$.fx.off=!0),dfr=trns[event].call(this,v,$.Deferred())),this.util.is_promise(dfr)||(dfr=$.Deferred()).reject(),dfr.always(function(){null!==fx_temp&&($.fx.off=fx_temp)}),dfr.promise()}}),{_slug:"template",_reciprocal:!0,_refs:{theme:"Theme"},_attr_default:{layout_uri:"",layout_raw:"",layout_parsed:"",tags:null,model:null},theme:null,_c:function(attributes){this._super("",attributes)},_hooks:function(){this.on("dom_init",function(ev){var tags=this.get_tags(null,null,!0),names=[],t=this;$.each(tags,function(idx,tag){var name=tag.get_name();-1===$.inArray(name,names)&&(names.push(name),tag.get_handler().trigger(ev.type,{template:t}))})})},get_theme:function(){return this.get_component("theme")},render:function(init){var item,tpl,tags,tag_promises,v=this.get_theme().get_viewer();if(!(init=this.util.is_bool(init)?init:!1))return!!v.is_active()&&(item=v.get_item(),this.util.is_type(item,View.Content_Item)?void(v.is_active()&&this.has_tags()&&(init=this.trigger("render-loading"),tags=(tpl=this).get_tags(),tag_promises=[],$.when(item.load(),init).done(function(){return!!v.is_active()&&($.each(tags,function(idx,tag){if(!v.is_active())return!1;tag_promises.push(tag.render(item).done(function(r){if(!v.is_active())return!1;r.tag.dom_get().html(r.output)}))}),!!v.is_active())&&void $.when.apply($,tag_promises).done(function(){tpl.trigger("render-complete")})}))):(v.close(),!1));this.trigger("render-init",this.dom_get())},get_layout:function(parsed){return(parsed=this.util.is_bool(parsed)?parsed:!0)?this.parse_layout():this.get_attribute("layout_raw","")},parse_layout:function(){var a="layout_parsed",ret=this.get_attribute(a);return this.util.is_string(ret)||(ret=this.sanitize_layout(this.get_layout(!1)),ret=this.parse_tags(ret),this.set_attribute(a,ret)),ret},sanitize_layout:function(l){var rtype,dom,tag_temp,cls,cls_new;return this.util.is_empty(l)||(rtype=this.util.is_string(l)?"string":null,dom=$(l),tag_temp=this.get_tag_temp(),cls=tag_temp.get_class(),cls_new=["x",cls].join("_"),$(tag_temp.get_selector(),dom).each(function(){$(this).removeClass(cls).addClass(cls_new)}),l="string"===rtype?dom=dom.wrap("<div />").parent().html():dom),l},parse_tags:function(l){if(!this.util.is_string(l))return"";for(var match,re=/\{{2}\s*(\w.*?)\s*\}{2}/gim;match=re.exec(l);)l=l.substring(0,match.index)+this.get_tag_container(match[1])+l.substring(match.index+match[0].length);return l},get_tag_container:function(tag){var attr=this.get_tag_attribute();return this.util.format('<span %s="%s"></span>',attr,encodeURI(tag))},get_tag_attribute:function(){return this.get_tag_temp().dom_get_attribute()},get_tag:function(idx){var tags,ret=null;return ret=this.has_tags()?(tags=this.get_tags())[idx=!this.util.is_int(idx)||idx<0||idx>=tags.length?0:idx]:ret},get_tags:function(name,prop,isolate){this.util.is_bool(isolate)||(isolate=!1);var attr,d,a="tags",tags=this.get_attribute(a);if(this.util.is_array(tags)||(tags=[],d=this.dom_get(),attr=this.get_tag_attribute(),d=$(d).find("["+attr+"]"),$(d).each(function(){var el=$(this),tag=new View.Template_Tag(decodeURI(el.attr(attr)));tag.has_handler()&&(tags.push(tag),isolate||(tag.dom_set(el),el.addClass(tag.get_classes(" ")))),isolate||el.removeAttr(attr)}),isolate)||this.set_attribute(a,tags,!1),!this.util.is_empty(tags)&&this.util.is_string(name)){this.util.is_string(prop)||(prop=!1);for(var tags_filtered=[],tc=null,x=0;x<tags.length;x++)name!==(tc=tags[x]).get_name()||prop&&prop!==tc.get_prop()||tags_filtered.push(tc);tags=tags_filtered}return this.util.is_array(tags,!1)?tags:[]},has_tags:function(){return 0<this.get_tags().length},get_tag_temp:function(){return this.get_controller().get_component_temp(View.Template_Tag)},get_tag_selector:function(name,prop){this.util.is_string(name)||(name=""),this.util.is_string(prop)||(prop="");var tag=this.get_tag_temp();return tag.set_attribute("name",name),tag.set_attribute("prop",prop),tag.get_selector("full")},dom_init:function(){this.dom_set(this.get_layout()),this.trigger("dom_init")},dom_get_tag:function(tag,prop){var level,ret=$(),tags=this.get_tags(tag,prop);return tags.length&&(level=null,this.util.is_string(tag)&&(level=this.util.is_string(prop)?"full":"tag"),tag="."+tags[0].get_class(level),ret=this.dom_get().find(tag)),ret}}),Viewer=(View.Template=Viewer.extend(Template),{_slug:"template_tag",_reciprocal:!0,_attr_default:{name:null,prop:null,match:null},handlers:{},_c:function(tag_match){this.parse(tag_match)},parse:function(tag_match){if(!this.util.is_string(tag_match))return!1;var part,parts=tag_match.split("|");if(!parts.length)return null;var attrs={name:null,prop:null,match:tag_match};attrs.name=parts[0],-1!==attrs.name.indexOf(".")&&(attrs.name=attrs.name.split(".",2),attrs.prop=attrs.name[1],attrs.name=attrs.name[0]);for(var x=1;x<parts.length;x++)1<(part=parts[x].split(":",1)).length&&!(part[0]in attrs)&&(attrs[part[0]]=part[1]);this.set_attributes(attrs,!0)},render:function(item){var tag=this;return tag.get_handler().render(item,tag).pipe(function(output){return{tag:tag,output:output}})},get_name:function(){return this.get_attribute("name")},get_prop:function(){return this.get_attribute("prop")},get_handler:function(){return this.has_handler()?this.handlers[this.get_name()]:new View.Template_Tag_Handler("")},has_handler:function(){return this.get_name()in this.handlers},get_classes:function(rtype){var cls=[this.get_class(),this.get_class("tag"),this.get_class("full")];return cls=this.util.is_string(rtype)?cls.join(rtype):cls},get_class:function(level){var cls="";switch(level){case"tag":cls=this.get_name();break;case"full":for(var parts=[this.get_name(),this.get_prop()],a=[],i=0;i<parts.length;i++)this.util.is_string(parts[i])&&a.push(parts[i]);cls=a.join("_")}return this.util.is_string(cls)?this.add_ns(cls):this.get_ns()},get_selector:function(level){level=this.get_class(level);return level=this.util.is_string(level)?"."+level:""}}),Template=(View.Template_Tag=Component.extend(Viewer),{_slug:"template_tag_handler",_attr_default:{supports_modifiers:!1,dynamic:!1,props:{}},render:function(item,instance){var dfr=$.Deferred();return this.call_attribute("render",item,instance,dfr),dfr.promise()},add_prop:function(prop,fn){var a="props",props=this.get_attribute(a);if(!this.util.is_string(prop)||!this.util.is_func(fn))return!1;(props=this.util.is_obj(props,!1)?props:{})[prop]=fn,this.set_attribute(a,props)},handle_prop:function(prop,item,instance){var props=this.get_attribute("props");return this.util.is_obj(props)&&prop in props&&this.util.is_func(props[prop])?props[prop].call(this,item,instance):item.get_viewer().get_label(prop)}});View.Template_Tag_Handler=Component.extend(Template),View=SLB.attach("View",View)})(jQuery);
window.SLB&&SLB.has_child("View.extend_theme")&&SLB.View.extend_theme("slb_baseline",{breakpoints:{small:480,large:1024},offset:function(){var o=document.documentElement.clientWidth>this.get_breakpoint("small")?{width:32,height:55}:{width:0,height:0};return o},margin:function(){var m=document.documentElement.clientWidth>this.get_breakpoint("small")?{height:50,width:20}:{height:0,width:0};return m}});
window.SLB&&SLB.has_child("View.extend_theme")&&!function($){SLB.View.extend_theme("slb_default",{transition:{open:function(v,dfr){var l=v.get_layout().hide(),o=v.get_overlay().hide(),thm=this,v=v.dom_get();return v.find(".slb_content").css({width:"",height:""}).find(this.get_tag_selector()).hide(),v.find(".slb_details").height(0),v.show({always:function(){var pos={top_base:$(document).scrollTop()};document.documentElement.clientWidth>thm.get_breakpoint("small")&&(pos.top=pos.top_base+$(window).height()/2-l.height()/2,!(pos.top<pos.top_base))||(pos.top=pos.top_base),o.fadeIn({always:function(){l.css(pos),dfr.resolve()}})}}),dfr.promise()},close:function(v,dfr){function reset(){c.width("").height(""),l.css("opacity",""),dfr.resolve()}var pos,anims,l=v.get_layout(),c=l.find(".slb_content");return v.animation_enabled()&&document.documentElement.clientWidth>this.get_breakpoint("small")?(anims={layout:{opacity:0,top:$(document).scrollTop()+$(window).height()/2},content:{width:0,height:0},speed:"fast"},pos=l.animate(anims.layout,anims.speed).promise(),anims=c.animate(anims.content,anims.speed).promise(),$.when(pos,anims).done(function(){v.get_overlay().fadeOut({always:function(){reset()}})})):(l.css("opacity",0),reset()),dfr.promise()},load:function(v){return v.get_layout().find(".slb_loading").show(),(document.documentElement.clientWidth>this.get_breakpoint("small")?v.get_layout().fadeIn():v.get_layout().show()).promise()},unload:function(v,dfr){var v=v.get_layout(),det=v.find(".slb_details"),v=v.find(".slb_content "+this.get_tag_selector());return det.css({height:0}),v.hide(),$.when(det.promise(),v.promise()).done(function(){dfr.resolve()}),dfr.promise()},complete:function(v,dfr){var dims_item,dims_det_height,pos,thm,v=v.get_layout(),loader=v.find(".slb_loading"),det=v.find(".slb_details"),det_data=det.find(".slb_data"),c=v.find(".slb_content"),c_tag=c.find(this.get_tag_selector());return document.documentElement.clientWidth>this.get_breakpoint("small")?(dims_item=this.get_item_dimensions(),det.width(dims_item.width),dims_det_height=det_data.outerHeight(),det.width(""),(pos={top_base:$(document).scrollTop()}).top=pos.top_base+$(window).height()/2-(dims_det_height+dims_item.height)/2,pos.top<pos.top_base&&(pos.top=pos.top_base),pos=v.animate(pos,"fast").promise(),dims_item=c.animate(dims_item,"fast").promise(),thm=this,$.when(pos,dims_item).done(function(){loader.fadeOut("fast",function(){c.find(thm.get_tag_selector("item","content")).fadeIn(function(){c_tag.show(),det.animate({height:det_data.outerHeight()},"slow").promise().done(function(){det.height(""),dfr.resolve()})})})})):(loader.hide(),c_tag.show(),det.height(""),dfr.resolve()),dfr.promise()}}})}(jQuery);
window.SLB&&SLB.has_child("View.extend_template_tag_handler")&&SLB.View.extend_template_tag_handler("item",{render:function(item,tag,dfr){var m="get_"+tag.get_prop(),m=this.util.is_method(item,m)?item[m]():item.get_attribute(tag.get_prop(),"");return this.util.is_promise(m)?m.done(function(output){dfr.resolve(output)}):dfr.resolve(m),dfr.promise()}});
window.SLB&&SLB.has_child("View.extend_template_tag_handler")&&SLB.View.extend_template_tag_handler("ui",{_hooks:function(){this.on("dom_init",function(ev){this.call_attribute("events_init",ev)})},events_init:function(ev){var ev=ev.data.template.get_theme().get_viewer(),thm=ev.get_theme();ev.on("events-complete",function(ev,v){thm.dom_get_tag("ui","close").click(function(){return v.close()}),thm.dom_get_tag("ui","nav_next").click(function(){v.item_next()}),thm.dom_get_tag("ui","nav_prev").click(function(){v.item_prev()}),thm.dom_get_tag("ui","slideshow_control").click(function(){v.slideshow_toggle()})}),ev.on("slideshow-toggle",function(ev,v){var tags=thm.get_tags("ui","slideshow_control");if(tags.length)for(var x=0;x<tags.length;x++)tags[x].render(v.get_item()).done(function(r){r.tag.dom_get().html(r.output)})})},render:function(item,tag,dfr){item=this.handle_prop(tag.get_prop(),item,tag);return this.util.is_promise(item)?item.done(function(output){dfr.resolve(output)}):dfr.resolve(item),dfr.promise()},props:{slideshow_control:function(item){var item=item.get_viewer(),prop=item.slideshow_active()?"slideshow_stop":"slideshow_start";return item.get_label(prop)},group_status:function(item){if(item.get_group().is_single())return"";var key,ph,out=item.get_viewer().get_label("group_status"),handlers={current:function(){return item.get_group(!0).get_pos()+1},total:function(){return item.get_group().get_size()}};for(key in handlers)-1!==out.indexOf(ph="%"+key+"%")&&(out=out.replace(new RegExp(ph,"ig"),handlers[key]()));return out}}});
window.SLB&&SLB.has_child("View.extend_content_handler")&&!function($){SLB.View.extend_content_handler("image",{render:function(item,dfr){var img=new Image;return $(img).on("load",function(e){var out;item.set_data(img),item.set_attribute("dimensions",{width:img.width,height:img.height}),out=$("<img />",{src:item.get_uri()}),dfr.resolve(out)}),img.src=item.get_uri(),dfr.promise()}})}(jQuery);