@symbo.ls/utils 3.14.599 → 3.14.656

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @symbo.ls/utils
2
2
 
3
+ ## 3.14.656
4
+
5
+ ### Patch Changes
6
+
7
+ - Auto-generated cross-repo patch release.
8
+ - Updated dependencies
9
+ - @symbo.ls/fetch@3.14.656
10
+
11
+ ## 3.14.651
12
+
13
+ ### Patch Changes
14
+
15
+ - Auto-generated cross-repo patch release.
16
+
3
17
  ## 3.14.599
4
18
 
5
19
  ### Patch Changes
@@ -1,2 +1,2 @@
1
- "use strict";var j=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var A=(s,i)=>{for(var r in i)j(s,r,{get:i[r],enumerable:!0})},W=(s,i,r,e)=>{if(i&&typeof i=="object"||typeof i=="function")for(let n of L(i))!S.call(s,n)&&n!==r&&j(s,n,{get:()=>i[n],enumerable:!(e=O(i,n))||e.enumerable});return s};var E=s=>W(j({},"__esModule",{value:!0}),s);var K={};A(K,{generateMetaTags:()=>q,getPageMetadata:()=>x});module.exports=E(K);var w=require("./types.js");const h=s=>{if(s==null)return"";const i={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};return s.toString().replace(/[&<>"']/g,r=>i[r])},T=s=>Object.entries(s||{}).filter(([i,r])=>r!==void 0).map(([i,r])=>`${i}="${h(r)}"`).join(" "),q=(s,i)=>(i||(s={...s,robots:"noindex"}),Object.entries(s).reduce((e,[n,o])=>{if(!o&&o!==0&&o!==!1)return e;if(n==="title")return e.push(`<title>${h(o)}</title>`),e;if(n==="canonical")return e.push(`<link rel="canonical" href="${h(o)}">`),e;if(n==="manifest")return e.push(`<link rel="manifest" href="${h(o)}">`),e;if(n==="favicon"||n==="favicons"||n==="icon"||n==="icons")return(Array.isArray(o)?o:[o]).forEach(f=>{if(typeof f=="string")e.push(`<link rel="icon" href="${h(f)}">`);else if(typeof f=="object"){const a=T(f);/rel=/.test(a)?e.push(`<link ${a}>`):e.push(`<link rel="icon" ${a}>`)}}),e;if(n==="alternate")return(Array.isArray(o)?o:[o]).forEach(f=>{if(typeof f=="object"){const a=Object.entries(f).filter(([t,u])=>u!==void 0).map(([t,u])=>`${t}="${h(u)}"`).join(" ");e.push(`<link rel="alternate" ${a}>`)}}),e;const p=(c,f,a="name")=>{if(typeof f=="string"||typeof f=="number"||typeof f=="boolean")e.push(`<meta ${a}="${h(c)}" content="${h(f)}">`);else if(Array.isArray(f))f.forEach(t=>{if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")e.push(`<meta ${a}="${h(c)}" content="${h(t)}">`);else if(typeof t=="object"){const u=Object.entries(t).filter(([m,l])=>l!==void 0).map(([m,l])=>`${m}="${h(l)}"`).join(" ");e.push(`<meta ${u}>`)}});else if(typeof f=="object"){const t=Object.entries(f).filter(([u,m])=>m!==void 0).map(([u,m])=>`${u}="${h(m)}"`).join(" ");e.push(`<meta ${t}>`)}};if(n.startsWith("http-equiv:")){const c=n.replace("http-equiv:","");return p(c,o,"http-equiv"),e}if(n.startsWith("itemprop:")){const c=n.replace("itemprop:","");return p(c,o,"itemprop"),e}const g=["og:","twitter:","fb:","article:","profile:","book:","business:","music:","product:","video:","DC:","DCTERMS:"].find(c=>n.startsWith(c));if(g){const c=n.replace(g,"");return p(`${g.replace(":","")}:${c}`,o,g==="twitter:"||g==="DC:"||g==="DCTERMS:"?"name":"property"),e}if(n.startsWith("apple:")||n.startsWith("msapplication:")){const c=n.startsWith("apple:")?"apple-":"msapplication-",f=n.replace(/^apple:|^msapplication:/,"");return p(`${c}${f}`,o,"name"),e}return p(n,o),e},['<meta charset="UTF-8">','<meta name="viewport" content="width=device-width, initial-scale=1">']).join(`
2
- `)),D=s=>typeof s=="string"&&s.length>0&&!s.startsWith("/")&&!s.startsWith("http");function F(s,i){if(!i||typeof i!="object")return s;const r=n=>{if(!D(n))return n;const o=i[n];return o?.src?o.src:n},e={...s};for(const[n,o]of Object.entries(e))typeof o=="string"?e[n]=r(o):Array.isArray(o)&&(e[n]=o.map(p=>typeof p=="string"?r(p):p));return e}function y(s,i){if(!s||!i)return;const r=i.split(".");let e=s;for(const n of r){if(e==null||typeof e!="object")return;e=e[n]}return e}function P(s,i,r){const n=(i.config||i.settings||{}).polyglot||i.polyglot,o=r?.lang||n?.defaultLang||"en",d=(n?.translations||{})[o]||{},g=r?.state||{},c={...s};for(const[f,a]of Object.entries(c))typeof a!="string"||!a.includes("{{")||(c[f]=a.replace(/\{\{\s*([^|{}]+?)\s*(?:\|\s*(\w+)\s*)?\}\}/g,(t,u,m)=>{const l=u.trim();if(m==="polyglot")return d[l]??y(d,l)??t;if(m==="getLocalStateLang")return y(g,l+o)??t;const $=y(g,l);return $!==void 0?$:d[l]??y(d,l)??t}));return c}function M(s){const i={...s};for(const[r,e]of Object.entries(i))if(typeof e=="function"){const n=e.toString(),o=n.match(/el\.call\(\s*["']getLocalStateLang["']\s*,\s*["']([^"']+)["']\s*\)/);if(o){i[r]=`{{ ${o[1]} | getLocalStateLang }}`;continue}const p=n.match(/el\.call\(\s*["']polyglot["']\s*,\s*["']([^"']+)["']\s*\)/);if(p){i[r]=`{{ ${p[1]} | polyglot }}`;continue}const d=n.match(/s\.(\w+(?:\.\w+)+)/);if(d){i[r]=`{{ ${d[1]} }}`;continue}delete i[r]}else if(typeof e=="string"){const n=e.match(/el\.call\(\s*["']getLocalStateLang["']\s*,\s*["']([^"']+)["']\s*\)/);if(n){i[r]=`{{ ${n[1]} | getLocalStateLang }}`;continue}const o=e.match(/el\.call\(\s*["']polyglot["']\s*,\s*["']([^"']+)["']\s*\)/);if(o){i[r]=`{{ ${o[1]} | polyglot }}`;continue}if(e.includes("=>")&&e.includes("s.")){const p=e.match(/s\.(\w+(?:\.\w+)+)/);if(p){i[r]=`{{ ${p[1]} }}`;continue}}}return i}function x(s,i,r,{isProduction:e=!1,channel:n="production"}={}){const o=s.pages?.[i],p=(0,w.isObject)(o?.state)&&o?.state,d=o?.metadata||o?.helmet||p||{},g=M(d),c=new Set(Object.keys(g)),f=s.app?.metadata||{},a=M(f);let t={};if(s.integrations?.seo?t={...s.integrations.seo,...a,...g}:Object.keys(a).length?t={...a,...g}:t={...g},!t.title){const l=s.name||s.key;l?e?t.title=l:n==="development"?t.title=`${l} / dev:symbo.ls`:n==="staging"?t.title=`${l} / staging:symbo.ls`:t.title=`${l} / symbo.ls`:t.title="Symbols demo"}t=P(t,s,r),t.title&&(c.has("title")||!t["og:title"])&&(c.has("og:title")||(t["og:title"]=t.title)),t.description&&(c.has("description")||!t["og:description"])&&(c.has("og:description")||(t["og:description"]=t.description)),t.title&&!t["twitter:title"]&&(t["twitter:title"]=t.title),t.description&&!t["twitter:description"]&&(t["twitter:description"]=t.description);const u=r?.actualPathname||i;if(t["og:url"]||t.url){const l=(t["og:url"]||t.url||"").replace(/\/$/,"");if(l&&u&&u!=="/"){const $=u.startsWith("/")?u:"/"+u;t["og:url"]=l+$}}t=F(t,s.files);const m=s.name||s.app?.metadata?.title||s.app?.name||"";for(const[l,$]of Object.entries(t))if(typeof $=="string"&&$.includes("{{")){const b=$.replace(/\{\{[^}]*\}\}/g,"").trim();b?t[l]=b:l==="title"?t[l]=m:delete t[l]}return t}
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,10 +1,10 @@
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})},$=(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)):{},$(t||!e||!e.__esModule?g(n,"default",{value:e,enumerable:!0}):n,e)),J=e=>$(g({},"__esModule",{value:!0}),e);var Ot={};M(Ot,{call:()=>ut,defineSetter:()=>rt,error:()=>O,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:()=>v,previousElement:()=>lt,remove:()=>H,setActiveRootState:()=>X,setNodeStyles:()=>C,setProps:()=>W,spotByPath:()=>V,variables:()=>ft,verbose:()=>N,warn:()=>it});module.exports=J(Ot);var S=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,S.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,S.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 w=null;const X=e=>{w=e||null},k=()=>w||null;function q(e){let t=null;const n=o=>o.__element&&o.root?.isRootState;if(!this)t=k();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=k()),e?t?.[e]:t}function tt(e){const t=this.getRootState()?.__element;return t&&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 v(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)?v.call(c,e,t):c):(0,f.isObjectLike)(i)&&(o[s]=v.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
- `,"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 O(...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=>{O.call(this,s)}),r}catch(r){if(O.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=St[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])}},R=(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
- ${R(i,t+1)}
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})},w=(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)):{},w(t||!e||!e.__esModule?g(n,"default",{value:e,enumerable:!0}):n,e)),J=e=>w(g({},"__esModule",{value:!0}),e);var vt={};M(vt,{call:()=>ut,defineSetter:()=>rt,error:()=>O,get:()=>U,getChildren:()=>Z,getContext:()=>ot,getDB:()=>at,getPath:()=>K,getQuery:()=>ht,getRef:()=>Y,getRoot:()=>tt,getRootContext:()=>nt,getRootData:()=>et,getRootState:()=>q,isMethod:()=>St,keys:()=>j,log:()=>st,lookdown:()=>z,lookdownAll:()=>G,lookup:()=>B,nextElement:()=>ct,parse:()=>Q,parseDeep:()=>v,previousElement:()=>lt,remove:()=>H,setActiveRootState:()=>X,setNodeStyles:()=>C,setProps:()=>W,spotByPath:()=>V,variables:()=>ft,verbose:()=>N,warn:()=>it});module.exports=J(vt);var S=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,S.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,S.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.getRootState()?.__element;return t&&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 v(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)?v.call(c,e,t):c):(0,f.isObjectLike)(i)&&(o[s]=v.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
+ `,"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 O(...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=>{O.call(this,s)}),r}catch(r){if(O.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
+ ${k(i,t+1)}
4
4
  ${n}}`).join(`
