@symbo.ls/utils 3.14.10 → 3.14.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @symbo.ls/utils
2
2
 
3
+ ## 3.14.12
4
+
5
+ ### Patch Changes
6
+
7
+ - Auto-generated cross-repo patch release.
8
+
9
+ ## 3.14.11
10
+
11
+ ### Patch Changes
12
+
13
+ - Manual patch bump triggered via workflow_dispatch (scope: @symbo.ls).
14
+ No source change behind this bump — released to refresh dist or
15
+ coordinate a cross-package version line.
16
+ - Updated dependencies
17
+ - @symbo.ls/fetch@3.14.8
18
+
3
19
  ## 3.14.10
4
20
 
5
21
  ### Patch Changes
package/array.js ADDED
@@ -0,0 +1,162 @@
1
+ 'use strict'
2
+
3
+ import { deepClone, deepMerge } from './object.js'
4
+ import { isArray, isNumber, isString } from './types.js'
5
+
6
+ export const arrayContainsOtherArray = (arr1, arr2) => {
7
+ return arr2.every(val => arr1.includes(val))
8
+ }
9
+
10
+ export const getFrequencyInArray = (arr, value) => {
11
+ let count = 0
12
+ for (let i = 0; i < arr.length; i++) {
13
+ if (arr[i] === value) count++
14
+ }
15
+ return count
16
+ }
17
+
18
+ export const removeFromArray = (arr, index) => {
19
+ if (isString(index)) index = parseInt(index)
20
+ if (isNumber(index)) {
21
+ if (index < 0 || index >= arr.length || isNaN(index)) {
22
+ throw new Error('Invalid index')
23
+ }
24
+ arr.splice(index, 1)
25
+ } else {
26
+ throw new Error('Invalid index')
27
+ }
28
+ return arr
29
+ }
30
+
31
+ export const swapItemsInArray = (arr, i, j) => {
32
+ if (i < 0 || j < 0 || i >= arr.length || j >= arr.length) return
33
+ ;[arr[i], arr[j]] = [arr[j], arr[i]]
34
+ }
35
+
36
+ export const joinArrays = (...arrays) => {
37
+ return [].concat(...arrays)
38
+ }
39
+
40
+ /**
41
+ * Merges array extendtypes
42
+ */
43
+ export const unstackArrayOfObjects = (arr, exclude = []) => {
44
+ return arr.reduce(
45
+ (a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
46
+ {}
47
+ )
48
+ }
49
+
50
+ export const cutArrayBeforeValue = (arr, value) => {
51
+ const index = arr.indexOf(value)
52
+ if (index !== -1) {
53
+ return arr.slice(0, index)
54
+ }
55
+ return arr
56
+ }
57
+
58
+ export const cutArrayAfterValue = (arr, value) => {
59
+ if (!isArray(arr)) return
60
+ const index = arr.indexOf(value)
61
+ if (index !== -1) {
62
+ return arr.slice(index + 1)
63
+ }
64
+ return arr
65
+ }
66
+
67
+ export const removeValueFromArray = (arr, value) => {
68
+ const index = arr.indexOf(value)
69
+ if (index > -1) {
70
+ const newArray = [...arr]
71
+ newArray.splice(index, 1)
72
+ return newArray
73
+ }
74
+ return arr
75
+ }
76
+
77
+ export const removeValueFromArrayAll = (arr, value) => {
78
+ return arr.filter(item => item !== value)
79
+ }
80
+
81
+ export const addItemAfterEveryElement = (array, item) => {
82
+ // Create a new array to hold the result
83
+ const result = []
84
+
85
+ // Loop through the input array
86
+ for (let i = 0; i < array.length; i++) {
87
+ // Add the current element to the result array
88
+ result.push(array[i])
89
+
90
+ // If it's not the last element, add the item
91
+ if (i < array.length - 1) {
92
+ result.push(item)
93
+ }
94
+ }
95
+
96
+ return result
97
+ }
98
+
99
+ export const reorderArrayByValues = (array, valueToMove, insertBeforeValue) => {
100
+ const newArray = [...array] // Create a copy of the original array
101
+ const indexToMove = newArray.indexOf(valueToMove) // Find the index of the value to move
102
+ const indexToInsertBefore = newArray.indexOf(insertBeforeValue) // Find the index to insert before
103
+ if (indexToMove !== -1 && indexToInsertBefore !== -1) {
104
+ const removedItem = newArray.splice(indexToMove, 1)[0] // Remove the item to move
105
+ const insertIndex =
106
+ indexToInsertBefore < indexToMove
107
+ ? indexToInsertBefore
108
+ : indexToInsertBefore + 1 // Adjust insert index
109
+ newArray.splice(insertIndex, 0, removedItem) // Insert the removed item before the specified value
110
+ }
111
+ return newArray
112
+ }
113
+
114
+ export const arraysEqual = (arr1, arr2) => {
115
+ if (arr1.length !== arr2.length) {
116
+ return false
117
+ }
118
+
119
+ for (let i = 0; i < arr1.length; i++) {
120
+ if (arr1[i] !== arr2[i]) {
121
+ return false
122
+ }
123
+ }
124
+
125
+ return true
126
+ }
127
+
128
+ // Using filter and includes
129
+ export const filterArrays = (sourceArr, excludeArr) => {
130
+ return sourceArr.filter(item => !excludeArr.includes(item))
131
+ }
132
+
133
+ // Using Set for better performance with large arrays
134
+ export const filterArraysFast = (sourceArr, excludeArr) => {
135
+ const excludeSet = new Set(excludeArr)
136
+ return sourceArr.filter(item => !excludeSet.has(item))
137
+ }
138
+
139
+ export const checkIfStringIsInArray = (string, arr) => {
140
+ if (!string) return 0
141
+ let count = 0
142
+ for (let i = 0; i < arr.length; i++) {
143
+ if (string.includes(arr[i])) count++
144
+ }
145
+ return count
146
+ }
147
+
148
+ export const removeDuplicatesInArray = arr => {
149
+ if (!isArray(arr)) return arr
150
+ return [...new Set(arr)]
151
+ }
152
+
153
+ export const addProtoToArray = (state, proto) => {
154
+ for (const key in proto) {
155
+ Object.defineProperty(state, key, {
156
+ value: proto[key],
157
+ enumerable: false, // Set this to true if you want the method to appear in for...in loops
158
+ configurable: true, // Set this to true if you want to allow redefining/removing the property later
159
+ writable: true // Set this to true if you want to allow changing the function later
160
+ })
161
+ }
162
+ }
package/assets.js ADDED
@@ -0,0 +1,117 @@
1
+ 'use strict'
2
+
3
+ /**
4
+ * Asset resolution + variant emitters shared across media components
5
+ * (Img, Video, Audio, AssetPicture, …) and any plugin that reads from
6
+ * `context.assets` / `context.files`.
7
+ *
8
+ * Components don't care WHERE an asset lives — runner-discovered file,
9
+ * cloud-uploaded entry, or hand-authored URL — they call `resolveAsset`
10
+ * with the element and get back a normalized shape (or null).
11
+ */
12
+
13
+ /**
14
+ * Look up `el.src` in `el.context.assets`, falling back to
15
+ * `el.context.files`. Normalizes the two source-side shapes:
16
+ *
17
+ * - **String URL** — cloud-resolved or hand-authored bare URLs.
18
+ * Returns `{ src, type: null, variants: null }`. Components emit
19
+ * a single-source tag with no `<source>` chain and no `srcset`.
20
+ *
21
+ * - **Manifest object** — `{ src, type, category, variants[] }`.
22
+ * Shape produced by the runner's filename-based asset walker
23
+ * (and any cloud provider that exposes variant metadata). Returned
24
+ * verbatim.
25
+ *
26
+ * Anything else (object without `.src`, missing key, non-string `el.src`)
27
+ * returns null. Components fall through to plain markup using `el.src`.
28
+ */
29
+ export const resolveAsset = (el) => {
30
+ const key = el && el.src
31
+ if (!key || typeof key !== 'string') return null
32
+ const ctx = el.context
33
+ if (!ctx) return null
34
+ const found = (ctx.assets && ctx.assets[key]) || (ctx.files && ctx.files[key])
35
+ if (!found) return null
36
+ if (typeof found === 'string') {
37
+ return { src: found, type: null, variants: null }
38
+ }
39
+ if (typeof found === 'object' && typeof found.src === 'string') {
40
+ return found
41
+ }
42
+ return null
43
+ }
44
+
45
+ /**
46
+ * Render an `srcset` value from a list of variants.
47
+ *
48
+ * Width descriptors take precedence over scale when present. Bare 1x
49
+ * entries are kept or dropped based on context:
50
+ *
51
+ * - `<source srcset>` (`keepOneX: true`, default): bare 1x URLs are
52
+ * required because `<source>` has no `src` fallback — without a 1x
53
+ * entry the source can't match default-DPR clients.
54
+ * - `<img srcset>` (`keepOneX: false`): bare 1x URLs are redundant
55
+ * because the `src` attribute already covers them.
56
+ */
57
+ export const srcsetFor = (variants, { keepOneX = true } = {}) => {
58
+ if (!Array.isArray(variants) || !variants.length) return ''
59
+ const usingWidth = variants.some((v) => typeof v.width === 'number')
60
+ const parts = []
61
+ for (const v of variants) {
62
+ if (usingWidth && typeof v.width === 'number') {
63
+ parts.push(`${v.src} ${v.width}w`)
64
+ } else if (!usingWidth) {
65
+ if (v.scale === 1 && keepOneX) parts.push(v.src)
66
+ else if (v.scale && v.scale !== 1) parts.push(`${v.src} ${v.scale}x`)
67
+ }
68
+ }
69
+ return parts.join(', ')
70
+ }
71
+
72
+ /**
73
+ * Same-format srcset for an `<img>` tag — filtered to the asset's
74
+ * primary format and with `keepOneX: false`. Used by `<Img>`.
75
+ */
76
+ export const buildImgSrcset = (asset) => {
77
+ if (!asset || !Array.isArray(asset.variants)) return ''
78
+ const sameFormat = asset.variants.filter((v) => v.format === asset.type)
79
+ return srcsetFor(sameFormat, { keepOneX: false })
80
+ }
81
+
82
+ /**
83
+ * Build the children of an `<picture>` (or any format-negotiating tag)
84
+ * from an asset manifest: one `<source type="…" srcset="…">` per non-
85
+ * primary format, plus a trailing `<img>` for the primary format.
86
+ *
87
+ * Returns a list of DOMQL element configs. When the asset has no
88
+ * variants array (cloud-string URL or single-source entry), returns
89
+ * just the `<img>`.
90
+ */
91
+ export const buildSourcesAndImg = (asset, alt) => {
92
+ if (!asset || typeof asset !== 'object' || typeof asset.src !== 'string') return []
93
+ if (!Array.isArray(asset.variants) || !asset.variants.length) {
94
+ return [{ tag: 'img', attr: { src: asset.src, alt: alt || '' } }]
95
+ }
96
+ // Group by format. Format that matches `asset.type` is the fallback
97
+ // and gets emitted as the trailing `<img>` (browsers fall through to
98
+ // it when no `<source>` matches). Other formats become `<source>`.
99
+ const byFormat = new Map()
100
+ for (const v of asset.variants) {
101
+ if (!byFormat.has(v.format)) byFormat.set(v.format, [])
102
+ byFormat.get(v.format).push(v)
103
+ }
104
+ const sources = []
105
+ for (const [format, list] of byFormat) {
106
+ if (format === asset.type) continue
107
+ sources.push({
108
+ tag: 'source',
109
+ attr: { type: format, srcset: srcsetFor(list, { keepOneX: true }) }
110
+ })
111
+ }
112
+ const sameFormat = byFormat.get(asset.type) || []
113
+ const fallbackSrcset = srcsetFor(sameFormat, { keepOneX: false })
114
+ const imgAttr = { src: asset.src, alt: alt || '' }
115
+ if (fallbackSrcset) imgAttr.srcset = fallbackSrcset
116
+ return [...sources, { tag: 'img', attr: imgAttr }]
117
+ }
package/browser.js ADDED
@@ -0,0 +1,13 @@
1
+ 'use strict'
2
+
3
+ export async function toggleFullscreen (opts) {
4
+ if (!document.fullscreenElement) {
5
+ try {
6
+ await (this.node || document).requestFullscreen()
7
+ } catch (err) {
8
+ console.warn(`Error attempting to enable fullscreen mode: ${err.message} (${err.name})`)
9
+ }
10
+ } else {
11
+ await document.exitFullscreen()
12
+ }
13
+ }
package/cache.js ADDED
@@ -0,0 +1,7 @@
1
+ 'use strict'
2
+
3
+ export const cache = {}
4
+
5
+ // Shared mutable options populated by create.js (cacheOptions/resetOptions).
6
+ // Holds .create (initial create options) and .defaultOptions (per-render overrides).
7
+ export const OPTIONS = {}
package/cdn.js ADDED
@@ -0,0 +1,83 @@
1
+ 'use strict'
2
+
3
+ function onlyDotsAndNumbers (str) {
4
+ return /^[0-9.]+$/.test(str) && str !== ''
5
+ }
6
+
7
+ export const CDN_PROVIDERS = {
8
+ skypack: {
9
+ url: 'https://cdn.skypack.dev',
10
+ formatUrl: (pkg, version) =>
11
+ `${CDN_PROVIDERS.skypack.url}/${pkg}${version !== 'latest' ? `@${version}` : ''}`
12
+ },
13
+ esmsh: {
14
+ url: 'https://esm.sh',
15
+ formatUrl: (pkg, version) =>
16
+ `${CDN_PROVIDERS.esmsh.url}/${pkg}${version !== 'latest' ? `@${version}` : ''}`
17
+ },
18
+ unpkg: {
19
+ url: 'https://unpkg.com',
20
+ formatUrl: (pkg, version) =>
21
+ `${CDN_PROVIDERS.unpkg.url}/${pkg}${version !== 'latest' ? `@${version}` : ''}?module`
22
+ },
23
+ jsdelivr: {
24
+ url: 'https://cdn.jsdelivr.net/npm',
25
+ formatUrl: (pkg, version) =>
26
+ `${CDN_PROVIDERS.jsdelivr.url}/${pkg}${version !== 'latest' ? `@${version}` : ''}/+esm`
27
+ },
28
+ symbols: {
29
+ url: 'https://pkg.symbo.ls',
30
+ formatUrl: (pkg, version) => {
31
+ if (pkg.split('/').length > 2 || !onlyDotsAndNumbers(version)) {
32
+ return `${CDN_PROVIDERS.symbols.url}/${pkg}`
33
+ }
34
+ return `${CDN_PROVIDERS.symbols.url}/${pkg}/${version}.js`
35
+ }
36
+ }
37
+ }
38
+
39
+ // Maps symbols.json packageManager values to CDN_PROVIDERS keys
40
+ export const PACKAGE_MANAGER_TO_CDN = {
41
+ 'esm.sh': 'esmsh',
42
+ 'unpkg': 'unpkg',
43
+ 'skypack': 'skypack',
44
+ 'jsdelivr': 'jsdelivr',
45
+ 'pkg.symbo.ls': 'symbols'
46
+ }
47
+
48
+ /**
49
+ * Derive the CDN provider key from a symbols config object.
50
+ * Returns null when packageManager is a local tool (npm/yarn/pnpm/bun).
51
+ */
52
+ export const getCdnProviderFromConfig = (symbolsConfig = {}) => {
53
+ const { packageManager } = symbolsConfig
54
+ return PACKAGE_MANAGER_TO_CDN[packageManager] || null
55
+ }
56
+
57
+ export const getCDNUrl = (
58
+ packageName,
59
+ version = 'latest',
60
+ provider = 'esmsh'
61
+ ) => {
62
+ const cdnConfig = CDN_PROVIDERS[provider] || CDN_PROVIDERS.esmsh
63
+ return cdnConfig.formatUrl(packageName, version)
64
+ }
65
+
66
+ /**
67
+ * Generate an HTML <script type="importmap"> tag from project dependencies.
68
+ */
69
+ export const getImportMapScript = (data, defaultProvider = 'skypack') => {
70
+ const dependencies = data.dependencies || {}
71
+ const keys = Object.keys(dependencies)
72
+ if (!keys.length) return ''
73
+
74
+ const imports = {}
75
+ for (const pkgName of keys) {
76
+ const version = dependencies[pkgName] || 'latest'
77
+ imports[pkgName] = getCDNUrl(pkgName, version, defaultProvider)
78
+ }
79
+
80
+ return `<script type="importmap">{
81
+ "imports": ${JSON.stringify(imports, null, 2)}
82
+ }</script>`
83
+ }
package/component.js ADDED
@@ -0,0 +1,25 @@
1
+ 'use strict'
2
+
3
+ import { createExtendsFromKeys } from './extends.js'
4
+ import { isString } from './types.js'
5
+
6
+ export const matchesComponentNaming = key => {
7
+ if (!isString(key) || !key.length) return false
8
+ const code = key.charCodeAt(0)
9
+ return code >= 65 && code <= 90 // A-Z
10
+ }
11
+
12
+ export function getCapitalCaseKeys (obj) {
13
+ return Object.keys(obj).filter(key => /^[A-Z]/.test(key))
14
+ }
15
+
16
+ export function getSpreadChildren (obj) {
17
+ return Object.keys(obj).filter(key => /^\d+$/.test(key))
18
+ }
19
+
20
+ export function isContextComponent (element, parent, passedKey) {
21
+ const { context } = parent || {}
22
+ const [extendsKey] = createExtendsFromKeys(passedKey)
23
+ const key = passedKey || extendsKey
24
+ return context?.components?.[key] || context?.pages?.[key]
25
+ }
package/cookie.js ADDED
@@ -0,0 +1,78 @@
1
+ 'use strict'
2
+
3
+ import { isUndefined } from './types.js'
4
+ import { document } from './globals.js'
5
+
6
+ export const isMobile = (() =>
7
+ typeof navigator === 'undefined' ? false : /Mobi/.test(navigator.userAgent))()
8
+
9
+ export const setCookie = (cname, cvalue, exdays = 365) => {
10
+ if (isUndefined(document) || isUndefined(document.cookie)) return
11
+ const d = new Date()
12
+ d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000)
13
+ const expires = `expires=${d.toUTCString()}`
14
+ document.cookie = `${cname}=${cvalue};${expires};path=/`
15
+ }
16
+
17
+ export const getCookie = cname => {
18
+ if (isUndefined(document) || isUndefined(document.cookie)) return
19
+ const name = `${cname}=`
20
+ const decodedCookie = decodeURIComponent(document.cookie)
21
+ const ca = decodedCookie.split(';')
22
+ for (let i = 0; i < ca.length; i++) {
23
+ let c = ca[i]
24
+ while (c.charAt(0) === ' ') c = c.substring(1)
25
+ if (c.indexOf(name) === 0) return c.substring(name.length, c.length)
26
+ }
27
+ return ''
28
+ }
29
+
30
+ export const removeCookie = cname => {
31
+ if (isUndefined(document) || isUndefined(document.cookie)) return
32
+ document.cookie = cname + '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;'
33
+ }
34
+ /**
35
+ * Load item from the localStorage
36
+ *
37
+ * @param key -- string to identify the storage item
38
+ * @returns {*} -- parsed data or undefined
39
+ */
40
+ export function getLocalStorage (key) {
41
+ // localStorage access throws in: Safari private mode (quota), sandboxed
42
+ // iframes without `allow-storage-access-by-user-activation`, Firefox with
43
+ // `dom.storage.enabled=false`. Wrap the access itself, not just the
44
+ // JSON.parse — the existing try only covered parse and let the read
45
+ // crash the host.
46
+ let item
47
+ try {
48
+ if (!window.localStorage) return undefined
49
+ item = window.localStorage.getItem(key)
50
+ } catch (e) {
51
+ return undefined
52
+ }
53
+ if (item === null) return undefined
54
+ try {
55
+ return JSON.parse(item)
56
+ } catch (e) {
57
+ return undefined
58
+ }
59
+ }
60
+
61
+ /**
62
+ * Save the data to window.localStorage
63
+ *
64
+ * @param key - local storage key to save the data under
65
+ * @param data - the data to save
66
+ */
67
+ export function setLocalStorage (key, data) {
68
+ if (data === undefined || data === null) return
69
+ try {
70
+ if (!window.localStorage) return
71
+ const value = typeof data === 'object' ? JSON.stringify(data) : data
72
+ window.localStorage.setItem(key, value)
73
+ } catch (e) {
74
+ // QuotaExceededError (Safari private + over quota), SecurityError
75
+ // (sandboxed iframe / disabled storage). Silent fail — caller doesn't
76
+ // expect an exception out of a "save best-effort" helper.
77
+ }
78
+ }
package/date.js ADDED
@@ -0,0 +1,10 @@
1
+ 'use strict'
2
+
3
+ export const formatDate = (timestamp) => {
4
+ if (!timestamp) return ''
5
+ const d = new Date(timestamp)
6
+ const ye = new Intl.DateTimeFormat('en', { year: 'numeric' }).format(d)
7
+ const mo = new Intl.DateTimeFormat('en', { month: 'short' }).format(d)
8
+ const da = new Intl.DateTimeFormat('en', { day: '2-digit' }).format(d)
9
+ return `${da} ${mo}, ${ye}`
10
+ }
@@ -0,0 +1,42 @@
1
+ 'use strict'
2
+
3
+ export const detectHeightOnInit = (element, state) => {
4
+ const heightTimeout = setTimeout(() => {
5
+ const { props } = element
6
+ if (!state.clientHeight) {
7
+ const {
8
+ node: { clientHeight }
9
+ } = element
10
+ if (clientHeight) {
11
+ state.clientHeight = clientHeight
12
+ }
13
+ }
14
+
15
+ if (state.active) {
16
+ if (props.height === 'auto') return
17
+ element.update(
18
+ {
19
+ height: state.clientHeight
20
+ },
21
+ { preventBeforeUpdateListener: true, preventChildrenUpdate: true }
22
+ )
23
+ const setAutoTimeout = setTimeout(() => {
24
+ element.update(
25
+ {
26
+ height: 'auto'
27
+ },
28
+ { preventBeforeUpdateListener: true, preventChildrenUpdate: true }
29
+ )
30
+ clearTimeout(setAutoTimeout)
31
+ }, 450)
32
+ } else {
33
+ element.update(
34
+ {
35
+ height: '0'
36
+ },
37
+ { preventBeforeUpdateListener: true, preventChildrenUpdate: true }
38
+ )
39
+ }
40
+ clearTimeout(heightTimeout)
41
+ })
42
+ }
@@ -1,12 +1,12 @@
1
- "use strict";var g=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var L=(e,t)=>{for(var o in t)g(e,o,{get:t[o],enumerable:!0})},B=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of M(t))!F.call(e,n)&&n!==o&&g(e,n,{get:()=>t[n],enumerable:!(r=R(t,n))||r.enumerable});return e};var H=e=>B(g({},"__esModule",{value:!0}),e);var ae={};L(ae,{clone:()=>G,createNestedObject:()=>oe,createObjectWithoutPrototype:()=>I,deepClone:()=>D,deepContains:()=>ne,deepDestringifyFunctions:()=>x,deepMerge:()=>z,deepStringifyFunctions:()=>_,destringifyGlobalScope:()=>Q,detectInfiniteLoop:()=>fe,excludeKeysFromObject:()=>ue,exec:()=>S,getInObjectByPath:()=>ie,hasFunction:()=>d,hasOwnProperty:()=>Y,isCyclic:()=>le,isEmpty:()=>C,isEmptyObject:()=>m,isEqualDeep:()=>W,makeObjectWithoutPrototype:()=>b,map:()=>J,merge:()=>q,objectToString:()=>P,overwrite:()=>j,overwriteDeep:()=>T,overwriteShallow:()=>ee,removeFromObject:()=>re,removeNestedKeyByPath:()=>se,setInObjectByPath:()=>ce,stringToObject:()=>X});module.exports=H(ae);var O=require("./globals.js"),i=require("./types.js"),E=require("./array.js"),A=require("./string.js"),h=require("./node.js"),N=require("./keys.js");const v="production",w=e=>e.charCodeAt(0)===95&&e.charCodeAt(1)===95,S=(e,t,o,r)=>{if((0,i.isFunction)(e))return t?typeof e.call!="function"?e:e.call(t,t,o||t.state,r||t.context):void 0;if(e!=null&&t?.context?.plugins&&((0,i.isArray)(e)||(0,i.isObject)(e)&&!(0,h.isDOMNode)(e))){const n=t.context.plugins;for(const s of n)if(s.resolveHandler){const c=s.resolveHandler(e,t);if(typeof c=="function")return S(c,t,o,r)}}return e},J=(e,t,o)=>{for(const r in t)e[r]=S(t[r],o)},q=(e,t,o=[])=>{const r=o instanceof Set;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(w(n)||(r?o.has(n):o.includes(n))||e[n]===void 0&&(e[n]=t[n]));return e},z=(e,t,o=N.METHODS_EXL)=>$(e,t,o,null),$=(e,t,o,r)=>{if(e===t)return e;if(r){for(let s=0;s<r.length;s+=2)if(r[s]===e&&r[s+1]===t)return e}const n=o instanceof Set;for(const s in t){if(!Object.prototype.hasOwnProperty.call(t,s)||w(s)||s==="constructor"||s==="prototype"||(n?o.has(s):o.includes(s)))continue;const c=e[s],f=t[s];if((0,i.isObjectLike)(c)&&(0,i.isObjectLike)(f)){const u=r||[];u.push(e,t),$(c,f,o,u),u.length-=2}else c===void 0&&(e[s]=f)}return e},G=(e,t=[])=>{const o=t instanceof Set,r={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(w(n)||(o?t.has(n):t.includes(n))||(r[n]=e[n]));return r},D=(e,t={})=>{const{exclude:o=[],cleanUndefined:r=!1,cleanNull:n=!1,window:s,visited:c=new WeakMap,handleExtends:f=!1}=t,u=s||O.window||globalThis;if(!(0,i.isObjectLike)(e)||(0,h.isDOMNode)(e))return e;if(c.has(e))return c.get(e);const a=(0,i.isArray)(e)?[]:{};c.set(e,a);const k=o instanceof Set?o:o.length>3?new Set(o):null;for(const p in e){if(!Object.prototype.hasOwnProperty.call(e,p)||w(p)||p==="__proto__"||(k?k.has(p):o.includes(p)))continue;const y=e[p];if(!(r&&y===void 0)&&!(n&&y===null)){if((0,h.isDOMNode)(y)){a[p]=y;continue}if(f&&p==="extends"&&(0,i.isArray)(y)){a[p]=(0,E.unstackArrayOfObjects)(y,o);continue}if((0,i.isFunction)(y)){a[p]=y;continue}(0,i.isObjectLike)(y)?a[p]=D(y,{...t,visited:c}):a[p]=y}}return a},_=(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 o in e){const r=e[o];if((0,i.isFunction)(r))t[o]=r.toString();else if((0,i.isObject)(r))t[o]={},_(r,t[o]);else if((0,i.isArray)(r)){const n=t[o]=[];for(let s=0;s<r.length;s++){const c=r[s];(0,i.isObject)(c)?(n[s]={},_(c,n[s])):(0,i.isFunction)(c)?n[s]=c.toString():n[s]=c}}else t[o]=r}return t},K=new Set(["&","*","-",":","%","{","}",">","<","@",".","/","!"," "]),P=(e={},t=0)=>{if(e===null||typeof e!="object")return String(e);let o=!1;for(const s in e){o=!0;break}if(!o)return"{}";const r=" ".repeat(t);let n=`{
2
- `;for(const s in e){if(!Object.prototype.hasOwnProperty.call(e,s))continue;const c=e[s];let f=!1;for(let l=0;l<s.length;l++)if(K.has(s[l])){f=!0;break}const u=f?`'${s}'`:s;if(n+=`${r} ${u}: `,(0,i.isArray)(c)){n+=`[
1
+ "use strict";var g=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var L=(e,t)=>{for(var o in t)g(e,o,{get:t[o],enumerable:!0})},B=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of M(t))!F.call(e,n)&&n!==o&&g(e,n,{get:()=>t[n],enumerable:!(r=R(t,n))||r.enumerable});return e};var H=e=>B(g({},"__esModule",{value:!0}),e);var pe={};L(pe,{clone:()=>z,createNestedObject:()=>se,createObjectWithoutPrototype:()=>I,deepClone:()=>D,deepContains:()=>re,deepDestringifyFunctions:()=>x,deepMerge:()=>q,deepStringifyFunctions:()=>S,destringifyGlobalScope:()=>X,detectInfiniteLoop:()=>le,excludeKeysFromObject:()=>ae,exec:()=>_,getInObjectByPath:()=>fe,hasFunction:()=>d,hasOwnProperty:()=>m,isCyclic:()=>ue,isEmpty:()=>C,isEmptyObject:()=>b,isEqualDeep:()=>W,makeObjectWithoutPrototype:()=>j,map:()=>J,merge:()=>V,objectToString:()=>P,overwrite:()=>ee,overwriteDeep:()=>T,overwriteShallow:()=>te,removeFromObject:()=>oe,removeNestedKeyByPath:()=>ce,setInObjectByPath:()=>ie,stringToObject:()=>Y});module.exports=H(pe);var O=require("./globals.js"),i=require("./types.js"),E=require("./array.js"),v=require("./string.js"),h=require("./node.js"),N=require("./keys.js");const $="production",w=e=>e.charCodeAt(0)===95&&e.charCodeAt(1)===95,_=(e,t,o,r)=>{if((0,i.isFunction)(e))return t?typeof e.call!="function"?e:e.call(t,t,o||t.state,r||t.context):void 0;if(e!=null&&t?.context?.plugins&&((0,i.isArray)(e)||(0,i.isObject)(e)&&!(0,h.isDOMNode)(e))){const n=t.context.plugins;for(const s of n)if(s.resolveHandler){const c=s.resolveHandler(e,t);if(typeof c=="function")return _(c,t,o,r)}}return e},J=(e,t,o)=>{for(const r in t)e[r]=_(t[r],o)},V=(e,t,o=[])=>{const r=o instanceof Set;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(w(n)||(r?o.has(n):o.includes(n))||e[n]===void 0&&(e[n]=t[n]));return e},q=(e,t,o=N.METHODS_EXL)=>A(e,t,o,null),A=(e,t,o,r)=>{if(e===t)return e;if(r){for(let s=0;s<r.length;s+=2)if(r[s]===e&&r[s+1]===t)return e}const n=o instanceof Set;for(const s in t){if(!Object.prototype.hasOwnProperty.call(t,s)||w(s)||s==="constructor"||s==="prototype"||(n?o.has(s):o.includes(s)))continue;const c=e[s],f=t[s];if((0,i.isObjectLike)(c)&&(0,i.isObjectLike)(f)){const u=r||[];u.push(e,t),A(c,f,o,u),u.length-=2}else c===void 0&&(e[s]=f)}return e},z=(e,t=[])=>{const o=t instanceof Set,r={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(w(n)||(o?t.has(n):t.includes(n))||(r[n]=e[n]));return r},D=(e,t={})=>{const{exclude:o=[],cleanUndefined:r=!1,cleanNull:n=!1,window:s,visited:c=new WeakMap,handleExtends:f=!1}=t,u=s||O.window||globalThis;if(!(0,i.isObjectLike)(e)||(0,h.isDOMNode)(e))return e;if(c.has(e))return c.get(e);const a=(0,i.isArray)(e)?[]:{};c.set(e,a);const k=o instanceof Set?o:o.length>3?new Set(o):null;for(const p in e){if(!Object.prototype.hasOwnProperty.call(e,p)||w(p)||p==="__proto__"||(k?k.has(p):o.includes(p)))continue;const y=e[p];if(!(r&&y===void 0)&&!(n&&y===null)){if((0,h.isDOMNode)(y)){a[p]=y;continue}if(f&&p==="extends"&&(0,i.isArray)(y)){a[p]=(0,E.unstackArrayOfObjects)(y,o);continue}if((0,i.isFunction)(y)){a[p]=y;continue}(0,i.isObjectLike)(y)?a[p]=D(y,{...t,visited:c}):a[p]=y}}return a},S=(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 o in e){const r=e[o];if((0,i.isFunction)(r))t[o]=r.toString();else if((0,i.isObject)(r))t[o]={},S(r,t[o]);else if((0,i.isArray)(r)){const n=t[o]=[];for(let s=0;s<r.length;s++){const c=r[s];(0,i.isObject)(c)?(n[s]={},S(c,n[s])):(0,i.isFunction)(c)?n[s]=c.toString():n[s]=c}}else t[o]=r}return t},G=new Set(["&","*","-",":","%","{","}",">","<","@",".","/","!"," "]),P=(e={},t=0)=>{if(e===null||typeof e!="object")return String(e);let o=!1;for(const s in e){o=!0;break}if(!o)return"{}";const r=" ".repeat(t);let n=`{
2
+ `;for(const s in e){if(!Object.prototype.hasOwnProperty.call(e,s))continue;const c=e[s];let f=!1;for(let l=0;l<s.length;l++)if(G.has(s[l])){f=!0;break}const u=f?`'${s}'`:s;if(n+=`${r} ${u}: `,(0,i.isArray)(c)){n+=`[
3
3
  `;for(const l of c)(0,i.isObjectLike)(l)&&l!==null?n+=`${r} ${P(l,t+2)},
4
4
  `:(0,i.isString)(l)?n+=`${r} '${l}',
5
5
  `:n+=`${r} ${l},
6
- `;n+=`${r} ]`}else(0,i.isObjectLike)(c)?n+=P(c,t+1):(0,i.isString)(c)?n+=(0,A.stringIncludesAny)(c,[`
6
+ `;n+=`${r} ]`}else(0,i.isObjectLike)(c)?n+=P(c,t+1):(0,i.isString)(c)?n+=(0,v.stringIncludesAny)(c,[`
7
7
  `,"'"])?`\`${c}\``:`'${c}'`:n+=c;n+=`,
8
- `}return n+=`${r}}`,n},U=[/^\(\s*\{[^}]*\}\s*\)\s*=>/,/^(\([^)]*\)|[^=]*)\s*=>/,/^function[\s(]/,/^async\s+/,/^\(\s*function/,/^[a-zA-Z_$][a-zA-Z0-9_$]*\s*=>/],V=/^["[{]/,d=e=>{if(!e)return!1;const t=e.trim().replace(/\n\s*/g," ").trim();if(t===""||t==="{}"||t==="[]"||!U.some(s=>s.test(t)))return!1;const r=t.charCodeAt(0),n=t.includes("=>");return!(r===123&&!n||r===91||V.test(t)&&!n)},Z=e=>(0,eval)(e),x=(e,t={},o={window:{eval:Z}})=>{for(const r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;const n=e[r];if((0,i.isString)(n))if(d(n))try{t[r]=o.window.eval(`(${n})`)}catch(s){typeof console<"u"&&console.warn&&console.warn('[smbls] deepDestringifyFunctions: eval failed on "'+r+'" \u2014 function will be left as a string and el.call("'+r+'") will silently no-op. Reason: '+(s&&s.message?s.message:String(s))+`.
8
+ `}return n+=`${r}}`,n},K=[/^\(\s*\{[^}]*\}\s*\)\s*=>/,/^(\([^)]*\)|[^=]*)\s*=>/,/^function[\s(]/,/^async\s+/,/^\(\s*function/,/^[a-zA-Z_$][a-zA-Z0-9_$]*\s*=>/],U=/^["[{]/,d=e=>{if(!e)return!1;const t=e.trim().replace(/\n\s*/g," ").trim();if(t===""||t==="{}"||t==="[]"||!K.some(s=>s.test(t)))return!1;const r=t.charCodeAt(0),n=t.includes("=>");return!(r===123&&!n||r===91||U.test(t)&&!n)},Z=e=>(0,eval)(e),x=(e,t={},o={window:{eval:Z}})=>{for(const r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;const n=e[r];if((0,i.isString)(n))if(d(n))try{t[r]=o.window.eval(`(${n})`)}catch(s){typeof console<"u"&&console.warn&&console.warn('[smbls] deepDestringifyFunctions: eval failed on "'+r+'" \u2014 function will be left as a string and el.call("'+r+'") will silently no-op. Reason: '+(s&&s.message?s.message:String(s))+`.
9
9
  First 200 chars of source: `+String(n).slice(0,200)),t[r]=n}else t[r]=n;else if((0,i.isArray)(n)){const s=t[r]=[];for(let c=0;c<n.length;c++){const f=n[c];if((0,i.isString)(f))if(d(f))try{s.push(o.window.eval(`(${f})`))}catch(u){typeof console<"u"&&console.warn&&console.warn(`[smbls] deepDestringifyFunctions: eval failed in array at index ${c} (prop "${r}"). Reason: ${u&&u.message?u.message:String(u)}.
10
- First 200 chars: ${String(f).slice(0,200)}`),s.push(f)}else s.push(f);else(0,i.isObject)(f)?s.push(x(f)):s.push(f)}}else(0,i.isObject)(n)?t[r]=x(n,t[r]):t[r]=n}return t},Q=e=>{if(!e||typeof e!="object")return e;const t={},o=[];for(const r of Object.keys(e)){const n=e[r];(0,i.isString)(n)&&d(n)?o.push([r,n]):t[r]=n}for(const[r,n]of o)try{const s=Object.keys(t).map(c=>`var ${c} = __gs__[${JSON.stringify(c)}];`).join(`
10
+ First 200 chars: ${String(f).slice(0,200)}`),s.push(f)}else s.push(f);else(0,i.isObject)(f)?s.push(x(f)):s.push(f)}}else(0,i.isObject)(n)?t[r]=x(n,t[r]):t[r]=n}return t},Q=e=>!e||typeof e!="object"?e:e.__type==="Set"&&Array.isArray(e.values)?new Set(e.values):e.__type==="Map"&&Array.isArray(e.entries)?new Map(e.entries):e,X=e=>{if(!e||typeof e!="object")return e;const t={},o=[];for(const r of Object.keys(e)){const n=e[r];(0,i.isString)(n)&&d(n)?o.push([r,n]):t[r]=Q(n)}for(const[r,n]of o)try{const s=Object.keys(t).map(c=>`var ${c} = __gs__[${JSON.stringify(c)}];`).join(`
11
11
  `);t[r]=O.window.eval(`(function(__gs__) { ${s}
12
- return (${n}); })`)(t)}catch{try{t[r]=O.window.eval(`(${n})`)}catch{t[r]=n}}return t},X=(e,t={verbose:!0})=>{try{return e?O.window.eval("("+e+")"):{}}catch(o){t.verbose&&console.warn(o)}},Y=(e,...t)=>Object.prototype.hasOwnProperty.call(e,...t),C=e=>{for(const t in e)return!1;return!0},m=e=>(0,i.isObject)(e)&&C(e),b=()=>Object.create(null),j=(e,t,o={})=>{const r=o.exclude||[],n=o.preventUnderscore;for(const s in t)r.includes(s)||!n&&w(s)||s==="constructor"||s==="prototype"||t[s]!==void 0&&(e[s]=t[s]);return e},ee=(e,t,o=[])=>{const r=o instanceof Set;for(const n in t)w(n)||n==="constructor"||n==="prototype"||(r?o.has(n):o.includes(n))||(e[n]=t[n]);return e},T=(e,t,o={},r=new WeakMap)=>{if(!(0,i.isObjectLike)(e)||!(0,i.isObjectLike)(t)||(0,h.isDOMNode)(e)||(0,h.isDOMNode)(t))return t;if(r.has(e))return r.get(e);r.set(e,e);const n=o.exclude,s=n?n instanceof Set?n:new Set(n):null,c=!o.preventForce;for(const f in t){if(!Object.prototype.hasOwnProperty.call(t,f)||s&&s.has(f)||c&&w(f)||f==="constructor"||f==="prototype")continue;const u=e[f],l=t[f];(0,h.isDOMNode)(l)?e[f]=l:(0,i.isObjectLike)(u)&&(0,i.isObjectLike)(l)?e[f]=T(u,l,o,r):l!==void 0&&(e[f]=l)}return e},W=(e,t,o=new Set)=>{if(typeof e!="object"||typeof t!="object"||e===null||t===null)return e===t;if(o.has(e)||o.has(t))return!0;o.add(e),o.add(t);const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let s=0;s<r.length;s++){const c=r[s];if(!Object.prototype.hasOwnProperty.call(t,c)||!W(e[c],t[c],o))return!1}return!0},te=new Set(["node","__ref"]),ne=(e,t,o=te)=>{if(e===t)return!0;if(!(0,i.isObjectLike)(e)||!(0,i.isObjectLike)(t)||(0,h.isDOMNode)(e)||(0,h.isDOMNode)(t))return e===t;const r=o instanceof Set?o:new Set(o),n=new WeakSet;function s(c,f){if(n.has(f))return!0;n.add(f);for(const u in f){if(!Object.prototype.hasOwnProperty.call(f,u)||r.has(u))continue;if(!Object.prototype.hasOwnProperty.call(c,u))return!1;const l=f[u],a=c[u];if((0,h.isDOMNode)(l)||(0,h.isDOMNode)(a)){if(l!==a)return!1}else if((0,i.isObjectLike)(l)&&(0,i.isObjectLike)(a)){if(!s(a,l))return!1}else if(l!==a)return!1}return!0}return s(e,t)},re=(e,t)=>{if(t==null)return e;if((0,i.is)(t)("string","number"))delete e[t];else if((0,i.isArray)(t))for(let o=0;o<t.length;o++)delete e[t[o]];else throw new Error("Invalid input: props must be a string or an array of strings");return e},I=e=>{if(e===null||typeof e!="object")return e;const t=Object.create(null);for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=I(e[o]));return t},oe=(e,t)=>{if(e.length===0)return t;const o={};let r=o;for(let n=0;n<e.length;n++)n===e.length-1&&t?r[e[n]]=t:(r[e[n]]={},r=r[e[n]]);return o},se=(e,t)=>{if(!Array.isArray(t))throw new Error("Path must be an array.");let o=e;for(let n=0;n<t.length-1;n++){if(o[t[n]]===void 0)return;o=o[t[n]]}const r=t[t.length-1];o&&Object.prototype.hasOwnProperty.call(o,r)&&delete o[r]},ce=(e,t,o)=>{if(!Array.isArray(t))throw new Error("Path must be an array.");let r=e;for(let n=0;n<t.length-1;n++)(!r[t[n]]||typeof r[t[n]]!="object")&&(r[t[n]]={}),r=r[t[n]];return r[t[t.length-1]]=o,e},ie=(e,t)=>{if(!Array.isArray(t))throw new Error("Path must be an array.");let o=e;for(let r=0;r<t.length;r++){if(o==null)return;o=o[t[r]]}return o},fe=e=>{let o=[],r=0;for(let n=0;n<e.length;n++)if(o.length<2)o.push(e[n]);else if(e[n]===o[n%2]?r++:(o=[e[n-1],e[n]],r=1),r>=20)return(v==="test"||v==="development")&&console.warn("Warning: Potential infinite loop detected due to repeated sequence:",o),!0},le=e=>{const t=new WeakSet;function o(r){if(r&&typeof r=="object"){if(t.has(r))return!0;t.add(r);for(const n in r)if(Object.prototype.hasOwnProperty.call(r,n)&&o(r[n]))return console.log(r,"cycle at "+n),!0}return!1}return o(e)},ue=(e,t)=>{const o=t instanceof Set?t:new Set(t),r={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&!o.has(n)&&(r[n]=e[n]);return r};
12
+ return (${n}); })`)(t)}catch{try{t[r]=O.window.eval(`(${n})`)}catch{t[r]=n}}return t},Y=(e,t={verbose:!0})=>{try{return e?O.window.eval("("+e+")"):{}}catch(o){t.verbose&&console.warn(o)}},m=(e,...t)=>Object.prototype.hasOwnProperty.call(e,...t),C=e=>{for(const t in e)return!1;return!0},b=e=>(0,i.isObject)(e)&&C(e),j=()=>Object.create(null),ee=(e,t,o={})=>{const r=o.exclude||[],n=o.preventUnderscore;for(const s in t)r.includes(s)||!n&&w(s)||s==="constructor"||s==="prototype"||t[s]!==void 0&&(e[s]=t[s]);return e},te=(e,t,o=[])=>{const r=o instanceof Set;for(const n in t)w(n)||n==="constructor"||n==="prototype"||(r?o.has(n):o.includes(n))||(e[n]=t[n]);return e},T=(e,t,o={},r=new WeakMap)=>{if(!(0,i.isObjectLike)(e)||!(0,i.isObjectLike)(t)||(0,h.isDOMNode)(e)||(0,h.isDOMNode)(t))return t;if(r.has(e))return r.get(e);r.set(e,e);const n=o.exclude,s=n?n instanceof Set?n:new Set(n):null,c=!o.preventForce;for(const f in t){if(!Object.prototype.hasOwnProperty.call(t,f)||s&&s.has(f)||c&&w(f)||f==="constructor"||f==="prototype")continue;const u=e[f],l=t[f];(0,h.isDOMNode)(l)?e[f]=l:(0,i.isObjectLike)(u)&&(0,i.isObjectLike)(l)?e[f]=T(u,l,o,r):l!==void 0&&(e[f]=l)}return e},W=(e,t,o=new Set)=>{if(typeof e!="object"||typeof t!="object"||e===null||t===null)return e===t;if(o.has(e)||o.has(t))return!0;o.add(e),o.add(t);const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let s=0;s<r.length;s++){const c=r[s];if(!Object.prototype.hasOwnProperty.call(t,c)||!W(e[c],t[c],o))return!1}return!0},ne=new Set(["node","__ref"]),re=(e,t,o=ne)=>{if(e===t)return!0;if(!(0,i.isObjectLike)(e)||!(0,i.isObjectLike)(t)||(0,h.isDOMNode)(e)||(0,h.isDOMNode)(t))return e===t;const r=o instanceof Set?o:new Set(o),n=new WeakSet;function s(c,f){if(n.has(f))return!0;n.add(f);for(const u in f){if(!Object.prototype.hasOwnProperty.call(f,u)||r.has(u))continue;if(!Object.prototype.hasOwnProperty.call(c,u))return!1;const l=f[u],a=c[u];if((0,h.isDOMNode)(l)||(0,h.isDOMNode)(a)){if(l!==a)return!1}else if((0,i.isObjectLike)(l)&&(0,i.isObjectLike)(a)){if(!s(a,l))return!1}else if(l!==a)return!1}return!0}return s(e,t)},oe=(e,t)=>{if(t==null)return e;if((0,i.is)(t)("string","number"))delete e[t];else if((0,i.isArray)(t))for(let o=0;o<t.length;o++)delete e[t[o]];else throw new Error("Invalid input: props must be a string or an array of strings");return e},I=e=>{if(e===null||typeof e!="object")return e;const t=Object.create(null);for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=I(e[o]));return t},se=(e,t)=>{if(e.length===0)return t;const o={};let r=o;for(let n=0;n<e.length;n++)n===e.length-1&&t?r[e[n]]=t:(r[e[n]]={},r=r[e[n]]);return o},ce=(e,t)=>{if(!Array.isArray(t))throw new Error("Path must be an array.");let o=e;for(let n=0;n<t.length-1;n++){if(o[t[n]]===void 0)return;o=o[t[n]]}const r=t[t.length-1];o&&Object.prototype.hasOwnProperty.call(o,r)&&delete o[r]},ie=(e,t,o)=>{if(!Array.isArray(t))throw new Error("Path must be an array.");let r=e;for(let n=0;n<t.length-1;n++)(!r[t[n]]||typeof r[t[n]]!="object")&&(r[t[n]]={}),r=r[t[n]];return r[t[t.length-1]]=o,e},fe=(e,t)=>{if(!Array.isArray(t))throw new Error("Path must be an array.");let o=e;for(let r=0;r<t.length;r++){if(o==null)return;o=o[t[r]]}return o},le=e=>{let o=[],r=0;for(let n=0;n<e.length;n++)if(o.length<2)o.push(e[n]);else if(e[n]===o[n%2]?r++:(o=[e[n-1],e[n]],r=1),r>=20)return($==="test"||$==="development")&&console.warn("Warning: Potential infinite loop detected due to repeated sequence:",o),!0},ue=e=>{const t=new WeakSet;function o(r){if(r&&typeof r=="object"){if(t.has(r))return!0;t.add(r);for(const n in r)if(Object.prototype.hasOwnProperty.call(r,n)&&o(r[n]))return console.log(r,"cycle at "+n),!0}return!1}return o(e)},ae=(e,t)=>{const o=t instanceof Set?t:new Set(t),r={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&!o.has(n)&&(r[n]=e[n]);return r};