@symbo.ls/utils 3.14.105 → 3.14.446

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,10 +1,26 @@
1
1
  # @symbo.ls/utils
2
2
 
3
+ ## 3.14.446
4
+
5
+ ### Patch Changes
6
+
7
+ - Auto-generated cross-repo patch release.
8
+
9
+ ## 3.14.276
10
+
11
+ ### Patch Changes
12
+
13
+ - Auto-generated cross-repo patch release.
14
+
3
15
  ## 3.14.105
4
16
 
5
17
  ### Patch Changes
6
18
 
7
- - @symbo.ls/fetch@3.14.105
19
+ - Manual patch bump triggered via workflow_dispatch (scope: all).
20
+ No source change behind this bump — released to refresh dist or
21
+ coordinate a cross-package version line.
22
+ - Updated dependencies
23
+ - @symbo.ls/fetch@3.14.105
8
24
 
9
25
  ## 3.14.104
10
26
 
@@ -1,13 +1,13 @@
1
- "use strict";var x=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var q=(e,t)=>{for(var r in t)x(e,r,{get:t[r],enumerable:!0})},B=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of F(t))!b.call(e,n)&&n!==r&&x(e,n,{get:()=>t[n],enumerable:!(o=W(t,n))||o.enumerable});return e};var G=e=>B(x({},"__esModule",{value:!0}),e);var Se={};q(Se,{clone:()=>V,createNestedObject:()=>ye,createObjectWithoutPrototype:()=>R,deepClone:()=>z,deepContains:()=>ae,deepDestringifyFunctions:()=>j,deepMerge:()=>U,deepStringifyFunctions:()=>k,destringifyGlobalScope:()=>re,detectInfiniteLoop:()=>ge,excludeKeysFromObject:()=>_e,exec:()=>P,getInObjectByPath:()=>we,hasFunction:()=>S,hasOwnProperty:()=>se,isCyclic:()=>Oe,isEmpty:()=>D,isEmptyObject:()=>ie,isEqualDeep:()=>M,makeObjectWithoutPrototype:()=>ce,map:()=>H,merge:()=>J,objectToString:()=>E,overwrite:()=>fe,overwriteDeep:()=>I,overwriteShallow:()=>le,removeFromObject:()=>pe,removeNestedKeyByPath:()=>he,setInObjectByPath:()=>de,stringToObject:()=>oe});module.exports=G(Se);var _=require("./globals.js"),c=require("./types.js"),T=require("./array.js"),N=require("./string.js"),g=require("./node.js"),C=require("./keys.js");const A="production",O=e=>e.charCodeAt(0)===95&&e.charCodeAt(1)===95,P=(e,t,r,o)=>{if((0,c.isFunction)(e))return t?typeof e.call!="function"?e:e.call(t,t,r||t.state,o||t.context):void 0;if(e!=null&&t?.context?.plugins&&((0,c.isArray)(e)||(0,c.isObject)(e)&&!(0,g.isDOMNode)(e))){const n=t.context.plugins;for(const s of n)if(s.resolveHandler){const i=s.resolveHandler(e,t);if(typeof i=="function")return P(i,t,r,o)}}return e},H=(e,t,r)=>{for(const o in t)e[o]=P(t[o],r)},J=(e,t,r=[])=>{const o=r instanceof Set;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(O(n)||(o?r.has(n):r.includes(n))||e[n]===void 0&&(e[n]=t[n]));return e},U=(e,t,r=C.METHODS_EXL)=>$(e,t,r,null),$=(e,t,r,o)=>{if(e===t)return e;if(o){for(let s=0;s<o.length;s+=2)if(o[s]===e&&o[s+1]===t)return e}const n=r instanceof Set;for(const s in t){if(!Object.prototype.hasOwnProperty.call(t,s)||O(s)||s==="constructor"||s==="prototype"||(n?r.has(s):r.includes(s)))continue;const i=e[s],f=t[s];if((0,c.isObjectLike)(i)&&(0,c.isObjectLike)(f)){const l=o||[];l.push(e,t),$(i,f,r,l),l.length-=2}else i===void 0&&(e[s]=f)}return e},V=(e,t=[])=>{const r=t instanceof Set,o={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(O(n)||(r?t.has(n):t.includes(n))||(o[n]=e[n]));return o},z=(e,t={})=>{const{exclude:r=[],cleanUndefined:o=!1,cleanNull:n=!1,visited:s=new WeakMap,handleExtends:i=!1}=t;if(!(0,c.isObjectLike)(e)||(0,g.isDOMNode)(e))return e;if(s.has(e))return s.get(e);const f=r instanceof Set?r:r.length>3?new Set(r):null,l=p=>f?f.has(p):r.includes(p),u=(0,c.isArray)(e)?[]:{};s.set(e,u);const y=[[e,u]];for(;y.length;){const[p,d]=y.pop();for(const h in p){if(!Object.prototype.hasOwnProperty.call(p,h)||O(h)||h==="__proto__"||l(h))continue;const a=p[h];if(!(o&&a===void 0)&&!(n&&a===null)){if((0,g.isDOMNode)(a)){d[h]=a;continue}if(i&&h==="extends"&&(0,c.isArray)(a)){d[h]=(0,T.unstackArrayOfObjects)(a,r);continue}if((0,c.isFunction)(a)){d[h]=a;continue}if((0,c.isObjectLike)(a))if(s.has(a))d[h]=s.get(a);else{const w=(0,c.isArray)(a)?[]:{};s.set(a,w),d[h]=w,y.push([a,w])}else d[h]=a}}}return u},k=(e,t={})=>{(e.node||e.__ref||e.parent||e.__element||e.parse)&&((e.__element||e.parent?.__element).warn("Trying to clone element or state at",e),e=e.parse?.());for(const r in e){const o=e[r];if((0,c.isFunction)(o))t[r]=o.toString();else if((0,c.isObject)(o))t[r]={},k(o,t[r]);else if((0,c.isArray)(o)){const n=t[r]=[];for(let s=0;s<o.length;s++){const i=o[s];(0,c.isObject)(i)?(n[s]={},k(i,n[s])):(0,c.isFunction)(i)?n[s]=i.toString():n[s]=i}}else t[r]=o}return t},K=new Set(["&","*","-",":","%","{","}",">","<","@",".","/","!"," "]),E=(e={},t=0)=>{if(e===null||typeof e!="object")return String(e);let r=!1;for(const s in e){r=!0;break}if(!r)return"{}";const o=" ".repeat(t);let n=`{
2
- `;for(const s in e){if(!Object.prototype.hasOwnProperty.call(e,s))continue;const i=e[s];let f=!1;for(let u=0;u<s.length;u++)if(K.has(s[u])){f=!0;break}const l=f?`'${s}'`:s;if(n+=`${o} ${l}: `,(0,c.isArray)(i)){n+=`[
3
- `;for(const u of i)(0,c.isObjectLike)(u)&&u!==null?n+=`${o} ${E(u,t+2)},
4
- `:(0,c.isString)(u)?n+=`${o} '${u}',
5
- `:n+=`${o} ${u},
1
+ "use strict";var x=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var q=(e,t)=>{for(var r in t)x(e,r,{get:t[r],enumerable:!0})},B=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of F(t))!b.call(e,n)&&n!==r&&x(e,n,{get:()=>t[n],enumerable:!(o=W(t,n))||o.enumerable});return e};var G=e=>B(x({},"__esModule",{value:!0}),e);var Se={};q(Se,{clone:()=>V,createNestedObject:()=>ye,createObjectWithoutPrototype:()=>R,deepClone:()=>z,deepContains:()=>ae,deepDestringifyFunctions:()=>j,deepMerge:()=>U,deepStringifyFunctions:()=>k,destringifyGlobalScope:()=>re,detectInfiniteLoop:()=>ge,excludeKeysFromObject:()=>_e,exec:()=>P,getInObjectByPath:()=>we,hasFunction:()=>S,hasOwnProperty:()=>se,isCyclic:()=>Oe,isEmpty:()=>D,isEmptyObject:()=>ie,isEqualDeep:()=>M,makeObjectWithoutPrototype:()=>ce,map:()=>H,merge:()=>J,objectToString:()=>E,overwrite:()=>fe,overwriteDeep:()=>I,overwriteShallow:()=>le,removeFromObject:()=>pe,removeNestedKeyByPath:()=>he,setInObjectByPath:()=>de,stringToObject:()=>oe});module.exports=G(Se);var _=require("./globals.js"),c=require("./types.js"),T=require("./array.js"),N=require("./string.js"),g=require("./node.js"),C=require("./keys.js");const A="production",O=e=>e.charCodeAt(0)===95&&e.charCodeAt(1)===95,P=(e,t,r,o)=>{if((0,c.isFunction)(e))return t?typeof e.call!="function"?e:e.call(t,t,r||t.state,o||t.context):void 0;if(e!=null&&t?.context?.plugins&&((0,c.isArray)(e)||(0,c.isObject)(e)&&!(0,g.isDOMNode)(e))){const n=t.context.plugins;for(const s of n)if(s.resolveHandler){const i=s.resolveHandler(e,t);if(typeof i=="function")return P(i,t,r,o)}}return e},H=(e,t,r)=>{for(const o in t)e[o]=P(t[o],r)},J=(e,t,r=[])=>{const o=r instanceof Set;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(O(n)||(o?r.has(n):r.includes(n))||e[n]===void 0&&(e[n]=t[n]));return e},U=(e,t,r=C.METHODS_EXL)=>$(e,t,r,null),$=(e,t,r,o)=>{if(e===t)return e;if(o){for(let s=0;s<o.length;s+=2)if(o[s]===e&&o[s+1]===t)return e}const n=r instanceof Set;for(const s in t){if(!Object.prototype.hasOwnProperty.call(t,s)||O(s)||s==="constructor"||s==="prototype"||(n?r.has(s):r.includes(s)))continue;const i=e[s],l=t[s];if((0,c.isObjectLike)(i)&&(0,c.isObjectLike)(l)){const u=o||[];u.push(e,t),$(i,l,r,u),u.length-=2}else i===void 0&&(e[s]=l)}return e},V=(e,t=[])=>{const r=t instanceof Set,o={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(O(n)||(r?t.has(n):t.includes(n))||(o[n]=e[n]));return o},z=(e,t={})=>{const{exclude:r=[],cleanUndefined:o=!1,cleanNull:n=!1,visited:s=new WeakMap,handleExtends:i=!1}=t;if(!(0,c.isObjectLike)(e)||(0,g.isDOMNode)(e))return e;if(s.has(e))return s.get(e);const l=r instanceof Set?r:r.length>3?new Set(r):null,u=y=>l?l.has(y):r.includes(y),f=(0,c.isArray)(e)?[]:{};s.set(e,f);const p=[[e,f]];for(;p.length;){const[y,d]=p.pop();for(const h in y){if(!Object.prototype.hasOwnProperty.call(y,h)||O(h)||h==="__proto__"||u(h))continue;const a=y[h];if(!(o&&a===void 0)&&!(n&&a===null)){if((0,g.isDOMNode)(a)){d[h]=a;continue}if(i&&h==="extends"&&(0,c.isArray)(a)){d[h]=(0,T.unstackArrayOfObjects)(a,r);continue}if((0,c.isFunction)(a)){d[h]=a;continue}if((0,c.isObjectLike)(a))if(s.has(a))d[h]=s.get(a);else{const w=(0,c.isArray)(a)?[]:{};s.set(a,w),d[h]=w,p.push([a,w])}else d[h]=a}}}return f},k=(e,t={})=>{(e.node||e.__ref||e.parent||e.__element||e.parse)&&((e.__element||e.parent?.__element).warn("Trying to clone element or state at",e),e=e.parse?.());for(const r in e){const o=e[r];if((0,c.isFunction)(o))t[r]=o.toString();else if((0,c.isObject)(o))t[r]={},k(o,t[r]);else if((0,c.isArray)(o)){const n=t[r]=[];for(let s=0;s<o.length;s++){const i=o[s];(0,c.isObject)(i)?(n[s]={},k(i,n[s])):(0,c.isFunction)(i)?n[s]=i.toString():n[s]=i}}else t[r]=o}return t},K=new Set(["&","*","-",":","%","{","}",">","<","@",".","/","!"," "]),E=(e={},t=0)=>{if(e===null||typeof e!="object")return String(e);let r=!1;for(const s in e){r=!0;break}if(!r)return"{}";const o=" ".repeat(t);let n=`{
2
+ `;for(const s in e){if(!Object.prototype.hasOwnProperty.call(e,s))continue;const i=e[s];let l=!1;for(let f=0;f<s.length;f++)if(K.has(s[f])){l=!0;break}const u=l?`'${s}'`:s;if(n+=`${o} ${u}: `,(0,c.isArray)(i)){n+=`[
3
+ `;for(const f of i)(0,c.isObjectLike)(f)&&f!==null?n+=`${o} ${E(f,t+2)},
4
+ `:(0,c.isString)(f)?n+=`${o} '${f}',
5
+ `:n+=`${o} ${f},
6
6
  `;n+=`${o} ]`}else(0,c.isObjectLike)(i)?n+=E(i,t+1):(0,c.isString)(i)?n+=(0,N.stringIncludesAny)(i,[`
7
7
  `,"'"])?`\`${i}\``:`'${i}'`:n+=i;n+=`,
8
- `}return n+=`${o}}`,n},X=[/^\(\s*\{[^}]*\}\s*\)\s*=>/,/^(\([^)]*\)|[^=]*)\s*=>/,/^function[\s(]/,/^async\s+/,/^\(\s*function/,/^[a-zA-Z_$][a-zA-Z0-9_$]*\s*=>/],Y=/^["[{]/,Z=/^(export|import)\s/,S=e=>{if(!e)return!1;const t=e.trim().replace(/\n\s*/g," ").trim();if(t===""||t==="{}"||t==="[]"||Z.test(t)||!X.some(s=>s.test(t)))return!1;const o=t.charCodeAt(0),n=t.includes("=>");return!(o===123&&!n||o===91||Y.test(t)&&!n)},Q=e=>(0,eval)(e),m=(e,t)=>{const r=/^(\s*(?:async\s+)?function\s*[\w$]*\s*\([^)]*\)\s*)\{/.exec(e);if(!r)return null;const o=r[0].length,n=[];let s=o,i=1,f=null;const l=e.length,u=new RegExp("^(?:const|let|var)\\s+"+t+"\\b");for(;s<l&&i>0;){const p=e[s];if(p==="/"&&e[s+1]==="/"){const d=e.indexOf(`
9
- `,s);s=d===-1?l:d;continue}if(p==="/"&&e[s+1]==="*"){const d=e.indexOf("*/",s+2);s=d===-1?l:d+2;continue}if(p==='"'||p==="'"||p==="`"){const d=p;for(s++;s<l;){if(e[s]==="\\"){s+=2;continue}if(e[s]===d){s++;break}if(d==="`"&&e[s]==="$"&&e[s+1]==="{"){s+=2;let h=1;for(;s<l&&h>0;)e[s]==="{"?h++:e[s]==="}"&&h--,s++;continue}s++}continue}if(p==="{"){i++,s++;continue}if(p==="}"){i--,s++;continue}if(i===1&&u.test(e.slice(s))){const d=s;let h=0,a=s;for(;a<l;){const w=e[a];if(w==='"'||w==="'"||w==="`"){const L=w;for(a++;a<l;){if(e[a]==="\\"){a+=2;continue}if(e[a]===L){a++;break}a++}continue}if(w==="("||w==="["||w==="{"){h++,a++;continue}if(w===")"||w==="]"||w==="}"){if(h===0)break;h--,a++;continue}if(h===0&&(w===";"||w===`
10
- `)){a++;break}a++}n.push([d,a]),s=a;continue}s++}if(!n.length)return null;let y=e;for(let p=n.length-1;p>=0;p--)y=y.slice(0,n[p][0])+y.slice(n[p][1]);return y},v=(e,t,r)=>{try{return r.window.eval(`(${e})`)}catch(o){const n=o&&o.message?o.message:String(o),s=/await is only valid in async/.test(n),i=/Identifier '([^']+)' has already been declared/.exec(n);let f=null;if(s){const l=String(e).trim();if(/^function[\s(]/.test(l))try{f=r.window.eval("(async "+l+")")}catch{}}else if(i){let l=String(e),u=i[1];for(let y=0;y<5;y++){const p=m(l,u);if(!p||p===l)break;l=p;try{f=r.window.eval("("+l+")");break}catch(d){const h=/Identifier '([^']+)' has already been declared/.exec(d&&d.message||String(d));if(!h||h[1]!==u)break}}}return f||(typeof console<"u"&&console.warn&&console.warn(`[smbls] deepDestringifyFunctions: eval failed on ${t} \u2014 value will be left as a string. Reason: `+n+`.
11
- First 200 chars of source: `+String(e).slice(0,200)),e)}},j=(e,t={},r={window:{eval:Q}})=>{if(!e||typeof e!="object")return t;const o=[[e,t]];for(;o.length;){const[n,s]=o.pop();for(const i in n){if(!Object.prototype.hasOwnProperty.call(n,i))continue;const f=n[i];if((0,c.isString)(f))S(f)?s[i]=v(f,`"${i}"`,r):s[i]=f;else if((0,c.isArray)(f)){const l=s[i]=[];for(let u=0;u<f.length;u++){const y=f[u];if((0,c.isString)(y))l.push(S(y)?v(y,`array index ${u} (prop "${i}")`,r):y);else if((0,c.isObject)(y)){const p={};l.push(p),o.push([y,p])}else l.push(y)}}else if((0,c.isObject)(f)){const l=s[i]&&typeof s[i]=="object"&&!(0,c.isArray)(s[i])?s[i]:s[i]={};o.push([f,l])}else s[i]=f}}return t},ee="Set",te="Map",ne=e=>!e||typeof e!="object"?e:e.__type===ee&&Array.isArray(e.values)?new Set(e.values):e.__type===te&&Array.isArray(e.entries)?new Map(e.entries):e,re=e=>{if(!e||typeof e!="object")return e;const t={},r=[];for(const o of Object.keys(e)){const n=e[o];(0,c.isString)(n)&&S(n)?r.push([o,n]):t[o]=ne(n)}for(const[o,n]of r)try{const s=Object.keys(t).map(i=>`var ${i} = __gs__[${JSON.stringify(i)}];`).join(`
8
+ `}return n+=`${o}}`,n},X=[/^\(\s*\{[^}]*\}\s*\)\s*=>/,/^(\([^)]*\)|[^=]*)\s*=>/,/^function[\s(]/,/^async\s+/,/^\(\s*function/,/^[a-zA-Z_$][a-zA-Z0-9_$]*\s*=>/],Y=/^["[{]/,Z=/^(export|import)\s/,S=e=>{if(!e)return!1;const t=e.trim().replace(/\n\s*/g," ").trim();if(t===""||t==="{}"||t==="[]"||Z.test(t)||!X.some(s=>s.test(t)))return!1;const o=t.charCodeAt(0),n=t.includes("=>");return!(o===123&&!n||o===91||Y.test(t)&&!n)},Q=e=>(0,eval)(e),m=(e,t)=>{const r=/^(\s*(?:async\s+)?function\s*[\w$]*\s*\([^)]*\)\s*)\{/.exec(e);if(!r)return null;const o=r[0].length,n=[];let s=o,i=1,l=null;const u=e.length,f=new RegExp("^(?:const|let|var)\\s+"+t+"\\b");for(;s<u&&i>0;){const y=e[s];if(y==="/"&&e[s+1]==="/"){const d=e.indexOf(`
9
+ `,s);s=d===-1?u:d;continue}if(y==="/"&&e[s+1]==="*"){const d=e.indexOf("*/",s+2);s=d===-1?u:d+2;continue}if(y==='"'||y==="'"||y==="`"){const d=y;for(s++;s<u;){if(e[s]==="\\"){s+=2;continue}if(e[s]===d){s++;break}if(d==="`"&&e[s]==="$"&&e[s+1]==="{"){s+=2;let h=1;for(;s<u&&h>0;)e[s]==="{"?h++:e[s]==="}"&&h--,s++;continue}s++}continue}if(y==="{"){i++,s++;continue}if(y==="}"){i--,s++;continue}if(i===1&&f.test(e.slice(s))){const d=s;let h=0,a=s;for(;a<u;){const w=e[a];if(w==='"'||w==="'"||w==="`"){const L=w;for(a++;a<u;){if(e[a]==="\\"){a+=2;continue}if(e[a]===L){a++;break}a++}continue}if(w==="("||w==="["||w==="{"){h++,a++;continue}if(w===")"||w==="]"||w==="}"){if(h===0)break;h--,a++;continue}if(h===0&&(w===";"||w===`
10
+ `)){a++;break}a++}n.push([d,a]),s=a;continue}s++}if(!n.length)return null;let p=e;for(let y=n.length-1;y>=0;y--)p=p.slice(0,n[y][0])+p.slice(n[y][1]);return p},v=(e,t,r)=>{const o=String(e).trimStart();if(/^(export|import)\s/.test(o))return e;try{return r.window.eval(`(${e})`)}catch(n){const s=n&&n.message?n.message:String(n),i=/await is only valid in async/.test(s),l=/Identifier '([^']+)' has already been declared/.exec(s);let u=null;if(i){const f=String(e).trim();if(/^function[\s(]/.test(f))try{u=r.window.eval("(async "+f+")")}catch{}}else if(l){let f=String(e),p=l[1];for(let y=0;y<5;y++){const d=m(f,p);if(!d||d===f)break;f=d;try{u=r.window.eval("("+f+")");break}catch(h){const a=/Identifier '([^']+)' has already been declared/.exec(h&&h.message||String(h));if(!a||a[1]!==p)break}}}return u||(typeof console<"u"&&console.warn&&console.warn(`[smbls] deepDestringifyFunctions: eval failed on ${t} \u2014 value will be left as a string. Reason: `+s+`.
11
+ First 200 chars of source: `+String(e).slice(0,200)),e)}},j=(e,t={},r={window:{eval:Q}})=>{if(!e||typeof e!="object")return t;const o=[[e,t]];for(;o.length;){const[n,s]=o.pop();for(const i in n){if(!Object.prototype.hasOwnProperty.call(n,i))continue;const l=n[i];if((0,c.isString)(l))S(l)?s[i]=v(l,`"${i}"`,r):s[i]=l;else if((0,c.isArray)(l)){const u=s[i]=[];for(let f=0;f<l.length;f++){const p=l[f];if((0,c.isString)(p))u.push(S(p)?v(p,`array index ${f} (prop "${i}")`,r):p);else if((0,c.isObject)(p)){const y={};u.push(y),o.push([p,y])}else u.push(p)}}else if((0,c.isObject)(l)){const u=s[i]&&typeof s[i]=="object"&&!(0,c.isArray)(s[i])?s[i]:s[i]={};o.push([l,u])}else s[i]=l}}return t},ee="Set",te="Map",ne=e=>!e||typeof e!="object"?e:e.__type===ee&&Array.isArray(e.values)?new Set(e.values):e.__type===te&&Array.isArray(e.entries)?new Map(e.entries):e,re=e=>{if(!e||typeof e!="object")return e;const t={},r=[];for(const o of Object.keys(e)){const n=e[o];(0,c.isString)(n)&&S(n)?r.push([o,n]):t[o]=ne(n)}for(const[o,n]of r)try{const s=Object.keys(t).map(i=>`var ${i} = __gs__[${JSON.stringify(i)}];`).join(`
12
12
  `);t[o]=_.window.eval(`(function(__gs__) { ${s}
13
- return (${n}); })`)(t)}catch{try{t[o]=_.window.eval(`(${n})`)}catch{t[o]=n}}return t},oe=(e,t={verbose:!0})=>{try{return e?_.window.eval("("+e+")"):{}}catch(r){t.verbose&&console.warn(r)}},se=(e,...t)=>Object.prototype.hasOwnProperty.call(e,...t),D=e=>{for(const t in e)return!1;return!0},ie=e=>(0,c.isObject)(e)&&D(e),ce=()=>Object.create(null),fe=(e,t,r={})=>{const o=r.exclude||[],n=r.preventUnderscore;for(const s in t)o.includes(s)||!n&&O(s)||s==="constructor"||s==="prototype"||t[s]!==void 0&&(e[s]=t[s]);return e},le=(e,t,r=[])=>{const o=r instanceof Set;for(const n in t)O(n)||n==="constructor"||n==="prototype"||(o?r.has(n):r.includes(n))||(e[n]=t[n]);return e},I=(e,t,r={},o=new WeakMap)=>{if(!(0,c.isObjectLike)(e)||!(0,c.isObjectLike)(t)||(0,g.isDOMNode)(e)||(0,g.isDOMNode)(t))return t;if(o.has(e))return o.get(e);o.set(e,e);const n=r.exclude,s=n?n instanceof Set?n:new Set(n):null,i=!r.preventForce;for(const f in t){if(!Object.prototype.hasOwnProperty.call(t,f)||s&&s.has(f)||i&&O(f)||f==="constructor"||f==="prototype")continue;const l=e[f],u=t[f];(0,g.isDOMNode)(u)?e[f]=u:(0,c.isObjectLike)(l)&&(0,c.isObjectLike)(u)?e[f]=I(l,u,r,o):u!==void 0&&(e[f]=u)}return e},M=(e,t,r=new Set)=>{if(typeof e!="object"||typeof t!="object"||e===null||t===null)return e===t;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);const o=Object.keys(e),n=Object.keys(t);if(o.length!==n.length)return!1;for(let s=0;s<o.length;s++){const i=o[s];if(!Object.prototype.hasOwnProperty.call(t,i)||!M(e[i],t[i],r))return!1}return!0},ue=new Set(["node","__ref"]),ae=(e,t,r=ue)=>{if(e===t)return!0;if(!(0,c.isObjectLike)(e)||!(0,c.isObjectLike)(t)||(0,g.isDOMNode)(e)||(0,g.isDOMNode)(t))return e===t;const o=r instanceof Set?r:new Set(r),n=new WeakSet;function s(i,f){if(n.has(f))return!0;n.add(f);for(const l in f){if(!Object.prototype.hasOwnProperty.call(f,l)||o.has(l))continue;if(!Object.prototype.hasOwnProperty.call(i,l))return!1;const u=f[l],y=i[l];if((0,g.isDOMNode)(u)||(0,g.isDOMNode)(y)){if(u!==y)return!1}else if((0,c.isObjectLike)(u)&&(0,c.isObjectLike)(y)){if(!s(y,u))return!1}else if(u!==y)return!1}return!0}return s(e,t)},pe=(e,t)=>{if(t==null)return e;if((0,c.is)(t)("string","number"))delete e[t];else if((0,c.isArray)(t))for(let r=0;r<t.length;r++)delete e[t[r]];else throw new Error("Invalid input: props must be a string or an array of strings");return e},R=e=>{if(e===null||typeof e!="object")return e;const t=Object.create(null);for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=R(e[r]));return t},ye=(e,t)=>{if(e.length===0)return t;const r={};let o=r;for(let n=0;n<e.length;n++)n===e.length-1&&t?o[e[n]]=t:(o[e[n]]={},o=o[e[n]]);return r},he=(e,t)=>{if(!Array.isArray(t))throw new Error("Path must be an array.");let r=e;for(let n=0;n<t.length-1;n++){if(r[t[n]]===void 0)return;r=r[t[n]]}const o=t[t.length-1];r&&Object.prototype.hasOwnProperty.call(r,o)&&delete r[o]},de=(e,t,r)=>{if(!Array.isArray(t))throw new Error("Path must be an array.");let o=e;for(let n=0;n<t.length-1;n++)(!o[t[n]]||typeof o[t[n]]!="object")&&(o[t[n]]={}),o=o[t[n]];return o[t[t.length-1]]=r,e},we=(e,t)=>{if(!Array.isArray(t))throw new Error("Path must be an array.");let r=e;for(let o=0;o<t.length;o++){if(r==null)return;r=r[t[o]]}return r},ge=e=>{let r=[],o=0;for(let n=0;n<e.length;n++)if(r.length<2)r.push(e[n]);else if(e[n]===r[n%2]?o++:(r=[e[n-1],e[n]],o=1),o>=20)return(A==="test"||A==="development")&&console.warn("Warning: Potential infinite loop detected due to repeated sequence:",r),!0},Oe=e=>{const t=new WeakSet;function r(o){if(o&&typeof o=="object"){if(t.has(o))return!0;t.add(o);for(const n in o)if(Object.prototype.hasOwnProperty.call(o,n)&&r(o[n]))return console.log(o,"cycle at "+n),!0}return!1}return r(e)},_e=(e,t)=>{const r=t instanceof Set?t:new Set(t),o={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&!r.has(n)&&(o[n]=e[n]);return o};
13
+ return (${n}); })`)(t)}catch{try{t[o]=_.window.eval(`(${n})`)}catch{t[o]=n}}return t},oe=(e,t={verbose:!0})=>{try{return e?_.window.eval("("+e+")"):{}}catch(r){t.verbose&&console.warn(r)}},se=(e,...t)=>Object.prototype.hasOwnProperty.call(e,...t),D=e=>{for(const t in e)return!1;return!0},ie=e=>(0,c.isObject)(e)&&D(e),ce=()=>Object.create(null),fe=(e,t,r={})=>{const o=r.exclude||[],n=r.preventUnderscore;for(const s in t)o.includes(s)||!n&&O(s)||s==="constructor"||s==="prototype"||t[s]!==void 0&&(e[s]=t[s]);return e},le=(e,t,r=[])=>{const o=r instanceof Set;for(const n in t)O(n)||n==="constructor"||n==="prototype"||(o?r.has(n):r.includes(n))||(e[n]=t[n]);return e},I=(e,t,r={},o=new WeakMap)=>{if(!(0,c.isObjectLike)(e)||!(0,c.isObjectLike)(t)||(0,g.isDOMNode)(e)||(0,g.isDOMNode)(t))return t;if(o.has(e))return o.get(e);o.set(e,e);const n=r.exclude,s=n?n instanceof Set?n:new Set(n):null,i=!r.preventForce;for(const l in t){if(!Object.prototype.hasOwnProperty.call(t,l)||s&&s.has(l)||i&&O(l)||l==="constructor"||l==="prototype")continue;const u=e[l],f=t[l];(0,g.isDOMNode)(f)?e[l]=f:(0,c.isObjectLike)(u)&&(0,c.isObjectLike)(f)?e[l]=I(u,f,r,o):f!==void 0&&(e[l]=f)}return e},M=(e,t,r=new Set)=>{if(typeof e!="object"||typeof t!="object"||e===null||t===null)return e===t;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);const o=Object.keys(e),n=Object.keys(t);if(o.length!==n.length)return!1;for(let s=0;s<o.length;s++){const i=o[s];if(!Object.prototype.hasOwnProperty.call(t,i)||!M(e[i],t[i],r))return!1}return!0},ue=new Set(["node","__ref"]),ae=(e,t,r=ue)=>{if(e===t)return!0;if(!(0,c.isObjectLike)(e)||!(0,c.isObjectLike)(t)||(0,g.isDOMNode)(e)||(0,g.isDOMNode)(t))return e===t;const o=r instanceof Set?r:new Set(r),n=new WeakSet;function s(i,l){if(n.has(l))return!0;n.add(l);for(const u in l){if(!Object.prototype.hasOwnProperty.call(l,u)||o.has(u))continue;if(!Object.prototype.hasOwnProperty.call(i,u))return!1;const f=l[u],p=i[u];if((0,g.isDOMNode)(f)||(0,g.isDOMNode)(p)){if(f!==p)return!1}else if((0,c.isObjectLike)(f)&&(0,c.isObjectLike)(p)){if(!s(p,f))return!1}else if(f!==p)return!1}return!0}return s(e,t)},pe=(e,t)=>{if(t==null)return e;if((0,c.is)(t)("string","number"))delete e[t];else if((0,c.isArray)(t))for(let r=0;r<t.length;r++)delete e[t[r]];else throw new Error("Invalid input: props must be a string or an array of strings");return e},R=e=>{if(e===null||typeof e!="object")return e;const t=Object.create(null);for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=R(e[r]));return t},ye=(e,t)=>{if(e.length===0)return t;const r={};let o=r;for(let n=0;n<e.length;n++)n===e.length-1&&t?o[e[n]]=t:(o[e[n]]={},o=o[e[n]]);return r},he=(e,t)=>{if(!Array.isArray(t))throw new Error("Path must be an array.");let r=e;for(let n=0;n<t.length-1;n++){if(r[t[n]]===void 0)return;r=r[t[n]]}const o=t[t.length-1];r&&Object.prototype.hasOwnProperty.call(r,o)&&delete r[o]},de=(e,t,r)=>{if(!Array.isArray(t))throw new Error("Path must be an array.");let o=e;for(let n=0;n<t.length-1;n++)(!o[t[n]]||typeof o[t[n]]!="object")&&(o[t[n]]={}),o=o[t[n]];return o[t[t.length-1]]=r,e},we=(e,t)=>{if(!Array.isArray(t))throw new Error("Path must be an array.");let r=e;for(let o=0;o<t.length;o++){if(r==null)return;r=r[t[o]]}return r},ge=e=>{let r=[],o=0;for(let n=0;n<e.length;n++)if(r.length<2)r.push(e[n]);else if(e[n]===r[n%2]?o++:(r=[e[n-1],e[n]],o=1),o>=20)return(A==="test"||A==="development")&&console.warn("Warning: Potential infinite loop detected due to repeated sequence:",r),!0},Oe=e=>{const t=new WeakSet;function r(o){if(o&&typeof o=="object"){if(t.has(o))return!0;t.add(o);for(const n in o)if(Object.prototype.hasOwnProperty.call(o,n)&&r(o[n]))return console.log(o,"cycle at "+n),!0}return!1}return r(e)},_e=(e,t)=>{const r=t instanceof Set?t:new Set(t),o={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&!r.has(n)&&(o[n]=e[n]);return o};
package/dist/cjs/scope.js CHANGED
@@ -1 +1 @@
1
- "use strict";var f=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var O=(o,c)=>{for(var p in c)f(o,p,{get:c[p],enumerable:!0})},S=(o,c,p,s)=>{if(c&&typeof c=="object"||typeof c=="function")for(let t of i(c))!a.call(o,t)&&t!==p&&f(o,t,{get:()=>c[t],enumerable:!(s=b(c,t))||s.enumerable});return o};var g=o=>S(f({},"__esModule",{value:!0}),o);var x={};O(x,{createScope:()=>j});module.exports=g(x);const j=(o,c)=>{const{__ref:p}=o,s=o.context||c.context||p.root?.context;s&&!s.globalScope&&(s.globalScope={});const t=c.scope||p.root?.scope,e=s?.globalScope;if(!o.scope)t?o.scope=t:e?o.scope=Object.create(e):o.scope={};else if(typeof o.scope=="object"&&o.scope!==null&&Object.getPrototypeOf(o.scope)===Object.prototype){const r=t||e;r&&Object.setPrototypeOf(o.scope,r)}};
1
+ "use strict";var f=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var O=(o,c)=>{for(var t in c)f(o,t,{get:c[t],enumerable:!0})},a=(o,c,t,p)=>{if(c&&typeof c=="object"||typeof c=="function")for(let e of i(c))!l.call(o,e)&&e!==t&&f(o,e,{get:()=>c[e],enumerable:!(p=b(c,e))||p.enumerable});return o};var y=o=>a(f({},"__esModule",{value:!0}),o);var u={};O(u,{createScope:()=>j});module.exports=y(u);const g=(o,c)=>{let t=c;for(;t;){if(t===o)return!0;t=Object.getPrototypeOf(t)}return!1},j=(o,c)=>{const{__ref:t}=o,p=o.context||c.context||t.root?.context;p&&!p.globalScope&&(p.globalScope={});const e=c.scope||t.root?.scope,s=p?.globalScope;if(!o.scope)e?o.scope=e:s?o.scope=Object.create(s):o.scope={};else if(typeof o.scope=="object"&&o.scope!==null&&Object.getPrototypeOf(o.scope)===Object.prototype){const r=e||s;r&&!g(o.scope,r)&&Object.setPrototypeOf(o.scope,r)}};
@@ -1 +1 @@
1
- "use strict";var u=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var $=Object.prototype.hasOwnProperty;var R=(e,n)=>{for(var o in n)u(e,o,{get:n[o],enumerable:!0})},j=(e,n,o,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of U(n))!$.call(e,r)&&r!==o&&u(e,r,{get:()=>n[r],enumerable:!(t=L(n,r))||t.enumerable});return e};var A=e=>j(u({},"__esModule",{value:!0}),e);var g={};R(g,{deepDefaults:()=>f,fetchLibraryData:()=>p,mergeSharedLibraries:()=>E,normalizeLibraryKey:()=>c,resolveSharedLibraries:()=>I});module.exports=A(g);var i=require("./types.js");const h="system",S="https://smbls-kv.nika-980.workers.dev",_="https://api.symbols.app";function c(e){const n=String(e||"").trim();if(!n)return{owner:h,key:"",full:""};let o=null,t=n;if(n.includes("/")){const s=n.indexOf("/");o=n.slice(0,s),t=n.slice(s+1)}t=t.replace(/\.symbo\.ls$/iu,""),o||(o=h);const r=t?`${o}/${t}`:"";return{owner:o,key:t,full:r}}const f=(e,n)=>{for(const o in n)o in e?(0,i.isObject)(e[o])&&(0,i.isObject)(n[o])&&f(e[o],n[o]):e[o]=n[o]},E=(e,n)=>{if(!(!n||!n.length))for(let o=0;o<n.length;o++){const t=n[o];if((0,i.isObject)(t)){for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r))if((0,i.isObject)(t[r])&&(0,i.isObject)(e[r]))if(r==="designSystem")f(e[r],t[r]);else for(const s in t[r])s in e[r]||(e[r][s]=t[r][s]);else r in e||(e[r]=t[r])}}};async function p(e,n={}){if((n.provider||"kv")==="api")return y(e,n);const t=await B(e,n);return t||y(e,n)}async function B(e,n={}){const o=n.kvBaseUrl||S,t=n.env||"production",r=`${o}/kv/${encodeURIComponent(e)}?env=${t}`;try{const s=await fetch(r,{method:"GET"});return s.ok&&(await s.json())?.value||null}catch{return null}}async function y(e,n={}){const o=n.apiBaseUrl||_,{key:t}=c(e);try{const r=`${o}/core/projects/libraries/available?search=${encodeURIComponent(t)}&limit=10`,s=await fetch(r,{method:"GET"});if(!s.ok)return null;const a=await s.json(),l=(a?.items||a?.data||(Array.isArray(a)?a:[])).find(v=>{const{key:w}=c(v?.key);return w.toLowerCase()===t.toLowerCase()});if(!l?.id&&!l?._id)return null;const b=l.id||l._id,k=`${o}/core/projects/${encodeURIComponent(b)}/data?branch=main`,d=await fetch(k,{method:"GET"});if(!d.ok)return null;const m=await d.json();return m?.data||m||null}catch{return null}}async function I(e,n={}){return!e||!e.length?[]:(await Promise.all(e.map(async t=>{if((0,i.isObject)(t))return t;if((0,i.isString)(t)){const{full:r}=c(t);if(!r)return null;try{const s=await p(r,n);return s||console.warn(`[smbls] Shared library "${r}" not found`),s}catch(s){return console.warn(`[smbls] Failed to fetch shared library "${r}":`,s.message),null}}return null}))).filter(Boolean)}
1
+ "use strict";var u=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var g=(n,t)=>{for(var e in t)u(n,e,{get:t[e],enumerable:!0})},E=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of U(t))!j.call(n,i)&&i!==e&&u(n,i,{get:()=>t[i],enumerable:!(r=R(t,i))||r.enumerable});return n};var S=n=>E(u({},"__esModule",{value:!0}),n);var P={};g(P,{deepDefaults:()=>f,fetchLibraryData:()=>k,isWrappedLibrary:()=>d,mergeSharedLibraries:()=>F,normalizeIgnoreList:()=>w,normalizeLibraryKey:()=>c,resolveSharedLibraries:()=>K,sharedLibrary:()=>x});module.exports=S(P);var s=require("./types.js");const m="system",_="https://smbls-kv.nika-980.workers.dev",I="https://api.symbols.app";function c(n){const t=String(n||"").trim();if(!t)return{owner:m,key:"",full:""};let e=null,r=t;if(t.includes("/")){const o=t.indexOf("/");e=t.slice(0,o),r=t.slice(o+1)}r=r.replace(/\.symbo\.ls$/iu,""),e||(e=m);const i=r?`${e}/${r}`:"";return{owner:e,key:r,full:i}}const f=(n,t,e,r)=>{for(const i in t){const o=r?`${r}/${i}`:i;e&&e.has(o)||(i in n?(0,s.isObject)(n[i])&&(0,s.isObject)(t[i])&&f(n[i],t[i],e,o):n[i]=t[i])}},O=new Set,B=n=>n.replace(/\.js$/iu,""),w=n=>{const t=new Set;if(!Array.isArray(n))return t;for(const e of n){if(!(0,s.isString)(e))continue;const r=e.split("/").map(i=>B(i.trim())).filter(Boolean).join("/");r&&t.add(r)}return t},x=(n,t={})=>({library:n,ignoreList:Array.isArray(t.ignoreList)?t.ignoreList:[]}),d=n=>(0,s.isObject)(n)&&Array.isArray(n.ignoreList)&&("library"in n||"key"in n||"name"in n),C=n=>n.library!==void 0?n.library:n.key??n.name,T=(n,t,e)=>{for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&!e.has(r))if((0,s.isObject)(t[r])&&(0,s.isObject)(n[r]))if(r==="designSystem")f(n[r],t[r],e,r);else for(const i in t[r])e.has(`${r}/${i}`)||i in n[r]||(n[r][i]=t[r][i]);else r in n||(n[r]=t[r])},F=(n,t)=>{if(!(!t||!t.length))for(let e=0;e<t.length;e++){let r=t[e],i=O;d(r)&&(i=w(r.ignoreList),r=r.library),(0,s.isObject)(r)&&T(n,r,i)}};async function k(n,t={}){if((t.provider||"kv")==="api")return h(n,t);const r=await G(n,t);return r||h(n,t)}async function G(n,t={}){const e=t.kvBaseUrl||_,r=t.env||"production",i=`${e}/kv/${encodeURIComponent(n)}?env=${r}`;try{const o=await fetch(i,{method:"GET"});return o.ok&&(await o.json())?.value||null}catch{return null}}async function h(n,t={}){const e=t.apiBaseUrl||I,{key:r}=c(n);try{const i=`${e}/core/projects/libraries/available?search=${encodeURIComponent(r)}&limit=10`,o=await fetch(i,{method:"GET"});if(!o.ok)return null;const a=await o.json(),l=(a?.items||a?.data||(Array.isArray(a)?a:[])).find($=>{const{key:A}=c($?.key);return A.toLowerCase()===r.toLowerCase()});if(!l?.id&&!l?._id)return null;const L=l.id||l._id,v=`${e}/core/projects/${encodeURIComponent(L)}/data?branch=main`,y=await fetch(v,{method:"GET"});if(!y.ok)return null;const p=await y.json();return p?.data||p||null}catch{return null}}async function b(n,t={}){if((0,s.isObject)(n))return n;if((0,s.isString)(n)){const{full:e}=c(n);if(!e)return null;try{const r=await k(e,t);return r||console.warn(`[smbls] Shared library "${e}" not found`),r}catch(r){return console.warn(`[smbls] Failed to fetch shared library "${e}":`,r.message),null}}return null}async function K(n,t={}){return!n||!n.length?[]:(await Promise.all(n.map(async r=>{if(d(r)){const i=await b(C(r),t);return i?{library:i,ignoreList:r.ignoreList}:null}return b(r,t)}))).filter(Boolean)}
@@ -1,13 +1,13 @@
1
- import{window as k}from"./globals.js";import{isFunction as P,isObjectLike as w,isObject as S,isArray as O,isString as x,is as I}from"./types.js";import{unstackArrayOfObjects as M}from"./array.js";import{stringIncludesAny as R}from"./string.js";import{isDOMNode as g}from"./node.js";import{METHODS_EXL as L}from"./keys.js";const A="production",_=e=>e.charCodeAt(0)===95&&e.charCodeAt(1)===95,$=(e,t,r,o)=>{if(P(e))return t?typeof e.call!="function"?e:e.call(t,t,r||t.state,o||t.context):void 0;if(e!=null&&t?.context?.plugins&&(O(e)||S(e)&&!g(e))){const n=t.context.plugins;for(const s of n)if(s.resolveHandler){const i=s.resolveHandler(e,t);if(typeof i=="function")return $(i,t,r,o)}}return e},ne=(e,t,r)=>{for(const o in t)e[o]=$(t[o],r)},re=(e,t,r=[])=>{const o=r instanceof Set;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(_(n)||(o?r.has(n):r.includes(n))||e[n]===void 0&&(e[n]=t[n]));return e},oe=(e,t,r=L)=>v(e,t,r,null),v=(e,t,r,o)=>{if(e===t)return e;if(o){for(let s=0;s<o.length;s+=2)if(o[s]===e&&o[s+1]===t)return e}const n=r instanceof Set;for(const s in t){if(!Object.prototype.hasOwnProperty.call(t,s)||_(s)||s==="constructor"||s==="prototype"||(n?r.has(s):r.includes(s)))continue;const i=e[s],c=t[s];if(w(i)&&w(c)){const f=o||[];f.push(e,t),v(i,c,r,f),f.length-=2}else i===void 0&&(e[s]=c)}return e},se=(e,t=[])=>{const r=t instanceof Set,o={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(_(n)||(r?t.has(n):t.includes(n))||(o[n]=e[n]));return o},ie=(e,t={})=>{const{exclude:r=[],cleanUndefined:o=!1,cleanNull:n=!1,visited:s=new WeakMap,handleExtends:i=!1}=t;if(!w(e)||g(e))return e;if(s.has(e))return s.get(e);const c=r instanceof Set?r:r.length>3?new Set(r):null,f=a=>c?c.has(a):r.includes(a),l=O(e)?[]:{};s.set(e,l);const p=[[e,l]];for(;p.length;){const[a,h]=p.pop();for(const y in a){if(!Object.prototype.hasOwnProperty.call(a,y)||_(y)||y==="__proto__"||f(y))continue;const u=a[y];if(!(o&&u===void 0)&&!(n&&u===null)){if(g(u)){h[y]=u;continue}if(i&&y==="extends"&&O(u)){h[y]=M(u,r);continue}if(P(u)){h[y]=u;continue}if(w(u))if(s.has(u))h[y]=s.get(u);else{const d=O(u)?[]:{};s.set(u,d),h[y]=d,p.push([u,d])}else h[y]=u}}}return l},T=(e,t={})=>{(e.node||e.__ref||e.parent||e.__element||e.parse)&&((e.__element||e.parent?.__element).warn("Trying to clone element or state at",e),e=e.parse?.());for(const r in e){const o=e[r];if(P(o))t[r]=o.toString();else if(S(o))t[r]={},T(o,t[r]);else if(O(o)){const n=t[r]=[];for(let s=0;s<o.length;s++){const i=o[s];S(i)?(n[s]={},T(i,n[s])):P(i)?n[s]=i.toString():n[s]=i}}else t[r]=o}return t},W=new Set(["&","*","-",":","%","{","}",">","<","@",".","/","!"," "]),N=(e={},t=0)=>{if(e===null||typeof e!="object")return String(e);let r=!1;for(const s in e){r=!0;break}if(!r)return"{}";const o=" ".repeat(t);let n=`{
2
- `;for(const s in e){if(!Object.prototype.hasOwnProperty.call(e,s))continue;const i=e[s];let c=!1;for(let l=0;l<s.length;l++)if(W.has(s[l])){c=!0;break}const f=c?`'${s}'`:s;if(n+=`${o} ${f}: `,O(i)){n+=`[
3
- `;for(const l of i)w(l)&&l!==null?n+=`${o} ${N(l,t+2)},
4
- `:x(l)?n+=`${o} '${l}',
5
- `:n+=`${o} ${l},
6
- `;n+=`${o} ]`}else w(i)?n+=N(i,t+1):x(i)?n+=R(i,[`
1
+ import{window as k}from"./globals.js";import{isFunction as P,isObjectLike as w,isObject as S,isArray as O,isString as x,is as I}from"./types.js";import{unstackArrayOfObjects as M}from"./array.js";import{stringIncludesAny as R}from"./string.js";import{isDOMNode as g}from"./node.js";import{METHODS_EXL as L}from"./keys.js";const A="production",_=e=>e.charCodeAt(0)===95&&e.charCodeAt(1)===95,$=(e,t,r,s)=>{if(P(e))return t?typeof e.call!="function"?e:e.call(t,t,r||t.state,s||t.context):void 0;if(e!=null&&t?.context?.plugins&&(O(e)||S(e)&&!g(e))){const n=t.context.plugins;for(const o of n)if(o.resolveHandler){const i=o.resolveHandler(e,t);if(typeof i=="function")return $(i,t,r,s)}}return e},ne=(e,t,r)=>{for(const s in t)e[s]=$(t[s],r)},re=(e,t,r=[])=>{const s=r instanceof Set;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(_(n)||(s?r.has(n):r.includes(n))||e[n]===void 0&&(e[n]=t[n]));return e},oe=(e,t,r=L)=>v(e,t,r,null),v=(e,t,r,s)=>{if(e===t)return e;if(s){for(let o=0;o<s.length;o+=2)if(s[o]===e&&s[o+1]===t)return e}const n=r instanceof Set;for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o)||_(o)||o==="constructor"||o==="prototype"||(n?r.has(o):r.includes(o)))continue;const i=e[o],f=t[o];if(w(i)&&w(f)){const l=s||[];l.push(e,t),v(i,f,r,l),l.length-=2}else i===void 0&&(e[o]=f)}return e},se=(e,t=[])=>{const r=t instanceof Set,s={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(_(n)||(r?t.has(n):t.includes(n))||(s[n]=e[n]));return s},ie=(e,t={})=>{const{exclude:r=[],cleanUndefined:s=!1,cleanNull:n=!1,visited:o=new WeakMap,handleExtends:i=!1}=t;if(!w(e)||g(e))return e;if(o.has(e))return o.get(e);const f=r instanceof Set?r:r.length>3?new Set(r):null,l=p=>f?f.has(p):r.includes(p),c=O(e)?[]:{};o.set(e,c);const a=[[e,c]];for(;a.length;){const[p,h]=a.pop();for(const y in p){if(!Object.prototype.hasOwnProperty.call(p,y)||_(y)||y==="__proto__"||l(y))continue;const u=p[y];if(!(s&&u===void 0)&&!(n&&u===null)){if(g(u)){h[y]=u;continue}if(i&&y==="extends"&&O(u)){h[y]=M(u,r);continue}if(P(u)){h[y]=u;continue}if(w(u))if(o.has(u))h[y]=o.get(u);else{const d=O(u)?[]:{};o.set(u,d),h[y]=d,a.push([u,d])}else h[y]=u}}}return c},T=(e,t={})=>{(e.node||e.__ref||e.parent||e.__element||e.parse)&&((e.__element||e.parent?.__element).warn("Trying to clone element or state at",e),e=e.parse?.());for(const r in e){const s=e[r];if(P(s))t[r]=s.toString();else if(S(s))t[r]={},T(s,t[r]);else if(O(s)){const n=t[r]=[];for(let o=0;o<s.length;o++){const i=s[o];S(i)?(n[o]={},T(i,n[o])):P(i)?n[o]=i.toString():n[o]=i}}else t[r]=s}return t},W=new Set(["&","*","-",":","%","{","}",">","<","@",".","/","!"," "]),N=(e={},t=0)=>{if(e===null||typeof e!="object")return String(e);let r=!1;for(const o in e){r=!0;break}if(!r)return"{}";const s=" ".repeat(t);let n=`{
2
+ `;for(const o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;const i=e[o];let f=!1;for(let c=0;c<o.length;c++)if(W.has(o[c])){f=!0;break}const l=f?`'${o}'`:o;if(n+=`${s} ${l}: `,O(i)){n+=`[
3
+ `;for(const c of i)w(c)&&c!==null?n+=`${s} ${N(c,t+2)},
4
+ `:x(c)?n+=`${s} '${c}',
5
+ `:n+=`${s} ${c},
6
+ `;n+=`${s} ]`}else w(i)?n+=N(i,t+1):x(i)?n+=R(i,[`
7
7
  `,"'"])?`\`${i}\``:`'${i}'`:n+=i;n+=`,
8
- `}return n+=`${o}}`,n},F=[/^\(\s*\{[^}]*\}\s*\)\s*=>/,/^(\([^)]*\)|[^=]*)\s*=>/,/^function[\s(]/,/^async\s+/,/^\(\s*function/,/^[a-zA-Z_$][a-zA-Z0-9_$]*\s*=>/],b=/^["[{]/,q=/^(export|import)\s/,E=e=>{if(!e)return!1;const t=e.trim().replace(/\n\s*/g," ").trim();if(t===""||t==="{}"||t==="[]"||q.test(t)||!F.some(s=>s.test(t)))return!1;const o=t.charCodeAt(0),n=t.includes("=>");return!(o===123&&!n||o===91||b.test(t)&&!n)},B=e=>(0,eval)(e),G=(e,t)=>{const r=/^(\s*(?:async\s+)?function\s*[\w$]*\s*\([^)]*\)\s*)\{/.exec(e);if(!r)return null;const o=r[0].length,n=[];let s=o,i=1,c=null;const f=e.length,l=new RegExp("^(?:const|let|var)\\s+"+t+"\\b");for(;s<f&&i>0;){const a=e[s];if(a==="/"&&e[s+1]==="/"){const h=e.indexOf(`
9
- `,s);s=h===-1?f:h;continue}if(a==="/"&&e[s+1]==="*"){const h=e.indexOf("*/",s+2);s=h===-1?f:h+2;continue}if(a==='"'||a==="'"||a==="`"){const h=a;for(s++;s<f;){if(e[s]==="\\"){s+=2;continue}if(e[s]===h){s++;break}if(h==="`"&&e[s]==="$"&&e[s+1]==="{"){s+=2;let y=1;for(;s<f&&y>0;)e[s]==="{"?y++:e[s]==="}"&&y--,s++;continue}s++}continue}if(a==="{"){i++,s++;continue}if(a==="}"){i--,s++;continue}if(i===1&&l.test(e.slice(s))){const h=s;let y=0,u=s;for(;u<f;){const d=e[u];if(d==='"'||d==="'"||d==="`"){const D=d;for(u++;u<f;){if(e[u]==="\\"){u+=2;continue}if(e[u]===D){u++;break}u++}continue}if(d==="("||d==="["||d==="{"){y++,u++;continue}if(d===")"||d==="]"||d==="}"){if(y===0)break;y--,u++;continue}if(y===0&&(d===";"||d===`
10
- `)){u++;break}u++}n.push([h,u]),s=u;continue}s++}if(!n.length)return null;let p=e;for(let a=n.length-1;a>=0;a--)p=p.slice(0,n[a][0])+p.slice(n[a][1]);return p},C=(e,t,r)=>{try{return r.window.eval(`(${e})`)}catch(o){const n=o&&o.message?o.message:String(o),s=/await is only valid in async/.test(n),i=/Identifier '([^']+)' has already been declared/.exec(n);let c=null;if(s){const f=String(e).trim();if(/^function[\s(]/.test(f))try{c=r.window.eval("(async "+f+")")}catch{}}else if(i){let f=String(e),l=i[1];for(let p=0;p<5;p++){const a=G(f,l);if(!a||a===f)break;f=a;try{c=r.window.eval("("+f+")");break}catch(h){const y=/Identifier '([^']+)' has already been declared/.exec(h&&h.message||String(h));if(!y||y[1]!==l)break}}}return c||(typeof console<"u"&&console.warn&&console.warn(`[smbls] deepDestringifyFunctions: eval failed on ${t} \u2014 value will be left as a string. Reason: `+n+`.
11
- First 200 chars of source: `+String(e).slice(0,200)),e)}},ce=(e,t={},r={window:{eval:B}})=>{if(!e||typeof e!="object")return t;const o=[[e,t]];for(;o.length;){const[n,s]=o.pop();for(const i in n){if(!Object.prototype.hasOwnProperty.call(n,i))continue;const c=n[i];if(x(c))E(c)?s[i]=C(c,`"${i}"`,r):s[i]=c;else if(O(c)){const f=s[i]=[];for(let l=0;l<c.length;l++){const p=c[l];if(x(p))f.push(E(p)?C(p,`array index ${l} (prop "${i}")`,r):p);else if(S(p)){const a={};f.push(a),o.push([p,a])}else f.push(p)}}else if(S(c)){const f=s[i]&&typeof s[i]=="object"&&!O(s[i])?s[i]:s[i]={};o.push([c,f])}else s[i]=c}}return t},H="Set",J="Map",U=e=>!e||typeof e!="object"?e:e.__type===H&&Array.isArray(e.values)?new Set(e.values):e.__type===J&&Array.isArray(e.entries)?new Map(e.entries):e,fe=e=>{if(!e||typeof e!="object")return e;const t={},r=[];for(const o of Object.keys(e)){const n=e[o];x(n)&&E(n)?r.push([o,n]):t[o]=U(n)}for(const[o,n]of r)try{const s=Object.keys(t).map(i=>`var ${i} = __gs__[${JSON.stringify(i)}];`).join(`
12
- `);t[o]=k.eval(`(function(__gs__) { ${s}
13
- return (${n}); })`)(t)}catch{try{t[o]=k.eval(`(${n})`)}catch{t[o]=n}}return t},le=(e,t={verbose:!0})=>{try{return e?k.eval("("+e+")"):{}}catch(r){t.verbose&&console.warn(r)}},ue=(e,...t)=>Object.prototype.hasOwnProperty.call(e,...t),V=e=>{for(const t in e)return!1;return!0},ae=e=>S(e)&&V(e),pe=()=>Object.create(null),ye=(e,t,r={})=>{const o=r.exclude||[],n=r.preventUnderscore;for(const s in t)o.includes(s)||!n&&_(s)||s==="constructor"||s==="prototype"||t[s]!==void 0&&(e[s]=t[s]);return e},he=(e,t,r=[])=>{const o=r instanceof Set;for(const n in t)_(n)||n==="constructor"||n==="prototype"||(o?r.has(n):r.includes(n))||(e[n]=t[n]);return e},z=(e,t,r={},o=new WeakMap)=>{if(!w(e)||!w(t)||g(e)||g(t))return t;if(o.has(e))return o.get(e);o.set(e,e);const n=r.exclude,s=n?n instanceof Set?n:new Set(n):null,i=!r.preventForce;for(const c in t){if(!Object.prototype.hasOwnProperty.call(t,c)||s&&s.has(c)||i&&_(c)||c==="constructor"||c==="prototype")continue;const f=e[c],l=t[c];g(l)?e[c]=l:w(f)&&w(l)?e[c]=z(f,l,r,o):l!==void 0&&(e[c]=l)}return e},K=(e,t,r=new Set)=>{if(typeof e!="object"||typeof t!="object"||e===null||t===null)return e===t;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);const o=Object.keys(e),n=Object.keys(t);if(o.length!==n.length)return!1;for(let s=0;s<o.length;s++){const i=o[s];if(!Object.prototype.hasOwnProperty.call(t,i)||!K(e[i],t[i],r))return!1}return!0},X=new Set(["node","__ref"]),de=(e,t,r=X)=>{if(e===t)return!0;if(!w(e)||!w(t)||g(e)||g(t))return e===t;const o=r instanceof Set?r:new Set(r),n=new WeakSet;function s(i,c){if(n.has(c))return!0;n.add(c);for(const f in c){if(!Object.prototype.hasOwnProperty.call(c,f)||o.has(f))continue;if(!Object.prototype.hasOwnProperty.call(i,f))return!1;const l=c[f],p=i[f];if(g(l)||g(p)){if(l!==p)return!1}else if(w(l)&&w(p)){if(!s(p,l))return!1}else if(l!==p)return!1}return!0}return s(e,t)},we=(e,t)=>{if(t==null)return e;if(I(t)("string","number"))delete e[t];else if(O(t))for(let r=0;r<t.length;r++)delete e[t[r]];else throw new Error("Invalid input: props must be a string or an array of strings");return e},Y=e=>{if(e===null||typeof e!="object")return e;const t=Object.create(null);for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=Y(e[r]));return t},ge=(e,t)=>{if(e.length===0)return t;const r={};let o=r;for(let n=0;n<e.length;n++)n===e.length-1&&t?o[e[n]]=t:(o[e[n]]={},o=o[e[n]]);return r},Oe=(e,t)=>{if(!Array.isArray(t))throw new Error("Path must be an array.");let r=e;for(let n=0;n<t.length-1;n++){if(r[t[n]]===void 0)return;r=r[t[n]]}const o=t[t.length-1];r&&Object.prototype.hasOwnProperty.call(r,o)&&delete r[o]},_e=(e,t,r)=>{if(!Array.isArray(t))throw new Error("Path must be an array.");let o=e;for(let n=0;n<t.length-1;n++)(!o[t[n]]||typeof o[t[n]]!="object")&&(o[t[n]]={}),o=o[t[n]];return o[t[t.length-1]]=r,e},Se=(e,t)=>{if(!Array.isArray(t))throw new Error("Path must be an array.");let r=e;for(let o=0;o<t.length;o++){if(r==null)return;r=r[t[o]]}return r},xe=e=>{let r=[],o=0;for(let n=0;n<e.length;n++)if(r.length<2)r.push(e[n]);else if(e[n]===r[n%2]?o++:(r=[e[n-1],e[n]],o=1),o>=20)return(A==="test"||A==="development")&&console.warn("Warning: Potential infinite loop detected due to repeated sequence:",r),!0},Pe=e=>{const t=new WeakSet;function r(o){if(o&&typeof o=="object"){if(t.has(o))return!0;t.add(o);for(const n in o)if(Object.prototype.hasOwnProperty.call(o,n)&&r(o[n]))return console.log(o,"cycle at "+n),!0}return!1}return r(e)},ke=(e,t)=>{const r=t instanceof Set?t:new Set(t),o={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&!r.has(n)&&(o[n]=e[n]);return o};export{se as clone,ge as createNestedObject,Y as createObjectWithoutPrototype,ie as deepClone,de as deepContains,ce as deepDestringifyFunctions,oe as deepMerge,T as deepStringifyFunctions,fe as destringifyGlobalScope,xe as detectInfiniteLoop,ke as excludeKeysFromObject,$ as exec,Se as getInObjectByPath,E as hasFunction,ue as hasOwnProperty,Pe as isCyclic,V as isEmpty,ae as isEmptyObject,K as isEqualDeep,pe as makeObjectWithoutPrototype,ne as map,re as merge,N as objectToString,ye as overwrite,z as overwriteDeep,he as overwriteShallow,we as removeFromObject,Oe as removeNestedKeyByPath,_e as setInObjectByPath,le as stringToObject};
8
+ `}return n+=`${s}}`,n},F=[/^\(\s*\{[^}]*\}\s*\)\s*=>/,/^(\([^)]*\)|[^=]*)\s*=>/,/^function[\s(]/,/^async\s+/,/^\(\s*function/,/^[a-zA-Z_$][a-zA-Z0-9_$]*\s*=>/],b=/^["[{]/,q=/^(export|import)\s/,E=e=>{if(!e)return!1;const t=e.trim().replace(/\n\s*/g," ").trim();if(t===""||t==="{}"||t==="[]"||q.test(t)||!F.some(o=>o.test(t)))return!1;const s=t.charCodeAt(0),n=t.includes("=>");return!(s===123&&!n||s===91||b.test(t)&&!n)},B=e=>(0,eval)(e),G=(e,t)=>{const r=/^(\s*(?:async\s+)?function\s*[\w$]*\s*\([^)]*\)\s*)\{/.exec(e);if(!r)return null;const s=r[0].length,n=[];let o=s,i=1,f=null;const l=e.length,c=new RegExp("^(?:const|let|var)\\s+"+t+"\\b");for(;o<l&&i>0;){const p=e[o];if(p==="/"&&e[o+1]==="/"){const h=e.indexOf(`
9
+ `,o);o=h===-1?l:h;continue}if(p==="/"&&e[o+1]==="*"){const h=e.indexOf("*/",o+2);o=h===-1?l:h+2;continue}if(p==='"'||p==="'"||p==="`"){const h=p;for(o++;o<l;){if(e[o]==="\\"){o+=2;continue}if(e[o]===h){o++;break}if(h==="`"&&e[o]==="$"&&e[o+1]==="{"){o+=2;let y=1;for(;o<l&&y>0;)e[o]==="{"?y++:e[o]==="}"&&y--,o++;continue}o++}continue}if(p==="{"){i++,o++;continue}if(p==="}"){i--,o++;continue}if(i===1&&c.test(e.slice(o))){const h=o;let y=0,u=o;for(;u<l;){const d=e[u];if(d==='"'||d==="'"||d==="`"){const D=d;for(u++;u<l;){if(e[u]==="\\"){u+=2;continue}if(e[u]===D){u++;break}u++}continue}if(d==="("||d==="["||d==="{"){y++,u++;continue}if(d===")"||d==="]"||d==="}"){if(y===0)break;y--,u++;continue}if(y===0&&(d===";"||d===`
10
+ `)){u++;break}u++}n.push([h,u]),o=u;continue}o++}if(!n.length)return null;let a=e;for(let p=n.length-1;p>=0;p--)a=a.slice(0,n[p][0])+a.slice(n[p][1]);return a},C=(e,t,r)=>{const s=String(e).trimStart();if(/^(export|import)\s/.test(s))return e;try{return r.window.eval(`(${e})`)}catch(n){const o=n&&n.message?n.message:String(n),i=/await is only valid in async/.test(o),f=/Identifier '([^']+)' has already been declared/.exec(o);let l=null;if(i){const c=String(e).trim();if(/^function[\s(]/.test(c))try{l=r.window.eval("(async "+c+")")}catch{}}else if(f){let c=String(e),a=f[1];for(let p=0;p<5;p++){const h=G(c,a);if(!h||h===c)break;c=h;try{l=r.window.eval("("+c+")");break}catch(y){const u=/Identifier '([^']+)' has already been declared/.exec(y&&y.message||String(y));if(!u||u[1]!==a)break}}}return l||(typeof console<"u"&&console.warn&&console.warn(`[smbls] deepDestringifyFunctions: eval failed on ${t} \u2014 value will be left as a string. Reason: `+o+`.
11
+ First 200 chars of source: `+String(e).slice(0,200)),e)}},ce=(e,t={},r={window:{eval:B}})=>{if(!e||typeof e!="object")return t;const s=[[e,t]];for(;s.length;){const[n,o]=s.pop();for(const i in n){if(!Object.prototype.hasOwnProperty.call(n,i))continue;const f=n[i];if(x(f))E(f)?o[i]=C(f,`"${i}"`,r):o[i]=f;else if(O(f)){const l=o[i]=[];for(let c=0;c<f.length;c++){const a=f[c];if(x(a))l.push(E(a)?C(a,`array index ${c} (prop "${i}")`,r):a);else if(S(a)){const p={};l.push(p),s.push([a,p])}else l.push(a)}}else if(S(f)){const l=o[i]&&typeof o[i]=="object"&&!O(o[i])?o[i]:o[i]={};s.push([f,l])}else o[i]=f}}return t},H="Set",J="Map",U=e=>!e||typeof e!="object"?e:e.__type===H&&Array.isArray(e.values)?new Set(e.values):e.__type===J&&Array.isArray(e.entries)?new Map(e.entries):e,fe=e=>{if(!e||typeof e!="object")return e;const t={},r=[];for(const s of Object.keys(e)){const n=e[s];x(n)&&E(n)?r.push([s,n]):t[s]=U(n)}for(const[s,n]of r)try{const o=Object.keys(t).map(i=>`var ${i} = __gs__[${JSON.stringify(i)}];`).join(`
12
+ `);t[s]=k.eval(`(function(__gs__) { ${o}
13
+ return (${n}); })`)(t)}catch{try{t[s]=k.eval(`(${n})`)}catch{t[s]=n}}return t},le=(e,t={verbose:!0})=>{try{return e?k.eval("("+e+")"):{}}catch(r){t.verbose&&console.warn(r)}},ue=(e,...t)=>Object.prototype.hasOwnProperty.call(e,...t),V=e=>{for(const t in e)return!1;return!0},ae=e=>S(e)&&V(e),pe=()=>Object.create(null),ye=(e,t,r={})=>{const s=r.exclude||[],n=r.preventUnderscore;for(const o in t)s.includes(o)||!n&&_(o)||o==="constructor"||o==="prototype"||t[o]!==void 0&&(e[o]=t[o]);return e},he=(e,t,r=[])=>{const s=r instanceof Set;for(const n in t)_(n)||n==="constructor"||n==="prototype"||(s?r.has(n):r.includes(n))||(e[n]=t[n]);return e},z=(e,t,r={},s=new WeakMap)=>{if(!w(e)||!w(t)||g(e)||g(t))return t;if(s.has(e))return s.get(e);s.set(e,e);const n=r.exclude,o=n?n instanceof Set?n:new Set(n):null,i=!r.preventForce;for(const f in t){if(!Object.prototype.hasOwnProperty.call(t,f)||o&&o.has(f)||i&&_(f)||f==="constructor"||f==="prototype")continue;const l=e[f],c=t[f];g(c)?e[f]=c:w(l)&&w(c)?e[f]=z(l,c,r,s):c!==void 0&&(e[f]=c)}return e},K=(e,t,r=new Set)=>{if(typeof e!="object"||typeof t!="object"||e===null||t===null)return e===t;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);const s=Object.keys(e),n=Object.keys(t);if(s.length!==n.length)return!1;for(let o=0;o<s.length;o++){const i=s[o];if(!Object.prototype.hasOwnProperty.call(t,i)||!K(e[i],t[i],r))return!1}return!0},X=new Set(["node","__ref"]),de=(e,t,r=X)=>{if(e===t)return!0;if(!w(e)||!w(t)||g(e)||g(t))return e===t;const s=r instanceof Set?r:new Set(r),n=new WeakSet;function o(i,f){if(n.has(f))return!0;n.add(f);for(const l in f){if(!Object.prototype.hasOwnProperty.call(f,l)||s.has(l))continue;if(!Object.prototype.hasOwnProperty.call(i,l))return!1;const c=f[l],a=i[l];if(g(c)||g(a)){if(c!==a)return!1}else if(w(c)&&w(a)){if(!o(a,c))return!1}else if(c!==a)return!1}return!0}return o(e,t)},we=(e,t)=>{if(t==null)return e;if(I(t)("string","number"))delete e[t];else if(O(t))for(let r=0;r<t.length;r++)delete e[t[r]];else throw new Error("Invalid input: props must be a string or an array of strings");return e},Y=e=>{if(e===null||typeof e!="object")return e;const t=Object.create(null);for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=Y(e[r]));return t},ge=(e,t)=>{if(e.length===0)return t;const r={};let s=r;for(let n=0;n<e.length;n++)n===e.length-1&&t?s[e[n]]=t:(s[e[n]]={},s=s[e[n]]);return r},Oe=(e,t)=>{if(!Array.isArray(t))throw new Error("Path must be an array.");let r=e;for(let n=0;n<t.length-1;n++){if(r[t[n]]===void 0)return;r=r[t[n]]}const s=t[t.length-1];r&&Object.prototype.hasOwnProperty.call(r,s)&&delete r[s]},_e=(e,t,r)=>{if(!Array.isArray(t))throw new Error("Path must be an array.");let s=e;for(let n=0;n<t.length-1;n++)(!s[t[n]]||typeof s[t[n]]!="object")&&(s[t[n]]={}),s=s[t[n]];return s[t[t.length-1]]=r,e},Se=(e,t)=>{if(!Array.isArray(t))throw new Error("Path must be an array.");let r=e;for(let s=0;s<t.length;s++){if(r==null)return;r=r[t[s]]}return r},xe=e=>{let r=[],s=0;for(let n=0;n<e.length;n++)if(r.length<2)r.push(e[n]);else if(e[n]===r[n%2]?s++:(r=[e[n-1],e[n]],s=1),s>=20)return(A==="test"||A==="development")&&console.warn("Warning: Potential infinite loop detected due to repeated sequence:",r),!0},Pe=e=>{const t=new WeakSet;function r(s){if(s&&typeof s=="object"){if(t.has(s))return!0;t.add(s);for(const n in s)if(Object.prototype.hasOwnProperty.call(s,n)&&r(s[n]))return console.log(s,"cycle at "+n),!0}return!1}return r(e)},ke=(e,t)=>{const r=t instanceof Set?t:new Set(t),s={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&!r.has(n)&&(s[n]=e[n]);return s};export{se as clone,ge as createNestedObject,Y as createObjectWithoutPrototype,ie as deepClone,de as deepContains,ce as deepDestringifyFunctions,oe as deepMerge,T as deepStringifyFunctions,fe as destringifyGlobalScope,xe as detectInfiniteLoop,ke as excludeKeysFromObject,$ as exec,Se as getInObjectByPath,E as hasFunction,ue as hasOwnProperty,Pe as isCyclic,V as isEmpty,ae as isEmptyObject,K as isEqualDeep,pe as makeObjectWithoutPrototype,ne as map,re as merge,N as objectToString,ye as overwrite,z as overwriteDeep,he as overwriteShallow,we as removeFromObject,Oe as removeNestedKeyByPath,_e as setInObjectByPath,le as stringToObject};
package/dist/esm/scope.js CHANGED
@@ -1 +1 @@
1
- const r=(o,s)=>{const{__ref:e}=o,c=o.context||s.context||e.root?.context;c&&!c.globalScope&&(c.globalScope={});const t=s.scope||e.root?.scope,p=c?.globalScope;if(!o.scope)t?o.scope=t:p?o.scope=Object.create(p):o.scope={};else if(typeof o.scope=="object"&&o.scope!==null&&Object.getPrototypeOf(o.scope)===Object.prototype){const f=t||p;f&&Object.setPrototypeOf(o.scope,f)}};export{r as createScope};
1
+ const f=(o,t)=>{let c=t;for(;c;){if(c===o)return!0;c=Object.getPrototypeOf(c)}return!1},b=(o,t)=>{const{__ref:c}=o,e=o.context||t.context||c.root?.context;e&&!e.globalScope&&(e.globalScope={});const p=t.scope||c.root?.scope,s=e?.globalScope;if(!o.scope)p?o.scope=p:s?o.scope=Object.create(s):o.scope={};else if(typeof o.scope=="object"&&o.scope!==null&&Object.getPrototypeOf(o.scope)===Object.prototype){const r=p||s;r&&!f(o.scope,r)&&Object.setPrototypeOf(o.scope,r)}};export{b as createScope};
@@ -1 +1 @@
1
- import{isObject as i,isString as v}from"./types.js";const d="system",w="https://smbls-kv.nika-980.workers.dev",L="https://api.symbols.app";function c(t){const n=String(t||"").trim();if(!n)return{owner:d,key:"",full:""};let r=null,e=n;if(n.includes("/")){const s=n.indexOf("/");r=n.slice(0,s),e=n.slice(s+1)}e=e.replace(/\.symbo\.ls$/iu,""),r||(r=d);const o=e?`${r}/${e}`:"";return{owner:r,key:e,full:o}}const m=(t,n)=>{for(const r in n)r in t?i(t[r])&&i(n[r])&&m(t[r],n[r]):t[r]=n[r]},A=(t,n)=>{if(!(!n||!n.length))for(let r=0;r<n.length;r++){const e=n[r];if(i(e)){for(const o in e)if(Object.prototype.hasOwnProperty.call(e,o))if(i(e[o])&&i(t[o]))if(o==="designSystem")m(t[o],e[o]);else for(const s in e[o])s in t[o]||(t[o][s]=e[o][s]);else o in t||(t[o]=e[o])}}};async function U(t,n={}){if((n.provider||"kv")==="api")return h(t,n);const e=await $(t,n);return e||h(t,n)}async function $(t,n={}){const r=n.kvBaseUrl||w,e=n.env||"production",o=`${r}/kv/${encodeURIComponent(t)}?env=${e}`;try{const s=await fetch(o,{method:"GET"});return s.ok&&(await s.json())?.value||null}catch{return null}}async function h(t,n={}){const r=n.apiBaseUrl||L,{key:e}=c(t);try{const o=`${r}/core/projects/libraries/available?search=${encodeURIComponent(e)}&limit=10`,s=await fetch(o,{method:"GET"});if(!s.ok)return null;const a=await s.json(),l=(a?.items||a?.data||(Array.isArray(a)?a:[])).find(b=>{const{key:k}=c(b?.key);return k.toLowerCase()===e.toLowerCase()});if(!l?.id&&!l?._id)return null;const y=l.id||l._id,p=`${r}/core/projects/${encodeURIComponent(y)}/data?branch=main`,u=await fetch(p,{method:"GET"});if(!u.ok)return null;const f=await u.json();return f?.data||f||null}catch{return null}}async function S(t,n={}){return!t||!t.length?[]:(await Promise.all(t.map(async e=>{if(i(e))return e;if(v(e)){const{full:o}=c(e);if(!o)return null;try{const s=await U(o,n);return s||console.warn(`[smbls] Shared library "${o}" not found`),s}catch(s){return console.warn(`[smbls] Failed to fetch shared library "${o}":`,s.message),null}}return null}))).filter(Boolean)}export{m as deepDefaults,U as fetchLibraryData,A as mergeSharedLibraries,c as normalizeLibraryKey,S as resolveSharedLibraries};
1
+ import{isObject as s,isString as d}from"./types.js";const y="system",$="https://smbls-kv.nika-980.workers.dev",A="https://api.symbols.app";function c(r){const t=String(r||"").trim();if(!t)return{owner:y,key:"",full:""};let e=null,n=t;if(t.includes("/")){const o=t.indexOf("/");e=t.slice(0,o),n=t.slice(o+1)}n=n.replace(/\.symbo\.ls$/iu,""),e||(e=y);const i=n?`${e}/${n}`:"";return{owner:e,key:n,full:i}}const p=(r,t,e,n)=>{for(const i in t){const o=n?`${n}/${i}`:i;e&&e.has(o)||(i in r?s(r[i])&&s(t[i])&&p(r[i],t[i],e,o):r[i]=t[i])}},R=new Set,U=r=>r.replace(/\.js$/iu,""),j=r=>{const t=new Set;if(!Array.isArray(r))return t;for(const e of r){if(!d(e))continue;const n=e.split("/").map(i=>U(i.trim())).filter(Boolean).join("/");n&&t.add(n)}return t},B=(r,t={})=>({library:r,ignoreList:Array.isArray(t.ignoreList)?t.ignoreList:[]}),m=r=>s(r)&&Array.isArray(r.ignoreList)&&("library"in r||"key"in r||"name"in r),g=r=>r.library!==void 0?r.library:r.key??r.name,E=(r,t,e)=>{for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&!e.has(n))if(s(t[n])&&s(r[n]))if(n==="designSystem")p(r[n],t[n],e,n);else for(const i in t[n])e.has(`${n}/${i}`)||i in r[n]||(r[n][i]=t[n][i]);else n in r||(r[n]=t[n])},x=(r,t)=>{if(!(!t||!t.length))for(let e=0;e<t.length;e++){let n=t[e],i=R;m(n)&&(i=j(n.ignoreList),n=n.library),s(n)&&E(r,n,i)}};async function S(r,t={}){if((t.provider||"kv")==="api")return h(r,t);const n=await _(r,t);return n||h(r,t)}async function _(r,t={}){const e=t.kvBaseUrl||$,n=t.env||"production",i=`${e}/kv/${encodeURIComponent(r)}?env=${n}`;try{const o=await fetch(i,{method:"GET"});return o.ok&&(await o.json())?.value||null}catch{return null}}async function h(r,t={}){const e=t.apiBaseUrl||A,{key:n}=c(r);try{const i=`${e}/core/projects/libraries/available?search=${encodeURIComponent(n)}&limit=10`,o=await fetch(i,{method:"GET"});if(!o.ok)return null;const a=await o.json(),l=(a?.items||a?.data||(Array.isArray(a)?a:[])).find(L=>{const{key:v}=c(L?.key);return v.toLowerCase()===n.toLowerCase()});if(!l?.id&&!l?._id)return null;const w=l.id||l._id,k=`${e}/core/projects/${encodeURIComponent(w)}/data?branch=main`,u=await fetch(k,{method:"GET"});if(!u.ok)return null;const f=await u.json();return f?.data||f||null}catch{return null}}async function b(r,t={}){if(s(r))return r;if(d(r)){const{full:e}=c(r);if(!e)return null;try{const n=await S(e,t);return n||console.warn(`[smbls] Shared library "${e}" not found`),n}catch(n){return console.warn(`[smbls] Failed to fetch shared library "${e}":`,n.message),null}}return null}async function C(r,t={}){return!r||!r.length?[]:(await Promise.all(r.map(async n=>{if(m(n)){const i=await b(g(n),t);return i?{library:i,ignoreList:n.ignoreList}:null}return b(n,t)}))).filter(Boolean)}export{p as deepDefaults,S as fetchLibraryData,m as isWrappedLibrary,x as mergeSharedLibraries,j as normalizeIgnoreList,c as normalizeLibraryKey,C as resolveSharedLibraries,B as sharedLibrary};
package/object.js CHANGED
@@ -494,6 +494,15 @@ const stripTopLevelDeclaration = (src, name) => {
494
494
  // result directly. `label` is used in warning messages so the surface
495
495
  // of the failure (object key vs array index) is identifiable.
496
496
  const _destringifyFnString = (str, label, opts) => {
497
+ // Module SOURCE files are stored as plain strings on project data
498
+ // (`code` fields driving CodePreview etc. — they start with
499
+ // `export …` / `import …`). They are display text, not function
500
+ // expressions: leaving them as strings IS the correct outcome, so
501
+ // skip the eval (which can only throw "Unexpected token 'export'")
502
+ // and the FR-1 warning that flooded the console once per component
503
+ // on every project fetch (2026-06-06).
504
+ const head = String(str).trimStart()
505
+ if (/^(export|import)\s/.test(head)) return str
497
506
  try {
498
507
  return opts.window.eval(`(${str})`)
499
508
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/utils",
3
- "version": "3.14.105",
3
+ "version": "3.14.446",
4
4
  "license": "CC-BY-NC-4.0",
5
5
  "type": "module",
6
6
  "module": "./dist/esm/index.js",
package/scope.js CHANGED
@@ -1,5 +1,18 @@
1
1
  'use strict'
2
2
 
3
+ // True if setting `obj`'s prototype to `proto` would create a cycle —
4
+ // i.e. `obj` is `proto` itself, or already sits in `proto`'s prototype
5
+ // chain. `Object.setPrototypeOf` throws "Cyclic __proto__ value" in that
6
+ // case, so every caller must check this first.
7
+ const wouldCyclePrototype = (obj, proto) => {
8
+ let p = proto
9
+ while (p) {
10
+ if (p === obj) return true
11
+ p = Object.getPrototypeOf(p)
12
+ }
13
+ return false
14
+ }
15
+
3
16
  // Create scope - shared object across the elements to the own or the nearest parent
4
17
  // Prototype chain: own scope → parent scope → ... → root scope → globalScope
5
18
  export const createScope = (element, parent) => {
@@ -26,7 +39,15 @@ export const createScope = (element, parent) => {
26
39
  // Element defines its own scope — chain prototype to parent scope (or globalScope)
27
40
  if (Object.getPrototypeOf(element.scope) === Object.prototype) {
28
41
  const proto = parentScope || globalScope
29
- if (proto) Object.setPrototypeOf(element.scope, proto)
42
+ // Guard against a cyclic prototype. Nested elements can share one
43
+ // scope object — e.g. a serialized project where frank's `__scope`
44
+ // free-var rewrite assigns the same scope reference across a
45
+ // subtree, so `parentScope === element.scope`. Without this guard
46
+ // setPrototypeOf throws "Cyclic __proto__ value", which aborts
47
+ // createChildren and blanks the entire subtree in the brender.
48
+ if (proto && !wouldCyclePrototype(element.scope, proto)) {
49
+ Object.setPrototypeOf(element.scope, proto)
50
+ }
30
51
  }
31
52
  }
32
53
  }
@@ -42,13 +42,101 @@ export function normalizeLibraryKey (raw) {
42
42
  /**
43
43
  * Recursively set defaults: copy keys from source into target
44
44
  * only where target is missing them. Non-destructive.
45
+ *
46
+ * @param {object} target
47
+ * @param {object} source
48
+ * @param {Set<string>} [ignore] - normalized '/'-joined paths to skip
49
+ * @param {string} [prefix] - current path prefix used to match `ignore`
45
50
  */
46
- export const deepDefaults = (target, source) => {
51
+ export const deepDefaults = (target, source, ignore, prefix) => {
47
52
  for (const k in source) {
53
+ const path = prefix ? `${prefix}/${k}` : k
54
+ if (ignore && ignore.has(path)) continue
48
55
  if (!(k in target)) {
49
56
  target[k] = source[k]
50
57
  } else if (isObject(target[k]) && isObject(source[k])) {
51
- deepDefaults(target[k], source[k])
58
+ deepDefaults(target[k], source[k], ignore, path)
59
+ }
60
+ }
61
+ }
62
+
63
+ const EMPTY_IGNORE = new Set()
64
+
65
+ const stripJsExt = (segment) => segment.replace(/\.js$/iu, '')
66
+
67
+ /**
68
+ * Normalize an `ignoreList` into a Set of '/'-joined path strings.
69
+ *
70
+ * Each entry names something to skip while merging a shared library — a
71
+ * top-level context key ('designSystem', 'state'), a file-ish top-level key
72
+ * ('app.js' → 'app'), or a nested path ('components/Header', 'designSystem/
73
+ * icons'). A trailing `.js` on any path segment is stripped, so file names and
74
+ * context keys are interchangeable.
75
+ *
76
+ * ['designSystem', 'app.js', 'components/Header']
77
+ * → Set { 'designSystem', 'app', 'components/Header' }
78
+ */
79
+ export const normalizeIgnoreList = (ignoreList) => {
80
+ const set = new Set()
81
+ if (!Array.isArray(ignoreList)) return set
82
+ for (const entry of ignoreList) {
83
+ if (!isString(entry)) continue
84
+ const path = entry
85
+ .split('/')
86
+ .map((seg) => stripJsExt(seg.trim()))
87
+ .filter(Boolean)
88
+ .join('/')
89
+ if (path) set.add(path)
90
+ }
91
+ return set
92
+ }
93
+
94
+ /**
95
+ * Wrap a shared library with merge options. Pass the result anywhere a
96
+ * shared-library entry is accepted (the `sharedLibraries` array); it is
97
+ * unwrapped during merge and its options honored.
98
+ *
99
+ * sharedLibrary(bigbrother, { ignoreList: ['designSystem', 'app.js'] })
100
+ *
101
+ * @param {object|string} library - a library context object or identifier
102
+ * @param {object} [options]
103
+ * @param {string[]} [options.ignoreList] - paths to skip while merging
104
+ */
105
+ export const sharedLibrary = (library, options = {}) => ({
106
+ library,
107
+ ignoreList: Array.isArray(options.ignoreList) ? options.ignoreList : []
108
+ })
109
+
110
+ // A wrapped entry carries an `ignoreList` array alongside the library it
111
+ // applies to. The library is named by `library` (a context object or an
112
+ // identifier string) OR, for symbols.json-shaped configs, by `key`/`name`.
113
+ // The `ignoreList` array is the discriminator — a bare library context never
114
+ // has one — so this never misfires on a real context.
115
+ export const isWrappedLibrary = (entry) =>
116
+ isObject(entry) &&
117
+ Array.isArray(entry.ignoreList) &&
118
+ ('library' in entry || 'key' in entry || 'name' in entry)
119
+
120
+ // The library a wrapped entry points at: an explicit `library`, else the
121
+ // symbols.json identifier fields `key`/`name`.
122
+ const wrappedLibraryRef = (entry) =>
123
+ entry.library !== undefined ? entry.library : (entry.key ?? entry.name)
124
+
125
+ const mergeOneLibrary = (context, sharedLib, ignore) => {
126
+ for (const key in sharedLib) {
127
+ if (!Object.prototype.hasOwnProperty.call(sharedLib, key)) continue
128
+ if (ignore.has(key)) continue // top-level skip: 'designSystem', 'app', 'state'
129
+ if (isObject(sharedLib[key]) && isObject(context[key])) {
130
+ if (key === 'designSystem') {
131
+ deepDefaults(context[key], sharedLib[key], ignore, key)
132
+ } else {
133
+ for (const k in sharedLib[key]) {
134
+ if (ignore.has(`${key}/${k}`)) continue // nested skip: 'components/Header'
135
+ if (!(k in context[key])) context[key][k] = sharedLib[key][k]
136
+ }
137
+ }
138
+ } else if (!(key in context)) {
139
+ context[key] = sharedLib[key]
52
140
  }
53
141
  }
54
142
  }
@@ -58,26 +146,22 @@ export const deepDefaults = (target, source) => {
58
146
  * - designSystem: deep defaults (non-destructive recursive)
59
147
  * - other object keys (components, pages, etc.): shallow add missing
60
148
  * - new top-level keys: copy from library
149
+ *
150
+ * Entries may be a bare library context, or a wrapped `{ library, ignoreList }`
151
+ * (see `sharedLibrary`). `ignoreList` names paths to skip while merging that
152
+ * library — e.g. `['designSystem']` imports a library WITHOUT its design system.
61
153
  */
62
154
  export const mergeSharedLibraries = (context, libraries) => {
63
155
  if (!libraries || !libraries.length) return
64
156
  for (let i = 0; i < libraries.length; i++) {
65
- const sharedLib = libraries[i]
66
- if (!isObject(sharedLib)) continue
67
- for (const key in sharedLib) {
68
- if (!Object.prototype.hasOwnProperty.call(sharedLib, key)) continue
69
- if (isObject(sharedLib[key]) && isObject(context[key])) {
70
- if (key === 'designSystem') {
71
- deepDefaults(context[key], sharedLib[key])
72
- } else {
73
- for (const k in sharedLib[key]) {
74
- if (!(k in context[key])) context[key][k] = sharedLib[key][k]
75
- }
76
- }
77
- } else if (!(key in context)) {
78
- context[key] = sharedLib[key]
79
- }
157
+ let sharedLib = libraries[i]
158
+ let ignore = EMPTY_IGNORE
159
+ if (isWrappedLibrary(sharedLib)) {
160
+ ignore = normalizeIgnoreList(sharedLib.ignoreList)
161
+ sharedLib = sharedLib.library
80
162
  }
163
+ if (!isObject(sharedLib)) continue
164
+ mergeOneLibrary(context, sharedLib, ignore)
81
165
  }
82
166
  }
83
167
 
@@ -149,11 +233,36 @@ async function fetchLibraryFromApi (identifier, opts = {}) {
149
233
  }
150
234
  }
151
235
 
236
+ // Resolve a single entry: a context object passes through; an identifier
237
+ // string is fetched into a library object.
238
+ async function resolveOneLibrary (entry, opts = {}) {
239
+ if (isObject(entry)) return entry
240
+ if (isString(entry)) {
241
+ const { full } = normalizeLibraryKey(entry)
242
+ if (!full) return null
243
+ try {
244
+ const data = await fetchLibraryData(full, opts)
245
+ if (!data) {
246
+ console.warn(`[smbls] Shared library "${full}" not found`)
247
+ }
248
+ return data
249
+ } catch (e) {
250
+ console.warn(`[smbls] Failed to fetch shared library "${full}":`, e.message)
251
+ return null
252
+ }
253
+ }
254
+ return null
255
+ }
256
+
152
257
  /**
153
258
  * Resolve an array that may contain strings and/or objects.
154
259
  * Strings are treated as library identifiers and fetched.
155
260
  * Objects pass through unchanged.
156
261
  *
262
+ * Wrapped entries (`{ library, ignoreList }` from `sharedLibrary`) are
263
+ * preserved: the inner `library` is resolved (so it may itself be an
264
+ * identifier string) while `ignoreList` is carried through to the merge step.
265
+ *
157
266
  * @param {Array<string|object>} libraries - Mixed array
158
267
  * @param {object} [opts] - Options passed to fetchLibraryData
159
268
  * @returns {Promise<object[]>} Array of resolved library objects
@@ -162,22 +271,12 @@ export async function resolveSharedLibraries (libraries, opts = {}) {
162
271
  if (!libraries || !libraries.length) return []
163
272
  const resolved = await Promise.all(
164
273
  libraries.map(async (entry) => {
165
- if (isObject(entry)) return entry
166
- if (isString(entry)) {
167
- const { full } = normalizeLibraryKey(entry)
168
- if (!full) return null
169
- try {
170
- const data = await fetchLibraryData(full, opts)
171
- if (!data) {
172
- console.warn(`[smbls] Shared library "${full}" not found`)
173
- }
174
- return data
175
- } catch (e) {
176
- console.warn(`[smbls] Failed to fetch shared library "${full}":`, e.message)
177
- return null
178
- }
274
+ if (isWrappedLibrary(entry)) {
275
+ const library = await resolveOneLibrary(wrappedLibraryRef(entry), opts)
276
+ if (!library) return null
277
+ return { library, ignoreList: entry.ignoreList }
179
278
  }
180
- return null
279
+ return resolveOneLibrary(entry, opts)
181
280
  })
182
281
  )
183
282
  return resolved.filter(Boolean)