5
5
  `):""},dt=e=>`{
6
- ${R(e,1)}
6
+ ${k(e,1)}
7
7
  }`,_t=e=>{const t={fields:{},include:[]},n=(o,r)=>{const s=[];for(const i in o)if(o[i]===!0)s.push(i);else{const c=r?`${r}.${i}`:i;t.include.push(c),n(o[i],c)}s.length&&(t.fields[r||"_root"]=s)};return n(e,""),t},gt=e=>{const t=s=>{const i=[],c=[];for(const l in s)if(s[l]===!0)i.push(l);else{const u=t(s[l]),a=[];u.select&&a.push(`$select=${u.select}`),u.expand&&a.push(`$expand=${u.expand}`),c.push(a.length?`${l}(${a.join(";")})`:l)}return{select:i.length?i.join(","):"",expand:c.length?c.join(","):""}},{select:n,expand:o}=t(e),r=[];return n&&r.push(`$select=${n}`),o&&r.push(`$expand=${o}`),r.join("&")},mt=(e,t)=>{const n=[],o=[],r=new Set,s=(a,p,x)=>{r.add(p),x&&o.push(`LEFT JOIN ${p} ON ${p}.${x}_id = ${x}.id`);for(const _ in a)a[_]===!0?n.push(`${p}.${_}`):s(a[_],_,p)},i=Object.keys(e);i.length===1&&e[i[0]]!==!0?s(e[i[0]],i[0],null):s(e,"_root",null);const c=[...r][0]||"_root",l=n.length?n.join(", "):"*",u=o.length?`
