@symbo.ls/utils 3.14.772 → 3.14.774

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";var u=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var a=(t,n)=>{for(var o in n)u(t,o,{get:n[o],enumerable:!0})},g=(t,n,o,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of p(n))!f.call(t,r)&&r!==o&&u(t,r,{get:()=>n[r],enumerable:!(e=l(n,r))||e.enumerable});return t};var x=t=>g(u({},"__esModule",{value:!0}),t);var F={};a(F,{cloneFunction:()=>b,debounce:()=>y,debounceOnContext:()=>d,hasHandlerPlugin:()=>v,isStringFunction:()=>T,memoize:()=>m,resolveHandler:()=>w,runPluginHook:()=>O});module.exports=x(F);function y(t,n,o){let e;return function(){const r=this,s=arguments,c=function(){e=null,o||t.apply(r,s)},i=o&&!e;clearTimeout(e),e=setTimeout(c,n),i&&t.apply(r,s)}}const d=(t,n,o=300)=>{let e;return(...r)=>{clearTimeout(e),e=setTimeout(()=>{n.apply(t,r)},o)}},m=t=>{const n={};return(...o)=>{const e=o[0];if(e in n)return n[e];{const r=t(e);return n[e]=r,r}}},H=/^((function\s*\([^)]*\)\s*\{[^}]*\})|(\([^)]*\)\s*=>))/,T=t=>H.test(t),v=t=>{const n=t?.plugins;if(!n||!n.length)return!1;for(const o of n)if(o.resolveHandler)return!0;return!1},w=(t,n)=>{if(typeof t=="function")return t;const o=n?.context?.plugins;if(!o)return t;for(const e of o)if(e.resolveHandler){const r=e.resolveHandler(t,n);if(typeof r=="function")return r}return t},O=(t,n,...o)=>{const e=n?.context?.plugins;if(!e)return!1;let r=!1;for(const s of e)typeof s[t]=="function"&&(s[t](n,...o),r=!0);return r};function b(t,n=window){const o=function(){return t.apply(n,arguments)};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(o[e]=t[e]);return o}
1
+ "use strict";var u=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var a=(t,n)=>{for(var o in n)u(t,o,{get:n[o],enumerable:!0})},g=(t,n,o,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of p(n))!f.call(t,r)&&r!==o&&u(t,r,{get:()=>n[r],enumerable:!(e=l(n,r))||e.enumerable});return t};var x=t=>g(u({},"__esModule",{value:!0}),t);var F={};a(F,{cloneFunction:()=>O,debounce:()=>y,debounceOnContext:()=>d,hasHandlerPlugin:()=>v,isStringFunction:()=>T,memoize:()=>m,resolveHandler:()=>w,runPluginHook:()=>b});module.exports=x(F);function y(t,n,o){let e;return function(){const r=this,s=arguments,c=function(){e=null,o||t.apply(r,s)},i=o&&!e;clearTimeout(e),e=setTimeout(c,n),i&&t.apply(r,s)}}const d=(t,n,o=300)=>{let e;return(...r)=>{clearTimeout(e),e=setTimeout(()=>{n.apply(t,r)},o)}},m=t=>{const n={};return(...o)=>{const e=o[0];if(e in n)return n[e];{const r=t(e);return n[e]=r,r}}},H=/^\s*(?:async\s+)?(?:function\b|\([^)]*\)\s*=>|[a-zA-Z_$][\w$]*\s*=>)/,T=t=>H.test(t),v=t=>{const n=t?.plugins;if(!n||!n.length)return!1;for(const o of n)if(o.resolveHandler)return!0;return!1},w=(t,n)=>{if(typeof t=="function")return t;const o=n?.context?.plugins;if(!o)return t;for(const e of o)if(e.resolveHandler){const r=e.resolveHandler(t,n);if(typeof r=="function")return r}return t},b=(t,n,...o)=>{const e=n?.context?.plugins;if(!e)return!1;let r=!1;for(const s of e)typeof s[t]=="function"&&(s[t](n,...o),r=!0);return r};function O(t,n=window){const o=function(){return t.apply(n,arguments)};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(o[e]=t[e]);return o}
@@ -1,2 +1,2 @@
1
- "use strict";var A=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var W=(i,r)=>{for(var t in r)A(i,t,{get:r[t],enumerable:!0})},T=(i,r,t,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of O(r))!E.call(i,s)&&s!==t&&A(i,s,{get:()=>r[s],enumerable:!(e=L(r,s))||e.enumerable});return i};var x=i=>T(A({},"__esModule",{value:!0}),i);var C={};W(C,{generateHeadArrayTags:()=>w,generateMetaTags:()=>_,getPageMetadata:()=>P,hashContent:()=>b});module.exports=x(C);var M=require("./types.js");const a=i=>{if(i==null)return"";const r={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};return i.toString().replace(/[&<>"']/g,t=>r[t])},D=i=>Object.entries(i||{}).filter(([r,t])=>t!==void 0).map(([r,t])=>`${r}="${a(t)}"`).join(" "),b=i=>{let r=5381;const t=String(i);for(let e=0;e<t.length;e++)r=(r*33^t.charCodeAt(e))>>>0;return r.toString(36)},R=new Set(["jsonLd","styles","scripts"]),w=i=>{const r=[];if(Array.isArray(i.jsonLd))for(const t of i.jsonLd){if(t==null)continue;const e=typeof t=="string"?t:JSON.stringify(t),s=String(e).replace(/<\/script/gi,"<\\/script");r.push(`<script type="application/ld+json" data-smbls-jsonld="${b(e)}">${s}<\/script>`)}if(Array.isArray(i.styles))for(const t of i.styles){if(t==null||!String(t).trim())continue;const e=String(t).replace(/<\/style/gi,"<\\/style");r.push(`<style data-smbls-style="${b(e)}">${e}</style>`)}if(Array.isArray(i.scripts))for(const t of i.scripts){if(!t)continue;const e=typeof t=="string",s=e?t:t.src;if(!s&&!t.body)continue;const o=[];s&&o.push(`src="${a(s)}"`),e||(t.type&&o.push(`type="${a(t.type)}"`),t.async&&o.push("async"),t.defer&&o.push("defer"),t.integrity&&o.push(`integrity="${a(t.integrity)}"`),t.crossorigin&&o.push(`crossorigin="${a(t.crossorigin)}"`),t.referrerpolicy&&o.push(`referrerpolicy="${a(t.referrerpolicy)}"`),t.nomodule&&o.push("nomodule"));const f=` data-smbls-script="${a(s||b(t.body||""))}"`;if(!e&&t.body){const h=String(t.body).replace(/<\/script/gi,"<\\/script");r.push(`<script ${o.join(" ")}${f}>${h}<\/script>`)}else r.push(`<script ${o.join(" ")}${f}><\/script>`)}return r},_=(i,r)=>{r||(i={...i,robots:"noindex"});const t=Object.entries(i).reduce((e,[s,o])=>{if(!o&&o!==0&&o!==!1||R.has(s))return e;if(s==="title")return e.push(`<title>${a(o)}</title>`),e;if(s==="canonical")return e.push(`<link rel="canonical" href="${a(o)}">`),e;if(s==="manifest")return e.push(`<link rel="manifest" href="${a(o)}">`),e;if(s==="favicon"||s==="favicons"||s==="icon"||s==="icons")return(Array.isArray(o)?o:[o]).forEach(p=>{if(typeof p=="string")e.push(`<link rel="icon" href="${a(p)}">`);else if(typeof p=="object"){const u=D(p);/rel=/.test(u)?e.push(`<link ${u}>`):e.push(`<link rel="icon" ${u}>`)}}),e;if(s==="alternate")return(Array.isArray(o)?o:[o]).forEach(p=>{if(typeof p=="object"){const u=Object.entries(p).filter(([n,g])=>g!==void 0).map(([n,g])=>`${n}="${a(g)}"`).join(" ");e.push(`<link rel="alternate" ${u}>`)}}),e;const f=(l,p,u="name")=>{if(typeof p=="string"||typeof p=="number"||typeof p=="boolean")e.push(`<meta ${u}="${a(l)}" content="${a(p)}">`);else if(Array.isArray(p))p.forEach(n=>{if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")e.push(`<meta ${u}="${a(l)}" content="${a(n)}">`);else if(typeof n=="object"){const g=Object.entries(n).filter(([d,c])=>c!==void 0).map(([d,c])=>`${d}="${a(c)}"`).join(" ");e.push(`<meta ${g}>`)}});else if(typeof p=="object"){const n=Object.entries(p).filter(([g,d])=>d!==void 0).map(([g,d])=>`${g}="${a(d)}"`).join(" ");e.push(`<meta ${n}>`)}};if(s.startsWith("http-equiv:")){const l=s.replace("http-equiv:","");return f(l,o,"http-equiv"),e}if(s.startsWith("itemprop:")){const l=s.replace("itemprop:","");return f(l,o,"itemprop"),e}const y=["og:","twitter:","fb:","article:","profile:","book:","business:","music:","product:","video:","DC:","DCTERMS:"].find(l=>s.startsWith(l));if(y){const l=s.replace(y,"");return f(`${y.replace(":","")}:${l}`,o,y==="twitter:"||y==="DC:"||y==="DCTERMS:"?"name":"property"),e}if(s.startsWith("apple:")||s.startsWith("msapplication:")){const l=s.startsWith("apple:")?"apple-":"msapplication-",p=s.replace(/^apple:|^msapplication:/,"");return f(`${l}${p}`,o,"name"),e}return f(s,o),e},['<meta charset="UTF-8">','<meta name="viewport" content="width=device-width, initial-scale=1">']);return t.push(...w(i)),t.join(`
2
- `)},q=i=>typeof i=="string"&&i.length>0&&!i.startsWith("/")&&!i.startsWith("http");function F(i,r){if(!r||typeof r!="object")return i;const t=s=>{if(!q(s))return s;const o=r[s];return o?.src?o.src:s},e={...i};for(const[s,o]of Object.entries(e))typeof o=="string"?e[s]=t(o):Array.isArray(o)&&(e[s]=o.map(f=>typeof f=="string"?t(f):f));return e}function m(i,r){if(!i||!r)return;const t=r.split(".");let e=i;for(const s of t){if(e==null||typeof e!="object")return;e=e[s]}return e}function K(i,r,t){const s=(r.config||r.settings||{}).polyglot||r.polyglot,o=t?.lang||s?.defaultLang||"en",h=(s?.translations||{})[o]||{},y=t?.state||{},l={...i};for(const[p,u]of Object.entries(l))typeof u!="string"||!u.includes("{{")||(l[p]=u.replace(/\{\{\s*([^|{}]+?)\s*(?:\|\s*(\w+)\s*)?\}\}/g,(n,g,d)=>{const c=g.trim();if(d==="polyglot")return h[c]??m(h,c)??n;if(d==="getLocalStateLang")return m(y,c+o)??n;const $=m(y,c);return $!==void 0?$:h[c]??m(h,c)??n}));return l}function S(i){const r={...i};for(const[t,e]of Object.entries(r))if(typeof e=="function"){const s=e.toString(),o=s.match(/el\.call\(\s*["']getLocalStateLang["']\s*,\s*["']([^"']+)["']\s*\)/);if(o){r[t]=`{{ ${o[1]} | getLocalStateLang }}`;continue}const f=s.match(/el\.call\(\s*["']polyglot["']\s*,\s*["']([^"']+)["']\s*\)/);if(f){r[t]=`{{ ${f[1]} | polyglot }}`;continue}const h=s.match(/s\.(\w+(?:\.\w+)+)/);if(h){r[t]=`{{ ${h[1]} }}`;continue}delete r[t]}else if(typeof e=="string"){const s=e.match(/el\.call\(\s*["']getLocalStateLang["']\s*,\s*["']([^"']+)["']\s*\)/);if(s){r[t]=`{{ ${s[1]} | getLocalStateLang }}`;continue}const o=e.match(/el\.call\(\s*["']polyglot["']\s*,\s*["']([^"']+)["']\s*\)/);if(o){r[t]=`{{ ${o[1]} | polyglot }}`;continue}if(e.includes("=>")&&e.includes("s.")){const f=e.match(/s\.(\w+(?:\.\w+)+)/);if(f){r[t]=`{{ ${f[1]} }}`;continue}}}return r}function P(i,r,t,{isProduction:e=!1,channel:s="production"}={}){const o=i.pages?.[r],f=(0,M.isObject)(o?.state)&&o?.state,h=o?.metadata||o?.helmet||f||{},y=S(h),l=new Set(Object.keys(y)),p=i.app?.metadata||{},u=S(p);let n={};if(i.integrations?.seo?n={...i.integrations.seo,...u,...y}:Object.keys(u).length?n={...u,...y}:n={...y},!n.title){const c=i.name||i.key;c?e?n.title=c:s==="development"?n.title=`${c} / dev:symbo.ls`:s==="staging"?n.title=`${c} / staging:symbo.ls`:n.title=`${c} / symbo.ls`:n.title="Symbols demo"}n=K(n,i,t),n.title&&(l.has("title")||!n["og:title"])&&(l.has("og:title")||(n["og:title"]=n.title)),n.description&&(l.has("description")||!n["og:description"])&&(l.has("og:description")||(n["og:description"]=n.description)),n.title&&!n["twitter:title"]&&(n["twitter:title"]=n.title),n.description&&!n["twitter:description"]&&(n["twitter:description"]=n.description);const g=t?.actualPathname||r;if(n["og:url"]||n.url){const c=(n["og:url"]||n.url||"").replace(/\/$/,"");if(c&&g&&g!=="/"){const $=g.startsWith("/")?g:"/"+g;n["og:url"]=c+$}}n=F(n,i.files);const d=i.name||i.app?.metadata?.title||i.app?.name||"";for(const[c,$]of Object.entries(n))if(typeof $=="string"&&$.includes("{{")){const j=$.replace(/\{\{[^}]*\}\}/g,"").trim();j?n[c]=j:c==="title"?n[c]=d:delete n[c]}return n}
1
+ "use strict";var S=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var T=(n,r)=>{for(var t in r)S(n,t,{get:r[t],enumerable:!0})},x=(n,r,t,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of E(r))!W.call(n,s)&&s!==t&&S(n,s,{get:()=>r[s],enumerable:!(e=O(r,s))||e.enumerable});return n};var D=n=>x(S({},"__esModule",{value:!0}),n);var H={};T(H,{generateHeadArrayTags:()=>L,generateMetaTags:()=>_,getPageMetadata:()=>C,hashContent:()=>b});module.exports=D(H);var A=require("./types.js"),w=require("./function.js");const a=n=>{if(n==null)return"";const r={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};return n.toString().replace(/[&<>"']/g,t=>r[t])},F=n=>Object.entries(n||{}).filter(([r,t])=>t!==void 0).map(([r,t])=>`${r}="${a(t)}"`).join(" "),b=n=>{let r=5381;const t=String(n);for(let e=0;e<t.length;e++)r=(r*33^t.charCodeAt(e))>>>0;return r.toString(36)},R=new Set(["jsonLd","styles","scripts"]),L=n=>{const r=[];if(Array.isArray(n.jsonLd))for(const t of n.jsonLd){if(t==null)continue;const e=typeof t=="string"?t:JSON.stringify(t),s=String(e).replace(/<\/script/gi,"<\\/script");r.push(`<script type="application/ld+json" data-smbls-jsonld="${b(e)}">${s}<\/script>`)}if(Array.isArray(n.styles))for(const t of n.styles){if(t==null||!String(t).trim())continue;const e=String(t).replace(/<\/style/gi,"<\\/style");r.push(`<style data-smbls-style="${b(e)}">${e}</style>`)}if(Array.isArray(n.scripts))for(const t of n.scripts){if(!t)continue;const e=typeof t=="string",s=e?t:t.src;if(!s&&!t.body)continue;const o=[];s&&o.push(`src="${a(s)}"`),e||(t.type&&o.push(`type="${a(t.type)}"`),t.async&&o.push("async"),t.defer&&o.push("defer"),t.integrity&&o.push(`integrity="${a(t.integrity)}"`),t.crossorigin&&o.push(`crossorigin="${a(t.crossorigin)}"`),t.referrerpolicy&&o.push(`referrerpolicy="${a(t.referrerpolicy)}"`),t.nomodule&&o.push("nomodule"));const f=` data-smbls-script="${a(s||b(t.body||""))}"`;if(!e&&t.body){const h=String(t.body).replace(/<\/script/gi,"<\\/script");r.push(`<script ${o.join(" ")}${f}>${h}<\/script>`)}else r.push(`<script ${o.join(" ")}${f}><\/script>`)}return r},_=(n,r)=>{r||(n={...n,robots:"noindex"});const t=Object.entries(n).reduce((e,[s,o])=>{if(!o&&o!==0&&o!==!1||R.has(s))return e;if(s==="title")return e.push(`<title>${a(o)}</title>`),e;if(s==="canonical")return e.push(`<link rel="canonical" href="${a(o)}">`),e;if(s==="manifest")return e.push(`<link rel="manifest" href="${a(o)}">`),e;if(s==="favicon"||s==="favicons"||s==="icon"||s==="icons")return(Array.isArray(o)?o:[o]).forEach(p=>{if(typeof p=="string")e.push(`<link rel="icon" href="${a(p)}">`);else if(typeof p=="object"){const u=F(p);/rel=/.test(u)?e.push(`<link ${u}>`):e.push(`<link rel="icon" ${u}>`)}}),e;if(s==="alternate")return(Array.isArray(o)?o:[o]).forEach(p=>{if(typeof p=="object"){const u=Object.entries(p).filter(([i,g])=>g!==void 0).map(([i,g])=>`${i}="${a(g)}"`).join(" ");e.push(`<link rel="alternate" ${u}>`)}}),e;const f=(l,p,u="name")=>{if(typeof p=="string"||typeof p=="number"||typeof p=="boolean")e.push(`<meta ${u}="${a(l)}" content="${a(p)}">`);else if(Array.isArray(p))p.forEach(i=>{if(typeof i=="string"||typeof i=="number"||typeof i=="boolean")e.push(`<meta ${u}="${a(l)}" content="${a(i)}">`);else if(typeof i=="object"){const g=Object.entries(i).filter(([d,c])=>c!==void 0).map(([d,c])=>`${d}="${a(c)}"`).join(" ");e.push(`<meta ${g}>`)}});else if(typeof p=="object"){const i=Object.entries(p).filter(([g,d])=>d!==void 0).map(([g,d])=>`${g}="${a(d)}"`).join(" ");e.push(`<meta ${i}>`)}};if(s.startsWith("http-equiv:")){const l=s.replace("http-equiv:","");return f(l,o,"http-equiv"),e}if(s.startsWith("itemprop:")){const l=s.replace("itemprop:","");return f(l,o,"itemprop"),e}const y=["og:","twitter:","fb:","article:","profile:","book:","business:","music:","product:","video:","DC:","DCTERMS:"].find(l=>s.startsWith(l));if(y){const l=s.replace(y,"");return f(`${y.replace(":","")}:${l}`,o,y==="twitter:"||y==="DC:"||y==="DCTERMS:"?"name":"property"),e}if(s.startsWith("apple:")||s.startsWith("msapplication:")){const l=s.startsWith("apple:")?"apple-":"msapplication-",p=s.replace(/^apple:|^msapplication:/,"");return f(`${l}${p}`,o,"name"),e}return f(s,o),e},['<meta charset="UTF-8">','<meta name="viewport" content="width=device-width, initial-scale=1">']);return t.push(...L(n)),t.join(`
2
+ `)},q=n=>typeof n=="string"&&n.length>0&&!n.startsWith("/")&&!n.startsWith("http");function K(n,r){if(!r||typeof r!="object")return n;const t=s=>{if(!q(s))return s;const o=r[s];return o?.src?o.src:s},e={...n};for(const[s,o]of Object.entries(e))typeof o=="string"?e[s]=t(o):Array.isArray(o)&&(e[s]=o.map(f=>typeof f=="string"?t(f):f));return e}function m(n,r){if(!n||!r)return;const t=r.split(".");let e=n;for(const s of t){if(e==null||typeof e!="object")return;e=e[s]}return e}function P(n,r,t){const s=(r.config||r.settings||{}).polyglot||r.polyglot,o=t?.lang||s?.defaultLang||"en",h=(s?.translations||{})[o]||{},y=t?.state||{},l={...n};for(const[p,u]of Object.entries(l))typeof u!="string"||!u.includes("{{")||(l[p]=u.replace(/\{\{\s*([^|{}]+?)\s*(?:\|\s*(\w+)\s*)?\}\}/g,(i,g,d)=>{const c=g.trim();if(d==="polyglot")return h[c]??m(h,c)??i;if(d==="getLocalStateLang")return m(y,c+o)??i;const $=m(y,c);return $!==void 0?$:h[c]??m(h,c)??i}));return l}function M(n){if(!(0,A.isObject)(n))return{};const r={...n};for(const[t,e]of Object.entries(r))if(typeof e=="function"){const s=e.toString(),o=s.match(/el\.call\(\s*["']getLocalStateLang["']\s*,\s*["']([^"']+)["']\s*\)/);if(o){r[t]=`{{ ${o[1]} | getLocalStateLang }}`;continue}const f=s.match(/el\.call\(\s*["']polyglot["']\s*,\s*["']([^"']+)["']\s*\)/);if(f){r[t]=`{{ ${f[1]} | polyglot }}`;continue}const h=s.match(/s\.(\w+(?:\.\w+)+)/);if(h){r[t]=`{{ ${h[1]} }}`;continue}delete r[t]}else if(typeof e=="string"){const s=e.match(/el\.call\(\s*["']getLocalStateLang["']\s*,\s*["']([^"']+)["']\s*\)/);if(s){r[t]=`{{ ${s[1]} | getLocalStateLang }}`;continue}const o=e.match(/el\.call\(\s*["']polyglot["']\s*,\s*["']([^"']+)["']\s*\)/);if(o){r[t]=`{{ ${o[1]} | polyglot }}`;continue}if(e.includes("=>")&&e.includes("s.")){const f=e.match(/s\.(\w+(?:\.\w+)+)/);if(f){r[t]=`{{ ${f[1]} }}`;continue}}(0,w.isStringFunction)(e)&&delete r[t]}return r}function C(n,r,t,{isProduction:e=!1,channel:s="production"}={}){const o=n.pages?.[r],f=(0,A.isObject)(o?.state)&&o?.state,h=o?.metadata||o?.helmet||f||{},y=M(h),l=new Set(Object.keys(y)),p=n.app?.metadata||{},u=M(p);let i={};if(n.integrations?.seo?i={...n.integrations.seo,...u,...y}:Object.keys(u).length?i={...u,...y}:i={...y},!i.title){const c=n.name||n.key;c?e?i.title=c:s==="development"?i.title=`${c} / dev:symbo.ls`:s==="staging"?i.title=`${c} / staging:symbo.ls`:i.title=`${c} / symbo.ls`:i.title="Symbols demo"}i=P(i,n,t),i.title&&(l.has("title")||!i["og:title"])&&(l.has("og:title")||(i["og:title"]=i.title)),i.description&&(l.has("description")||!i["og:description"])&&(l.has("og:description")||(i["og:description"]=i.description)),i.title&&!i["twitter:title"]&&(i["twitter:title"]=i.title),i.description&&!i["twitter:description"]&&(i["twitter:description"]=i.description);const g=t?.actualPathname||r;if(i["og:url"]||i.url){const c=(i["og:url"]||i.url||"").replace(/\/$/,"");if(c&&g&&g!=="/"){const $=g.startsWith("/")?g:"/"+g;i["og:url"]=c+$}}i=K(i,n.files);const d=n.name||n.app?.metadata?.title||n.app?.name||"";for(const[c,$]of Object.entries(i))if(typeof $=="string"&&$.includes("{{")){const j=$.replace(/\{\{[^}]*\}\}/g,"").trim();j?i[c]=j:c==="title"?i[c]=d:delete i[c]}return i}
@@ -1,4 +1,4 @@
1
- "use strict";var D=Object.create;var g=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var M=(e,t)=>{for(var n in t)g(e,n,{get:t[n],enumerable:!0})},O=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of I(t))!F.call(e,r)&&r!==n&&g(e,r,{get:()=>t[r],enumerable:!(o=T(t,r))||o.enumerable});return e};var m=(e,t,n)=>(n=e!=null?D(L(e)):{},O(t||!e||!e.__esModule?g(n,"default",{value:e,enumerable:!0}):n,e)),J=e=>O(g({},"__esModule",{value:!0}),e);var wt={};M(wt,{call:()=>ut,defineSetter:()=>rt,error:()=>S,get:()=>U,getChildren:()=>Z,getContext:()=>ot,getDB:()=>at,getPath:()=>K,getQuery:()=>ht,getRef:()=>Y,getRoot:()=>tt,getRootContext:()=>nt,getRootData:()=>et,getRootState:()=>q,isMethod:()=>vt,keys:()=>j,log:()=>st,lookdown:()=>z,lookdownAll:()=>G,lookup:()=>B,nextElement:()=>ct,parse:()=>Q,parseDeep:()=>w,previousElement:()=>lt,remove:()=>H,setActiveRootState:()=>X,setNodeStyles:()=>C,setProps:()=>W,spotByPath:()=>V,variables:()=>ft,verbose:()=>N,warn:()=>it});module.exports=J(wt);var v=require("./triggerEvent.js"),d=require("./keys.js"),f=require("./types.js"),E=require("./object.js"),P=require("./env.js"),A=require("./array.js"),b=require("./cache.js");const h="production";function V(e){const t=this,{__ref:n}=t,o=[].concat(e);let r=n.root[o[0]];if(!o||!o.length)return console.log(o,"on",t.key,"is undefined");for(;r.key===o[0]&&(o.shift(),!!o.length);)if(r=r[o[0]],!r)return;return r}function B(e){const t=this;let{parent:n}=t;if((0,f.isFunction)(e))return n.state&&e(n,n.state,n.context)?n:n.parent?n.lookup(e):void 0;if(t[e])return t[e];for(;n.param!==e;){if(n[e])return n[e];if(n=n.parent,!n)return}return n}function z(e){const t=this,{__ref:n}=t,o=n?.__children;if(o)for(let r=0;r<o.length;r++){const s=o[r],i=t[s];if(s===e)return i;if((0,f.isFunction)(e)){const l=e(i,i.state,i.context);if(i.state&&l)return i}const c=i?.lookdown?.(e);if(c)return c}}function G(e,t=[]){const n=this,{__ref:o}=n,r=o?.__children;if(r){for(let s=0;s<r.length;s++){const i=r[s],c=n[i];if(i===e)t.push(c);else if((0,f.isFunction)(e)){const l=e(c,c.state,c.context);c.state&&l&&t.push(c)}c?.lookdownAll?.(e,t)}return t.length?t:void 0}}function C(e={}){const t=this;if(t.node?.style){for(const n in e){const o=e[n],r=t[n];if((0,f.isObject)(o)&&r)C.call(r,o);else if(o!=null){const s=n.replace(/[A-Z]/g,c=>"-"+c.toLowerCase()),i=String(o).replace(/\s*!important\s*$/,"");t.node.style.setProperty(s,i,"important")}}return t}}function H(e){const t=this;if((0,v.triggerEventOn)("beforeRemove",t,e)===!1)return t;(0,f.isFunction)(t.node.remove)?t.node.remove():(0,P.isProduction)()||(console.warn("This item cant be removed"),t.log()),delete t.parent[t.key],t.parent.__ref&&(t.parent.__ref.__children=(0,A.removeValueFromArray)(t.parent.__ref.__children,t.key)),(0,v.triggerEventOn)("remove",t,e)}function U(e){return this[e]}function W(e,t){const n=this;if(e)return n.update(e,t),n}function Y(e){return e?this.__ref&&this.__ref[e]:this.__ref}function Z(){return this.getRef("__children").map(t=>this[t])}function K(){return this.getRef().path}let R=null;const X=e=>{R=e||null},$=()=>R||null;function q(e){let t=null;const n=o=>o.__element&&o.root?.isRootState;if(!this)t=$();else if(n(this))t=this.root;else if(this.__ref&&this.__ref.path){const o=this.state&&n(this.state),r=(0,f.isFunction)(this.state)&&this.parent.state&&n(this.parent.state);(o||r)&&(t=this.state.root||this.parent.state.root)}return t||(t=$()),e?t?.[e]:t}function tt(e){const t=this?.__ref?.root||this.getRootState()?.__element;if(!t)throw new Error(`[smbls] getRoot() could not resolve a root element for "${this?.key||"<unknown>"}" \u2014 it has no __ref (never went through create()) and no root state is registered. Answering undefined here used to no-op silently for every caller.`);return Object.keys(t).length>0&&e?t[e]:t}function et(e){return this.getRoot("data")&&Object.keys(this.getRoot("data")).length>0&&e?this.getRoot("data")[e]:this.getRoot("data")}function nt(e){const t=this.getRoot()?.context;return e?t[e]:t}function ot(e){const t=this.context;return e?t[e]:t}const rt=(e,t,n,o)=>Object.defineProperty(e,t,{get:n,set:o});function j(){const e=this,t=[];for(const n in e)!Object.prototype.hasOwnProperty.call(e,n)||d.DOMQ_PROPERTIES.has(n)&&!d.PARSED_DOMQ_PROPERTIES.has(n)||t.push(n);return t}function Q(e=[]){const t=this,n={},o=j.call(t),r=o.includes("children"),s=e.length?new Set(e):null;for(let i=0;i<o.length;i++){const c=o[i];if(s&&s.has(c)||!Object.prototype.hasOwnProperty.call(t,c)||r&&c==="content")continue;const l=t[c];if(c==="state"){if(t.__ref&&!t.__ref.__hasRootState)continue;const u=(0,f.isFunction)(l&&l.parse)?l.parse():l;n[c]=(0,f.isFunction)(u)?u:JSON.parse(JSON.stringify(u||{}))}else if(c==="scope"){if(t.__ref&&!t.__ref.__hasRootScope)continue;n[c]=JSON.parse(JSON.stringify(l||{}))}else if(c==="props"){const{__element:u,update:a,...p}=t[c];n[c]=p}else(0,f.isDefined)(l)&&Object.prototype.hasOwnProperty.call(t,c)&&(n[c]=l)}return n}function w(e=[],t=new WeakSet){const n=this;if(t.has(n))return;t.add(n);const o=Q.call(n,e),r=e.length?new Set(e):null;for(const s in o){if(r&&r.has(s)||!Object.prototype.hasOwnProperty.call(n,s))continue;const i=o[s];Array.isArray(i)?o[s]=i.map(c=>(0,f.isObjectLike)(c)?w.call(c,e,t):c):(0,f.isObjectLike)(i)&&(o[s]=w.call(i,e,t))}return o}function N(...e){if(h!=="test"&&h!=="development")return;const t=this,{__ref:n}=t;return console.groupCollapsed(t.key),e.length?e.forEach(o=>console.log(`%c${o}:
1
+ "use strict";var D=Object.create;var g=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var M=(e,t)=>{for(var n in t)g(e,n,{get:t[n],enumerable:!0})},O=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of I(t))!F.call(e,r)&&r!==n&&g(e,r,{get:()=>t[r],enumerable:!(o=T(t,r))||o.enumerable});return e};var m=(e,t,n)=>(n=e!=null?D(L(e)):{},O(t||!e||!e.__esModule?g(n,"default",{value:e,enumerable:!0}):n,e)),J=e=>O(g({},"__esModule",{value:!0}),e);var wt={};M(wt,{call:()=>ut,defineSetter:()=>rt,error:()=>S,get:()=>U,getChildren:()=>Z,getContext:()=>ot,getDB:()=>at,getPath:()=>K,getQuery:()=>ht,getRef:()=>Y,getRoot:()=>tt,getRootContext:()=>nt,getRootData:()=>et,getRootState:()=>q,isMethod:()=>vt,keys:()=>j,log:()=>st,lookdown:()=>z,lookdownAll:()=>G,lookup:()=>B,nextElement:()=>ct,parse:()=>Q,parseDeep:()=>w,previousElement:()=>lt,remove:()=>H,setActiveRootState:()=>X,setNodeStyles:()=>C,setProps:()=>W,spotByPath:()=>V,variables:()=>ft,verbose:()=>N,warn:()=>it});module.exports=J(wt);var v=require("./triggerEvent.js"),d=require("./keys.js"),f=require("./types.js"),E=require("./object.js"),P=require("./env.js"),A=require("./array.js"),b=require("./cache.js");const h="production";function V(e){const t=this,{__ref:n}=t,o=[].concat(e);let r=n.root[o[0]];if(!o||!o.length)return console.log(o,"on",t.key,"is undefined");for(;r.key===o[0]&&(o.shift(),!!o.length);)if(r=r[o[0]],!r)return;return r}function B(e){const t=this;let{parent:n}=t;if((0,f.isFunction)(e))return n.state&&e(n,n.state,n.context)?n:n.parent?n.lookup(e):void 0;if(t[e])return t[e];for(;n.param!==e;){if(n[e])return n[e];if(n=n.parent,!n)return}return n}function z(e){const t=this,{__ref:n}=t,o=n?.__children;if(o)for(let r=0;r<o.length;r++){const s=o[r],i=t[s];if(s===e)return i;if((0,f.isFunction)(e)){const l=e(i,i.state,i.context);if(i.state&&l)return i}const c=i?.lookdown?.(e);if(c)return c}}function G(e,t=[]){const n=this,{__ref:o}=n,r=o?.__children;if(r){for(let s=0;s<r.length;s++){const i=r[s],c=n[i];if(i===e)t.push(c);else if((0,f.isFunction)(e)){const l=e(c,c.state,c.context);c.state&&l&&t.push(c)}c?.lookdownAll?.(e,t)}return t.length?t:void 0}}function C(e={}){const t=this;if(t.node?.style){for(const n in e){const o=e[n],r=t[n];if((0,f.isObject)(o)&&r)C.call(r,o);else if(o!=null){const s=n.replace(/[A-Z]/g,c=>"-"+c.toLowerCase()),i=String(o).replace(/\s*!important\s*$/,"");t.node.style.setProperty(s,i,"important")}}return t}}function H(e){const t=this;if((0,v.triggerEventOn)("beforeRemove",t,e)===!1)return t;(0,f.isFunction)(t.node.remove)?t.node.remove():(0,P.isProduction)()||(console.warn("This item cant be removed"),t.log()),delete t.parent[t.key],t.parent.__ref&&(t.parent.__ref.__children=(0,A.removeValueFromArray)(t.parent.__ref.__children,t.key)),(0,v.triggerEventOn)("remove",t,e)}function U(e){return this[e]}function W(e,t){const n=this;if(e)return n.update(e,t),n}function Y(e){return e?this.__ref&&this.__ref[e]:this.__ref}function Z(){const e=this.getRef("__children");return Array.isArray(e)?e.map(t=>this[t]):[]}function K(){return this.getRef().path}let R=null;const X=e=>{R=e||null},$=()=>R||null;function q(e){let t=null;const n=o=>o.__element&&o.root?.isRootState;if(!this)t=$();else if(n(this))t=this.root;else if(this.__ref&&this.__ref.path){const o=this.state&&n(this.state),r=(0,f.isFunction)(this.state)&&this.parent.state&&n(this.parent.state);(o||r)&&(t=this.state.root||this.parent.state.root)}return t||(t=$()),e?t?.[e]:t}function tt(e){const t=this?.__ref?.root||this.getRootState()?.__element;if(!t)throw new Error(`[smbls] getRoot() could not resolve a root element for "${this?.key||"<unknown>"}" \u2014 it has no __ref (never went through create()) and no root state is registered. Answering undefined here used to no-op silently for every caller.`);return Object.keys(t).length>0&&e?t[e]:t}function et(e){return this.getRoot("data")&&Object.keys(this.getRoot("data")).length>0&&e?this.getRoot("data")[e]:this.getRoot("data")}function nt(e){const t=this.getRoot()?.context;return e?t[e]:t}function ot(e){const t=this.context;return e?t[e]:t}const rt=(e,t,n,o)=>Object.defineProperty(e,t,{get:n,set:o});function j(){const e=this,t=[];for(const n in e)!Object.prototype.hasOwnProperty.call(e,n)||d.DOMQ_PROPERTIES.has(n)&&!d.PARSED_DOMQ_PROPERTIES.has(n)||t.push(n);return t}function Q(e=[]){const t=this,n={},o=j.call(t),r=o.includes("children"),s=e.length?new Set(e):null;for(let i=0;i<o.length;i++){const c=o[i];if(s&&s.has(c)||!Object.prototype.hasOwnProperty.call(t,c)||r&&c==="content")continue;const l=t[c];if(c==="state"){if(t.__ref&&!t.__ref.__hasRootState)continue;const u=(0,f.isFunction)(l&&l.parse)?l.parse():l;n[c]=(0,f.isFunction)(u)?u:JSON.parse(JSON.stringify(u||{}))}else if(c==="scope"){if(t.__ref&&!t.__ref.__hasRootScope)continue;n[c]=JSON.parse(JSON.stringify(l||{}))}else if(c==="props"){const{__element:u,update:a,...p}=t[c];n[c]=p}else(0,f.isDefined)(l)&&Object.prototype.hasOwnProperty.call(t,c)&&(n[c]=l)}return n}function w(e=[],t=new WeakSet){const n=this;if(t.has(n))return;t.add(n);const o=Q.call(n,e),r=e.length?new Set(e):null;for(const s in o){if(r&&r.has(s)||!Object.prototype.hasOwnProperty.call(n,s))continue;const i=o[s];Array.isArray(i)?o[s]=i.map(c=>(0,f.isObjectLike)(c)?w.call(c,e,t):c):(0,f.isObjectLike)(i)&&(o[s]=w.call(i,e,t))}return o}function N(...e){if(h!=="test"&&h!=="development")return;const t=this,{__ref:n}=t;return console.groupCollapsed(t.key),e.length?e.forEach(o=>console.log(`%c${o}:
2
2
  `,"font-weight: bold",t[o])):(console.log(n.path),t.keys().forEach(r=>console.log(`%c${r}:`,"font-weight: bold",t[r]))),console.log(t),console.groupEnd(t.key),t}function st(...e){(h==="test"||h==="development")&&console.log(...e)}function it(...e){(h==="test"||h==="development")&&console.warn(...e)}function S(...e){if(h==="test"||h==="development"){if(e[e.length-1]?.debugger)debugger;throw e[e.length-1]?.verbose&&N.call(this),new Error(...e)}}function ct(){const e=this,{key:t,parent:n}=e,{__children:o}=n.__ref,r=o.indexOf(t),s=o[r+1];return n[s]}function lt(e){const t=e||this,{key:n,parent:o}=t,{__children:r}=o.__ref;if(!r)return;const s=r.indexOf(n);return o[r[s-1]]}function ft(e={}){const t=this;t.data||(t.data={}),t.data.varCaches||(t.data.varCaches={});const n=t.data.varCaches,o={};let r;for(const s in e)e[s]!==n[s]&&(r=!0,o[s]=e[s]);return{changed:s=>{if(!r)return;const i=s(o,(0,E.deepClone)(n));for(const c in o)n[c]=o[c];return i},timeout:(s,i)=>{if(!r)return;const c=setTimeout(()=>{s(o),clearTimeout(c)},i)}}}function ut(e,...t){const n=this.context,o=n.utils?.[e]||n.functions?.[e]||n.methods?.[e]||n.snippets?.[e];if(o)try{const r=o.call(this,...t);return r&&typeof r.then=="function"&&r.catch(s=>{S.call(this,s)}),r}catch(r){if(S.call(this,r),n?.strictMode)throw r}}async function at(){const e=this,t=e.context?.fetch;if(!t)return null;if(typeof t.select=="function"){if(!t.__authInitialized&&t.getSession){const{initAdapterAuth:r}=await import("@symbo.ls/fetch");await r(t,e.context)}return t}if(t.__resolved){if(!t.__resolved.__authInitialized&&t.__resolved.getSession){const{initAdapterAuth:r}=await import("@symbo.ls/fetch");await r(t.__resolved,e.context)}return t.__resolved}if(t.__resolving)return t.__resolving;const n=import("@symbo.ls/fetch").then(({resolveDb:r})=>r(t));t.__resolving=n;const o=await n;if(t.__resolved=o,e.context.fetch=o,delete t.__resolving,o?.getSession){const{initAdapterAuth:r}=await import("@symbo.ls/fetch");await r(o,e.context)}return o}function ht(e){const t=this,n=e||b.OPTIONS.useStateQuery||t.context?.useStateQuery;if(!n)return null;const o={};if(y(t,o),n===!0)return o;const r=yt[n];return r?r(o):o}const y=(e,t)=>{const n=e.__ref;if(!n)return;const o=n.__state;o&&typeof o=="string"&&pt(t,o);const r=n.__children;if(r)for(let c=0;c<r.length;c++){const l=e[r[c]];l&&l.__ref&&y(l,t)}const s=n.contentElementKey||"content",i=e[s];i&&i.__ref&&y(i,t)},pt=(e,t)=>{const o=t.replaceAll("../","").replaceAll("~/","").split("/");let r=e;for(let s=0;s<o.length;s++){const i=o[s];s===o.length-1?r[i]||(r[i]=!0):(r[i]===!0&&(r[i]={}),r[i]||(r[i]={}),r=r[i])}},k=(e,t=0)=>{const n=" ".repeat(t),o=Object.entries(e);return o.length?o.map(([s,i])=>i===!0?`${n}${s}`:`${n}${s} {
3
3
  ${k(i,t+1)}
4
4
  ${n}}`).join(`
@@ -1 +1 @@
1
- function l(t,e,o){let n;return function(){const r=this,s=arguments,u=function(){n=null,o||t.apply(r,s)},c=o&&!n;clearTimeout(n),n=setTimeout(u,e),c&&t.apply(r,s)}}const p=(t,e,o=300)=>{let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>{e.apply(t,r)},o)}},f=t=>{const e={};return(...o)=>{const n=o[0];if(n in e)return e[n];{const r=t(n);return e[n]=r,r}}},i=/^((function\s*\([^)]*\)\s*\{[^}]*\})|(\([^)]*\)\s*=>))/,a=t=>i.test(t),g=t=>{const e=t?.plugins;if(!e||!e.length)return!1;for(const o of e)if(o.resolveHandler)return!0;return!1},x=(t,e)=>{if(typeof t=="function")return t;const o=e?.context?.plugins;if(!o)return t;for(const n of o)if(n.resolveHandler){const r=n.resolveHandler(t,e);if(typeof r=="function")return r}return t},y=(t,e,...o)=>{const n=e?.context?.plugins;if(!n)return!1;let r=!1;for(const s of n)typeof s[t]=="function"&&(s[t](e,...o),r=!0);return r};function d(t,e=window){const o=function(){return t.apply(e,arguments)};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(o[n]=t[n]);return o}export{d as cloneFunction,l as debounce,p as debounceOnContext,g as hasHandlerPlugin,a as isStringFunction,f as memoize,x as resolveHandler,y as runPluginHook};
1
+ function l(t,e,o){let n;return function(){const r=this,s=arguments,u=function(){n=null,o||t.apply(r,s)},c=o&&!n;clearTimeout(n),n=setTimeout(u,e),c&&t.apply(r,s)}}const p=(t,e,o=300)=>{let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>{e.apply(t,r)},o)}},f=t=>{const e={};return(...o)=>{const n=o[0];if(n in e)return e[n];{const r=t(n);return e[n]=r,r}}},i=/^\s*(?:async\s+)?(?:function\b|\([^)]*\)\s*=>|[a-zA-Z_$][\w$]*\s*=>)/,a=t=>i.test(t),g=t=>{const e=t?.plugins;if(!e||!e.length)return!1;for(const o of e)if(o.resolveHandler)return!0;return!1},x=(t,e)=>{if(typeof t=="function")return t;const o=e?.context?.plugins;if(!o)return t;for(const n of o)if(n.resolveHandler){const r=n.resolveHandler(t,e);if(typeof r=="function")return r}return t},y=(t,e,...o)=>{const n=e?.context?.plugins;if(!n)return!1;let r=!1;for(const s of n)typeof s[t]=="function"&&(s[t](e,...o),r=!0);return r};function d(t,e=window){const o=function(){return t.apply(e,arguments)};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(o[n]=t[n]);return o}export{d as cloneFunction,l as debounce,p as debounceOnContext,g as hasHandlerPlugin,a as isStringFunction,f as memoize,x as resolveHandler,y as runPluginHook};
@@ -1,2 +1,2 @@
1
- import{isObject as S}from"./types.js";const a=r=>{if(r==null)return"";const o={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};return r.toString().replace(/[&<>"']/g,e=>o[e])},M=r=>Object.entries(r||{}).filter(([o,e])=>e!==void 0).map(([o,e])=>`${o}="${a(e)}"`).join(" "),j=r=>{let o=5381;const e=String(r);for(let t=0;t<e.length;t++)o=(o*33^e.charCodeAt(t))>>>0;return o.toString(36)},w=new Set(["jsonLd","styles","scripts"]),L=r=>{const o=[];if(Array.isArray(r.jsonLd))for(const e of r.jsonLd){if(e==null)continue;const t=typeof e=="string"?e:JSON.stringify(e),n=String(t).replace(/<\/script/gi,"<\\/script");o.push(`<script type="application/ld+json" data-smbls-jsonld="${j(t)}">${n}<\/script>`)}if(Array.isArray(r.styles))for(const e of r.styles){if(e==null||!String(e).trim())continue;const t=String(e).replace(/<\/style/gi,"<\\/style");o.push(`<style data-smbls-style="${j(t)}">${t}</style>`)}if(Array.isArray(r.scripts))for(const e of r.scripts){if(!e)continue;const t=typeof e=="string",n=t?e:e.src;if(!n&&!e.body)continue;const i=[];n&&i.push(`src="${a(n)}"`),t||(e.type&&i.push(`type="${a(e.type)}"`),e.async&&i.push("async"),e.defer&&i.push("defer"),e.integrity&&i.push(`integrity="${a(e.integrity)}"`),e.crossorigin&&i.push(`crossorigin="${a(e.crossorigin)}"`),e.referrerpolicy&&i.push(`referrerpolicy="${a(e.referrerpolicy)}"`),e.nomodule&&i.push("nomodule"));const f=` data-smbls-script="${a(n||j(e.body||""))}"`;if(!t&&e.body){const h=String(e.body).replace(/<\/script/gi,"<\\/script");o.push(`<script ${i.join(" ")}${f}>${h}<\/script>`)}else o.push(`<script ${i.join(" ")}${f}><\/script>`)}return o},x=(r,o)=>{o||(r={...r,robots:"noindex"});const e=Object.entries(r).reduce((t,[n,i])=>{if(!i&&i!==0&&i!==!1||w.has(n))return t;if(n==="title")return t.push(`<title>${a(i)}</title>`),t;if(n==="canonical")return t.push(`<link rel="canonical" href="${a(i)}">`),t;if(n==="manifest")return t.push(`<link rel="manifest" href="${a(i)}">`),t;if(n==="favicon"||n==="favicons"||n==="icon"||n==="icons")return(Array.isArray(i)?i:[i]).forEach(p=>{if(typeof p=="string")t.push(`<link rel="icon" href="${a(p)}">`);else if(typeof p=="object"){const u=M(p);/rel=/.test(u)?t.push(`<link ${u}>`):t.push(`<link rel="icon" ${u}>`)}}),t;if(n==="alternate")return(Array.isArray(i)?i:[i]).forEach(p=>{if(typeof p=="object"){const u=Object.entries(p).filter(([s,g])=>g!==void 0).map(([s,g])=>`${s}="${a(g)}"`).join(" ");t.push(`<link rel="alternate" ${u}>`)}}),t;const f=(l,p,u="name")=>{if(typeof p=="string"||typeof p=="number"||typeof p=="boolean")t.push(`<meta ${u}="${a(l)}" content="${a(p)}">`);else if(Array.isArray(p))p.forEach(s=>{if(typeof s=="string"||typeof s=="number"||typeof s=="boolean")t.push(`<meta ${u}="${a(l)}" content="${a(s)}">`);else if(typeof s=="object"){const g=Object.entries(s).filter(([d,c])=>c!==void 0).map(([d,c])=>`${d}="${a(c)}"`).join(" ");t.push(`<meta ${g}>`)}});else if(typeof p=="object"){const s=Object.entries(p).filter(([g,d])=>d!==void 0).map(([g,d])=>`${g}="${a(d)}"`).join(" ");t.push(`<meta ${s}>`)}};if(n.startsWith("http-equiv:")){const l=n.replace("http-equiv:","");return f(l,i,"http-equiv"),t}if(n.startsWith("itemprop:")){const l=n.replace("itemprop:","");return f(l,i,"itemprop"),t}const y=["og:","twitter:","fb:","article:","profile:","book:","business:","music:","product:","video:","DC:","DCTERMS:"].find(l=>n.startsWith(l));if(y){const l=n.replace(y,"");return f(`${y.replace(":","")}:${l}`,i,y==="twitter:"||y==="DC:"||y==="DCTERMS:"?"name":"property"),t}if(n.startsWith("apple:")||n.startsWith("msapplication:")){const l=n.startsWith("apple:")?"apple-":"msapplication-",p=n.replace(/^apple:|^msapplication:/,"");return f(`${l}${p}`,i,"name"),t}return f(n,i),t},['<meta charset="UTF-8">','<meta name="viewport" content="width=device-width, initial-scale=1">']);return e.push(...L(r)),e.join(`
2
- `)},O=r=>typeof r=="string"&&r.length>0&&!r.startsWith("/")&&!r.startsWith("http");function E(r,o){if(!o||typeof o!="object")return r;const e=n=>{if(!O(n))return n;const i=o[n];return i?.src?i.src:n},t={...r};for(const[n,i]of Object.entries(t))typeof i=="string"?t[n]=e(i):Array.isArray(i)&&(t[n]=i.map(f=>typeof f=="string"?e(f):f));return t}function m(r,o){if(!r||!o)return;const e=o.split(".");let t=r;for(const n of e){if(t==null||typeof t!="object")return;t=t[n]}return t}function W(r,o,e){const n=(o.config||o.settings||{}).polyglot||o.polyglot,i=e?.lang||n?.defaultLang||"en",h=(n?.translations||{})[i]||{},y=e?.state||{},l={...r};for(const[p,u]of Object.entries(l))typeof u!="string"||!u.includes("{{")||(l[p]=u.replace(/\{\{\s*([^|{}]+?)\s*(?:\|\s*(\w+)\s*)?\}\}/g,(s,g,d)=>{const c=g.trim();if(d==="polyglot")return h[c]??m(h,c)??s;if(d==="getLocalStateLang")return m(y,c+i)??s;const $=m(y,c);return $!==void 0?$:h[c]??m(h,c)??s}));return l}function A(r){const o={...r};for(const[e,t]of Object.entries(o))if(typeof t=="function"){const n=t.toString(),i=n.match(/el\.call\(\s*["']getLocalStateLang["']\s*,\s*["']([^"']+)["']\s*\)/);if(i){o[e]=`{{ ${i[1]} | getLocalStateLang }}`;continue}const f=n.match(/el\.call\(\s*["']polyglot["']\s*,\s*["']([^"']+)["']\s*\)/);if(f){o[e]=`{{ ${f[1]} | polyglot }}`;continue}const h=n.match(/s\.(\w+(?:\.\w+)+)/);if(h){o[e]=`{{ ${h[1]} }}`;continue}delete o[e]}else if(typeof t=="string"){const n=t.match(/el\.call\(\s*["']getLocalStateLang["']\s*,\s*["']([^"']+)["']\s*\)/);if(n){o[e]=`{{ ${n[1]} | getLocalStateLang }}`;continue}const i=t.match(/el\.call\(\s*["']polyglot["']\s*,\s*["']([^"']+)["']\s*\)/);if(i){o[e]=`{{ ${i[1]} | polyglot }}`;continue}if(t.includes("=>")&&t.includes("s.")){const f=t.match(/s\.(\w+(?:\.\w+)+)/);if(f){o[e]=`{{ ${f[1]} }}`;continue}}}return o}function D(r,o,e,{isProduction:t=!1,channel:n="production"}={}){const i=r.pages?.[o],f=S(i?.state)&&i?.state,h=i?.metadata||i?.helmet||f||{},y=A(h),l=new Set(Object.keys(y)),p=r.app?.metadata||{},u=A(p);let s={};if(r.integrations?.seo?s={...r.integrations.seo,...u,...y}:Object.keys(u).length?s={...u,...y}:s={...y},!s.title){const c=r.name||r.key;c?t?s.title=c:n==="development"?s.title=`${c} / dev:symbo.ls`:n==="staging"?s.title=`${c} / staging:symbo.ls`:s.title=`${c} / symbo.ls`:s.title="Symbols demo"}s=W(s,r,e),s.title&&(l.has("title")||!s["og:title"])&&(l.has("og:title")||(s["og:title"]=s.title)),s.description&&(l.has("description")||!s["og:description"])&&(l.has("og:description")||(s["og:description"]=s.description)),s.title&&!s["twitter:title"]&&(s["twitter:title"]=s.title),s.description&&!s["twitter:description"]&&(s["twitter:description"]=s.description);const g=e?.actualPathname||o;if(s["og:url"]||s.url){const c=(s["og:url"]||s.url||"").replace(/\/$/,"");if(c&&g&&g!=="/"){const $=g.startsWith("/")?g:"/"+g;s["og:url"]=c+$}}s=E(s,r.files);const d=r.name||r.app?.metadata?.title||r.app?.name||"";for(const[c,$]of Object.entries(s))if(typeof $=="string"&&$.includes("{{")){const b=$.replace(/\{\{[^}]*\}\}/g,"").trim();b?s[c]=b:c==="title"?s[c]=d:delete s[c]}return s}export{L as generateHeadArrayTags,x as generateMetaTags,D as getPageMetadata,j as hashContent};
1
+ import{isObject as S}from"./types.js";import{isStringFunction as M}from"./function.js";const a=r=>{if(r==null)return"";const o={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};return r.toString().replace(/[&<>"']/g,e=>o[e])},w=r=>Object.entries(r||{}).filter(([o,e])=>e!==void 0).map(([o,e])=>`${o}="${a(e)}"`).join(" "),j=r=>{let o=5381;const e=String(r);for(let t=0;t<e.length;t++)o=(o*33^e.charCodeAt(t))>>>0;return o.toString(36)},L=new Set(["jsonLd","styles","scripts"]),O=r=>{const o=[];if(Array.isArray(r.jsonLd))for(const e of r.jsonLd){if(e==null)continue;const t=typeof e=="string"?e:JSON.stringify(e),n=String(t).replace(/<\/script/gi,"<\\/script");o.push(`<script type="application/ld+json" data-smbls-jsonld="${j(t)}">${n}<\/script>`)}if(Array.isArray(r.styles))for(const e of r.styles){if(e==null||!String(e).trim())continue;const t=String(e).replace(/<\/style/gi,"<\\/style");o.push(`<style data-smbls-style="${j(t)}">${t}</style>`)}if(Array.isArray(r.scripts))for(const e of r.scripts){if(!e)continue;const t=typeof e=="string",n=t?e:e.src;if(!n&&!e.body)continue;const i=[];n&&i.push(`src="${a(n)}"`),t||(e.type&&i.push(`type="${a(e.type)}"`),e.async&&i.push("async"),e.defer&&i.push("defer"),e.integrity&&i.push(`integrity="${a(e.integrity)}"`),e.crossorigin&&i.push(`crossorigin="${a(e.crossorigin)}"`),e.referrerpolicy&&i.push(`referrerpolicy="${a(e.referrerpolicy)}"`),e.nomodule&&i.push("nomodule"));const f=` data-smbls-script="${a(n||j(e.body||""))}"`;if(!t&&e.body){const h=String(e.body).replace(/<\/script/gi,"<\\/script");o.push(`<script ${i.join(" ")}${f}>${h}<\/script>`)}else o.push(`<script ${i.join(" ")}${f}><\/script>`)}return o},F=(r,o)=>{o||(r={...r,robots:"noindex"});const e=Object.entries(r).reduce((t,[n,i])=>{if(!i&&i!==0&&i!==!1||L.has(n))return t;if(n==="title")return t.push(`<title>${a(i)}</title>`),t;if(n==="canonical")return t.push(`<link rel="canonical" href="${a(i)}">`),t;if(n==="manifest")return t.push(`<link rel="manifest" href="${a(i)}">`),t;if(n==="favicon"||n==="favicons"||n==="icon"||n==="icons")return(Array.isArray(i)?i:[i]).forEach(p=>{if(typeof p=="string")t.push(`<link rel="icon" href="${a(p)}">`);else if(typeof p=="object"){const u=w(p);/rel=/.test(u)?t.push(`<link ${u}>`):t.push(`<link rel="icon" ${u}>`)}}),t;if(n==="alternate")return(Array.isArray(i)?i:[i]).forEach(p=>{if(typeof p=="object"){const u=Object.entries(p).filter(([s,g])=>g!==void 0).map(([s,g])=>`${s}="${a(g)}"`).join(" ");t.push(`<link rel="alternate" ${u}>`)}}),t;const f=(l,p,u="name")=>{if(typeof p=="string"||typeof p=="number"||typeof p=="boolean")t.push(`<meta ${u}="${a(l)}" content="${a(p)}">`);else if(Array.isArray(p))p.forEach(s=>{if(typeof s=="string"||typeof s=="number"||typeof s=="boolean")t.push(`<meta ${u}="${a(l)}" content="${a(s)}">`);else if(typeof s=="object"){const g=Object.entries(s).filter(([d,c])=>c!==void 0).map(([d,c])=>`${d}="${a(c)}"`).join(" ");t.push(`<meta ${g}>`)}});else if(typeof p=="object"){const s=Object.entries(p).filter(([g,d])=>d!==void 0).map(([g,d])=>`${g}="${a(d)}"`).join(" ");t.push(`<meta ${s}>`)}};if(n.startsWith("http-equiv:")){const l=n.replace("http-equiv:","");return f(l,i,"http-equiv"),t}if(n.startsWith("itemprop:")){const l=n.replace("itemprop:","");return f(l,i,"itemprop"),t}const y=["og:","twitter:","fb:","article:","profile:","book:","business:","music:","product:","video:","DC:","DCTERMS:"].find(l=>n.startsWith(l));if(y){const l=n.replace(y,"");return f(`${y.replace(":","")}:${l}`,i,y==="twitter:"||y==="DC:"||y==="DCTERMS:"?"name":"property"),t}if(n.startsWith("apple:")||n.startsWith("msapplication:")){const l=n.startsWith("apple:")?"apple-":"msapplication-",p=n.replace(/^apple:|^msapplication:/,"");return f(`${l}${p}`,i,"name"),t}return f(n,i),t},['<meta charset="UTF-8">','<meta name="viewport" content="width=device-width, initial-scale=1">']);return e.push(...O(r)),e.join(`
2
+ `)},E=r=>typeof r=="string"&&r.length>0&&!r.startsWith("/")&&!r.startsWith("http");function W(r,o){if(!o||typeof o!="object")return r;const e=n=>{if(!E(n))return n;const i=o[n];return i?.src?i.src:n},t={...r};for(const[n,i]of Object.entries(t))typeof i=="string"?t[n]=e(i):Array.isArray(i)&&(t[n]=i.map(f=>typeof f=="string"?e(f):f));return t}function m(r,o){if(!r||!o)return;const e=o.split(".");let t=r;for(const n of e){if(t==null||typeof t!="object")return;t=t[n]}return t}function T(r,o,e){const n=(o.config||o.settings||{}).polyglot||o.polyglot,i=e?.lang||n?.defaultLang||"en",h=(n?.translations||{})[i]||{},y=e?.state||{},l={...r};for(const[p,u]of Object.entries(l))typeof u!="string"||!u.includes("{{")||(l[p]=u.replace(/\{\{\s*([^|{}]+?)\s*(?:\|\s*(\w+)\s*)?\}\}/g,(s,g,d)=>{const c=g.trim();if(d==="polyglot")return h[c]??m(h,c)??s;if(d==="getLocalStateLang")return m(y,c+i)??s;const $=m(y,c);return $!==void 0?$:h[c]??m(h,c)??s}));return l}function A(r){if(!S(r))return{};const o={...r};for(const[e,t]of Object.entries(o))if(typeof t=="function"){const n=t.toString(),i=n.match(/el\.call\(\s*["']getLocalStateLang["']\s*,\s*["']([^"']+)["']\s*\)/);if(i){o[e]=`{{ ${i[1]} | getLocalStateLang }}`;continue}const f=n.match(/el\.call\(\s*["']polyglot["']\s*,\s*["']([^"']+)["']\s*\)/);if(f){o[e]=`{{ ${f[1]} | polyglot }}`;continue}const h=n.match(/s\.(\w+(?:\.\w+)+)/);if(h){o[e]=`{{ ${h[1]} }}`;continue}delete o[e]}else if(typeof t=="string"){const n=t.match(/el\.call\(\s*["']getLocalStateLang["']\s*,\s*["']([^"']+)["']\s*\)/);if(n){o[e]=`{{ ${n[1]} | getLocalStateLang }}`;continue}const i=t.match(/el\.call\(\s*["']polyglot["']\s*,\s*["']([^"']+)["']\s*\)/);if(i){o[e]=`{{ ${i[1]} | polyglot }}`;continue}if(t.includes("=>")&&t.includes("s.")){const f=t.match(/s\.(\w+(?:\.\w+)+)/);if(f){o[e]=`{{ ${f[1]} }}`;continue}}M(t)&&delete o[e]}return o}function R(r,o,e,{isProduction:t=!1,channel:n="production"}={}){const i=r.pages?.[o],f=S(i?.state)&&i?.state,h=i?.metadata||i?.helmet||f||{},y=A(h),l=new Set(Object.keys(y)),p=r.app?.metadata||{},u=A(p);let s={};if(r.integrations?.seo?s={...r.integrations.seo,...u,...y}:Object.keys(u).length?s={...u,...y}:s={...y},!s.title){const c=r.name||r.key;c?t?s.title=c:n==="development"?s.title=`${c} / dev:symbo.ls`:n==="staging"?s.title=`${c} / staging:symbo.ls`:s.title=`${c} / symbo.ls`:s.title="Symbols demo"}s=T(s,r,e),s.title&&(l.has("title")||!s["og:title"])&&(l.has("og:title")||(s["og:title"]=s.title)),s.description&&(l.has("description")||!s["og:description"])&&(l.has("og:description")||(s["og:description"]=s.description)),s.title&&!s["twitter:title"]&&(s["twitter:title"]=s.title),s.description&&!s["twitter:description"]&&(s["twitter:description"]=s.description);const g=e?.actualPathname||o;if(s["og:url"]||s.url){const c=(s["og:url"]||s.url||"").replace(/\/$/,"");if(c&&g&&g!=="/"){const $=g.startsWith("/")?g:"/"+g;s["og:url"]=c+$}}s=W(s,r.files);const d=r.name||r.app?.metadata?.title||r.app?.name||"";for(const[c,$]of Object.entries(s))if(typeof $=="string"&&$.includes("{{")){const b=$.replace(/\{\{[^}]*\}\}/g,"").trim();b?s[c]=b:c==="title"?s[c]=d:delete s[c]}return s}export{O as generateHeadArrayTags,F as generateMetaTags,R as getPageMetadata,j as hashContent};
@@ -1,4 +1,4 @@
1
- import{triggerEventOn as m}from"./triggerEvent.js";import{DOMQ_PROPERTIES as R,METHODS as $,PARSED_DOMQ_PROPERTIES as k}from"./keys.js";import{isDefined as E,isFunction as p,isObject as P,isObjectLike as x}from"./types.js";import{deepClone as A}from"./object.js";import{isProduction as b}from"./env.js";import{removeValueFromArray as C}from"./array.js";import{OPTIONS as j}from"./cache.js";const a="production";function K(e){const t=this,{__ref:n}=t,o=[].concat(e);let r=n.root[o[0]];if(!o||!o.length)return console.log(o,"on",t.key,"is undefined");for(;r.key===o[0]&&(o.shift(),!!o.length);)if(r=r[o[0]],!r)return;return r}function X(e){const t=this;let{parent:n}=t;if(p(e))return n.state&&e(n,n.state,n.context)?n:n.parent?n.lookup(e):void 0;if(t[e])return t[e];for(;n.param!==e;){if(n[e])return n[e];if(n=n.parent,!n)return}return n}function q(e){const t=this,{__ref:n}=t,o=n?.__children;if(o)for(let r=0;r<o.length;r++){const s=o[r],i=t[s];if(s===e)return i;if(p(e)){const l=e(i,i.state,i.context);if(i.state&&l)return i}const c=i?.lookdown?.(e);if(c)return c}}function tt(e,t=[]){const n=this,{__ref:o}=n,r=o?.__children;if(r){for(let s=0;s<r.length;s++){const i=r[s],c=n[i];if(i===e)t.push(c);else if(p(e)){const l=e(c,c.state,c.context);c.state&&l&&t.push(c)}c?.lookdownAll?.(e,t)}return t.length?t:void 0}}function Q(e={}){const t=this;if(t.node?.style){for(const n in e){const o=e[n],r=t[n];if(P(o)&&r)Q.call(r,o);else if(o!=null){const s=n.replace(/[A-Z]/g,c=>"-"+c.toLowerCase()),i=String(o).replace(/\s*!important\s*$/,"");t.node.style.setProperty(s,i,"important")}}return t}}function et(e){const t=this;if(m("beforeRemove",t,e)===!1)return t;p(t.node.remove)?t.node.remove():b()||(console.warn("This item cant be removed"),t.log()),delete t.parent[t.key],t.parent.__ref&&(t.parent.__ref.__children=C(t.parent.__ref.__children,t.key)),m("remove",t,e)}function nt(e){return this[e]}function ot(e,t){const n=this;if(e)return n.update(e,t),n}function rt(e){return e?this.__ref&&this.__ref[e]:this.__ref}function st(){return this.getRef("__children").map(t=>this[t])}function it(){return this.getRef().path}let y=null;const ct=e=>{y=e||null},v=()=>y||null;function lt(e){let t=null;const n=o=>o.__element&&o.root?.isRootState;if(!this)t=v();else if(n(this))t=this.root;else if(this.__ref&&this.__ref.path){const o=this.state&&n(this.state),r=p(this.state)&&this.parent.state&&n(this.parent.state);(o||r)&&(t=this.state.root||this.parent.state.root)}return t||(t=v()),e?t?.[e]:t}function ft(e){const t=this?.__ref?.root||this.getRootState()?.__element;if(!t)throw new Error(`[smbls] getRoot() could not resolve a root element for "${this?.key||"<unknown>"}" \u2014 it has no __ref (never went through create()) and no root state is registered. Answering undefined here used to no-op silently for every caller.`);return Object.keys(t).length>0&&e?t[e]:t}function ut(e){return this.getRoot("data")&&Object.keys(this.getRoot("data")).length>0&&e?this.getRoot("data")[e]:this.getRoot("data")}function at(e){const t=this.getRoot()?.context;return e?t[e]:t}function ht(e){const t=this.context;return e?t[e]:t}const pt=(e,t,n,o)=>Object.defineProperty(e,t,{get:n,set:o});function N(){const e=this,t=[];for(const n in e)!Object.prototype.hasOwnProperty.call(e,n)||R.has(n)&&!k.has(n)||t.push(n);return t}function D(e=[]){const t=this,n={},o=N.call(t),r=o.includes("children"),s=e.length?new Set(e):null;for(let i=0;i<o.length;i++){const c=o[i];if(s&&s.has(c)||!Object.prototype.hasOwnProperty.call(t,c)||r&&c==="content")continue;const l=t[c];if(c==="state"){if(t.__ref&&!t.__ref.__hasRootState)continue;const f=p(l&&l.parse)?l.parse():l;n[c]=p(f)?f:JSON.parse(JSON.stringify(f||{}))}else if(c==="scope"){if(t.__ref&&!t.__ref.__hasRootScope)continue;n[c]=JSON.parse(JSON.stringify(l||{}))}else if(c==="props"){const{__element:f,update:u,...h}=t[c];n[c]=h}else E(l)&&Object.prototype.hasOwnProperty.call(t,c)&&(n[c]=l)}return n}function w(e=[],t=new WeakSet){const n=this;if(t.has(n))return;t.add(n);const o=D.call(n,e),r=e.length?new Set(e):null;for(const s in o){if(r&&r.has(s)||!Object.prototype.hasOwnProperty.call(n,s))continue;const i=o[s];Array.isArray(i)?o[s]=i.map(c=>x(c)?w.call(c,e,t):c):x(i)&&(o[s]=w.call(i,e,t))}return o}function T(...e){if(a!=="test"&&a!=="development")return;const t=this,{__ref:n}=t;return console.groupCollapsed(t.key),e.length?e.forEach(o=>console.log(`%c${o}:
1
+ import{triggerEventOn as m}from"./triggerEvent.js";import{DOMQ_PROPERTIES as R,METHODS as $,PARSED_DOMQ_PROPERTIES as k}from"./keys.js";import{isDefined as E,isFunction as p,isObject as P,isObjectLike as x}from"./types.js";import{deepClone as A}from"./object.js";import{isProduction as b}from"./env.js";import{removeValueFromArray as C}from"./array.js";import{OPTIONS as j}from"./cache.js";const a="production";function K(e){const t=this,{__ref:n}=t,o=[].concat(e);let r=n.root[o[0]];if(!o||!o.length)return console.log(o,"on",t.key,"is undefined");for(;r.key===o[0]&&(o.shift(),!!o.length);)if(r=r[o[0]],!r)return;return r}function X(e){const t=this;let{parent:n}=t;if(p(e))return n.state&&e(n,n.state,n.context)?n:n.parent?n.lookup(e):void 0;if(t[e])return t[e];for(;n.param!==e;){if(n[e])return n[e];if(n=n.parent,!n)return}return n}function q(e){const t=this,{__ref:n}=t,o=n?.__children;if(o)for(let r=0;r<o.length;r++){const s=o[r],i=t[s];if(s===e)return i;if(p(e)){const l=e(i,i.state,i.context);if(i.state&&l)return i}const c=i?.lookdown?.(e);if(c)return c}}function tt(e,t=[]){const n=this,{__ref:o}=n,r=o?.__children;if(r){for(let s=0;s<r.length;s++){const i=r[s],c=n[i];if(i===e)t.push(c);else if(p(e)){const l=e(c,c.state,c.context);c.state&&l&&t.push(c)}c?.lookdownAll?.(e,t)}return t.length?t:void 0}}function Q(e={}){const t=this;if(t.node?.style){for(const n in e){const o=e[n],r=t[n];if(P(o)&&r)Q.call(r,o);else if(o!=null){const s=n.replace(/[A-Z]/g,c=>"-"+c.toLowerCase()),i=String(o).replace(/\s*!important\s*$/,"");t.node.style.setProperty(s,i,"important")}}return t}}function et(e){const t=this;if(m("beforeRemove",t,e)===!1)return t;p(t.node.remove)?t.node.remove():b()||(console.warn("This item cant be removed"),t.log()),delete t.parent[t.key],t.parent.__ref&&(t.parent.__ref.__children=C(t.parent.__ref.__children,t.key)),m("remove",t,e)}function nt(e){return this[e]}function ot(e,t){const n=this;if(e)return n.update(e,t),n}function rt(e){return e?this.__ref&&this.__ref[e]:this.__ref}function st(){const e=this.getRef("__children");return Array.isArray(e)?e.map(t=>this[t]):[]}function it(){return this.getRef().path}let y=null;const ct=e=>{y=e||null},v=()=>y||null;function lt(e){let t=null;const n=o=>o.__element&&o.root?.isRootState;if(!this)t=v();else if(n(this))t=this.root;else if(this.__ref&&this.__ref.path){const o=this.state&&n(this.state),r=p(this.state)&&this.parent.state&&n(this.parent.state);(o||r)&&(t=this.state.root||this.parent.state.root)}return t||(t=v()),e?t?.[e]:t}function ft(e){const t=this?.__ref?.root||this.getRootState()?.__element;if(!t)throw new Error(`[smbls] getRoot() could not resolve a root element for "${this?.key||"<unknown>"}" \u2014 it has no __ref (never went through create()) and no root state is registered. Answering undefined here used to no-op silently for every caller.`);return Object.keys(t).length>0&&e?t[e]:t}function ut(e){return this.getRoot("data")&&Object.keys(this.getRoot("data")).length>0&&e?this.getRoot("data")[e]:this.getRoot("data")}function at(e){const t=this.getRoot()?.context;return e?t[e]:t}function ht(e){const t=this.context;return e?t[e]:t}const pt=(e,t,n,o)=>Object.defineProperty(e,t,{get:n,set:o});function N(){const e=this,t=[];for(const n in e)!Object.prototype.hasOwnProperty.call(e,n)||R.has(n)&&!k.has(n)||t.push(n);return t}function D(e=[]){const t=this,n={},o=N.call(t),r=o.includes("children"),s=e.length?new Set(e):null;for(let i=0;i<o.length;i++){const c=o[i];if(s&&s.has(c)||!Object.prototype.hasOwnProperty.call(t,c)||r&&c==="content")continue;const l=t[c];if(c==="state"){if(t.__ref&&!t.__ref.__hasRootState)continue;const f=p(l&&l.parse)?l.parse():l;n[c]=p(f)?f:JSON.parse(JSON.stringify(f||{}))}else if(c==="scope"){if(t.__ref&&!t.__ref.__hasRootScope)continue;n[c]=JSON.parse(JSON.stringify(l||{}))}else if(c==="props"){const{__element:f,update:u,...h}=t[c];n[c]=h}else E(l)&&Object.prototype.hasOwnProperty.call(t,c)&&(n[c]=l)}return n}function w(e=[],t=new WeakSet){const n=this;if(t.has(n))return;t.add(n);const o=D.call(n,e),r=e.length?new Set(e):null;for(const s in o){if(r&&r.has(s)||!Object.prototype.hasOwnProperty.call(n,s))continue;const i=o[s];Array.isArray(i)?o[s]=i.map(c=>x(c)?w.call(c,e,t):c):x(i)&&(o[s]=w.call(i,e,t))}return o}function T(...e){if(a!=="test"&&a!=="development")return;const t=this,{__ref:n}=t;return console.groupCollapsed(t.key),e.length?e.forEach(o=>console.log(`%c${o}:
2
2
  `,"font-weight: bold",t[o])):(console.log(n.path),t.keys().forEach(r=>console.log(`%c${r}:`,"font-weight: bold",t[r]))),console.log(t),console.groupEnd(t.key),t}function dt(...e){(a==="test"||a==="development")&&console.log(...e)}function _t(...e){(a==="test"||a==="development")&&console.warn(...e)}function S(...e){if(a==="test"||a==="development"){if(e[e.length-1]?.debugger)debugger;throw e[e.length-1]?.verbose&&T.call(this),new Error(...e)}}function gt(){const e=this,{key:t,parent:n}=e,{__children:o}=n.__ref,r=o.indexOf(t),s=o[r+1];return n[s]}function mt(e){const t=e||this,{key:n,parent:o}=t,{__children:r}=o.__ref;if(!r)return;const s=r.indexOf(n);return o[r[s-1]]}function xt(e={}){const t=this;t.data||(t.data={}),t.data.varCaches||(t.data.varCaches={});const n=t.data.varCaches,o={};let r;for(const s in e)e[s]!==n[s]&&(r=!0,o[s]=e[s]);return{changed:s=>{if(!r)return;const i=s(o,A(n));for(const c in o)n[c]=o[c];return i},timeout:(s,i)=>{if(!r)return;const c=setTimeout(()=>{s(o),clearTimeout(c)},i)}}}function yt(e,...t){const n=this.context,o=n.utils?.[e]||n.functions?.[e]||n.methods?.[e]||n.snippets?.[e];if(o)try{const r=o.call(this,...t);return r&&typeof r.then=="function"&&r.catch(s=>{S.call(this,s)}),r}catch(r){if(S.call(this,r),n?.strictMode)throw r}}async function vt(){const e=this,t=e.context?.fetch;if(!t)return null;if(typeof t.select=="function"){if(!t.__authInitialized&&t.getSession){const{initAdapterAuth:r}=await import("@symbo.ls/fetch");await r(t,e.context)}return t}if(t.__resolved){if(!t.__resolved.__authInitialized&&t.__resolved.getSession){const{initAdapterAuth:r}=await import("@symbo.ls/fetch");await r(t.__resolved,e.context)}return t.__resolved}if(t.__resolving)return t.__resolving;const n=import("@symbo.ls/fetch").then(({resolveDb:r})=>r(t));t.__resolving=n;const o=await n;if(t.__resolved=o,e.context.fetch=o,delete t.__resolving,o?.getSession){const{initAdapterAuth:r}=await import("@symbo.ls/fetch");await r(o,e.context)}return o}function wt(e){const t=this,n=e||j.useStateQuery||t.context?.useStateQuery;if(!n)return null;const o={};if(g(t,o),n===!0)return o;const r=B[n];return r?r(o):o}const g=(e,t)=>{const n=e.__ref;if(!n)return;const o=n.__state;o&&typeof o=="string"&&I(t,o);const r=n.__children;if(r)for(let c=0;c<r.length;c++){const l=e[r[c]];l&&l.__ref&&g(l,t)}const s=n.contentElementKey||"content",i=e[s];i&&i.__ref&&g(i,t)},I=(e,t)=>{const o=t.replaceAll("../","").replaceAll("~/","").split("/");let r=e;for(let s=0;s<o.length;s++){const i=o[s];s===o.length-1?r[i]||(r[i]=!0):(r[i]===!0&&(r[i]={}),r[i]||(r[i]={}),r=r[i])}},O=(e,t=0)=>{const n=" ".repeat(t),o=Object.entries(e);return o.length?o.map(([s,i])=>i===!0?`${n}${s}`:`${n}${s} {
3
3
  ${O(i,t+1)}
4
4
  ${n}}`).join(`
package/function.js CHANGED
@@ -67,7 +67,10 @@ export const memoize = fn => {
67
67
  }
68
68
  }
69
69
 
70
- const RE_STRING_FUNCTION = /^((function\s*\([^)]*\)\s*\{[^}]*\})|(\([^)]*\)\s*=>))/
70
+ // A function's source, however it was written: `function (…) {…}` (a method
71
+ // shorthand's `name (…) {` is NOT one — that is how object literals read),
72
+ // `(…) =>`, `x =>`, each with an optional `async`.
73
+ const RE_STRING_FUNCTION = /^\s*(?:async\s+)?(?:function\b|\([^)]*\)\s*=>|[a-zA-Z_$][\w$]*\s*=>)/
71
74
 
72
75
  export const isStringFunction = inputString => {
73
76
  return RE_STRING_FUNCTION.test(inputString)
package/metadata.js CHANGED
@@ -1,6 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  import { isObject } from './types.js'
4
+ import { isStringFunction } from './function.js'
4
5
 
5
6
  const escapeHtml = (text) => {
6
7
  if (text === null || text === undefined) return ''
@@ -357,6 +358,13 @@ function resolveMetadataTemplates (metadata, data, ssrContext) {
357
358
  * (el, s) => s.item ? s.item.image_url : ""
358
359
  */
359
360
  function convertFunctionMetaToTemplates (metadata) {
361
+ // A page may set `metadata` itself to a function ((el, s) => ({ title… })):
362
+ // the runtime helmet resolves that against live state, the publish
363
+ // pipeline cannot. In the project JSON it is a string — spreading it made
364
+ // one <meta> per CHARACTER of its source (`<meta name="0" content="(">`,
365
+ // 137 of them on aihouse's home page, 2026-09-24). Nothing to read here;
366
+ // the app-level metadata is what the static head gets.
367
+ if (!isObject(metadata)) return {}
360
368
  const result = { ...metadata }
361
369
  for (const [key, value] of Object.entries(result)) {
362
370
  if (typeof value === 'function') {
@@ -401,6 +409,12 @@ function convertFunctionMetaToTemplates (metadata) {
401
409
  continue
402
410
  }
403
411
  }
412
+ // Still a function's source — `(el, s) => el.call('propertyMetadata').title`
413
+ // — that none of the patterns read: the runtime resolves it, the static
414
+ // head must not print code into a <meta content>.
415
+ if (isStringFunction(value)) {
416
+ delete result[key]
417
+ }
404
418
  }
405
419
  }
406
420
  return result
package/methods.js CHANGED
@@ -173,6 +173,9 @@ export function getRef (key) {
173
173
 
174
174
  export function getChildren () {
175
175
  const __children = this.getRef('__children')
176
+ // An element with no children array (a bare ref, a node not built by
177
+ // create) has no children — never a throw.
178
+ if (!Array.isArray(__children)) return []
176
179
  return __children.map(k => this[k])
177
180
  }
178
181
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/utils",
3
- "version": "3.14.772",
3
+ "version": "3.14.774",
4
4
  "license": "CC-BY-NC-4.0",
5
5
  "type": "module",
6
6
  "module": "./dist/esm/index.js",