@symbo.ls/utils 3.14.774 → 3.14.776
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/dist/cjs/keys.js +1 -1
- package/dist/cjs/methods.js +7 -7
- package/dist/cjs/object.js +19 -18
- package/dist/cjs/sharedLibraries.js +1 -1
- package/dist/cjs/string.js +3 -3
- package/dist/esm/keys.js +1 -1
- package/dist/esm/methods.js +4 -4
- package/dist/esm/object.js +19 -18
- package/dist/esm/sharedLibraries.js +1 -1
- package/dist/esm/string.js +3 -3
- package/keys.js +37 -0
- package/methods.js +24 -1
- package/object.js +378 -12
- package/package.json +1 -1
- package/sharedLibraries.js +96 -4
- package/string.js +43 -0
package/dist/cjs/keys.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var a=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var E=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},h=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of _(t))!i.call(e,o)&&o!==n&&a(e,o,{get:()=>t[o],enumerable:!(s=c(t,o))||s.enumerable});return e};var x=e=>h(a({},"__esModule",{value:!0}),e);var y={};E(y,{DOMQL_EVENTS:()=>g,DOMQ_PROPERTIES:()=>S,ELEMENT_METHOD_OVERRIDE_POINTS:()=>l,METHODS:()=>r,METHODS_EXL:()=>f,PARSED_DOMQ_PROPERTIES:()=>R,PROPS_METHODS:()=>d,STATE_METHODS:()=>p,STATE_PROPERTIES:()=>u,isBuiltinElementMethod:()=>m,isProtectedElementMethod:()=>P});module.exports=x(y);const S=new Set(["attr","style","text","html","content","data","classlist","state","scope","root","deps","extend","extends","$router","routes","children","childExtend","childExtends","childExtendRecursive","childExtendsRecursive","props","if","define","__name","__ref","__hash","__text","key","tag","query","parent","node","variables","on","fetch","component","context","preventContentUpdate","preventContentRecreate"]),R=new Set(["attr","style","text","html","content","data","class","state","scope","children","props","if","key","tag","query","on","context"]),u=["ref","parent","__element","__depends","__ref","__children","root"],p=new Set(["update","parse","clean","create","destroy","add","toggle","remove","apply","set","reset","replace","quietReplace","quietUpdate","applyReplace","applyFunction","keys","values","ref","rootUpdate","parentUpdate","parent","__element","__depends","__ref","__children","root","setByPath","setPathCollection","removeByPath","removePathCollection","getByPath"]),d=new Set(["update","__element"]),r=new Set(["set","reset","update","remove","updateContent","removeContent","lookup","lookdown","lookdownAll","getRef","getPath","setNodeStyles","spotByPath","keys","parse","setProps","parseDeep","variables","if","log","verbose","warn","error","call","nextElement","previousElement","getRootState","getRoot","getRootData","getRootContext","getContext","getQuery","getDB","getChildren","preventContentUpdate","preventContentRecreate"]),m=e=>r.has(e),l=new Set(["log","warn","error","verbose"]),P=e=>r.has(e)&&!l.has(e),f=new Set(["node","context","extends","__element","__ref",...r,...p,...d]),g=new Set(["init","beforeClassAssign","render","renderRouter","attachNode","stateInit","stateCreated","beforeStateUpdate","stateUpdate","beforeUpdate","done","create","complete","frame","update","fetchError","fetchComplete"]);
|
package/dist/cjs/methods.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";var D=Object.create;var g=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var
|
|
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
|
|
3
|
-
${
|
|
1
|
+
"use strict";var D=Object.create;var g=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var I=Object.getPrototypeOf,L=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 F(t))!L.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(I(e)):{},$(t||!e||!e.__esModule?g(n,"default",{value:e,enumerable:!0}):n,e)),J=e=>$(g({},"__esModule",{value:!0}),e);var wt={};M(wt,{call:()=>at,defineSetter:()=>st,error:()=>R,get:()=>U,getChildren:()=>Z,getContext:()=>rt,getDB:()=>ht,getPath:()=>K,getQuery:()=>pt,getRef:()=>Y,getRoot:()=>et,getRootContext:()=>ot,getRootData:()=>nt,getRootState:()=>tt,isMethod:()=>St,keys:()=>j,log:()=>it,lookdown:()=>z,lookdownAll:()=>G,lookup:()=>B,nextElement:()=>lt,parse:()=>Q,parseDeep:()=>O,previousElement:()=>ft,promoteActiveRootState:()=>q,remove:()=>H,setActiveRootState:()=>X,setNodeStyles:()=>C,setProps:()=>W,spotByPath:()=>V,variables:()=>ut,verbose:()=>N,warn:()=>ct});module.exports=J(wt);var w=require("./triggerEvent.js"),d=require("./keys.js"),f=require("./types.js"),y=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,w.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,w.triggerEventOn)("remove",t,e)}function U(e){return this[e]}function W(e,t){const n=this;if(e)return n.update(e,t),n}function Y(e){return e?this.__ref&&this.__ref[e]:this.__ref}function Z(){const e=this.getRef("__children");return Array.isArray(e)?e.map(t=>this[t]):[]}function K(){return this.getRef().path}let x=null;const X=e=>{x=e||null},q=(e,t)=>{e&&t&&x===e&&(x=t)},k=()=>x||null;function tt(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 et(e){const t=this?.__ref?.root||this.getRootState()?.__element;if(!t)throw new Error(`[smbls] getRoot() could not resolve a root element for "${this?.key||"<unknown>"}" \u2014 it has no __ref (never went through create()) and no root state is registered. Answering undefined here used to no-op silently for every caller.`);return Object.keys(t).length>0&&e?t[e]:t}function nt(e){return this.getRoot("data")&&Object.keys(this.getRoot("data")).length>0&&e?this.getRoot("data")[e]:this.getRoot("data")}function ot(e){const t=this.getRoot()?.context;return e?t[e]:t}function rt(e){const t=this.context;return e?t[e]:t}const st=(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 O(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)?O.call(c,e,t):c):(0,f.isObjectLike)(i)&&(o[s]=O.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 it(...e){(h==="test"||h==="development")&&console.log(...e)}function ct(...e){(h==="test"||h==="development")&&console.warn(...e)}function R(...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 lt(){const e=this,{key:t,parent:n}=e,{__children:o}=n.__ref,r=o.indexOf(t),s=o[r+1];return n[s]}function ft(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 ut(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,y.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 at(e,...t){const n=this.context,o=n.utils?.[e]||n.functions?.[e]||n.methods?.[e]||n.snippets?.[e];if(o&&!(0,y.isFailedRevival)(o))try{const r=o.call(this,...t);return r&&typeof r.then=="function"&&r.catch(s=>{R.call(this,s)}),r}catch(r){if(R.call(this,r),n?.strictMode)throw r}}async function ht(){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 pt(e){const t=this,n=e||b.OPTIONS.useStateQuery||t.context?.useStateQuery;if(!n)return null;const o={};if(S(t,o),n===!0)return o;const r=vt[n];return r?r(o):o}const S=(e,t)=>{const n=e.__ref;if(!n)return;const o=n.__state;o&&typeof o=="string"&&dt(t,o);const r=n.__children;if(r)for(let c=0;c<r.length;c++){const l=e[r[c]];l&&l.__ref&&S(l,t)}const s=n.contentElementKey||"content",i=e[s];i&&i.__ref&&S(i,t)},dt=(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=(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
|
+
${E(i,t+1)}
|
|
4
4
|
${n}}`).join(`
|
|
5
|
-
`):""},
|
|
6
|
-
${
|
|
7
|
-
}`,
|
|
5
|
+
`):""},_t=e=>`{
|
|
6
|
+
${E(e,1)}
|
|
7
|
+
}`,gt=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},mt=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("&")},xt=(e,t)=>{const n=[],o=[],r=new Set,s=(a,p,v)=>{r.add(p),v&&o.push(`LEFT JOIN ${p} ON ${p}.${v}_id = ${v}.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}`},
|
|
10
|
+
FROM ${c}${u}`},yt=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},vt={graphql:_t,"json-api":gt,odata:mt,sql:xt,paths:yt};function St(e,t){return!!(d.METHODS.has(e)||t?.context?.methods?.[e])}
|
package/dist/cjs/object.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`,"'"])?"`"+t.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")+"`":"'"+t.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\r/g,"\\r")+"'"},
|
|
3
|
-
`;for(const
|
|
4
|
-
`;for(const
|
|
5
|
-
`:(0,
|
|
6
|
-
`:(0,
|
|
7
|
-
`:
|
|
8
|
-
`;
|
|
9
|
-
`}return
|
|
10
|
-
`,
|
|
11
|
-
`)){p++;break}p++}
|
|
12
|
-
First 200 chars of source: `+String(e).slice(0,200)),e)}},
|
|
13
|
-
|
|
14
|
-
`)
|
|
15
|
-
${i}
|
|
16
|
-
|
|
17
|
-
`);t[s]=
|
|
18
|
-
|
|
1
|
+
"use strict";var P=Object.defineProperty;var te=Object.getOwnPropertyDescriptor;var ne=Object.getOwnPropertyNames;var re=Object.prototype.hasOwnProperty;var oe=(e,t)=>{for(var n in t)P(e,n,{get:t[n],enumerable:!0})},ie=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ne(t))!re.call(e,r)&&r!==n&&P(e,r,{get:()=>t[r],enumerable:!(o=te(t,r))||o.enumerable});return e};var ce=e=>ie(P({},"__esModule",{value:!0}),e);var je={};oe(je,{clone:()=>ue,createNestedObject:()=>Be,createObjectWithoutPrototype:()=>ee,deepClone:()=>ae,deepContains:()=>Ge,deepDestringifyFunctions:()=>me,deepMerge:()=>le,deepStringifyFunctions:()=>R,destringifyGlobalScope:()=>Fe,detectInfiniteLoop:()=>Ve,excludeKeysFromObject:()=>Qe,exec:()=>N,getFunctionSource:()=>De,getInObjectByPath:()=>Je,hasFunction:()=>k,hasOwnProperty:()=>Me,isCyclic:()=>Xe,isEmpty:()=>X,isEmptyObject:()=>We,isEqualDeep:()=>j,isFailedRevival:()=>ze,isLazyFunction:()=>Ce,makeObjectWithoutPrototype:()=>Ye,map:()=>se,merge:()=>fe,objectToString:()=>C,overwrite:()=>ve,overwriteDeep:()=>Q,overwriteShallow:()=>Ze,removeFromObject:()=>Ke,removeNestedKeyByPath:()=>Ue,setInObjectByPath:()=>qe,stringToObject:()=>be});module.exports=ce(je);var S=require("./globals.js"),l=require("./types.js"),q=require("./array.js"),J=require("./string.js"),_=require("./node.js"),V=require("./keys.js");const z="production",w=e=>e.charCodeAt(0)===95&&e.charCodeAt(1)===95,N=(e,t,n,o)=>{if((0,l.isFunction)(e))return t?typeof e.call!="function"?e:e.call(t,t,n||t.state,o||t.context):void 0;if(e!=null&&t?.context?.plugins&&((0,l.isArray)(e)||(0,l.isObject)(e)&&!(0,_.isDOMNode)(e))){const r=t.context.plugins;for(const i of r)if(i.resolveHandler){const c=i.resolveHandler(e,t);if(typeof c=="function")return N(c,t,n,o)}}return e},se=(e,t,n)=>{for(const o in t)e[o]=N(t[o],n)},fe=(e,t,n=[])=>{const o=n instanceof Set;for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(w(r)||(o?n.has(r):n.includes(r))||e[r]===void 0&&(e[r]=t[r]));return e},le=(e,t,n=V.METHODS_EXL)=>L(e,t,n,null),L=(e,t,n,o)=>{if(e===t)return e;if(o){for(let i=0;i<o.length;i+=2)if(o[i]===e&&o[i+1]===t)return e}const r=n instanceof Set;for(const i in t){if(!Object.prototype.hasOwnProperty.call(t,i)||w(i)||i==="constructor"||i==="prototype"||(r?n.has(i):n.includes(i)))continue;const c=e[i],u=t[i];if((0,l.isObjectLike)(c)&&(0,l.isObjectLike)(u)){const s=o||[];s.push(e,t),L(c,u,n,s),s.length-=2}else c===void 0&&(e[i]=u)}return e},ue=(e,t=[])=>{const n=t instanceof Set,o={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(w(r)||(n?t.has(r):t.includes(r))||(o[r]=e[r]));return o},ae=(e,t={})=>{const{exclude:n=[],cleanUndefined:o=!1,cleanNull:r=!1,visited:i=new WeakMap,handleExtends:c=!1}=t;if(!(0,l.isObjectLike)(e)||(0,_.isDOMNode)(e))return e;if(i.has(e))return i.get(e);const u=n instanceof Set?n:n.length>3?new Set(n):null,s=a=>u?u.has(a):n.includes(a),y=(0,l.isArray)(e)?[]:{};i.set(e,y);const f=[[e,y]];for(;f.length;){const[a,g]=f.pop();for(const d in a){if(!Object.prototype.hasOwnProperty.call(a,d)||w(d)||d==="__proto__"||s(d))continue;const p=a[d];if(!(o&&p===void 0)&&!(r&&p===null)){if((0,_.isDOMNode)(p)){g[d]=p;continue}if(c&&d==="extends"&&(0,l.isArray)(p)){g[d]=(0,q.unstackArrayOfObjects)(p,n);continue}if((0,l.isFunction)(p)){g[d]=p;continue}if((0,l.isObjectLike)(p))if(i.has(p))g[d]=i.get(p);else{const h=(0,l.isArray)(p)?[]:{};i.set(p,h),g[d]=h,f.push([p,h])}else g[d]=p}}}return y},R=(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 n in e){const o=e[n];if((0,l.isFunction)(o))t[n]=o.toString();else if((0,l.isObject)(o))t[n]={},R(o,t[n]);else if((0,l.isArray)(o)){const r=t[n]=[];for(let i=0;i<o.length;i++){const c=o[i];(0,l.isObject)(c)?(r[i]={},R(c,r[i])):(0,l.isFunction)(c)?r[i]=c.toString():r[i]=c}}else t[n]=o}return t},pe=/^[A-Za-z_$][A-Za-z0-9_$]*$/,ye=e=>`'${String(e).replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\r/g,"\\r").replace(/\n/g,"\\n")}'`,I=e=>{const t=String(e);return(0,J.stringIncludesAny)(t,[`
|
|
2
|
+
`,"'"])?"`"+t.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")+"`":"'"+t.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\r/g,"\\r")+"'"},C=(e={},t=0)=>{if(e===null||typeof e!="object"||e instanceof RegExp)return String(e);let n=!1;for(const i in e){n=!0;break}if(!n)return"{}";const o=" ".repeat(t);let r=`{
|
|
3
|
+
`;for(const i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;const c=e[i],u=pe.test(i)?i:ye(i);if(r+=`${o} ${u}: `,c instanceof RegExp)r+=String(c);else if((0,l.isArray)(c)){r+=`[
|
|
4
|
+
`;for(const s of c)s instanceof RegExp?r+=`${o} ${String(s)},
|
|
5
|
+
`:(0,l.isObjectLike)(s)&&s!==null?r+=`${o} ${C(s,t+2)},
|
|
6
|
+
`:(0,l.isString)(s)?r+=`${o} ${I(s)},
|
|
7
|
+
`:r+=`${o} ${s},
|
|
8
|
+
`;r+=`${o} ]`}else(0,l.isObjectLike)(c)?r+=C(c,t+1):(0,l.isString)(c)?r+=I(c):r+=c;r+=`,
|
|
9
|
+
`}return r+=`${o}}`,r},de=[/^\(\s*\{[^}]*\}\s*\)\s*=>/,/^(\([^)]*\)|[^=]*)\s*=>/,/^function[\s(]/,/^async\s+/,/^\(\s*function/,/^[a-zA-Z_$][a-zA-Z0-9_$]*\s*=>/,/^(?:\*\s*)?[a-zA-Z_$][\w$]*\s*\((?:[^()]|\([^()]*\))*\)\s*\{[\s\S]*\}$/],he=/^["[{]/,ge=/^(export|import)\s/,k=e=>{if(!e)return!1;const t=e.trim();if(t===""||t==="{}"||t==="[]")return!1;const n=t.includes("=>");if(!n&&t.charCodeAt(0)!==40&&!t.startsWith("function")&&!t.startsWith("async")&&!(t.charCodeAt(t.length-1)===125&&t.includes("("))||ge.test(t)||!de.some(i=>i.test(t)))return!1;const r=t.charCodeAt(0);return!(r===123&&!n||r===91||he.test(t)&&!n)},m=e=>(0,eval)(e),_e=(e,t)=>{const n=/^(\s*(?:async\s+)?function\s*[\w$]*\s*\([^)]*\)\s*)\{/.exec(e);if(!n)return null;const o=n[0].length,r=[];let i=o,c=1,u=null;const s=e.length,y=new RegExp("^(?:const|let|var)\\s+"+t+"\\b");for(;i<s&&c>0;){const a=e[i];if(a==="/"&&e[i+1]==="/"){const g=e.indexOf(`
|
|
10
|
+
`,i);i=g===-1?s:g;continue}if(a==="/"&&e[i+1]==="*"){const g=e.indexOf("*/",i+2);i=g===-1?s:g+2;continue}if(a==='"'||a==="'"||a==="`"){const g=a;for(i++;i<s;){if(e[i]==="\\"){i+=2;continue}if(e[i]===g){i++;break}if(g==="`"&&e[i]==="$"&&e[i+1]==="{"){i+=2;let d=1;for(;i<s&&d>0;)e[i]==="{"?d++:e[i]==="}"&&d--,i++;continue}i++}continue}if(a==="{"){c++,i++;continue}if(a==="}"){c--,i++;continue}if(c===1&&y.test(e.slice(i))){const g=i;let d=0,p=i;for(;p<s;){const h=e[p];if(h==='"'||h==="'"||h==="`"){const A=h;for(p++;p<s;){if(e[p]==="\\"){p+=2;continue}if(e[p]===A){p++;break}p++}continue}if(h==="("||h==="["||h==="{"){d++,p++;continue}if(h===")"||h==="]"||h==="}"){if(d===0)break;d--,p++;continue}if(d===0&&(h===";"||h===`
|
|
11
|
+
`)){p++;break}p++}r.push([g,p]),i=p;continue}i++}if(!r.length)return null;let f=e;for(let a=r.length-1;a>=0;a--)f=f.slice(0,r[a][0])+f.slice(r[a][1]);return f},x=(e,t,n,o)=>{const r=String(e).trimStart();if(/^(export|import)\s/.test(r))return e;try{return n.window.eval(`(${e})`)}catch(i){const c=i&&i.message?i.message:String(i),u=/await is only valid in async/.test(c),s=/Identifier '([^']+)' has already been declared/.exec(c);let y=null;if(u){const f=String(e).trim();if(/^function[\s(]/.test(f))try{y=n.window.eval("(async "+f+")")}catch{}}else if(s){let f=String(e),a=s[1];for(let g=0;g<5;g++){const d=_e(f,a);if(!d||d===f)break;f=d;try{y=n.window.eval("("+f+")");break}catch(p){const h=/Identifier '([^']+)' has already been declared/.exec(p&&p.message||String(p));if(!h||h[1]!==a)break}}}if(!y&&/Unexpected (token '\{'|identifier)/.test(c))try{const f=n.window.eval("({"+e+"})");if(f&&typeof f=="object"){const a=Object.keys(f);a.length===1&&typeof f[a[0]]=="function"&&(y=f[a[0]])}}catch{}return y||(typeof console<"u"&&console.warn&&console.warn(`[smbls] deepDestringifyFunctions: eval failed on ${t} \u2014 `+(o?"revived lazily, so its source compiled on this first use; it acts as the string it replaces (a call returns the source text, el.call treats it as not callable). Reason: ":"value will be left as a string. Reason: ")+c+`.
|
|
12
|
+
First 200 chars of source: `+String(e).slice(0,200)),e)}},F=1,T=2,O=new WeakMap,we=/^(async\s+)?function(?![\w$])\s*(\*)?\s*([A-Za-z_$][\w$]*)?\s*\((?:[^()'"`/]|\([^()'"`/]*\))*\)\s*\{/,Oe=/^(async\s+)?[A-Za-z_$][\w$]*\s*=>/,Se=/^(async\s*)?\((?:[^()'"`/]|\([^()'"`/]*\))*\)\s*=>/,Ee=/^(async\s+)?([A-Za-z_$][\w$]*)\s*\((?:[^()'"`/]|\([^()'"`/]*\))*\)\s*\{/,Ae=new Set(["if","for","while","switch","catch","with","do","return","typeof","void","delete","new","in","of","instanceof","function","class","const","let","var","await","yield","import","export","try","else","throw","case","default","break","continue","debugger","finally","super","this","null","true","false","async","get","set","static"]),b=e=>e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===36||e===95,xe=(e,t,n)=>{let o=e.indexOf(t,n);for(;o!==-1;){const r=o+t.length;if((o===0||!b(e.charCodeAt(o-1)))&&(r>=e.length||!b(e.charCodeAt(r))))return!0;o=e.indexOf(t,r)}return!1},M=e=>{let t=e.length-1;for(;t>=0&&e.charCodeAt(t)<=32;)t--;return t<0?-1:e.charCodeAt(t)},$e=e=>{let t=e,n=0;for(;n<t.length&&t.charCodeAt(n)<=32;)n++;n&&(t=t.slice(n));let o=we.exec(t);if(o){if(o[2]||M(t)!==125)return null;const r=o[3]||"";return r&&xe(t,r,o[0].indexOf("("))||t.indexOf("arguments.callee")!==-1?null:{src:e,name:r,kind:o[1]?T:F,async:!!o[1],fn:void 0}}return o=Oe.exec(t)||Se.exec(t),o?{src:e,name:"",kind:T,async:!!o[1],fn:void 0}:(o=Ee.exec(t),o&&!Ae.has(o[2])&&M(t)===125?t.indexOf("arguments.callee")!==-1?null:{src:e,name:o[2],kind:T,async:!!o[1],fn:void 0}:null)},W=e=>e.index===-1?`"${e.key}"`:`array index ${e.index} (prop "${e.key}")`,$=e=>{const t=x(e.src,W(e),e.opts,!0);let n=null;return typeof t=="function"?n=t:(e.value=t,typeof t!="string"&&typeof console<"u"&&console.warn&&console.warn(`[smbls] deepDestringifyFunctions: ${W(e)} did not evaluate to a function \u2014 the lazily revived function returns that value.
|
|
13
|
+
First 200 chars of source: `+String(e.src).slice(0,200))),e.fn=n,e.opts=null,n},ke=(e,t,n)=>Reflect.construct(e,t,n);function Pe(){const e=O.get(this);return e?e.src.trim():Function.prototype.toString.call(this)}const Te={length:{get(){const e=O.get(this);if(!e)return 0;const t=e.fn===void 0?$(e):e.fn;return t?t.length:0},configurable:!0},name:{get(){const e=O.get(this);return e?e.name:""},configurable:!0},toString:{value:Pe,writable:!0,configurable:!0}},Ne=Object.getPrototypeOf(async function(){}),Re=e=>{let t;return e.kind===F?t=function(){const n=e.fn===void 0?$(e):e.fn;return n===null?e.value:new.target?ke(n,arguments,new.target):n.apply(this,arguments)}:t={lazy(){const n=e.fn===void 0?$(e):e.fn;return n===null?e.value:n.apply(this,arguments)}}.lazy,O.set(t,e),Object.defineProperties(t,Te),e.async&&Object.setPrototypeOf(t,Ne),t},Y=(e,t,n,o)=>{const r=$e(e);return r?(r.key=t,r.index=n,r.opts=o,Re(r)):x(e,n===-1?`"${t}"`:`array index ${n} (prop "${t}")`,o)},Ce=e=>typeof e=="function"&&O.has(e),De=e=>{const t=O.get(e);return t?t.src.trim():Function.prototype.toString.call(e)},ze=e=>{const t=typeof e=="function"?O.get(e):void 0;return t?(t.fn===void 0?$(t):t.fn)===null:!1},Le=new Set(["components","pages","functions","methods","snippets","app","globalScope"]),Ie={window:{eval:m}},me=(e,t={},n=Ie)=>{if(!e||typeof e!="object")return t;(!n||!n.window||typeof n.window.eval!="function")&&(n={...n,window:{eval:m}});const o=n.lazy===!0,r=n.lazy==="context",i=(u,s,y)=>o||r&&(u===e?Le.has(s):y),c=[[e,t,o]];for(;c.length;){const[u,s,y]=c.pop();for(const f in u){if(!Object.prototype.hasOwnProperty.call(u,f))continue;const a=u[f];if((0,l.isString)(a))k(a)?s[f]=y?Y(a,f,-1,n):x(a,`"${f}"`,n):s[f]=a;else if((0,l.isArray)(a)){const g=s[f]=[],d=i(u,f,y);for(let p=0;p<a.length;p++){const h=a[p];if((0,l.isString)(h))g.push(k(h)?d?Y(h,f,p,n):x(h,`array index ${p} (prop "${f}")`,n):h);else if((0,l.isObject)(h)){const A=U(h);if(A)g.push(A);else{const D={};g.push(D),c.push([h,D,d])}}else g.push(h)}}else if((0,l.isObject)(a)){const g=U(a);if(g){s[f]=g;continue}const d=s[f]&&typeof s[f]=="object"&&!(0,l.isArray)(s[f])?s[f]:s[f]={};c.push([a,d,i(u,f,y)])}else s[f]=a}}return t},v="Set",Z="Map",H="RegExp",G="WeakMap",K="WeakSet",B=e=>{const t=Object.keys(e);return t.length===1&&t[0]==="__type"},E=(e,t)=>{if(!e||typeof e!="object")return e;const n=i=>E(i,t||(t=new WeakMap));if(e.__type===v&&(0,l.isArray)(e.values))return new Set(e.values.map(n));if(e.__type===Z&&(0,l.isArray)(e.entries))return new Map(e.entries.map(i=>(0,l.isArray)(i)?[n(i[0]),n(i[1])]:i));if(e.__type===G&&B(e))return new WeakMap;if(e.__type===K&&B(e))return new WeakSet;if(e.__type===H&&(0,l.isString)(e.source))try{return new RegExp(e.source,(0,l.isString)(e.flags)?e.flags:"")}catch{return e}if(t||(t=new WeakMap),t.has(e))return t.get(e);let o=!1;if((0,l.isArray)(e)){const i=new Array(e.length);t.set(e,i);for(let c=0;c<e.length;c++)i[c]=E(e[c],t),i[c]!==e[c]&&(o=!0);return o||t.set(e,e),o?i:e}const r={};t.set(e,r);for(const i of Object.keys(e))r[i]=E(e[i],t),r[i]!==e[i]&&(o=!0);return o||t.set(e,e),o?r:e},U=e=>{if(!e||typeof e!="object")return null;const t=e.__type;if(t!==H&&t!==v&&t!==Z&&t!==G&&t!==K)return null;const n=E(e);return n===e?null:n},Fe=e=>{if(!e||typeof e!="object")return e;const t={},n=[];for(const c of Object.keys(e)){const u=e[c];(0,l.isString)(u)&&k(u)?n.push([c,u]):t[c]=E(u)}if(n.length===0)return t;const o=c=>/^[A-Za-z_$][\w$]*$/.test(c),r=n.filter(([c])=>o(c)),i=Object.keys(t).filter(o).map(c=>`var ${c} = __gs__[${JSON.stringify(c)}];`).join(`
|
|
14
|
+
`);try{const c=r.map(([y,f])=>`var ${y} = (${f});`).join(`
|
|
15
|
+
`),u="{ "+r.map(([y])=>`${JSON.stringify(y)}: ${y}`).join(", ")+" }",s=S.window.eval(`(function(__gs__) { ${i}
|
|
16
|
+
${c}
|
|
17
|
+
return ${u}; })`)(t);Object.assign(t,s)}catch{for(const[u,s]of r)try{const y=Object.keys(t).filter(o).map(f=>`var ${f} = __gs__[${JSON.stringify(f)}];`).join(`
|
|
18
|
+
`);t[u]=S.window.eval(`(function(__gs__) { ${y}
|
|
19
|
+
return (${s}); })`)(t)}catch{try{t[u]=S.window.eval(`(${s})`)}catch{t[u]=s}}}for(const[c,u]of n)if(!o(c))try{t[c]=S.window.eval(`(${u})`)}catch{t[c]=u}return t},be=(e,t={verbose:!0})=>{try{return e?S.window.eval("("+e+")"):{}}catch(n){t.verbose&&console.warn(n)}},Me=(e,...t)=>Object.prototype.hasOwnProperty.call(e,...t),X=e=>{for(const t in e)return!1;return!0},We=e=>(0,l.isObject)(e)&&X(e),Ye=()=>Object.create(null),ve=(e,t,n={})=>{const o=n.exclude||[],r=n.preventUnderscore;for(const i in t)o.includes(i)||!r&&w(i)||i==="constructor"||i==="prototype"||t[i]!==void 0&&(e[i]=t[i]);return e},Ze=(e,t,n=[])=>{const o=n instanceof Set;for(const r in t)w(r)||r==="constructor"||r==="prototype"||(o?n.has(r):n.includes(r))||(e[r]=t[r]);return e},Q=(e,t,n={},o=new WeakMap)=>{if(!(0,l.isObjectLike)(e)||!(0,l.isObjectLike)(t)||(0,_.isDOMNode)(e)||(0,_.isDOMNode)(t))return t;if(o.has(e))return o.get(e);o.set(e,e);const r=n.exclude,i=r?r instanceof Set?r:new Set(r):null,c=!n.preventForce;for(const u in t){if(!Object.prototype.hasOwnProperty.call(t,u)||i&&i.has(u)||c&&w(u)||u==="constructor"||u==="prototype")continue;const s=e[u],y=t[u];(0,_.isDOMNode)(y)?e[u]=y:(0,l.isObjectLike)(s)&&(0,l.isObjectLike)(y)?e[u]=Q(s,y,n,o):y!==void 0&&(e[u]=y)}return e},j=(e,t,n=new Set)=>{if(typeof e!="object"||typeof t!="object"||e===null||t===null)return e===t;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);const o=Object.keys(e),r=Object.keys(t);if(o.length!==r.length)return!1;for(let i=0;i<o.length;i++){const c=o[i];if(!Object.prototype.hasOwnProperty.call(t,c)||!j(e[c],t[c],n))return!1}return!0},He=new Set(["node","__ref"]),Ge=(e,t,n=He)=>{if(e===t)return!0;if(!(0,l.isObjectLike)(e)||!(0,l.isObjectLike)(t)||(0,_.isDOMNode)(e)||(0,_.isDOMNode)(t))return e===t;const o=n instanceof Set?n:new Set(n),r=new WeakSet;function i(c,u){if(r.has(u))return!0;r.add(u);for(const s in u){if(!Object.prototype.hasOwnProperty.call(u,s)||o.has(s))continue;if(!Object.prototype.hasOwnProperty.call(c,s))return!1;const y=u[s],f=c[s];if((0,_.isDOMNode)(y)||(0,_.isDOMNode)(f)){if(y!==f)return!1}else if((0,l.isObjectLike)(y)&&(0,l.isObjectLike)(f)){if(!i(f,y))return!1}else if(y!==f)return!1}return!0}return i(e,t)},Ke=(e,t)=>{if(t==null)return e;if((0,l.is)(t)("string","number"))delete e[t];else if((0,l.isArray)(t))for(let n=0;n<t.length;n++)delete e[t[n]];else throw new Error("Invalid input: props must be a string or an array of strings");return e},ee=e=>{if(e===null||typeof e!="object")return e;const t=Object.create(null);for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=ee(e[n]));return t},Be=(e,t)=>{if(e.length===0)return t;const n={};let o=n;for(let r=0;r<e.length;r++)r===e.length-1&&t?o[e[r]]=t:(o[e[r]]={},o=o[e[r]]);return n},Ue=(e,t)=>{if(!Array.isArray(t))throw new Error("Path must be an array.");let n=e;for(let r=0;r<t.length-1;r++){if(n[t[r]]===void 0)return;n=n[t[r]]}const o=t[t.length-1];n&&Object.prototype.hasOwnProperty.call(n,o)&&delete n[o]},qe=(e,t,n)=>{if(!Array.isArray(t))throw new Error("Path must be an array.");let o=e;for(let r=0;r<t.length-1;r++)(!o[t[r]]||typeof o[t[r]]!="object")&&(o[t[r]]={}),o=o[t[r]];return o[t[t.length-1]]=n,e},Je=(e,t)=>{if(!Array.isArray(t))throw new Error("Path must be an array.");let n=e;for(let o=0;o<t.length;o++){if(n==null)return;n=n[t[o]]}return n},Ve=e=>{let n=[],o=0;for(let r=0;r<e.length;r++)if(n.length<2)n.push(e[r]);else if(e[r]===n[r%2]?o++:(n=[e[r-1],e[r]],o=1),o>=20)return(z==="test"||z==="development")&&console.warn("Warning: Potential infinite loop detected due to repeated sequence:",n),!0},Xe=e=>{const t=new WeakSet;function n(o){if(o&&typeof o=="object"){if(t.has(o))return!0;t.add(o);for(const r in o)if(Object.prototype.hasOwnProperty.call(o,r)&&n(o[r]))return console.log(o,"cycle at "+r),!0}return!1}return n(e)},Qe=(e,t)=>{const n=t instanceof Set?t:new Set(t),o={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&!n.has(r)&&(o[r]=e[r]);return o};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var h=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var P=(n,t)=>{for(var o in t)h(n,o,{get:t[o],enumerable:!0})},M=(n,t,o,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of F(t))!U.call(n,s)&&s!==o&&h(n,s,{get:()=>t[s],enumerable:!(e=E(t,s))||e.enumerable});return n};var D=n=>M(h({},"__esModule",{value:!0}),n);var nn={};P(nn,{__resetBuiltinMethodWarnings:()=>Y,deepDefaults:()=>p,fetchLibraryData:()=>j,isWrappedLibrary:()=>w,mergeSharedLibraries:()=>Q,normalizeIgnoreList:()=>y,normalizeLibraryKey:()=>u,resolveSharedLibraries:()=>Z,sharedLibrary:()=>K});module.exports=D(nn);var l=require("./types.js"),f=require("./keys.js"),I=require("./env.js");const k="system",T="https://smbls-kv.nika-980.workers.dev",C="https://api.symbols.app";function u(n){const t=String(n||"").trim();if(!t)return{owner:k,key:"",full:""};let o=null,e=t;if(t.includes("/")){const r=t.indexOf("/");o=t.slice(0,r),e=t.slice(r+1)}e=e.replace(/\.symbo\.ls$/iu,""),o||(o=k);const s=e?`${o}/${e}`:"";return{owner:o,key:e,full:s}}const p=(n,t,o,e)=>{for(const s in t){const r=e?`${e}/${s}`:s;o&&o.has(r)||(s in n?(0,l.isObject)(n[s])&&(0,l.isObject)(t[s])&&p(n[s],t[s],o,r):n[s]=t[s])}},$=(n,t,o)=>{if(!(0,l.isObject)(n)||!t.size)return n;const e=`${o}/`;let s=!1;for(const a of t)if(a.startsWith(e)){s=!0;break}if(!s)return n;const r={};for(const a in n){if(!Object.prototype.hasOwnProperty.call(n,a))continue;const i=`${o}/${a}`;t.has(i)||(r[a]=$(n[a],t,i))}return r},N=new Set,G=new Set(["components","pages","functions","snippets","methods"]),L=(n,t)=>t===""&&G.has(n),A=["fontFamily","fontfamily","font_family","FONT_FAMILY"],W=n=>{const t=new Map;if(!(0,l.isObject)(n))return t;for(const o of A){const e=n[o];if((0,l.isObject)(e))for(const s in e)!(0,l.isObject)(e[s])||!e[s].isDefault||(t.has(o)||t.set(o,new Set),t.get(o).add(s))}return t},z=(n,t)=>{for(const o of A){const e=n[o];if(!(0,l.isObject)(e))continue;const s=t.get(o);let r=null;for(const a in e){const i=e[a];if(!(0,l.isObject)(i)||!i.isDefault||s&&s.has(a))continue;const c={...i};delete c.isDefault,r||(r={...e}),r[a]=c}r&&(n[o]=r)}},J=n=>n.replace(/\.js$/iu,""),y=n=>{const t=new Set;if(!Array.isArray(n))return t;for(const o of n){if(!(0,l.isString)(o))continue;const e=o.split("/").map(s=>J(s.trim())).filter(Boolean).join("/");e&&t.add(e)}return t},K=(n,t={})=>({library:n,ignoreList:Array.isArray(t.ignoreList)?t.ignoreList:[]}),w=n=>(0,l.isObject)(n)&&Array.isArray(n.ignoreList)&&("library"in n||"key"in n||"name"in n),S=n=>n.library!==void 0?n.library:n.key??n.name,m=new Set,Y=()=>{m.clear()},x=(n,t)=>{const o=t.filter(e=>!m.has(e));if(o.length){for(const e of o)m.add(e);(0,I.isLoudDevRuntime)()&&console.warn(`[smbls] shared library "${n}" ships ${o.map(e=>`methods.${e}`).join(", ")} \u2014 named like a built-in element method. Refused: the built-in wins; a library cannot replace an element method on the consuming app. If the app wants this version, declare it in the app's OWN methods.`)}},V=(n,t,o)=>{let e=null;for(const s in n)if((0,f.isProtectedElementMethod)(s)&&(t.has(`methods/${s}`)||o.push(s),!e)){e={};for(const r in n)(0,f.isProtectedElementMethod)(r)||(e[r]=n[r])}return e||n},q=(n,t,o,e="library")=>{const s=y(t.sharedLibIgnore);t.sharePages===!1&&s.add("pages");const r=s.size?new Set([...o,...s]):o,a=[];for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&!(i==="sharePages"||i==="sharedLibIgnore")&&i!=="app"&&!r.has(i)){if((0,l.isObject)(t[i])&&(0,l.isObject)(n[i])){if(i==="designSystem")p(n[i],t[i],r,i);else for(const c in t[i])if(!r.has(`${i}/${c}`)){if(i==="methods"&&(0,f.isProtectedElementMethod)(c)){c in n[i]||a.push(c);continue}c in n[i]?L(i,n[i][c])&&!L(i,t[i][c])&&(n[i][c]=t[i][c]):n[i][c]=t[i][c]}}else if(!(i in n)){const c=t[i],d=i==="methods"&&c&&typeof c=="object"?V(c,r,a):c;n[i]=$(d,r,i)}}a.length&&x(e,a)},H=(n,t,o)=>{if(n!==t){const e=S(n);if((0,l.isString)(e)&&e)return e;if(n.key||n.name)return n.key||n.name}return t&&(t.key||t.name)||`sharedLibraries[${o}]`},Q=(n,t)=>{if(!t||!t.length)return;const o=W(n.designSystem);for(let e=0;e<t.length;e++){const s=t[e];let r=s,a=N;w(r)&&(a=y(r.ignoreList),r=r.library),(0,l.isObject)(r)&&q(n,r,a,H(s,r,e))}o.size&&z(n.designSystem,o)};async function j(n,t={}){if((t.provider||"kv")==="api")return _(n,t);const e=await X(n,t);return e||_(n,t)}async function X(n,t={}){const o=t.kvBaseUrl||T,e=t.env||"production",s=`${o}/kv/${encodeURIComponent(n)}?env=${e}`;try{const r=await fetch(s,{method:"GET"});return r.ok&&(await r.json())?.value||null}catch{return null}}async function _(n,t={}){const o=t.apiBaseUrl||C,{key:e}=u(n);try{const s=`${o}/core/projects/libraries/available?search=${encodeURIComponent(e)}&limit=10`,r=await fetch(s,{method:"GET"});if(!r.ok)return null;const a=await r.json(),c=(a?.items||a?.data||(Array.isArray(a)?a:[])).find(O=>{const{key:B}=u(O?.key);return B.toLowerCase()===e.toLowerCase()});if(!c?.id&&!c?._id)return null;const d=c.id||c._id,R=`${o}/core/projects/${encodeURIComponent(d)}/data?branch=main`,b=await fetch(R,{method:"GET"});if(!b.ok)return null;const g=await b.json();return g?.data||g||null}catch{return null}}async function v(n,t={}){if((0,l.isObject)(n))return n;if((0,l.isString)(n)){const{full:o}=u(n);if(!o)return null;try{const e=await j(o,t);return e||console.warn(`[smbls] Shared library "${o}" not found`),e}catch(e){return console.warn(`[smbls] Failed to fetch shared library "${o}":`,e.message),null}}return null}async function Z(n,t={}){return!n||!n.length?[]:(await Promise.all(n.map(async e=>{if(w(e)){const s=await v(S(e),t);return s?{library:s,ignoreList:e.ignoreList}:null}return v(e,t)}))).filter(Boolean)}
|
package/dist/cjs/string.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`);let
|
|
3
|
-
`).replace(/\/\/\/\/\/tilde/g,"`").replace(/\/\/\/\/\/dlrsgn/g,"$"),P=/[^a-zA-Z0-9\s]/g,
|
|
1
|
+
"use strict";var _=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var N=(e,n)=>{for(var t in n)_(e,t,{get:n[t],enumerable:!0})},O=(e,n,t,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let c of L(n))!j.call(e,c)&&c!==t&&_(e,c,{get:()=>n[c],enumerable:!(s=A(n,c))||s.enumerable});return e};var R=e=>O(_({},"__esModule",{value:!0}),e);var M={};N(M,{customDecodeURIComponent:()=>z,customEncodeURIComponent:()=>q,decodeNewlines:()=>K,encodeNewlines:()=>D,findKeyPosition:()=>v,lowercaseFirstLetter:()=>T,replaceLiteralsWithObjectFields:()=>F,replaceOctalEscapeSequences:()=>V,stringIncludesAny:()=>I,trimStringFromSymbols:()=>k});module.exports=R(M);const I=(e,n)=>{for(const t of n)if(e.includes(t))return!0;return!1},k=(e,n)=>{const t=new RegExp(`[${n.join("\\")}]`,"g");return e.replace(t,"")},E={2:/{{\s*((?:\.\.\/)*)([\w\d.]+)\s*(?:\|\s*([\w\d.]+))?\s*}}/g,3:/{{{(\s*(?:\.\.\/)*)([\w\d.]+)\s*(?:\|\s*([\w\d.]+))?\s*}}}/g},x=(e,n)=>n.split(".").reduce((t,s)=>t?.[s],e),$=(e,n)=>{if(!e||!e.__ref)return!0;let t=e;for(;t;){if(t.allowRuntimeTemplates===!0)return!0;const s=t.__ref&&t.__ref.__authoredTemplates;if(s&&s.has(n))return!0;t=t.parent}return!1};function F(e,n,t={}){const{bracketsLength:s=2}=t,c=s===3?"{{{":"{{";if(!e.includes(c)||!$(this,e))return e;const m=E[s],a=n||this.state||{},u=this;return e.replace(m,(p,d,r,i)=>{const g=r.trim();if(i){const l=u?.context,o=l?.functions?.[i]||l?.utils?.[i]||l?.methods?.[i]||l?.snippets?.[i]||u?.[i];if(o&&typeof o=="function")try{return String(o.call(u,g)??"")}catch{return""}return""}if(d){const l=(d.match(/\.\.\//g)||[]).length;let o=a;for(let f=0;f<l;f++){if(!o||!o.parent)return"";o=o.parent}if(g==="parent")return String(o.value??"");const h=x(o,g);return h!=null&&typeof h=="object"?"":String(h??"")}else{const l=x(a,g);if(l!=null&&typeof l!="object")return String(l);const o=u?.context?.polyglot;if(o?.translations){const h=a?.root?.lang||a?.lang||u?.context?.state?.lang||o.defaultLang||"en",f=o.translations[h];if(f){const C=x(f,g);if(C!=null&&typeof C!="object")return String(C);for(const w in f){const b=f[w];if(b&&typeof b=="object"&&!Array.isArray(b)){const S=x(b,g);if(S!=null&&typeof S!="object")return String(S)}}}const y=x(o.translations,g);if(y!=null&&typeof y!="object")return String(y)}return""}})}const T=e=>`${e.charAt(0).toLowerCase()}${e.slice(1)}`,v=(e,n)=>{const t=e.split(`
|
|
2
|
+
`);let s=-1,c=-1,m=-1,a=-1;const u=new RegExp(`\\b${n}\\b\\s*:\\s*`);let p=0,d=!1;for(let r=0;r<t.length;r++)if(u.test(t[r])&&!d){if(d=!0,s=r+1,m=t[r].indexOf(n)+1,t[r].includes("{}")){c=s,a=t[r].indexOf("{}")+3;break}const i=t[r].slice(m+n.length);if(i.includes("{")||i.includes("["))p=1;else{c=r+1,a=t[r].length+1;break}}else if(d&&(p+=(t[r].match(/{/g)||[]).length,p+=(t[r].match(/\[/g)||[]).length,p-=(t[r].match(/}/g)||[]).length,p-=(t[r].match(/]/g)||[]).length,p===0)){c=r+1,a=t[r].lastIndexOf("}")!==-1?t[r].lastIndexOf("}")+2:t[r].length+1;break}return{startColumn:m,endColumn:a,startLineNumber:s,endLineNumber:c}},U=/\\([0-7]{1,3})/g,V=e=>e.replace(U,(n,t)=>String.fromCharCode(parseInt(t,8))),D=e=>e.replace(/\n/g,"/////n").replace(/`/g,"/////tilde").replace(/\$/g,"/////dlrsgn"),K=e=>e.replace(/\/\/\/\/\/n/g,`
|
|
3
|
+
`).replace(/\/\/\/\/\/tilde/g,"`").replace(/\/\/\/\/\/dlrsgn/g,"$"),P=/[^a-zA-Z0-9\s]/g,q=e=>e.replace(P,n=>"%"+n.charCodeAt(0).toString(16).toUpperCase()),z=e=>e.replace(/%[0-9A-Fa-f]{2}/g,n=>String.fromCharCode(parseInt(n.slice(1),16)));
|
package/dist/esm/keys.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a=new Set(["attr","style","text","html","content","data","classlist","state","scope","root","deps","extend","extends","$router","routes","children","childExtend","childExtends","childExtendRecursive","childExtendsRecursive","props","if","define","__name","__ref","__hash","__text","key","tag","query","parent","node","variables","on","fetch","component","context","preventContentUpdate","preventContentRecreate"]),s=new Set(["attr","style","text","html","content","data","class","state","scope","children","props","if","key","tag","query","on","context"]),p=["ref","parent","__element","__depends","__ref","__children","root"],o=new Set(["update","parse","clean","create","destroy","add","toggle","remove","apply","set","reset","replace","quietReplace","quietUpdate","applyReplace","applyFunction","keys","values","ref","rootUpdate","parentUpdate","parent","__element","__depends","__ref","__children","root","setByPath","setPathCollection","removeByPath","removePathCollection","getByPath"]),n=new Set(["update","__element"]),t=new Set(["set","reset","update","remove","updateContent","removeContent","lookup","lookdown","lookdownAll","getRef","getPath","setNodeStyles","spotByPath","keys","parse","setProps","parseDeep","variables","if","log","verbose","warn","error","call","nextElement","previousElement","getRootState","getRoot","getRootData","getRootContext","getContext","getQuery","getDB","getChildren","preventContentUpdate","preventContentRecreate"]),d=e=>t.has(e),r=new Set(["log","warn","error","verbose"]),l=e=>t.has(e)&&!r.has(e),c=new Set(["node","context","extends","__element","__ref",...t,...o,...n]),_=new Set(["init","beforeClassAssign","render","renderRouter","attachNode","stateInit","stateCreated","beforeStateUpdate","stateUpdate","beforeUpdate","done","create","complete","frame","update","fetchError","fetchComplete"]);export{_ as DOMQL_EVENTS,a as DOMQ_PROPERTIES,r as ELEMENT_METHOD_OVERRIDE_POINTS,t as METHODS,c as METHODS_EXL,s as PARSED_DOMQ_PROPERTIES,n as PROPS_METHODS,o as STATE_METHODS,p as STATE_PROPERTIES,d as isBuiltinElementMethod,l as isProtectedElementMethod};
|
package/dist/esm/methods.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{triggerEventOn as
|
|
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
|
|
1
|
+
import{triggerEventOn as x}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 y}from"./types.js";import{deepClone as A,isFailedRevival as b}from"./object.js";import{isProduction as C}from"./env.js";import{removeValueFromArray as j}from"./array.js";import{OPTIONS as Q}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 N(e={}){const t=this;if(t.node?.style){for(const n in e){const o=e[n],r=t[n];if(P(o)&&r)N.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(x("beforeRemove",t,e)===!1)return t;p(t.node.remove)?t.node.remove():C()||(console.warn("This item cant be removed"),t.log()),delete t.parent[t.key],t.parent.__ref&&(t.parent.__ref.__children=j(t.parent.__ref.__children,t.key)),x("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(){const e=this.getRef("__children");return Array.isArray(e)?e.map(t=>this[t]):[]}function ct(){return this.getRef().path}let _=null;const lt=e=>{_=e||null},ft=(e,t)=>{e&&t&&_===e&&(_=t)},v=()=>_||null;function ut(e){let t=null;const n=o=>o.__element&&o.root?.isRootState;if(!this)t=v();else if(n(this))t=this.root;else if(this.__ref&&this.__ref.path){const o=this.state&&n(this.state),r=p(this.state)&&this.parent.state&&n(this.parent.state);(o||r)&&(t=this.state.root||this.parent.state.root)}return t||(t=v()),e?t?.[e]:t}function at(e){const t=this?.__ref?.root||this.getRootState()?.__element;if(!t)throw new Error(`[smbls] getRoot() could not resolve a root element for "${this?.key||"<unknown>"}" \u2014 it has no __ref (never went through create()) and no root state is registered. Answering undefined here used to no-op silently for every caller.`);return Object.keys(t).length>0&&e?t[e]:t}function ht(e){return this.getRoot("data")&&Object.keys(this.getRoot("data")).length>0&&e?this.getRoot("data")[e]:this.getRoot("data")}function pt(e){const t=this.getRoot()?.context;return e?t[e]:t}function dt(e){const t=this.context;return e?t[e]:t}const _t=(e,t,n,o)=>Object.defineProperty(e,t,{get:n,set:o});function D(){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 T(e=[]){const t=this,n={},o=D.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 S(e=[],t=new WeakSet){const n=this;if(t.has(n))return;t.add(n);const o=T.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=>y(c)?S.call(c,e,t):c):y(i)&&(o[s]=S.call(i,e,t))}return o}function F(...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 gt(...e){(a==="test"||a==="development")&&console.log(...e)}function mt(...e){(a==="test"||a==="development")&&console.warn(...e)}function w(...e){if(a==="test"||a==="development"){if(e[e.length-1]?.debugger)debugger;throw e[e.length-1]?.verbose&&F.call(this),new Error(...e)}}function xt(){const e=this,{key:t,parent:n}=e,{__children:o}=n.__ref,r=o.indexOf(t),s=o[r+1];return n[s]}function yt(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 vt(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&&!b(o))try{const r=o.call(this,...t);return r&&typeof r.then=="function"&&r.catch(s=>{w.call(this,s)}),r}catch(r){if(w.call(this,r),n?.strictMode)throw r}}async function wt(){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||Q.useStateQuery||t.context?.useStateQuery;if(!n)return null;const o={};if(m(t,o),n===!0)return o;const r=z[n];return r?r(o):o}const m=(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&&m(l,t)}const s=n.contentElementKey||"content",i=e[s];i&&i.__ref&&m(i,t)},I=(e,t)=>{const o=t.replaceAll("../","").replaceAll("~/","").split("/");let r=e;for(let s=0;s<o.length;s++){const i=o[s];s===o.length-1?r[i]||(r[i]=!0):(r[i]===!0&&(r[i]={}),r[i]||(r[i]={}),r=r[i])}},O=(e,t=0)=>{const n=" ".repeat(t),o=Object.entries(e);return o.length?o.map(([s,i])=>i===!0?`${n}${s}`:`${n}${s} {
|
|
3
3
|
${O(i,t+1)}
|
|
4
4
|
${n}}`).join(`
|
|
5
5
|
`):""},L=e=>`{
|
|
6
6
|
${O(e,1)}
|
|
7
|
-
}`,
|
|
7
|
+
}`,M=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},J=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("&")},V=(e,t)=>{const n=[],o=[],r=new Set,s=(u,h,g)=>{r.add(h),g&&o.push(`LEFT JOIN ${h} ON ${h}.${g}_id = ${g}.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}`},
|
|
10
|
+
FROM ${c}${f}`},B=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},z={graphql:L,"json-api":M,odata:J,sql:V,paths:B};function Rt(e,t){return!!($.has(e)||t?.context?.methods?.[e])}export{St as call,_t as defineSetter,w as error,ot as get,it as getChildren,dt as getContext,wt as getDB,ct as getPath,Ot as getQuery,st as getRef,at as getRoot,pt as getRootContext,ht as getRootData,ut as getRootState,Rt as isMethod,D as keys,gt as log,tt as lookdown,et as lookdownAll,q as lookup,xt as nextElement,T as parse,S as parseDeep,yt as previousElement,ft as promoteActiveRootState,nt as remove,lt as setActiveRootState,N as setNodeStyles,rt as setProps,X as spotByPath,vt as variables,F as verbose,mt as warn};
|
package/dist/esm/object.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import{window as
|
|
2
|
-
`,"'"])?"`"+t.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")+"`":"'"+t.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\r/g,"\\r")+"'"},
|
|
3
|
-
`;for(const
|
|
4
|
-
`;for(const
|
|
5
|
-
`:g(
|
|
6
|
-
`:O(
|
|
7
|
-
`:r+=`${
|
|
8
|
-
`;r+=`${
|
|
9
|
-
`}return r+=`${
|
|
10
|
-
`,
|
|
11
|
-
`)){a++;break}a++}r.push([h,a]),
|
|
12
|
-
First 200 chars of source: `+String(e).slice(0,200)),e)}},
|
|
13
|
-
|
|
14
|
-
`)
|
|
15
|
-
${i}
|
|
16
|
-
|
|
17
|
-
`);t[s]
|
|
18
|
-
|
|
1
|
+
import{window as x}from"./globals.js";import{isFunction as P,isObjectLike as g,isObject as A,isArray as _,isString as O,is as X}from"./types.js";import{unstackArrayOfObjects as Q}from"./array.js";import{stringIncludesAny as j}from"./string.js";import{isDOMNode as w}from"./node.js";import{METHODS_EXL as ee}from"./keys.js";const z="production",S=e=>e.charCodeAt(0)===95&&e.charCodeAt(1)===95,L=(e,t,n,o)=>{if(P(e))return t?typeof e.call!="function"?e:e.call(t,t,n||t.state,o||t.context):void 0;if(e!=null&&t?.context?.plugins&&(_(e)||A(e)&&!w(e))){const r=t.context.plugins;for(const i of r)if(i.resolveHandler){const c=i.resolveHandler(e,t);if(typeof c=="function")return L(c,t,n,o)}}return e},ze=(e,t,n)=>{for(const o in t)e[o]=L(t[o],n)},Le=(e,t,n=[])=>{const o=n instanceof Set;for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(S(r)||(o?n.has(r):n.includes(r))||e[r]===void 0&&(e[r]=t[r]));return e},Ie=(e,t,n=ee)=>I(e,t,n,null),I=(e,t,n,o)=>{if(e===t)return e;if(o){for(let i=0;i<o.length;i+=2)if(o[i]===e&&o[i+1]===t)return e}const r=n instanceof Set;for(const i in t){if(!Object.prototype.hasOwnProperty.call(t,i)||S(i)||i==="constructor"||i==="prototype"||(r?n.has(i):n.includes(i)))continue;const c=e[i],l=t[i];if(g(c)&&g(l)){const s=o||[];s.push(e,t),I(c,l,n,s),s.length-=2}else c===void 0&&(e[i]=l)}return e},me=(e,t=[])=>{const n=t instanceof Set,o={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(S(r)||(n?t.has(r):t.includes(r))||(o[r]=e[r]));return o},Fe=(e,t={})=>{const{exclude:n=[],cleanUndefined:o=!1,cleanNull:r=!1,visited:i=new WeakMap,handleExtends:c=!1}=t;if(!g(e)||w(e))return e;if(i.has(e))return i.get(e);const l=n instanceof Set?n:n.length>3?new Set(n):null,s=u=>l?l.has(u):n.includes(u),p=_(e)?[]:{};i.set(e,p);const f=[[e,p]];for(;f.length;){const[u,h]=f.pop();for(const y in u){if(!Object.prototype.hasOwnProperty.call(u,y)||S(y)||y==="__proto__"||s(y))continue;const a=u[y];if(!(o&&a===void 0)&&!(r&&a===null)){if(w(a)){h[y]=a;continue}if(c&&y==="extends"&&_(a)){h[y]=Q(a,n);continue}if(P(a)){h[y]=a;continue}if(g(a))if(i.has(a))h[y]=i.get(a);else{const d=_(a)?[]:{};i.set(a,d),h[y]=d,f.push([a,d])}else h[y]=a}}}return p},m=(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 n in e){const o=e[n];if(P(o))t[n]=o.toString();else if(A(o))t[n]={},m(o,t[n]);else if(_(o)){const r=t[n]=[];for(let i=0;i<o.length;i++){const c=o[i];A(c)?(r[i]={},m(c,r[i])):P(c)?r[i]=c.toString():r[i]=c}}else t[n]=o}return t},te=/^[A-Za-z_$][A-Za-z0-9_$]*$/,ne=e=>`'${String(e).replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\r/g,"\\r").replace(/\n/g,"\\n")}'`,F=e=>{const t=String(e);return j(t,[`
|
|
2
|
+
`,"'"])?"`"+t.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")+"`":"'"+t.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\r/g,"\\r")+"'"},b=(e={},t=0)=>{if(e===null||typeof e!="object"||e instanceof RegExp)return String(e);let n=!1;for(const i in e){n=!0;break}if(!n)return"{}";const o=" ".repeat(t);let r=`{
|
|
3
|
+
`;for(const i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;const c=e[i],l=te.test(i)?i:ne(i);if(r+=`${o} ${l}: `,c instanceof RegExp)r+=String(c);else if(_(c)){r+=`[
|
|
4
|
+
`;for(const s of c)s instanceof RegExp?r+=`${o} ${String(s)},
|
|
5
|
+
`:g(s)&&s!==null?r+=`${o} ${b(s,t+2)},
|
|
6
|
+
`:O(s)?r+=`${o} ${F(s)},
|
|
7
|
+
`:r+=`${o} ${s},
|
|
8
|
+
`;r+=`${o} ]`}else g(c)?r+=b(c,t+1):O(c)?r+=F(c):r+=c;r+=`,
|
|
9
|
+
`}return r+=`${o}}`,r},re=[/^\(\s*\{[^}]*\}\s*\)\s*=>/,/^(\([^)]*\)|[^=]*)\s*=>/,/^function[\s(]/,/^async\s+/,/^\(\s*function/,/^[a-zA-Z_$][a-zA-Z0-9_$]*\s*=>/,/^(?:\*\s*)?[a-zA-Z_$][\w$]*\s*\((?:[^()]|\([^()]*\))*\)\s*\{[\s\S]*\}$/],oe=/^["[{]/,ie=/^(export|import)\s/,R=e=>{if(!e)return!1;const t=e.trim();if(t===""||t==="{}"||t==="[]")return!1;const n=t.includes("=>");if(!n&&t.charCodeAt(0)!==40&&!t.startsWith("function")&&!t.startsWith("async")&&!(t.charCodeAt(t.length-1)===125&&t.includes("("))||ie.test(t)||!re.some(i=>i.test(t)))return!1;const r=t.charCodeAt(0);return!(r===123&&!n||r===91||oe.test(t)&&!n)},M=e=>(0,eval)(e),ce=(e,t)=>{const n=/^(\s*(?:async\s+)?function\s*[\w$]*\s*\([^)]*\)\s*)\{/.exec(e);if(!n)return null;const o=n[0].length,r=[];let i=o,c=1,l=null;const s=e.length,p=new RegExp("^(?:const|let|var)\\s+"+t+"\\b");for(;i<s&&c>0;){const u=e[i];if(u==="/"&&e[i+1]==="/"){const h=e.indexOf(`
|
|
10
|
+
`,i);i=h===-1?s:h;continue}if(u==="/"&&e[i+1]==="*"){const h=e.indexOf("*/",i+2);i=h===-1?s:h+2;continue}if(u==='"'||u==="'"||u==="`"){const h=u;for(i++;i<s;){if(e[i]==="\\"){i+=2;continue}if(e[i]===h){i++;break}if(h==="`"&&e[i]==="$"&&e[i+1]==="{"){i+=2;let y=1;for(;i<s&&y>0;)e[i]==="{"?y++:e[i]==="}"&&y--,i++;continue}i++}continue}if(u==="{"){c++,i++;continue}if(u==="}"){c--,i++;continue}if(c===1&&p.test(e.slice(i))){const h=i;let y=0,a=i;for(;a<s;){const d=e[a];if(d==='"'||d==="'"||d==="`"){const k=d;for(a++;a<s;){if(e[a]==="\\"){a+=2;continue}if(e[a]===k){a++;break}a++}continue}if(d==="("||d==="["||d==="{"){y++,a++;continue}if(d===")"||d==="]"||d==="}"){if(y===0)break;y--,a++;continue}if(y===0&&(d===";"||d===`
|
|
11
|
+
`)){a++;break}a++}r.push([h,a]),i=a;continue}i++}if(!r.length)return null;let f=e;for(let u=r.length-1;u>=0;u--)f=f.slice(0,r[u][0])+f.slice(r[u][1]);return f},T=(e,t,n,o)=>{const r=String(e).trimStart();if(/^(export|import)\s/.test(r))return e;try{return n.window.eval(`(${e})`)}catch(i){const c=i&&i.message?i.message:String(i),l=/await is only valid in async/.test(c),s=/Identifier '([^']+)' has already been declared/.exec(c);let p=null;if(l){const f=String(e).trim();if(/^function[\s(]/.test(f))try{p=n.window.eval("(async "+f+")")}catch{}}else if(s){let f=String(e),u=s[1];for(let h=0;h<5;h++){const y=ce(f,u);if(!y||y===f)break;f=y;try{p=n.window.eval("("+f+")");break}catch(a){const d=/Identifier '([^']+)' has already been declared/.exec(a&&a.message||String(a));if(!d||d[1]!==u)break}}}if(!p&&/Unexpected (token '\{'|identifier)/.test(c))try{const f=n.window.eval("({"+e+"})");if(f&&typeof f=="object"){const u=Object.keys(f);u.length===1&&typeof f[u[0]]=="function"&&(p=f[u[0]])}}catch{}return p||(typeof console<"u"&&console.warn&&console.warn(`[smbls] deepDestringifyFunctions: eval failed on ${t} \u2014 `+(o?"revived lazily, so its source compiled on this first use; it acts as the string it replaces (a call returns the source text, el.call treats it as not callable). Reason: ":"value will be left as a string. Reason: ")+c+`.
|
|
12
|
+
First 200 chars of source: `+String(e).slice(0,200)),e)}},W=1,C=2,E=new WeakMap,se=/^(async\s+)?function(?![\w$])\s*(\*)?\s*([A-Za-z_$][\w$]*)?\s*\((?:[^()'"`/]|\([^()'"`/]*\))*\)\s*\{/,fe=/^(async\s+)?[A-Za-z_$][\w$]*\s*=>/,le=/^(async\s*)?\((?:[^()'"`/]|\([^()'"`/]*\))*\)\s*=>/,ue=/^(async\s+)?([A-Za-z_$][\w$]*)\s*\((?:[^()'"`/]|\([^()'"`/]*\))*\)\s*\{/,ae=new Set(["if","for","while","switch","catch","with","do","return","typeof","void","delete","new","in","of","instanceof","function","class","const","let","var","await","yield","import","export","try","else","throw","case","default","break","continue","debugger","finally","super","this","null","true","false","async","get","set","static"]),Y=e=>e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===36||e===95,pe=(e,t,n)=>{let o=e.indexOf(t,n);for(;o!==-1;){const r=o+t.length;if((o===0||!Y(e.charCodeAt(o-1)))&&(r>=e.length||!Y(e.charCodeAt(r))))return!0;o=e.indexOf(t,r)}return!1},v=e=>{let t=e.length-1;for(;t>=0&&e.charCodeAt(t)<=32;)t--;return t<0?-1:e.charCodeAt(t)},ye=e=>{let t=e,n=0;for(;n<t.length&&t.charCodeAt(n)<=32;)n++;n&&(t=t.slice(n));let o=se.exec(t);if(o){if(o[2]||v(t)!==125)return null;const r=o[3]||"";return r&&pe(t,r,o[0].indexOf("("))||t.indexOf("arguments.callee")!==-1?null:{src:e,name:r,kind:o[1]?C:W,async:!!o[1],fn:void 0}}return o=fe.exec(t)||le.exec(t),o?{src:e,name:"",kind:C,async:!!o[1],fn:void 0}:(o=ue.exec(t),o&&!ae.has(o[2])&&v(t)===125?t.indexOf("arguments.callee")!==-1?null:{src:e,name:o[2],kind:C,async:!!o[1],fn:void 0}:null)},Z=e=>e.index===-1?`"${e.key}"`:`array index ${e.index} (prop "${e.key}")`,N=e=>{const t=T(e.src,Z(e),e.opts,!0);let n=null;return typeof t=="function"?n=t:(e.value=t,typeof t!="string"&&typeof console<"u"&&console.warn&&console.warn(`[smbls] deepDestringifyFunctions: ${Z(e)} did not evaluate to a function \u2014 the lazily revived function returns that value.
|
|
13
|
+
First 200 chars of source: `+String(e.src).slice(0,200))),e.fn=n,e.opts=null,n},de=(e,t,n)=>Reflect.construct(e,t,n);function he(){const e=E.get(this);return e?e.src.trim():Function.prototype.toString.call(this)}const ge={length:{get(){const e=E.get(this);if(!e)return 0;const t=e.fn===void 0?N(e):e.fn;return t?t.length:0},configurable:!0},name:{get(){const e=E.get(this);return e?e.name:""},configurable:!0},toString:{value:he,writable:!0,configurable:!0}},_e=Object.getPrototypeOf(async function(){}),we=e=>{let t;return e.kind===W?t=function(){const n=e.fn===void 0?N(e):e.fn;return n===null?e.value:new.target?de(n,arguments,new.target):n.apply(this,arguments)}:t={lazy(){const n=e.fn===void 0?N(e):e.fn;return n===null?e.value:n.apply(this,arguments)}}.lazy,E.set(t,e),Object.defineProperties(t,ge),e.async&&Object.setPrototypeOf(t,_e),t},H=(e,t,n,o)=>{const r=ye(e);return r?(r.key=t,r.index=n,r.opts=o,we(r)):T(e,n===-1?`"${t}"`:`array index ${n} (prop "${t}")`,o)},be=e=>typeof e=="function"&&E.has(e),Me=e=>{const t=E.get(e);return t?t.src.trim():Function.prototype.toString.call(e)},We=e=>{const t=typeof e=="function"?E.get(e):void 0;return t?(t.fn===void 0?N(t):t.fn)===null:!1},Oe=new Set(["components","pages","functions","methods","snippets","app","globalScope"]),Se={window:{eval:M}},Ye=(e,t={},n=Se)=>{if(!e||typeof e!="object")return t;(!n||!n.window||typeof n.window.eval!="function")&&(n={...n,window:{eval:M}});const o=n.lazy===!0,r=n.lazy==="context",i=(l,s,p)=>o||r&&(l===e?Oe.has(s):p),c=[[e,t,o]];for(;c.length;){const[l,s,p]=c.pop();for(const f in l){if(!Object.prototype.hasOwnProperty.call(l,f))continue;const u=l[f];if(O(u))R(u)?s[f]=p?H(u,f,-1,n):T(u,`"${f}"`,n):s[f]=u;else if(_(u)){const h=s[f]=[],y=i(l,f,p);for(let a=0;a<u.length;a++){const d=u[a];if(O(d))h.push(R(d)?y?H(d,f,a,n):T(d,`array index ${a} (prop "${f}")`,n):d);else if(A(d)){const k=V(d);if(k)h.push(k);else{const D={};h.push(D),c.push([d,D,y])}}else h.push(d)}}else if(A(u)){const h=V(u);if(h){s[f]=h;continue}const y=s[f]&&typeof s[f]=="object"&&!_(s[f])?s[f]:s[f]={};c.push([u,y,i(l,f,p)])}else s[f]=u}}return t},G="Set",K="Map",B="RegExp",U="WeakMap",q="WeakSet",J=e=>{const t=Object.keys(e);return t.length===1&&t[0]==="__type"},$=(e,t)=>{if(!e||typeof e!="object")return e;const n=i=>$(i,t||(t=new WeakMap));if(e.__type===G&&_(e.values))return new Set(e.values.map(n));if(e.__type===K&&_(e.entries))return new Map(e.entries.map(i=>_(i)?[n(i[0]),n(i[1])]:i));if(e.__type===U&&J(e))return new WeakMap;if(e.__type===q&&J(e))return new WeakSet;if(e.__type===B&&O(e.source))try{return new RegExp(e.source,O(e.flags)?e.flags:"")}catch{return e}if(t||(t=new WeakMap),t.has(e))return t.get(e);let o=!1;if(_(e)){const i=new Array(e.length);t.set(e,i);for(let c=0;c<e.length;c++)i[c]=$(e[c],t),i[c]!==e[c]&&(o=!0);return o||t.set(e,e),o?i:e}const r={};t.set(e,r);for(const i of Object.keys(e))r[i]=$(e[i],t),r[i]!==e[i]&&(o=!0);return o||t.set(e,e),o?r:e},V=e=>{if(!e||typeof e!="object")return null;const t=e.__type;if(t!==B&&t!==G&&t!==K&&t!==U&&t!==q)return null;const n=$(e);return n===e?null:n},ve=e=>{if(!e||typeof e!="object")return e;const t={},n=[];for(const c of Object.keys(e)){const l=e[c];O(l)&&R(l)?n.push([c,l]):t[c]=$(l)}if(n.length===0)return t;const o=c=>/^[A-Za-z_$][\w$]*$/.test(c),r=n.filter(([c])=>o(c)),i=Object.keys(t).filter(o).map(c=>`var ${c} = __gs__[${JSON.stringify(c)}];`).join(`
|
|
14
|
+
`);try{const c=r.map(([p,f])=>`var ${p} = (${f});`).join(`
|
|
15
|
+
`),l="{ "+r.map(([p])=>`${JSON.stringify(p)}: ${p}`).join(", ")+" }",s=x.eval(`(function(__gs__) { ${i}
|
|
16
|
+
${c}
|
|
17
|
+
return ${l}; })`)(t);Object.assign(t,s)}catch{for(const[l,s]of r)try{const p=Object.keys(t).filter(o).map(f=>`var ${f} = __gs__[${JSON.stringify(f)}];`).join(`
|
|
18
|
+
`);t[l]=x.eval(`(function(__gs__) { ${p}
|
|
19
|
+
return (${s}); })`)(t)}catch{try{t[l]=x.eval(`(${s})`)}catch{t[l]=s}}}for(const[c,l]of n)if(!o(c))try{t[c]=x.eval(`(${l})`)}catch{t[c]=l}return t},Ze=(e,t={verbose:!0})=>{try{return e?x.eval("("+e+")"):{}}catch(n){t.verbose&&console.warn(n)}},He=(e,...t)=>Object.prototype.hasOwnProperty.call(e,...t),Ee=e=>{for(const t in e)return!1;return!0},Ge=e=>A(e)&&Ee(e),Ke=()=>Object.create(null),Be=(e,t,n={})=>{const o=n.exclude||[],r=n.preventUnderscore;for(const i in t)o.includes(i)||!r&&S(i)||i==="constructor"||i==="prototype"||t[i]!==void 0&&(e[i]=t[i]);return e},Ue=(e,t,n=[])=>{const o=n instanceof Set;for(const r in t)S(r)||r==="constructor"||r==="prototype"||(o?n.has(r):n.includes(r))||(e[r]=t[r]);return e},Ae=(e,t,n={},o=new WeakMap)=>{if(!g(e)||!g(t)||w(e)||w(t))return t;if(o.has(e))return o.get(e);o.set(e,e);const r=n.exclude,i=r?r instanceof Set?r:new Set(r):null,c=!n.preventForce;for(const l in t){if(!Object.prototype.hasOwnProperty.call(t,l)||i&&i.has(l)||c&&S(l)||l==="constructor"||l==="prototype")continue;const s=e[l],p=t[l];w(p)?e[l]=p:g(s)&&g(p)?e[l]=Ae(s,p,n,o):p!==void 0&&(e[l]=p)}return e},xe=(e,t,n=new Set)=>{if(typeof e!="object"||typeof t!="object"||e===null||t===null)return e===t;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);const o=Object.keys(e),r=Object.keys(t);if(o.length!==r.length)return!1;for(let i=0;i<o.length;i++){const c=o[i];if(!Object.prototype.hasOwnProperty.call(t,c)||!xe(e[c],t[c],n))return!1}return!0},$e=new Set(["node","__ref"]),qe=(e,t,n=$e)=>{if(e===t)return!0;if(!g(e)||!g(t)||w(e)||w(t))return e===t;const o=n instanceof Set?n:new Set(n),r=new WeakSet;function i(c,l){if(r.has(l))return!0;r.add(l);for(const s in l){if(!Object.prototype.hasOwnProperty.call(l,s)||o.has(s))continue;if(!Object.prototype.hasOwnProperty.call(c,s))return!1;const p=l[s],f=c[s];if(w(p)||w(f)){if(p!==f)return!1}else if(g(p)&&g(f)){if(!i(f,p))return!1}else if(p!==f)return!1}return!0}return i(e,t)},Je=(e,t)=>{if(t==null)return e;if(X(t)("string","number"))delete e[t];else if(_(t))for(let n=0;n<t.length;n++)delete e[t[n]];else throw new Error("Invalid input: props must be a string or an array of strings");return e},ke=e=>{if(e===null||typeof e!="object")return e;const t=Object.create(null);for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=ke(e[n]));return t},Ve=(e,t)=>{if(e.length===0)return t;const n={};let o=n;for(let r=0;r<e.length;r++)r===e.length-1&&t?o[e[r]]=t:(o[e[r]]={},o=o[e[r]]);return n},Xe=(e,t)=>{if(!Array.isArray(t))throw new Error("Path must be an array.");let n=e;for(let r=0;r<t.length-1;r++){if(n[t[r]]===void 0)return;n=n[t[r]]}const o=t[t.length-1];n&&Object.prototype.hasOwnProperty.call(n,o)&&delete n[o]},Qe=(e,t,n)=>{if(!Array.isArray(t))throw new Error("Path must be an array.");let o=e;for(let r=0;r<t.length-1;r++)(!o[t[r]]||typeof o[t[r]]!="object")&&(o[t[r]]={}),o=o[t[r]];return o[t[t.length-1]]=n,e},je=(e,t)=>{if(!Array.isArray(t))throw new Error("Path must be an array.");let n=e;for(let o=0;o<t.length;o++){if(n==null)return;n=n[t[o]]}return n},et=e=>{let n=[],o=0;for(let r=0;r<e.length;r++)if(n.length<2)n.push(e[r]);else if(e[r]===n[r%2]?o++:(n=[e[r-1],e[r]],o=1),o>=20)return(z==="test"||z==="development")&&console.warn("Warning: Potential infinite loop detected due to repeated sequence:",n),!0},tt=e=>{const t=new WeakSet;function n(o){if(o&&typeof o=="object"){if(t.has(o))return!0;t.add(o);for(const r in o)if(Object.prototype.hasOwnProperty.call(o,r)&&n(o[r]))return console.log(o,"cycle at "+r),!0}return!1}return n(e)},nt=(e,t)=>{const n=t instanceof Set?t:new Set(t),o={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&!n.has(r)&&(o[r]=e[r]);return o};export{me as clone,Ve as createNestedObject,ke as createObjectWithoutPrototype,Fe as deepClone,qe as deepContains,Ye as deepDestringifyFunctions,Ie as deepMerge,m as deepStringifyFunctions,ve as destringifyGlobalScope,et as detectInfiniteLoop,nt as excludeKeysFromObject,L as exec,Me as getFunctionSource,je as getInObjectByPath,R as hasFunction,He as hasOwnProperty,tt as isCyclic,Ee as isEmpty,Ge as isEmptyObject,xe as isEqualDeep,We as isFailedRevival,be as isLazyFunction,Ke as makeObjectWithoutPrototype,ze as map,Le as merge,b as objectToString,Be as overwrite,Ae as overwriteDeep,Ue as overwriteShallow,Je as removeFromObject,Xe as removeNestedKeyByPath,Qe as setInObjectByPath,Ze as stringToObject};
|