8
8
  `+o.join(`
9
9
  `):"";return`SELECT ${l}
10
- FROM ${c}${u}`},xt=e=>{const t=[],n=(o,r)=>{for(const s in o){const i=r?`${r}/${s}`:s;o[s]===!0?t.push(i):n(o[s],i)}};return n(e,""),t},yt=e=>{const t=o=>{const r=[];for(const s in o)o[s]===!0?r.push(s):r.push(`${s}(${t(o[s])})`);return r.join(", ")},n=Object.keys(e);return n.length===1&&e[n[0]]!==!0?{from:n[0],select:t(e[n[0]])}:{from:null,select:t(e)}},St={graphql:dt,"json-api":_t,odata:gt,sql:mt,supabase:yt,paths:xt};function vt(e,t){return!!(d.METHODS.has(e)||t?.context?.methods?.[e])}
10
+ FROM ${c}${u}`},xt=e=>{const t=[],n=(o,r)=>{for(const s in o){const i=r?`${r}/${s}`:s;o[s]===!0?t.push(i):n(o[s],i)}};return n(e,""),t},yt={graphql:dt,"json-api":_t,odata:gt,sql:mt,paths:xt};function St(e,t){return!!(d.METHODS.has(e)||t?.context?.methods?.[e])}
@@ -1,2 +1,2 @@
1
- import{isObject as M}from"./types.js";const h=i=>{if(i==null)return"";const o={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};return i.toString().replace(/[&<>"']/g,r=>o[r])},w=i=>Object.entries(i||{}).filter(([o,r])=>r!==void 0).map(([o,r])=>`${o}="${h(r)}"`).join(" "),W=(i,o)=>(o||(i={...i,robots:"noindex"}),Object.entries(i).reduce((e,[n,s])=>{if(!s&&s!==0&&s!==!1)return e;if(n==="title")return e.push(`<title>${h(s)}</title>`),e;if(n==="canonical")return e.push(`<link rel="canonical" href="${h(s)}">`),e;if(n==="manifest")return e.push(`<link rel="manifest" href="${h(s)}">`),e;if(n==="favicon"||n==="favicons"||n==="icon"||n==="icons")return(Array.isArray(s)?s:[s]).forEach(f=>{if(typeof f=="string")e.push(`<link rel="icon" href="${h(f)}">`);else if(typeof f=="object"){const a=w(f);/rel=/.test(a)?e.push(`<link ${a}>`):e.push(`<link rel="icon" ${a}>`)}}),e;if(n==="alternate")return(Array.isArray(s)?s:[s]).forEach(f=>{if(typeof f=="object"){const a=Object.entries(f).filter(([t,u])=>u!==void 0).map(([t,u])=>`${t}="${h(u)}"`).join(" ");e.push(`<link rel="alternate" ${a}>`)}}),e;const p=(c,f,a="name")=>{if(typeof f=="string"||typeof f=="number"||typeof f=="boolean")e.push(`<meta ${a}="${h(c)}" content="${h(f)}">`);else if(Array.isArray(f))f.forEach(t=>{if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")e.push(`<meta ${a}="${h(c)}" content="${h(t)}">`);else if(typeof t=="object"){const u=Object.entries(t).filter(([m,l])=>l!==void 0).map(([m,l])=>`${m}="${h(l)}"`).join(" ");e.push(`<meta ${u}>`)}});else if(typeof f=="object"){const t=Object.entries(f).filter(([u,m])=>m!==void 0).map(([u,m])=>`${u}="${h(m)}"`).join(" ");e.push(`<meta ${t}>`)}};if(n.startsWith("http-equiv:")){const c=n.replace("http-equiv:","");return p(c,s,"http-equiv"),e}if(n.startsWith("itemprop:")){const c=n.replace("itemprop:","");return p(c,s,"itemprop"),e}const g=["og:","twitter:","fb:","article:","profile:","book:","business:","music:","product:","video:","DC:","DCTERMS:"].find(c=>n.startsWith(c));if(g){const c=n.replace(g,"");return p(`${g.replace(":","")}:${c}`,s,g==="twitter:"||g==="DC:"||g==="DCTERMS:"?"name":"property"),e}if(n.startsWith("apple:")||n.startsWith("msapplication:")){const c=n.startsWith("apple:")?"apple-":"msapplication-",f=n.replace(/^apple:|^msapplication:/,"");return p(`${c}${f}`,s,"name"),e}return p(n,s),e},['<meta charset="UTF-8">','<meta name="viewport" content="width=device-width, initial-scale=1">']).join(`
2
- `)),O=i=>typeof i=="string"&&i.length>0&&!i.startsWith("/")&&!i.startsWith("http");function L(i,o){if(!o||typeof o!="object")return i;const r=n=>{if(!O(n))return n;const s=o[n];return s?.src?s.src:n},e={...i};for(const[n,s]of Object.entries(e))typeof s=="string"?e[n]=r(s):Array.isArray(s)&&(e[n]=s.map(p=>typeof p=="string"?r(p):p));return e}function y(i,o){if(!i||!o)return;const r=o.split(".");let e=i;for(const n of r){if(e==null||typeof e!="object")return;e=e[n]}return e}function S(i,o,r){const n=(o.config||o.settings||{}).polyglot||o.polyglot,s=r?.lang||n?.defaultLang||"en",d=(n?.translations||{})[s]||{},g=r?.state||{},c={...i};for(const[f,a]of Object.entries(c))typeof a!="string"||!a.includes("{{")||(c[f]=a.replace(/\{\{\s*([^|{}]+?)\s*(?:\|\s*(\w+)\s*)?\}\}/g,(t,u,m)=>{const l=u.trim();if(m==="polyglot")return d[l]??y(d,l)??t;if(m==="getLocalStateLang")return y(g,l+s)??t;const $=y(g,l);return $!==void 0?$:d[l]??y(d,l)??t}));return c}function j(i){const o={...i};for(const[r,e]of Object.entries(o))if(typeof e=="function"){const n=e.toString(),s=n.match(/el\.call\(\s*["']getLocalStateLang["']\s*,\s*["']([^"']+)["']\s*\)/);if(s){o[r]=`{{ ${s[1]} | getLocalStateLang }}`;continue}const p=n.match(/el\.call\(\s*["']polyglot["']\s*,\s*["']([^"']+)["']\s*\)/);if(p){o[r]=`{{ ${p[1]} | polyglot }}`;continue}const d=n.match(/s\.(\w+(?:\.\w+)+)/);if(d){o[r]=`{{ ${d[1]} }}`;continue}delete o[r]}else if(typeof e=="string"){const n=e.match(/el\.call\(\s*["']getLocalStateLang["']\s*,\s*["']([^"']+)["']\s*\)/);if(n){o[r]=`{{ ${n[1]} | getLocalStateLang }}`;continue}const s=e.match(/el\.call\(\s*["']polyglot["']\s*,\s*["']([^"']+)["']\s*\)/);if(s){o[r]=`{{ ${s[1]} | polyglot }}`;continue}if(e.includes("=>")&&e.includes("s.")){const p=e.match(/s\.(\w+(?:\.\w+)+)/);if(p){o[r]=`{{ ${p[1]} }}`;continue}}}return o}function E(i,o,r,{isProduction:e=!1,channel:n="production"}={}){const s=i.pages?.[o],p=M(s?.state)&&s?.state,d=s?.metadata||s?.helmet||p||{},g=j(d),c=new Set(Object.keys(g)),f=i.app?.metadata||{},a=j(f);let t={};if(i.integrations?.seo?t={...i.integrations.seo,...a,...g}:Object.keys(a).length?t={...a,...g}:t={...g},!t.title){const l=i.name||i.key;l?e?t.title=l:n==="development"?t.title=`${l} / dev:symbo.ls`:n==="staging"?t.title=`${l} / staging:symbo.ls`:t.title=`${l} / symbo.ls`:t.title="Symbols demo"}t=S(t,i,r),t.title&&(c.has("title")||!t["og:title"])&&(c.has("og:title")||(t["og:title"]=t.title)),t.description&&(c.has("description")||!t["og:description"])&&(c.has("og:description")||(t["og:description"]=t.description)),t.title&&!t["twitter:title"]&&(t["twitter:title"]=t.title),t.description&&!t["twitter:description"]&&(t["twitter:description"]=t.description);const u=r?.actualPathname||o;if(t["og:url"]||t.url){const l=(t["og:url"]||t.url||"").replace(/\/$/,"");if(l&&u&&u!=="/"){const $=u.startsWith("/")?u:"/"+u;t["og:url"]=l+$}}t=L(t,i.files);const m=i.name||i.app?.metadata?.title||i.app?.name||"";for(const[l,$]of Object.entries(t))if(typeof $=="string"&&$.includes("{{")){const b=$.replace(/\{\{[^}]*\}\}/g,"").trim();b?t[l]=b:l==="title"?t[l]=m:delete t[l]}return t}export{W as generateMetaTags,E as getPageMetadata};
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,10 +1,10 @@
1
- import{triggerEventOn as m}from"./triggerEvent.js";import{DOMQ_PROPERTIES as w,METHODS as k,PARSED_DOMQ_PROPERTIES as R}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 X(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 q(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 tt(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 et(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 nt(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 ot(e){return this[e]}function rt(e,t){const n=this;if(e)return n.update(e,t),n}function st(e){return e?this.__ref&&this.__ref[e]:this.__ref}function it(){return this.getRef("__children").map(t=>this[t])}function ct(){return this.getRef().path}let y=null;const lt=e=>{y=e||null},S=()=>y||null;function ft(e){let t=null;const n=o=>o.__element&&o.root?.isRootState;if(!this)t=S();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=S()),e?t?.[e]:t}function ut(e){const t=this.getRootState()?.__element;return t&&Object.keys(t).length>0&&e?t[e]:t}function at(e){return this.getRoot("data")&&Object.keys(this.getRoot("data")).length>0&&e?this.getRoot("data")[e]:this.getRoot("data")}function ht(e){const t=this.getRoot()?.context;return e?t[e]:t}function pt(e){const t=this.context;return e?t[e]:t}const dt=(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)||w.has(n)&&!R.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 v(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)?v.call(c,e,t):c):x(i)&&(o[s]=v.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
- `,"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 _t(...e){(a==="test"||a==="development")&&console.log(...e)}function gt(...e){(a==="test"||a==="development")&&console.warn(...e)}function O(...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 mt(){const e=this,{key:t,parent:n}=e,{__children:o}=n.__ref,r=o.indexOf(t),s=o[r+1];return n[s]}function xt(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 yt(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 St(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=>{O.call(this,s)}),r}catch(r){if(O.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 Ot(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=z[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])}},$=(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
- ${$(i,t+1)}
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},S=()=>y||null;function lt(e){let t=null;const n=o=>o.__element&&o.root?.isRootState;if(!this)t=S();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=S()),e?t?.[e]:t}function ft(e){const t=this.getRootState()?.__element;return t&&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 v(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)?v.call(c,e,t):c):x(i)&&(o[s]=v.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
+ `,"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 O(...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=>{O.call(this,s)}),r}catch(r){if(O.call(this,r),n?.strictMode)throw r}}async function St(){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 vt(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])}},w=(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
+ ${w(i,t+1)}
4
4
  ${n}}`).join(`
5
5
  `):""},L=e=>`{
6
- ${$(e,1)}
6
+ ${w(e,1)}
7
7
  }`,F=e=>{const t={fields:{},include:[]},n=(o,r)=>{const s=[];for(const i in o)if(o[i]===!0)s.push(i);else{const c=r?`${r}.${i}`:i;t.include.push(c),n(o[i],c)}s.length&&(t.fields[r||"_root"]=s)};return n(e,""),t},M=e=>{const t=s=>{const i=[],c=[];for(const l in s)if(s[l]===!0)i.push(l);else{const f=t(s[l]),u=[];f.select&&u.push(`$select=${f.select}`),f.expand&&u.push(`$expand=${f.expand}`),c.push(u.length?`${l}(${u.join(";")})`:l)}return{select:i.length?i.join(","):"",expand:c.length?c.join(","):""}},{select:n,expand:o}=t(e),r=[];return n&&r.push(`$select=${n}`),o&&r.push(`$expand=${o}`),r.join("&")},J=(e,t)=>{const n=[],o=[],r=new Set,s=(u,h,_)=>{r.add(h),_&&o.push(`LEFT JOIN ${h} ON ${h}.${_}_id = ${_}.id`);for(const d in u)u[d]===!0?n.push(`${h}.${d}`):s(u[d],d,h)},i=Object.keys(e);i.length===1&&e[i[0]]!==!0?s(e[i[0]],i[0],null):s(e,"_root",null);const c=[...r][0]||"_root",l=n.length?n.join(", "):"*",f=o.length?`
8
8
  `+o.join(`
9
9
  `):"";return`SELECT ${l}
10
- FROM ${c}${f}`},V=e=>{const t=[],n=(o,r)=>{for(const s in o){const i=r?`${r}/${s}`:s;o[s]===!0?t.push(i):n(o[s],i)}};return n(e,""),t},B=e=>{const t=o=>{const r=[];for(const s in o)o[s]===!0?r.push(s):r.push(`${s}(${t(o[s])})`);return r.join(", ")},n=Object.keys(e);return n.length===1&&e[n[0]]!==!0?{from:n[0],select:t(e[n[0]])}:{from:null,select:t(e)}},z={graphql:L,"json-api":F,odata:M,sql:J,supabase:B,paths:V};function $t(e,t){return!!(k.has(e)||t?.context?.methods?.[e])}export{St as call,dt as defineSetter,O as error,ot as get,it as getChildren,pt as getContext,vt as getDB,ct as getPath,Ot as getQuery,st as getRef,ut as getRoot,ht as getRootContext,at as getRootData,ft as getRootState,$t as isMethod,N as keys,_t as log,tt as lookdown,et as lookdownAll,q as lookup,mt as nextElement,D as parse,v as parseDeep,xt as previousElement,nt as remove,lt as setActiveRootState,Q as setNodeStyles,rt as setProps,X as spotByPath,yt as variables,T as verbose,gt as warn};
10
+ FROM ${c}${f}`},V=e=>{const t=[],n=(o,r)=>{for(const s in o){const i=r?`${r}/${s}`:s;o[s]===!0?t.push(i):n(o[s],i)}};return n(e,""),t},B={graphql:L,"json-api":F,odata:M,sql:J,paths:V};function Ot(e,t){return!!($.has(e)||t?.context?.methods?.[e])}export{yt as call,pt as defineSetter,O as error,nt as get,st as getChildren,ht as getContext,St as getDB,it as getPath,vt as getQuery,rt as getRef,ft as getRoot,at as getRootContext,ut as getRootData,lt as getRootState,Ot as isMethod,N as keys,dt as log,q as lookdown,tt as lookdownAll,X as lookup,gt as nextElement,D as parse,v as parseDeep,mt as previousElement,et as remove,ct as setActiveRootState,Q as setNodeStyles,ot as setProps,K as spotByPath,xt as variables,T as verbose,_t as warn};
package/metadata.js CHANGED
@@ -14,6 +14,106 @@ const buildAttrs = (obj) =>
14
14
  .map(([k, v]) => `${k}="${escapeHtml(v)}"`)
15
15
  .join(' ')
16
16
 
17
+ /**
18
+ * Stable signature used to content-key the `<script>` / `<style>` tags that
19
+ * `metadata.jsonLd` / `metadata.styles` / `metadata.scripts` emit. Not
20
+ * cryptographic — it only has to be deterministic per identical content so
21
+ * the three head pipelines (SSR `generateHeadHtml`, client runtime
22
+ * `applyMetadata`, published-site `generateMetaTags`) produce the same key
23
+ * and never double-emit or pile up duplicate tags after hydration.
24
+ *
25
+ * Lives here because `utils` is the lowest package in the graph:
26
+ * `@symbo.ls/helmet` already depends on `@symbo.ls/utils`, never the
27
+ * reverse, so this is the only place the three pipelines can share one
28
+ * implementation without a cycle. The helmet plugin still carries a
29
+ * byte-identical private `_hashContent` (`plugins/helmet/index.js`); it can
30
+ * drop it in favour of this export whenever that package is next touched.
31
+ */
32
+ export const hashContent = (s) => {
33
+ let h = 5381
34
+ const str = String(s)
35
+ for (let i = 0; i < str.length; i++) h = ((h * 33) ^ str.charCodeAt(i)) >>> 0
36
+ return h.toString(36)
37
+ }
38
+
39
+ /**
40
+ * Array-shaped head extensions. These are NOT meta tags — they carry their
41
+ * own tag shape (`<script type="application/ld+json">`, `<style>`,
42
+ * `<script src>`), so they must never reach the generic `processMetaTag`
43
+ * path (which would serialize `{ '@context': … }` object keys straight into
44
+ * `<meta @context="…">`). The client runtime skips them the same way — see
45
+ * `applyMetadata` in `plugins/helmet/index.js`.
46
+ */
47
+ const HEAD_ARRAY_KEYS = new Set(['jsonLd', 'styles', 'scripts'])
48
+
49
+ /**
50
+ * Render the `jsonLd` / `styles` / `scripts` head extensions.
51
+ *
52
+ * Emission semantics mirror `generateHeadHtml` (`plugins/helmet/index.js`)
53
+ * exactly — same `data-smbls-*` key attributes, same escaping, same hash
54
+ * inputs — so a published page and an SSR'd page produce interchangeable
55
+ * head markup and the client runtime reconciles both without re-emitting.
56
+ *
57
+ * metadata.jsonLd: [{ '@context': 'https://schema.org', '@type': 'Organization', … }]
58
+ * metadata.styles: ['@media (prefers-color-scheme: dark) { :root { --c: #111 } }']
59
+ * metadata.scripts: [{ src: 'https://…', async: true, defer: true, integrity: '…' }]
60
+ */
61
+ export const generateHeadArrayTags = (metadata) => {
62
+ const tags = []
63
+
64
+ // jsonLd: one <script type="application/ld+json"> per entry.
65
+ if (Array.isArray(metadata.jsonLd)) {
66
+ for (const item of metadata.jsonLd) {
67
+ if (item == null) continue
68
+ const body = typeof item === 'string' ? item : JSON.stringify(item)
69
+ // Defense in depth: script bodies must not contain '</script>'. Escape
70
+ // the forward slash so a malicious or accidental value can't break out.
71
+ // The key hashes the RAW body so the escaping never shifts the key.
72
+ const safe = String(body).replace(/<\/script/gi, '<\\/script')
73
+ tags.push(`<script type="application/ld+json" data-smbls-jsonld="${hashContent(body)}">${safe}</script>`)
74
+ }
75
+ }
76
+
77
+ // styles: inline <style> blocks.
78
+ if (Array.isArray(metadata.styles)) {
79
+ for (const s of metadata.styles) {
80
+ if (s == null || !String(s).trim()) continue
81
+ const body = String(s).replace(/<\/style/gi, '<\\/style')
82
+ tags.push(`<style data-smbls-style="${hashContent(body)}">${body}</style>`)
83
+ }
84
+ }
85
+
86
+ // scripts: src-keyed <script> with async/defer/integrity passthrough.
87
+ if (Array.isArray(metadata.scripts)) {
88
+ for (const spec of metadata.scripts) {
89
+ if (!spec) continue
90
+ const isStr = typeof spec === 'string'
91
+ const src = isStr ? spec : spec.src
92
+ if (!src && !spec.body) continue
93
+ const attrs = []
94
+ if (src) attrs.push(`src="${escapeHtml(src)}"`)
95
+ if (!isStr) {
96
+ if (spec.type) attrs.push(`type="${escapeHtml(spec.type)}"`)
97
+ if (spec.async) attrs.push('async')
98
+ if (spec.defer) attrs.push('defer')
99
+ if (spec.integrity) attrs.push(`integrity="${escapeHtml(spec.integrity)}"`)
100
+ if (spec.crossorigin) attrs.push(`crossorigin="${escapeHtml(spec.crossorigin)}"`)
101
+ if (spec.referrerpolicy) attrs.push(`referrerpolicy="${escapeHtml(spec.referrerpolicy)}"`)
102
+ if (spec.nomodule) attrs.push('nomodule')
103
+ }
104
+ const keyAttr = ` data-smbls-script="${escapeHtml(src || hashContent(spec.body || ''))}"`
105
+ if (!isStr && spec.body) {
106
+ const safe = String(spec.body).replace(/<\/script/gi, '<\\/script')
107
+ tags.push(`<script ${attrs.join(' ')}${keyAttr}>${safe}</script>`)
108
+ } else {
109
+ tags.push(`<script ${attrs.join(' ')}${keyAttr}></script>`)
110
+ }
111
+ }
112
+ }
113
+
114
+ return tags
115
+ }
116
+
17
117
  /**
18
118
  * Generates HTML meta tags from a flat metadata object.
19
119
  * Works on both server (SSR head injection) and client (dynamic meta updates).
@@ -29,6 +129,10 @@ export const generateMetaTags = (metadata, isProduction) => {
29
129
  (acc, [key, value]) => {
30
130
  if (!value && value !== 0 && value !== false) return acc
31
131
 
132
+ // Array-shaped head extensions carry their own tag shape — emitted
133
+ // after the reduce by generateHeadArrayTags, never as <meta>.
134
+ if (HEAD_ARRAY_KEYS.has(key)) return acc
135
+
32
136
  if (key === 'title') {
33
137
  acc.push(`<title>${escapeHtml(value)}</title>`)
34
138
  return acc
@@ -148,6 +252,9 @@ export const generateMetaTags = (metadata, isProduction) => {
148
252
  ]
149
253
  )
150
254
 
255
+ // jsonLd / styles / scripts trail the meta tags, matching generateHeadHtml.
256
+ tags.push(...generateHeadArrayTags(metadata))
257
+
151
258
  return tags.join('\n')
152
259
  }
153
260
 
package/methods.js CHANGED
@@ -475,8 +475,8 @@ export async function getDB () {
475
475
  element.context.fetch = resolved
476
476
  delete db.__resolving
477
477
  // resolveDb returns null when the config has no `adapter` field or the
478
- // adapter's setup() bails (e.g. cross-realm Supabase createClient
479
- // returns a client without `.auth` — see workspace
478
+ // adapter's setup() bails (e.g. a cross-realm client factory returns a
479
+ // client without `.auth` — see workspace
480
480
  // attachDbAdapters.js:resolveDbAdapters for the consumer-side
481
481
  // pre-resolve that bypasses this path). Without `?.`, the next line
482
482
  // throws `Cannot read properties of null (reading 'getSession')` and
@@ -659,31 +659,11 @@ const formatPaths = query => {
659
659
  return paths
660
660
  }
661
661
 
662
- const formatSupabase = query => {
663
- const build = obj => {
664
- const parts = []
665
- for (const key in obj) {
666
- if (obj[key] === true) {
667
- parts.push(key)
668
- } else {
669
- parts.push(`${key}(${build(obj[key])})`)
670
- }
671
- }
672
- return parts.join(', ')
673
- }
674
- const roots = Object.keys(query)
675
- if (roots.length === 1 && query[roots[0]] !== true) {
676
- return { from: roots[0], select: build(query[roots[0]]) }
677
- }
678
- return { from: null, select: build(query) }
679
- }
680
-
681
662
  const QUERY_FORMATTERS = {
682
663
  graphql: formatGraphQL,
683
664
  'json-api': formatJsonApi,
684
665
  odata: formatOData,
685
666
  sql: formatSQL,
686
- supabase: formatSupabase,
687
667
  paths: formatPaths
688
668
  }
689
669
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/utils",
3
- "version": "3.14.599",
3
+ "version": "3.14.656",
4
4
  "license": "CC-BY-NC-4.0",
5
5
  "type": "module",
6
6
  "module": "./dist/esm/index.js",
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
49
49
  "peerDependencies": {
50
- "@symbo.ls/fetch": "^3.14.599"
50
+ "@symbo.ls/fetch": "^3.14.656"
51
51
  },
52
52
  "peerDependenciesMeta": {
53
53
  "@symbo.ls/fetch": {