object-flatten-referencing 7.2.1 → 7.2.3
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
|
@@ -3,13 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 7.2.3 (2026-09-01)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- align object predicate contracts ([2268d1b](https://github.com/codsen/codsen/commit/2268d1b75188c2ec9c13b14ace4360f6836fd1bd))
|
|
11
|
+
|
|
12
|
+
## 7.2.2 (2026-08-22)
|
|
13
|
+
|
|
14
|
+
### Performance Improvements
|
|
15
|
+
|
|
16
|
+
- optimise package hot paths and JSON editing ([f3112bd](https://github.com/codsen/codsen/commit/f3112bd7fc0d7c9bc09312d3744c950691d72ca5))
|
|
17
|
+
|
|
6
18
|
## 7.2.0 (2026-08-19)
|
|
7
19
|
|
|
8
20
|
### Bug Fixes
|
|
9
21
|
|
|
10
22
|
- handle missing values in flatten helpers ([67fbc75](https://github.com/codsen/codsen/commit/67fbc75a4ae02ea36e11c95494416c0523e8ace9))
|
|
11
23
|
- make validation diagnostics safe ([7b01074](https://github.com/codsen/codsen/commit/7b0107476f12734aeb8e82852ba980b187280110))
|
|
12
|
-
- resolve review findings
|
|
24
|
+
- resolve various review findings ([b60e9ee](https://github.com/codsen/codsen/commit/b60e9eeb499af94685cfb87b4970fe025be1fc10))
|
|
13
25
|
- retire direct publish aliases ([f98e31e](https://github.com/codsen/codsen/commit/f98e31eb89bc185471225664e610b55f34fbf648))
|
|
14
26
|
|
|
15
27
|
### Features
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name object-flatten-referencing
|
|
3
3
|
* @fileoverview Flatten complex nested objects according to a reference objects
|
|
4
|
-
* @version 7.2.
|
|
4
|
+
* @version 7.2.3
|
|
5
5
|
* @author Roy Revelt
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/object-flatten-referencing/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import{arrayiffy as
|
|
10
|
+
import{arrayiffy as O}from"arrayiffy-if-string";import{deepClone as D,existy as v,formatDiagnosticValue as $,isPlainObject as b,isStr as m,match as A}from"codsen-utils";import{strIndexesOfPlus as R}from"str-indexes-of-plus";var T="7.2.3";import{deepClone as S,isPlainObject as x,isStr as j}from"codsen-utils";var W={wrapHeadsWith:"%%_",wrapTailsWith:"_%%",dontWrapKeys:[],dontWrapPaths:[],xhtml:!0,preventDoubleWrapping:!0,preventWrappingIfContains:[],objectKeyAndValueJoinChar:".",wrapGlobalFlipSwitch:!0,ignore:[],whatToDoWhenReferenceIsMissing:0,mergeArraysWithLineBreaks:!0,mergeWithoutTrailingBrIfLineContainsBr:!0,enforceStrictKeyset:!0};function w(p,d){let c={...W,...d};if(!p||Object.keys(p).length===0)return[];let i=S(p),r=[];return x(i)&&Object.keys(i).forEach(a=>{x(i[a])&&(i[a]=w(i[a],c)),Array.isArray(i[a])&&(r=r.concat(i[a].map(h=>`${a}${c.objectKeyAndValueJoinChar}${h}`))),j(i[a])&&r.push(`${a}${c.objectKeyAndValueJoinChar}${i[a]}`)}),r}function y(p,d,c=!1,i=!1){let r={...W,...d};if(!p||p.length===0)return"";let a=S(p),h="";if(a.length)if(i){for(let e=0,s=a.length;e<s;e++)if(j(a[e])){let l;l="",r.mergeArraysWithLineBreaks&&e>0&&(!r.mergeWithoutTrailingBrIfLineContainsBr||typeof a[e-1]!="string"||r.mergeWithoutTrailingBrIfLineContainsBr&&a[e-1]!==void 0&&!a[e-1].toLowerCase().includes("<br"))&&(l=`<br${r.xhtml?" /":""}>`),h+=`${l}${c?r.wrapHeadsWith:""}${a[e]}${c?r.wrapTailsWith:""}`}else if(Array.isArray(a[e])&&a[e].length&&a[e].every(j)){let l="";r.mergeArraysWithLineBreaks&&h.length&&(l=`<br${r.xhtml?" /":""}>`),h=a[e].reduce((u,t,o,n)=>{let f="";return o!==n.length-1&&(f=" "),u+(o===0?l:"")+(c?r.wrapHeadsWith:"")+t+(c?r.wrapTailsWith:"")+f},h)}}else h=a.reduce((e,s,l,u)=>{let t="";r.mergeArraysWithLineBreaks&&l>0&&(t=`<br${r.xhtml?" /":""}>`);let o="";return l!==u.length-1&&(o=" "),`${e}${l===0?t:""}${c?r.wrapHeadsWith:""}${s}${c?r.wrapTailsWith:""}${o}`},h);return h}var N=T;function V(p,d,c){if(!b(p))throw new Error(`object-flatten-referencing/flattenReferencing(): [THROW_ID_01] the first input argument must be a plain object! It was given as ${$(p,4)} (its typeof was ${typeof p}).`);if(!b(d))throw new Error(`object-flatten-referencing/flattenReferencing(): [THROW_ID_02] the second input argument must be a plain object! It was given as ${$(d,4)} (its typeof was ${typeof d}).`);if(c&&!b(c))throw new Error(`object-flatten-referencing/flattenReferencing(): [THROW_ID_03] the third input argument must be a plain object! It was given as ${$(c,4)} (its typeof was ${typeof c}).`);let i={...W,...c};i.dontWrapKeys=O(i.dontWrapKeys),i.preventWrappingIfContains=O(i.preventWrappingIfContains),i.dontWrapPaths=O(i.dontWrapPaths),i.ignore=O(i.ignore),typeof i.whatToDoWhenReferenceIsMissing!="number"&&(i.whatToDoWhenReferenceIsMissing=+i.whatToDoWhenReferenceIsMissing||0);function r(a,h,e,s=!0,l=!0,u=""){let t=a,o=h;return e.wrapGlobalFlipSwitch||(s=!1),b(t)?Object.keys(t).forEach(n=>{let f=u+(u.length===0?n:`.${n}`);if(e.ignore.length===0||!e.ignore.includes(n)){if(e.wrapGlobalFlipSwitch&&(s=!0,e.dontWrapKeys.length&&(s=s&&!e.dontWrapKeys.some(g=>A(n,g,{caseSensitiveMatch:!0}))),e.dontWrapPaths.length&&(s=s&&!e.dontWrapPaths.some(g=>g===f)),e.preventWrappingIfContains.length&&typeof t[n]=="string"&&(s=s&&!e.preventWrappingIfContains.some(g=>t[n].includes(g)))),v(o[n])||!v(o[n])&&e.whatToDoWhenReferenceIsMissing===2)if(Array.isArray(t[n]))if(e.whatToDoWhenReferenceIsMissing===2||m(o[n]))t[n]=y(t[n],e,s,l);else{if(t[n].every(g=>typeof g=="string"||Array.isArray(g))){let g=!0;t[n].forEach(I=>{Array.isArray(I)&&!I.every(m)&&(g=!1)}),g&&(l=!1)}t[n]=r(t[n],o[n],e,s,l,f)}else b(t[n])?e.whatToDoWhenReferenceIsMissing===2||m(o[n])?t[n]=y(w(t[n],e),e,s,l):s?t[n]=r(t[n],o[n],e,s,l,f):t[n]=r(t[n],o[n],{...e,wrapGlobalFlipSwitch:!1},s,l,f):m(t[n])&&(t[n]=r(t[n],o[n],e,s,l,f));else if(typeof t[n]!=typeof o[n]&&e.whatToDoWhenReferenceIsMissing===1)throw new Error(`object-flatten-referencing/flattenReferencing(): [THROW_ID_04] resolvedReference object does not have the key ${n} and we need it. TIP: Turn off throwing via opts2.whatToDoWhenReferenceIsMissing.`)}}):Array.isArray(t)?Array.isArray(o)?t.forEach((n,f)=>{v(t[f])&&v(o[f])?t[f]=r(t[f],o[f],e,s,l,`${u}[${f}]`):t[f]=r(t[f],o[0],e,s,l,`${u}[${f}]`)}):m(o)&&(t=y(t,e,s,l)):m(t)&&t.length&&(e.wrapHeadsWith||e.wrapTailsWith)&&(!e.preventDoubleWrapping||(e.wrapHeadsWith===""||!R(t,e.wrapHeadsWith.trim()).length)&&(e.wrapTailsWith===""||!R(t,e.wrapTailsWith.trim()).length))&&(t=`${s?e.wrapHeadsWith:""}${t}${s?e.wrapTailsWith:""}`),t}return r(D(p),d,i)}export{O as arrayiffy,W as defaults,y as flattenArr,w as flattenObject,V as flattenReferencing,N as version};
|
|
@@ -1,25 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name object-flatten-referencing
|
|
3
3
|
* @fileoverview Flatten complex nested objects according to a reference objects
|
|
4
|
-
* @version 7.2.
|
|
4
|
+
* @version 7.2.3
|
|
5
5
|
* @author Roy Revelt
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/object-flatten-referencing/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
"use strict";var objectFlattenReferencing=(()=>{var T=Object.defineProperty,re=Object.defineProperties,ne=Object.getOwnPropertyDescriptor,ie=Object.getOwnPropertyDescriptors,se=Object.getOwnPropertyNames,k=Object.getOwnPropertySymbols;var K=Object.prototype.hasOwnProperty,le=Object.prototype.propertyIsEnumerable;var E=(e,r,t)=>r in e?T(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,W=(e,r)=>{for(var t in r||(r={}))K.call(r,t)&&E(e,t,r[t]);if(k)for(var t of k(r))le.call(r,t)&&E(e,t,r[t]);return e},V=(e,r)=>re(e,ie(r));var ae=(e,r)=>{for(var t in r)T(e,t,{get:r[t],enumerable:!0})},oe=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of se(r))!K.call(e,s)&&s!==t&&T(e,s,{get:()=>r[s],enumerable:!(n=ne(r,s))||n.enumerable});return e};var ue=e=>oe(T({},"__esModule",{value:!0}),e);var $=(e,r,t)=>E(e,typeof r!="symbol"?r+"":r,t);var Ie={};ae(Ie,{arrayiffy:()=>C,defaults:()=>j,flattenArr:()=>D,flattenObject:()=>L,flattenReferencing:()=>Se,version:()=>$e});function C(e){return typeof e!="string"?e:e.length?[e]:[]}function fe(){let e=[],r=0,t=!1;return{append(n){return t?!1:r+n.length>1999?(e.push("\u2026"),r+=1,t=!0,!1):(e.push(n),r+=n.length,!0)},result(){return e.join("")},stopped(){return t}}}function ce(e){return"\\u".concat(e.toString(16).padStart(4,"0"))}function P(e,r){if(e.append('"')){for(let t=0;t<r.length&&!e.stopped();t+=1){let n=r.charCodeAt(t);n===34?e.append('\\"'):n===92?e.append("\\\\"):n===8?e.append("\\b"):n===9?e.append("\\t"):n===10?e.append("\\n"):n===12?e.append("\\f"):n===13?e.append("\\r"):n<32||n===8232||n===8233||n>=55296&&n<=57343?e.append(ce(n)):e.append(r[t])}e.append('"')}}function pe(e){return e.get&&e.set?"[Getter/Setter]":e.get?"[Getter]":e.set?"[Setter]":"[Accessor]"}function U(e,r){e.append("Symbol(");let t=String(r);t.length>8&&P(e,t.slice(7,-1)),e.append(")")}function J(e,r){typeof r=="symbol"?U(e,r):P(e,String(r))}function B(e,r=0){let t=fe(),n=r===4?4:0,s=new WeakSet,i=0;function a(o){n&&t.append(" ".repeat(o*n))}function l(o,g){o&&t.append(","),n&&(t.append("\n"),a(g+1))}function u(o,g,m){n&&g&&(t.append("\n"),a(m)),t.append(o)}function f(o,g){Object.prototype.hasOwnProperty.call(o,"value")?p(o.value,g):t.append(pe(o))}function d(o,g){let m;try{m=Reflect.getOwnPropertyDescriptor(o,"length")}catch(b){t.append("[Uninspectable]");return}let y=m==null?void 0:m.value;if(!Number.isSafeInteger(y)||y<0){t.append("[Uninspectable]");return}t.append("[");let v=!1;for(let b=0;b<y&&!t.stopped();b+=1){if(l(v,g),v=!0,i>=50){t.append("[MaxEntries]");break}i+=1;let O;try{O=Reflect.getOwnPropertyDescriptor(o,String(b))}catch(je){t.append("[Uninspectable]");continue}O!=null&&O.enumerable?f(O,g+1):t.append("[Empty]")}u("]",v,g)}function c(o,g){let m;try{m=Reflect.ownKeys(o)}catch(v){t.append("[Uninspectable]");return}t.append("{");let y=!1;for(let v of m){if(t.stopped())break;if(i>=50){l(y,g),y=!0,P(t,"\u2026"),t.append(n?": ":":"),t.append("[MaxEntries]");break}i+=1;let b;try{b=Reflect.getOwnPropertyDescriptor(o,v)}catch(O){l(y,g),y=!0,J(t,v),t.append(n?": ":":"),t.append("[Uninspectable]");continue}b!=null&&b.enumerable&&(l(y,g),y=!0,J(t,v),t.append(n?": ":":"),f(b,g+1))}u("}",y,g)}function h(o,g){if(s.has(o)){t.append("[Circular]");return}if(g>=5){t.append("[MaxDepth]");return}let m;try{m=Array.isArray(o)}catch(y){t.append("[Uninspectable]");return}s.add(o);try{m?d(o,g):c(o,g)}finally{s.delete(o)}}function p(o,g){o===null?t.append("null"):typeof o=="string"?P(t,o):typeof o=="number"?t.append(Object.is(o,-0)?"-0":String(o)):typeof o=="boolean"?t.append(o?"true":"false"):typeof o>"u"?t.append("undefined"):typeof o=="bigint"?t.append("".concat(o,"n")):typeof o=="symbol"?U(t,o):typeof o=="function"?t.append("[Function]"):h(o,g)}try{return p(e,0),t.result()}catch(o){return"[Uninspectable]"}}var Re=new Set([..."\u060B$\u20BC\u17DB\xA5\u20A1\u20B1\xA3\u20AC\xA2\u20B9\uFDFC\u20AA\u20A9\u20AD\u20A8\u20AE\u20A6\u20BD\u20AB\u0E3F\u20A9\u20BA\u20B4","$U","$b","B/.","BZ$","Br","Bs","C$","CHF","Ft","Gs","J$","KM","K\u010D","L","MT","NT$","P","Q","R","R$","RD$","RM","Rp","S","S/.","TT$","Z$","kn","kr","lei","z\u0142","\u0192","\u0414\u0438\u043D.","\u0434\u0435\u043D","\u043B\u0432","\u062F.\u0625","Lek"]);var he=class{constructor(){$(this,"hasRepeatedReferences",!1);$(this,"clones",[]);$(this,"index");$(this,"sources",[])}get(e){if(this.index){let t=this.index.get(e);return t!==void 0&&(this.hasRepeatedReferences=!0),t}let r=this.sources.indexOf(e);if(r!==-1)return this.hasRepeatedReferences=!0,this.clones[r]}set(e,r){if(this.index){this.index.set(e,r);return}if(this.sources.push(e),this.clones.push(r),this.sources.length===32){this.index=new WeakMap;for(let t=0;t<this.sources.length;t++)this.index.set(this.sources[t],this.clones[t]);this.sources=[],this.clones=[]}}};function Q(e,r){let t=r.get(e);if(t!==void 0)return t;let n=e.slice(0);return r.set(e,n),n}function ge(e,r){if(typeof Buffer<"u"&&Buffer.isBuffer(e)){let i=Buffer.from(e);return r.set(e,i),i}let t=Q(e.buffer,r);if(e instanceof DataView){let i=new DataView(t,e.byteOffset,e.byteLength);return r.set(e,i),i}let n=e.constructor,s=new n(t,e.byteOffset,e.length);return r.set(e,s),s}function _(e,r,t,n){for(let s of t){let i=r[s];e[s]=typeof i!="object"||i===null?i:x(i,n)}}function x(e,r){if(typeof e!="object"||e===null)return e;let t=r.get(e);if(t!==void 0)return t;if(Array.isArray(e)){let i=e.length,a=new Array(i);r.set(e,a);let l=e,u=Object.keys(e);if(u.length===i&&(i===0||u[i-1]==="".concat(i-1)))for(let f=0;f<i;f++){let d=l[f];a[f]=typeof d!="object"||d===null?d:x(d,r)}else _(a,l,u,r);return a}let n=Object.getPrototypeOf(e);if(n===Object.prototype||n===null){let i={};return r.set(e,i),_(i,e,Object.keys(e),r),i}if(e instanceof Date){let i=new Date(e.getTime());return r.set(e,i),i}if(ArrayBuffer.isView(e))return ge(e,r);if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return Q(e,r);if(e instanceof Map){let i=new Map;r.set(e,i);for(let[a,l]of e)i.set(x(a,r),x(l,r));return i}if(e instanceof Set){let i=new Set;r.set(e,i);for(let a of e)i.add(x(a,r));return i}let s={};return r.set(e,s),_(s,e,Object.keys(e),r),s}function S(e){return x(e,new he)}function A(e){if(e==null||typeof e!="object")return!1;let r=Object.getPrototypeOf(e);return r!==null&&r!==Object.prototype&&Object.getPrototypeOf(r)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function w(e){return typeof e=="string"}function I(e){return e!=null}var de=256,me=1024,be=1,ye=new Map,ve=new Map;function H(e){if(e>=97&&e<=122)return e-32;if(e>65535)return e;let r=String.fromCharCode(e).toUpperCase();if(r.length!==1)return e;let t=r.charCodeAt(0);return e>127&&t<128?e:t}function F(e,r,t,n,s,i){for(let a=0;a<s;a++){let l=e.charCodeAt(r+a),u=t.charCodeAt(n+a);if(i||(l>=97&&l<=122&&(l-=32),u>=97&&u<=122&&(u-=32)),l!==u)return!1}return!0}function z(e,r,t){let n=r.indexOf("\\");if(n===-1&&e===r)return!0;let s=r.indexOf("*");if(n===-1&&s===-1){if(t)return!1;for(let d=0;d<r.length;d++)if(r.charCodeAt(d)>127)return;return e.length===r.length&&F(e,0,r,0,r.length,!1)}if(n!==-1)return;let i=0,a=!1,l=-1;for(let d=0;d<r.length;d++){let c=r.charCodeAt(d);if(c>127)return;if(c===42){if(l=d,!a){if(i++,i>1)return;a=!0}}else a=!1}let u=l+1,f=r.length-u;return e.length<s+f?!1:F(e,0,r,0,s,t)&&F(e,e.length-f,r,u,f,t)}function we(e){let r=new Uint32Array(e.length),t=0;for(let n=1;n<e.length;n++){for(;t>0&&e[n]!==e[t];)t=r[t-1];e[n]===e[t]&&t++,r[n]=t}return r}function We(e,r){let t=[[]],n=!0,s=!1,i=!1,a=0;for(let h=0;h<e.length;){let p=e.codePointAt(h);if(p!==92){if(p===42)s=!0,i||(t.push([]),i=!0);else{let b=r?p:H(p);t[t.length-1].push(b),n&&(n=b<=127),a++,i=!1}h+=p>65535?2:1;continue}let o=h+1;for(;e.charCodeAt(o)===92;)o++;let g=o-h,m=e.codePointAt(o),y,v=!1;m===42?(v=g%2===0,y=v?g/2:(g-1)/2):m===void 0||m===10||m===13||m===8232||m===8233?y=Math.ceil(g/2):y=Math.floor(g/2);for(let b=0;b<y;b++)t[t.length-1].push(92),a++;if(v){i=!1,h=o;continue}if(m!==void 0){let b=r?m:H(m);t[t.length-1].push(b),n&&(n=b<=127),a++,o+=m>65535?2:1}i=!1,h=o}let l=s&&t[0].length===0,u=s&&t[t.length-1].length===0,f=[];for(let h of t)h.length&&f.push({values:h});let d=l?0:1,c=f.length-(u?0:1);for(let h=d;h<c;h++)f[h].values.length>be&&(f[h].failure=we(f[h].values));return{asciiOnly:n,endsWithWildcard:u,hasWildcard:s,minimumInputLength:a,segments:f,startsWithWildcard:l}}function Z(e,r){let t=r?ye:ve,n=e.length<=me;if(n){let i=t.get(e);if(i)return i}let s=We(e,r);if(n){if(t.size>=de){let i=t.keys().next().value;i!==void 0&&t.delete(i)}t.set(e,s)}return s}function q(e,r){if(r){let s=[];for(let i=0;i<e.length;){let a=e.codePointAt(i);s.push(a),i+=a>65535?2:1}return s}let t=new Uint32Array(e.length),n=0;for(let s=0;s<e.length;){let i=e.codePointAt(s);t[n]=H(i),n++,s+=i>65535?2:1}return n===t.length?t:t.subarray(0,n)}function R(e,r,t,n){for(let s=0;s<t.values.length;s++){let i=e.charCodeAt(r+s);if(!n&&i>=97&&i<=122&&(i-=32),i!==t.values[s])return!1}return!0}function Ae(e,r,t,n,s){let i=n-r.values.length;if(i<t)return-1;if(!r.failure){for(let l=t;l<=i;l++)if(R(e,l,r,s))return l;return-1}let a=0;for(let l=t;l<n;l++){let u=e.charCodeAt(l);for(!s&&u>=97&&u<=122&&(u-=32);a>0&&u!==r.values[a];)a=r.failure[a-1];if(u===r.values[a]&&(a++,a===r.values.length))return l-a+1}return-1}function Y(e,r,t){if(e.length<r.minimumInputLength)return!1;if(!r.hasWildcard)return e.length===r.minimumInputLength&&R(e,0,r.segments[0],t);let n=0,s=r.segments.length,i=0,a=e.length;if(!r.startsWithWildcard){let l=r.segments[0];if(!R(e,0,l,t))return!1;i=l.values.length,n++}if(!r.endsWithWildcard){s--;let l=r.segments[s];if(a-=l.values.length,!R(e,a,l,t))return!1}for(let l=n;l<s;l++){let u=r.segments[l],f=Ae(e,u,i,a,t);if(f===-1)return!1;i=f+u.values.length}return!0}function M(e,r,t){for(let n=0;n<t.values.length;n++)if(e[r+n]!==t.values[n])return!1;return!0}function Oe(e,r,t,n){let s=n-r.values.length;if(s<t)return-1;if(!r.failure){for(let a=t;a<=s;a++)if(M(e,a,r))return a;return-1}let i=0;for(let a=t;a<n;a++){for(;i>0&&e[a]!==r.values[i];)i=r.failure[i-1];if(e[a]===r.values[i]&&(i++,i===r.values.length))return a-i+1}return-1}function X(e,r){if(e.length<r.minimumInputLength)return!1;if(!r.hasWildcard)return e.length===r.minimumInputLength&&M(e,0,r.segments[0]);let t=0,n=r.segments.length,s=0,i=e.length;if(!r.startsWithWildcard){let a=r.segments[0];if(!M(e,0,a))return!1;s=a.values.length,t++}if(!r.endsWithWildcard){n--;let a=r.segments[n];if(i-=a.values.length,!M(e,i,a))return!1}for(let a=t;a<n;a++){let l=r.segments[a],u=Oe(e,l,s,i);if(u===-1)return!1;s=u+l.values.length}return!0}function Ce(e,r,t){let n=z(e,r,t);if(n!==void 0)return n;let s=Z(r,t);return s.asciiOnly?Y(e,s,t):X(q(e,t),s)}function G(e,r,t,n){var a;let s=z(e,r,t);if(s!==void 0)return s;let i=Z(r,t);return i.asciiOnly?Y(e,i,t):((a=n.tokens)!=null||(n.tokens=q(e,t)),X(n.tokens,i))}function ee(e,r,t){if(typeof r!="string"&&!r.length)return!1;let n=t===void 0?!1:t.caseSensitiveMatch===!0;if(typeof r=="string"){let l=r.charCodeAt(0)===33,u=l?r.slice(1):r,f=Ce(e,u,n);return l?!f:f}let s={},i=!1,a=!1;for(let l of r){let u=l.charCodeAt(0)===33,f=u?l.slice(1):l;if(u){if(G(e,f,n,s))return!1}else i=!0,!a&&G(e,f,n,s)&&(a=!0)}return i?a:!0}function N(e,r,t=0){if(typeof e!="string")throw new TypeError("str-indexes-of-plus/strIndexesOfPlus(): [THROW_ID_01] first input argument must be a string! Currently it's: ".concat(typeof e));if(typeof r!="string")throw new TypeError("str-indexes-of-plus/strIndexesOfPlus(): [THROW_ID_02] second input argument must be a string! Currently it's: ".concat(typeof r));let n=Number(t);if(!Number.isInteger(n)||n<0||typeof t=="string"&&!/^\d+$/.test(t))throw new TypeError("str-indexes-of-plus/strIndexesOfPlus(): [THROW_ID_03] third input argument must be a natural number! Currently it's: ".concat(t));let s=Array.from(e),i=Array.from(r);if(!s.length||!i.length||n>=s.length)return[];let a=[],l=s.length-i.length;e:for(let u=n;u<=l;u++){for(let f=0;f<i.length;f++)if(s[u+f]!==i[f])continue e;a.push(u)}return a}var te="7.2.1";var j={wrapHeadsWith:"%%_",wrapTailsWith:"_%%",dontWrapKeys:[],dontWrapPaths:[],xhtml:!0,preventDoubleWrapping:!0,preventWrappingIfContains:[],objectKeyAndValueJoinChar:".",wrapGlobalFlipSwitch:!0,ignore:[],whatToDoWhenReferenceIsMissing:0,mergeArraysWithLineBreaks:!0,mergeWithoutTrailingBrIfLineContainsBr:!0,enforceStrictKeyset:!0};function L(e,r){let t=W(W({},j),r);if(!e||Object.keys(e).length===0)return[];let n=S(e),s=[];return A(n)&&Object.keys(n).forEach(i=>{A(n[i])&&(n[i]=L(n[i],t)),Array.isArray(n[i])&&(s=s.concat(n[i].map(a=>"".concat(i).concat(t.objectKeyAndValueJoinChar).concat(a)))),w(n[i])&&s.push("".concat(i).concat(t.objectKeyAndValueJoinChar).concat(n[i]))}),s}function D(e,r,t=!1,n=!1){let s=W(W({},j),r);if(!e||e.length===0)return"";let i=S(e),a="";if(i.length)if(n){for(let l=0,u=i.length;l<u;l++)if(w(i[l])){let f;f="",s.mergeArraysWithLineBreaks&&l>0&&(!s.mergeWithoutTrailingBrIfLineContainsBr||typeof i[l-1]!="string"||s.mergeWithoutTrailingBrIfLineContainsBr&&i[l-1]!==void 0&&!i[l-1].toLowerCase().includes("<br"))&&(f="<br".concat(s.xhtml?" /":"",">")),a+="".concat(f).concat(t?s.wrapHeadsWith:"").concat(i[l]).concat(t?s.wrapTailsWith:"")}else if(Array.isArray(i[l])&&i[l].length&&i[l].every(w)){let f="";s.mergeArraysWithLineBreaks&&a.length&&(f="<br".concat(s.xhtml?" /":"",">")),a=i[l].reduce((d,c,h,p)=>{let o="";return h!==p.length-1&&(o=" "),d+(h===0?f:"")+(t?s.wrapHeadsWith:"")+c+(t?s.wrapTailsWith:"")+o},a)}}else a=i.reduce((l,u,f,d)=>{let c="";s.mergeArraysWithLineBreaks&&f>0&&(c="<br".concat(s.xhtml?" /":"",">"));let h="";return f!==d.length-1&&(h=" "),"".concat(l).concat(f===0?c:"").concat(t?s.wrapHeadsWith:"").concat(u).concat(t?s.wrapTailsWith:"").concat(h)},a);return a}var $e=te;function Se(e,r,t){if(!A(e))throw new Error("object-flatten-referencing/flattenReferencing(): [THROW_ID_01] the first input argument must be a plain object! It was given as ".concat(B(e,4)," (its typeof was ").concat(typeof e,")."));if(!A(r))throw new Error("object-flatten-referencing/flattenReferencing(): [THROW_ID_02] the second input argument must be a plain object! It was given as ".concat(B(r,4)," (its typeof was ").concat(typeof r,")."));if(t&&!A(t))throw new Error("object-flatten-referencing/flattenReferencing(): [THROW_ID_03] the third input argument must be a plain object! It was given as ".concat(B(t,4)," (its typeof was ").concat(typeof t,")."));let n=W(W({},j),t);n.dontWrapKeys=C(n.dontWrapKeys),n.preventWrappingIfContains=C(n.preventWrappingIfContains),n.dontWrapPaths=C(n.dontWrapPaths),n.ignore=C(n.ignore),typeof n.whatToDoWhenReferenceIsMissing!="number"&&(n.whatToDoWhenReferenceIsMissing=+n.whatToDoWhenReferenceIsMissing||0);function s(i,a,l,u=!0,f=!0,d=""){let c=i,h=a;return l.wrapGlobalFlipSwitch||(u=!1),A(c)?Object.keys(c).forEach(p=>{let o=d+(d.length===0?p:".".concat(p));if(l.ignore.length===0||!l.ignore.includes(p)){if(l.wrapGlobalFlipSwitch&&(u=!0,l.dontWrapKeys.length&&(u=u&&!l.dontWrapKeys.some(g=>ee(p,g,{caseSensitiveMatch:!0}))),l.dontWrapPaths.length&&(u=u&&!l.dontWrapPaths.some(g=>g===o)),l.preventWrappingIfContains.length&&typeof c[p]=="string"&&(u=u&&!l.preventWrappingIfContains.some(g=>c[p].includes(g)))),I(h[p])||!I(h[p])&&l.whatToDoWhenReferenceIsMissing===2)if(Array.isArray(c[p]))if(l.whatToDoWhenReferenceIsMissing===2||w(h[p]))c[p]=D(c[p],l,u,f);else{if(c[p].every(g=>typeof g=="string"||Array.isArray(g))){let g=!0;c[p].forEach(m=>{Array.isArray(m)&&!m.every(w)&&(g=!1)}),g&&(f=!1)}c[p]=s(c[p],h[p],l,u,f,o)}else A(c[p])?l.whatToDoWhenReferenceIsMissing===2||w(h[p])?c[p]=D(L(c[p],l),l,u,f):u?c[p]=s(c[p],h[p],l,u,f,o):c[p]=s(c[p],h[p],V(W({},l),{wrapGlobalFlipSwitch:!1}),u,f,o):w(c[p])&&(c[p]=s(c[p],h[p],l,u,f,o));else if(typeof c[p]!=typeof h[p]&&l.whatToDoWhenReferenceIsMissing===1)throw new Error("object-flatten-referencing/flattenReferencing(): [THROW_ID_04] resolvedReference object does not have the key ".concat(p," and we need it. TIP: Turn off throwing via opts2.whatToDoWhenReferenceIsMissing."))}}):Array.isArray(c)?Array.isArray(h)?c.forEach((p,o)=>{I(c[o])&&I(h[o])?c[o]=s(c[o],h[o],l,u,f,"".concat(d,"[").concat(o,"]")):c[o]=s(c[o],h[0],l,u,f,"".concat(d,"[").concat(o,"]"))}):w(h)&&(c=D(c,l,u,f)):w(c)&&c.length&&(l.wrapHeadsWith||l.wrapTailsWith)&&(!l.preventDoubleWrapping||(l.wrapHeadsWith===""||!N(c,l.wrapHeadsWith.trim()).length)&&(l.wrapTailsWith===""||!N(c,l.wrapTailsWith.trim()).length))&&(c="".concat(u?l.wrapHeadsWith:"").concat(c).concat(u?l.wrapTailsWith:"")),c}return s(S(e),r,n)}return ue(Ie);})();
|
|
10
|
+
"use strict";var objectFlattenReferencing=(()=>{var T=Object.defineProperty,he=Object.defineProperties,ge=Object.getOwnPropertyDescriptor,de=Object.getOwnPropertyDescriptors,be=Object.getOwnPropertyNames,J=Object.getOwnPropertySymbols;var q=Object.prototype.hasOwnProperty,ye=Object.prototype.propertyIsEnumerable;var B=(e,t,_)=>t in e?T(e,t,{enumerable:!0,configurable:!0,writable:!0,value:_}):e[t]=_,O=(e,t)=>{for(var _ in t||(t={}))q.call(t,_)&&B(e,_,t[_]);if(J)for(var _ of J(t))ye.call(t,_)&&B(e,_,t[_]);return e},U=(e,t)=>he(e,de(t));var me=(e,t)=>{for(var _ in t)T(e,_,{get:t[_],enumerable:!0})},ve=(e,t,_,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of be(t))!q.call(e,i)&&i!==_&&T(e,i,{get:()=>t[i],enumerable:!(r=ge(t,i))||r.enumerable});return e};var Oe=e=>ve(T({},"__esModule",{value:!0}),e);var C=(e,t,_)=>B(e,typeof t!="symbol"?t+"":t,_);var et={};me(et,{arrayiffy:()=>W,defaults:()=>D,flattenArr:()=>R,flattenObject:()=>L,flattenReferencing:()=>Xe,version:()=>Ye});function W(e){return typeof e!="string"?e:e.length?[e]:[]}function we(){let e=[],t=0,_=!1;return{append(r){return _?!1:t+r.length>1999?(e.push("\u2026"),t+=1,_=!0,!1):(e.push(r),t+=r.length,!0)},result(){return e.join("")},stopped(){return _}}}function je(e){return"\\u".concat(e.toString(16).padStart(4,"0"))}function P(e,t){if(e.append('"')){for(let _=0;_<t.length&&!e.stopped();_+=1){let r=t.charCodeAt(_);r===34?e.append('\\"'):r===92?e.append("\\\\"):r===8?e.append("\\b"):r===9?e.append("\\t"):r===10?e.append("\\n"):r===12?e.append("\\f"):r===13?e.append("\\r"):r<32||r===8232||r===8233||r>=55296&&r<=57343?e.append(je(r)):e.append(t[_])}e.append('"')}}function Ae(e){return e.get&&e.set?"[Getter/Setter]":e.get?"[Getter]":e.set?"[Setter]":"[Accessor]"}function Q(e,t){e.append("Symbol(");let _=String(t);_.length>8&&P(e,_.slice(7,-1)),e.append(")")}function G(e,t){typeof t=="symbol"?Q(e,t):P(e,String(t))}function S(e,t=0){let _=we(),r=t===4?4:0,i=new WeakSet,n=0;function a(o){r&&_.append(" ".repeat(o*r))}function s(o,h){o&&_.append(","),r&&(_.append("\n"),a(h+1))}function l(o,h,d){r&&h&&(_.append("\n"),a(d)),_.append(o)}function u(o,h){Object.prototype.hasOwnProperty.call(o,"value")?c(o.value,h):_.append(Ae(o))}function g(o,h){let d;try{d=Reflect.getOwnPropertyDescriptor(o,"length")}catch(b){_.append("[Uninspectable]");return}let y=d==null?void 0:d.value;if(!Number.isSafeInteger(y)||y<0){_.append("[Uninspectable]");return}_.append("[");let m=!1;for(let b=0;b<y&&!_.stopped();b+=1){if(s(m,h),m=!0,n>=50){_.append("[MaxEntries]");break}n+=1;let A;try{A=Reflect.getOwnPropertyDescriptor(o,String(b))}catch(tt){_.append("[Uninspectable]");continue}A!=null&&A.enumerable?u(A,h+1):_.append("[Empty]")}l("]",m,h)}function f(o,h){let d;try{d=Reflect.ownKeys(o)}catch(m){_.append("[Uninspectable]");return}_.append("{");let y=!1;for(let m of d){if(_.stopped())break;if(n>=50){s(y,h),y=!0,P(_,"\u2026"),_.append(r?": ":":"),_.append("[MaxEntries]");break}n+=1;let b;try{b=Reflect.getOwnPropertyDescriptor(o,m)}catch(A){s(y,h),y=!0,G(_,m),_.append(r?": ":":"),_.append("[Uninspectable]");continue}b!=null&&b.enumerable&&(s(y,h),y=!0,G(_,m),_.append(r?": ":":"),u(b,h+1))}l("}",y,h)}function p(o,h){if(i.has(o)){_.append("[Circular]");return}if(h>=5){_.append("[MaxDepth]");return}let d;try{d=Array.isArray(o)}catch(y){_.append("[Uninspectable]");return}i.add(o);try{d?g(o,h):f(o,h)}finally{i.delete(o)}}function c(o,h){o===null?_.append("null"):typeof o=="string"?P(_,o):typeof o=="number"?_.append(Object.is(o,-0)?"-0":String(o)):typeof o=="boolean"?_.append(o?"true":"false"):typeof o>"u"?_.append("undefined"):typeof o=="bigint"?_.append("".concat(o,"n")):typeof o=="symbol"?Q(_,o):typeof o=="function"?_.append("[Function]"):p(o,h)}try{return c(e,0),_.result()}catch(o){return"[Uninspectable]"}}var We=["_16_0_a_0_4_0_5_m_1_u_1_cp_4_b_e_4_7_0_1_0_3l_4_1_1_2_3_1_0_6_0_1_2_1_0_1_j_1_2a_1_3u_8_4l_1_11_2_0_","6_14_1z_q_4_3_19_16_z_1_1_2q_1_0_f_1_7_1_a_2_2_0_g_0_1_t_t_2g_b_0_o_w_9_1_4_0_5_l_4_0_9_0_3_0_n_o_7_","a_5_n_1_6_g_15_1m_1h_3_0_i_0_7_9_f_f_4_7_2_1_2_l_1_6_1_0_3_3_3_0_g_0_d_1_1_2_e_1_a_0_8_5_4_1_2_l_1_6","_1_1_1_1_1_1_v_3_1_0_j_2_g_8_1_2_1_l_1_6_1_1_1_4_3_0_i_0_f_1_n_0_b_7_2_1_2_l_1_6_1_1_1_4_3_0_u_1_1_2","_f_0_h_0_1_5_3_2_1_3_3_1_1_0_1_1_3_1_3_2_3_b_m_0_1g_7_1_2_1_m_1_f_3_0_q_2_1_1_2_1_u_0_4_7_1_2_1_m_1_","9_1_4_3_0_u_2_1_1_f_1_h_8_1_2_1_14_2_0_g_0_5_2_8_2_o_5_5_h_3_n_1_8_1_0_2_6_1m_1b_1_1_c_6_1m_1_1_0_1_","4_1_n_1_0_1_9_1_1_9_0_2_4_1_0_l_3_w_0_1r_7_1_z_r_4_37_16_k_0_g_5_4_3_3_0_3_1_7_2_4_c_c_0_h_11_1_0_5_","0_2_16_1_98_1_3_2_6_1_0_1_3_2_14_1_3_2_w_1_3_2_6_1_0_1_3_2_e_1_1k_1_3_2_1u_11_f_g_2d_2_5_3_h7_2_g_1_","p_5_22_6_7_7_h_d_i_e_h_e_c_1_2_f_1f_z_0_4_0_1v_2g_7_4_2_x_1_0_5_1x_a_u_1d_t_2_4_b_17_4_p_1i_m_9_1g_2","a_0_2l_1a_h_7_1i_t_d_1_a_17_q_z_15_2_a_z_2_a_5_16_2_2_15_3_1_5_1_1_3_0_5_5b_1s_7p_2_5_2_11_2_5_2_7_1","_0_1_0_1_0_1_u_2_1g_1_6_1_0_3_2_1_6_3_3_2_5_4_c_5_2_1_6_38_0_d_0_g_c_2t_0_4_0_2_9_1_0_3_4_6_0_1_0_1_","0_1_3_1_a_2_3_5_4_4_0_1g_1_22j_6c_6_3_3_1_c_11_1_0_5_0_2_1j_7_0_g_m_9_6_1_6_1_6_1_6_1_6_1_6_1_6_1_6_","28_0_d1_1_16_4_5_1_4_2d_6_2_1_2h_1_3_5_16_1_2l_h_v_1c_f_e8_533_1s_h3g_1v_19_2_7g_3_f_a_1_k_1a_g_u_2_","1x_1d_8_2_2u_2_29_k_g_1_2_1_3_1_m_t_1f_e_1d_1q_5_3_0_1_1_b_r_a_m_p_s_7_1a_s_0_g_4_1_9_a_4_1_14_n_2_1","_7_k_m_3_0_3_1d_1_0_3_1_2_4_2_0_1_0_o_2_2_a_7_2_c_5_2_5_2_5_9_6_1_6_1_16_1_d_6_36_t_8mb_c_m_4_1c_6is","_a5_2_2x_12_6_c_4_5_0_1_9_1_c_1_4_1_0_1_1_1_1_1_2z_x_a2_i_1r_2_1h_14_b_38_4_1_3q_10_p_6_p_b_2g_3_5_2","_5_2_5_2_2_z_b_1_p_1_i_1_1_1_e_2_d_y_3e_at_s_3_1c_1b_v_d_j_1_7_6_11_a_t_2_z_4_7_1c_4d_i_z_4_z_4_13_8","_1f_c_a_1_e_1_6_1_1_1_a_1_e_1_6_1_1_3_1f_c_8m_9_l_a_7_o_5_1_15_1_8_1x_5_2_0_1_17_1_1_3_0_2_m_a_m_9_u","_1t_i_1_1_a_l_a_p_6_p_12_1j_6_1_1s_0_f_3_1_2_1_s_16_s_3_s_z_7_1_r_r_1h_a_l_a_i_d_h_32_20_1j_1e_d_1e_","d_z_12_r_9_m_6y_15_6_1_g_5_1k_s_a_0_8_l_16_h_1a_k_r_m_c_1g_1l_1_2_0_d_18_w_o_q_z_t_0_2_0_8_y_3_0_c_1","b_e_3_l_0_1_0_z_h_1_o_j_1_1r_6_1_0_1_3_1_e_1_9_7_1a_12_7_2_1_2_l_1_6_1_1_1_4_3_0_i_0_c_4_u_9_1_0_2_0","_1_11_1_0_p_0_1_0_18_1g_i_3_k_2_u_1b_k_1_1_0_54_1a_15_3_10_1b_k_0_1n_16_d_0_1z_q_11_6_55_17_38_1r_v_","7_2_0_2_7_1_1_1_n_f_0_1_0_2m_7_2_12_g_0_1_0_s_0_a_13_7_0_l_0_b_19_j_0_i_20_5j_w_v_8_1_10_h_0_1d_t_34","_6_1_1_1_11_l_0_p_5_1_1_1_v_e_0_n_17_78_i_f_0_1_c_1_x_3g_0_27_pl_6e_5f_218_2o_f_tr_h_5_p_32y_5_g6_5a","1_t_1cy_fs_7_u_h_26_h_t_i_1b_g_3_v_k_5_i_c0_18_5v_1r_w_o_2_o_18_22_5_0_1u_c_1s_1_1_0_e_1_c_5p1_15_v_","2p_36_6pp_3_1_6_1_1_1_82_f_0_t_2_2_0_e_3_8_az_1s4_2y_5_c_3_8_7_9_4me_2c_1_1y_1_1_2_0_2_1_2_3_1_b_1_0","_1_6_1_1s_1_3_2_7_1_6_1_r_1_3_1_4_1_0_3_6_1_9f_2_o_1_o_1_u_1_o_1_u_1_o_1_u_1_o_1_u_1_o_1_7_1f8_u_6_5","_79_1p_42_18_a_6_g_0_8x_t_i_17_dg_r_6c_t_2_0_5r_u_1_2_1_1_1_6_2_4_9_1_68_6_1_3_1_1_1_e_1_5g_1n_1v_7_","0_xg_3_1_q_1_1_1_0_2_0_1_9_1_3_1_0_1_0_6_0_4_0_1_0_1_0_1_2_1_1_1_0_2_0_1_0_1_0_1_0_1_0_1_1_1_0_2_3_1","_6_1_3_1_3_1_0_1_9_1_g_5_2_1_4_1_g_3es_wyn_w_3dp_2_4gd_2_5rk_f_h9_1wi_f1_15u_3t6_5_6jt"].join(""),N=We.slice(1).split("_"),xe=[],Z=127;for(let e=0;e<N.length;e+=2){let t=Z+1+Number.parseInt(N[e],36),_=t+Number.parseInt(N[e+1],36);xe.push([t,_]),Z=_}var lt=new Set([..."\u060B$\u20BC\u17DB\xA5\u20A1\u20B1\xA3\u20AC\xA2\u20B9\uFDFC\u20AA\u20A9\u20AD\u20A8\u20AE\u20A6\u20BD\u20AB\u0E3F\u20A9\u20BA\u20B4","$U","$b","B/.","BZ$","Br","Bs","C$","CHF","Ft","Gs","J$","KM","K\u010D","L","MT","NT$","P","Q","R","R$","RD$","RM","Rp","S","S/.","TT$","Z$","kn","kr","lei","z\u0142","\u0192","\u0414\u0438\u043D.","\u0434\u0435\u043D","\u043B\u0432","\u062F.\u0625","Lek"]);var re=Function.prototype.toString,Ce=re.call(Object),Se=class{constructor(){C(this,"hasRepeatedReferences",!1);C(this,"clones",[]);C(this,"index");C(this,"sources",[])}get(e){if(this.index){let _=this.index.get(e);return _!==void 0&&(this.hasRepeatedReferences=!0),_}let t=this.sources.indexOf(e);if(t!==-1)return this.hasRepeatedReferences=!0,this.clones[t]}set(e,t){if(this.index){this.index.set(e,t);return}if(this.sources.push(e),this.clones.push(t),this.sources.length===32){this.index=new WeakMap;for(let _=0;_<this.sources.length;_++)this.index.set(this.sources[_],this.clones[_]);this.sources=[],this.clones=[]}}};function ne(e,t){let _=t.get(e);if(_!==void 0)return _;let r=e.slice(0);return t.set(e,r),r}function Ie(e,t){if(typeof Buffer<"u"&&Buffer.isBuffer(e)){let n=Buffer.from(e);return t.set(e,n),n}let _=ne(e.buffer,t);if(e instanceof DataView||Object.prototype.toString.call(e)==="[object DataView]"){let n=new DataView(_,e.byteOffset,e.byteLength);return t.set(e,n),n}let r=e.constructor,i=new r(_,e.byteOffset,e.length);return t.set(e,i),i}function $e(e,t,_){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:_,writable:!0})}function k(e,t,_,r){for(let i of _){let n=t[i],a=typeof n!="object"||n===null?n:j(n,r);i==="__proto__"?$e(e,i,a):e[i]=a}}function x(e,t,_,r){for(let i of _){let n=Object.getOwnPropertyDescriptor(t,i);if(n){if("value"in n){let a=n.value;n.value=typeof a!="object"||a===null?a:j(a,r)}Object.defineProperty(e,i,n)}}}var De=Map.prototype.entries,Re=Set.prototype.values,V=Object.prototype.toString,X,Te=(X=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength"))==null?void 0:X.get,ee,Pe=(ee=Object.getOwnPropertyDescriptor(RegExp.prototype,"flags"))==null?void 0:ee.get,te,st=(te=Object.getOwnPropertyDescriptor(RegExp.prototype,"global"))==null?void 0:te.get,_e,ie=(_e=Object.getOwnPropertyDescriptor(RegExp.prototype,"source"))==null?void 0:_e.get,at=RegExp.prototype.test,F;function ke(e){if(e instanceof ArrayBuffer)return!0;try{return Te.call(e),!0}catch(t){return!1}}function Me(e){try{return De.call(e)}catch(t){return null}}function Ee(e){try{return Re.call(e)}catch(t){return null}}function Le(e){var t;try{return F||(F=(t=Object.getOwnPropertyDescriptor(URL.prototype,"href"))==null?void 0:t.get),F.call(e)}catch(_){return null}}function j(e,t){if(typeof e!="object"||e===null)return e;let _=t.get(e);if(_!==void 0)return _;if(Array.isArray(e)){let l=e.length,u=new Array(l);t.set(e,u);let g=e,f=Object.keys(e);if(f.length===l&&(l===0||f[l-1]==="".concat(l-1)))for(let p=0;p<l;p++){let c=g[p];u[p]=typeof c!="object"||c===null?c:j(c,t)}else k(u,g,f,t);return u}let r=Object.getPrototypeOf(e);if(r===Object.prototype){let l={};return t.set(e,l),k(l,e,Object.keys(e),t),l}if(r===null){let l=Object.create(null);return t.set(e,l),k(l,e,Object.keys(e),t),l}if(Ne(e)){let l=new Date(le.call(e));return t.set(e,l),x(l,e,Object.keys(e),t),l}if(ArrayBuffer.isView(e))return Ie(e,t);if(ke(e)||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return ne(e,t);let i=Me(e);if(i){let l=new Map;t.set(e,l);for(let[u,g]of i)l.set(j(u,t),j(g,t));return x(l,e,Object.keys(e),t),l}let n=Ee(e);if(n){let l=new Set;t.set(e,l);for(let u of n)l.add(j(u,t));return x(l,e,Object.keys(e),t),l}if(Be(e)&&e!==RegExp.prototype){let l=new RegExp(ie.call(e),Pe.call(e));return l.lastIndex=e.lastIndex,t.set(e,l),x(l,e,Object.keys(e),t),l}let a=Le(e);if(a!==null){let l=new URL(a);return t.set(e,l),x(l,e,Object.keys(e),t),l}if(e instanceof Error||V.call(e)==="[object Error]"){let l=Object.create(Object.getPrototypeOf(e));return t.set(e,l),x(l,e,Reflect.ownKeys(e),t),l}let s=Object.create(r);return t.set(e,s),k(s,e,Object.keys(e),t),s}function I(e){return j(e,new Se)}function w(e){var r;if(e==null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;let _=Object.getOwnPropertyDescriptor(t,"constructor");return!_||!("value"in _)||typeof _.value!="function"?!1:((r=Object.getOwnPropertyDescriptor(_.value,"prototype"))==null?void 0:r.value)===t&&re.call(_.value)===Ce}function v(e){return typeof e=="string"}function Be(e){if(e===null||typeof e!="object")return!1;try{return e instanceof RegExp?(e.source,!0):V.call(e)!=="[object RegExp]"?!1:(ie.call(e),!0)}catch(t){return!1}}var le=Date.prototype.getTime;function Ne(e){if(e instanceof Date)return!0;if(e===null||typeof e!="object"||V.call(e)!=="[object Date]")return!1;try{return le.call(e),!0}catch(t){return!1}}function $(e){return e!=null}var Fe=256,He=1024,ze=1,Ve=new Map,Ke=new Map;function z(e){if(e>=97&&e<=122)return e-32;if(e>65535)return e;let t=String.fromCharCode(e).toUpperCase();if(t.length!==1)return e;let _=t.charCodeAt(0);return e>127&&_<128?e:_}function H(e,t,_,r,i,n){for(let a=0;a<i;a++){let s=e.charCodeAt(t+a),l=_.charCodeAt(r+a);if(n||(s>=97&&s<=122&&(s-=32),l>=97&&l<=122&&(l-=32)),s!==l)return!1}return!0}function se(e,t,_){let r=t.indexOf("\\");if(r===-1&&e===t)return!0;let i=t.indexOf("*");if(r===-1&&i===-1){if(_)return!1;for(let g=0;g<t.length;g++)if(t.charCodeAt(g)>127)return;return e.length===t.length&&H(e,0,t,0,t.length,!1)}if(r!==-1)return;let n=0,a=!1,s=-1;for(let g=0;g<t.length;g++){let f=t.charCodeAt(g);if(f>127)return;if(f===42){if(s=g,!a){if(n++,n>1)return;a=!0}}else a=!1}let l=s+1,u=t.length-l;return e.length<i+u?!1:H(e,0,t,0,i,_)&&H(e,e.length-u,t,l,u,_)}function Je(e){let t=new Uint32Array(e.length),_=0;for(let r=1;r<e.length;r++){for(;_>0&&e[r]!==e[_];)_=t[_-1];e[r]===e[_]&&_++,t[r]=_}return t}function qe(e,t){let _=[[]],r=!0,i=!1,n=!1,a=0;for(let p=0;p<e.length;){let c=e.codePointAt(p);if(c!==92){if(c===42)i=!0,n||(_.push([]),n=!0);else{let b=t?c:z(c);_[_.length-1].push(b),r&&(r=b<=127),a++,n=!1}p+=c>65535?2:1;continue}let o=p+1;for(;e.charCodeAt(o)===92;)o++;let h=o-p,d=e.codePointAt(o),y,m=!1;d===42?(m=h%2===0,y=m?h/2:(h-1)/2):d===void 0||d===10||d===13||d===8232||d===8233?y=Math.ceil(h/2):y=Math.floor(h/2);for(let b=0;b<y;b++)_[_.length-1].push(92),a++;if(m){n=!1,p=o;continue}if(d!==void 0){let b=t?d:z(d);_[_.length-1].push(b),r&&(r=b<=127),a++,o+=d>65535?2:1}n=!1,p=o}let s=i&&_[0].length===0,l=i&&_[_.length-1].length===0,u=[];for(let p of _)p.length&&u.push({values:p});let g=s?0:1,f=u.length-(l?0:1);for(let p=g;p<f;p++)u[p].values.length>ze&&(u[p].failure=Je(u[p].values));return{asciiOnly:r,endsWithWildcard:l,hasWildcard:i,minimumInputLength:a,segments:u,startsWithWildcard:s}}function ae(e,t){let _=t?Ve:Ke,r=e.length<=He;if(r){let n=_.get(e);if(n)return n}let i=qe(e,t);if(r){if(_.size>=Fe){let n=_.keys().next().value;n!==void 0&&_.delete(n)}_.set(e,i)}return i}function oe(e,t){if(t){let i=[];for(let n=0;n<e.length;){let a=e.codePointAt(n);i.push(a),n+=a>65535?2:1}return i}let _=new Uint32Array(e.length),r=0;for(let i=0;i<e.length;){let n=e.codePointAt(i);_[r]=z(n),r++,i+=n>65535?2:1}return r===_.length?_:_.subarray(0,r)}function M(e,t,_,r){for(let i=0;i<_.values.length;i++){let n=e.charCodeAt(t+i);if(!r&&n>=97&&n<=122&&(n-=32),n!==_.values[i])return!1}return!0}function Ue(e,t,_,r,i){let n=r-t.values.length;if(n<_)return-1;if(!t.failure){for(let s=_;s<=n;s++)if(M(e,s,t,i))return s;return-1}let a=0;for(let s=_;s<r;s++){let l=e.charCodeAt(s);for(!i&&l>=97&&l<=122&&(l-=32);a>0&&l!==t.values[a];)a=t.failure[a-1];if(l===t.values[a]&&(a++,a===t.values.length))return s-a+1}return-1}function ue(e,t,_){if(e.length<t.minimumInputLength)return!1;if(!t.hasWildcard)return e.length===t.minimumInputLength&&M(e,0,t.segments[0],_);let r=0,i=t.segments.length,n=0,a=e.length;if(!t.startsWithWildcard){let s=t.segments[0];if(!M(e,0,s,_))return!1;n=s.values.length,r++}if(!t.endsWithWildcard){i--;let s=t.segments[i];if(a-=s.values.length,!M(e,a,s,_))return!1}for(let s=r;s<i;s++){let l=t.segments[s],u=Ue(e,l,n,a,_);if(u===-1)return!1;n=u+l.values.length}return!0}function E(e,t,_){for(let r=0;r<_.values.length;r++)if(e[t+r]!==_.values[r])return!1;return!0}function Ge(e,t,_,r){let i=r-t.values.length;if(i<_)return-1;if(!t.failure){for(let a=_;a<=i;a++)if(E(e,a,t))return a;return-1}let n=0;for(let a=_;a<r;a++){for(;n>0&&e[a]!==t.values[n];)n=t.failure[n-1];if(e[a]===t.values[n]&&(n++,n===t.values.length))return a-n+1}return-1}function fe(e,t){if(e.length<t.minimumInputLength)return!1;if(!t.hasWildcard)return e.length===t.minimumInputLength&&E(e,0,t.segments[0]);let _=0,r=t.segments.length,i=0,n=e.length;if(!t.startsWithWildcard){let a=t.segments[0];if(!E(e,0,a))return!1;i=a.values.length,_++}if(!t.endsWithWildcard){r--;let a=t.segments[r];if(n-=a.values.length,!E(e,n,a))return!1}for(let a=_;a<r;a++){let s=t.segments[a],l=Ge(e,s,i,n);if(l===-1)return!1;i=l+s.values.length}return!0}function Qe(e,t,_){let r=se(e,t,_);if(r!==void 0)return r;let i=ae(t,_);return i.asciiOnly?ue(e,i,_):fe(oe(e,_),i)}function Y(e,t,_,r){var a;let i=se(e,t,_);if(i!==void 0)return i;let n=ae(t,_);return n.asciiOnly?ue(e,n,_):((a=r.tokens)!=null||(r.tokens=oe(e,_)),fe(r.tokens,n))}function ce(e,t,_){if(typeof t!="string"&&!t.length)return!1;let r=_===void 0?!1:_.caseSensitiveMatch===!0;if(typeof t=="string"){let s=t.charCodeAt(0)===33,l=s?t.slice(1):t,u=Qe(e,l,r);return s?!u:u}let i={},n=!1,a=!1;for(let s of t){let l=s.charCodeAt(0)===33,u=l?s.slice(1):s;if(l){if(Y(e,u,r,i))return!1}else n=!0,!a&&Y(e,u,r,i)&&(a=!0)}return n?a:!0}function K(e,t,_=0){if(typeof e!="string")throw new TypeError("str-indexes-of-plus/strIndexesOfPlus(): [THROW_ID_01] first input argument must be a string! Currently it's: ".concat(typeof e));if(typeof t!="string")throw new TypeError("str-indexes-of-plus/strIndexesOfPlus(): [THROW_ID_02] second input argument must be a string! Currently it's: ".concat(typeof t));let r=Number(_);if(!Number.isInteger(r)||r<0||typeof _=="string"&&!/^\d+$/.test(_))throw new TypeError("str-indexes-of-plus/strIndexesOfPlus(): [THROW_ID_03] third input argument must be a natural number! Currently it's: ".concat(_));let i=Array.from(e),n=Array.from(t);if(!i.length||!n.length||r>=i.length)return[];let a=[],s=i.length-n.length;e:for(let l=r;l<=s;l++){for(let u=0;u<n.length;u++)if(i[l+u]!==n[u])continue e;a.push(l)}return a}var pe="7.2.3";var D={wrapHeadsWith:"%%_",wrapTailsWith:"_%%",dontWrapKeys:[],dontWrapPaths:[],xhtml:!0,preventDoubleWrapping:!0,preventWrappingIfContains:[],objectKeyAndValueJoinChar:".",wrapGlobalFlipSwitch:!0,ignore:[],whatToDoWhenReferenceIsMissing:0,mergeArraysWithLineBreaks:!0,mergeWithoutTrailingBrIfLineContainsBr:!0,enforceStrictKeyset:!0};function L(e,t){let _=O(O({},D),t);if(!e||Object.keys(e).length===0)return[];let r=I(e),i=[];return w(r)&&Object.keys(r).forEach(n=>{w(r[n])&&(r[n]=L(r[n],_)),Array.isArray(r[n])&&(i=i.concat(r[n].map(a=>"".concat(n).concat(_.objectKeyAndValueJoinChar).concat(a)))),v(r[n])&&i.push("".concat(n).concat(_.objectKeyAndValueJoinChar).concat(r[n]))}),i}function R(e,t,_=!1,r=!1){let i=O(O({},D),t);if(!e||e.length===0)return"";let n=I(e),a="";if(n.length)if(r){for(let s=0,l=n.length;s<l;s++)if(v(n[s])){let u;u="",i.mergeArraysWithLineBreaks&&s>0&&(!i.mergeWithoutTrailingBrIfLineContainsBr||typeof n[s-1]!="string"||i.mergeWithoutTrailingBrIfLineContainsBr&&n[s-1]!==void 0&&!n[s-1].toLowerCase().includes("<br"))&&(u="<br".concat(i.xhtml?" /":"",">")),a+="".concat(u).concat(_?i.wrapHeadsWith:"").concat(n[s]).concat(_?i.wrapTailsWith:"")}else if(Array.isArray(n[s])&&n[s].length&&n[s].every(v)){let u="";i.mergeArraysWithLineBreaks&&a.length&&(u="<br".concat(i.xhtml?" /":"",">")),a=n[s].reduce((g,f,p,c)=>{let o="";return p!==c.length-1&&(o=" "),g+(p===0?u:"")+(_?i.wrapHeadsWith:"")+f+(_?i.wrapTailsWith:"")+o},a)}}else a=n.reduce((s,l,u,g)=>{let f="";i.mergeArraysWithLineBreaks&&u>0&&(f="<br".concat(i.xhtml?" /":"",">"));let p="";return u!==g.length-1&&(p=" "),"".concat(s).concat(u===0?f:"").concat(_?i.wrapHeadsWith:"").concat(l).concat(_?i.wrapTailsWith:"").concat(p)},a);return a}var Ye=pe;function Xe(e,t,_){if(!w(e))throw new Error("object-flatten-referencing/flattenReferencing(): [THROW_ID_01] the first input argument must be a plain object! It was given as ".concat(S(e,4)," (its typeof was ").concat(typeof e,")."));if(!w(t))throw new Error("object-flatten-referencing/flattenReferencing(): [THROW_ID_02] the second input argument must be a plain object! It was given as ".concat(S(t,4)," (its typeof was ").concat(typeof t,")."));if(_&&!w(_))throw new Error("object-flatten-referencing/flattenReferencing(): [THROW_ID_03] the third input argument must be a plain object! It was given as ".concat(S(_,4)," (its typeof was ").concat(typeof _,")."));let r=O(O({},D),_);r.dontWrapKeys=W(r.dontWrapKeys),r.preventWrappingIfContains=W(r.preventWrappingIfContains),r.dontWrapPaths=W(r.dontWrapPaths),r.ignore=W(r.ignore),typeof r.whatToDoWhenReferenceIsMissing!="number"&&(r.whatToDoWhenReferenceIsMissing=+r.whatToDoWhenReferenceIsMissing||0);function i(n,a,s,l=!0,u=!0,g=""){let f=n,p=a;return s.wrapGlobalFlipSwitch||(l=!1),w(f)?Object.keys(f).forEach(c=>{let o=g+(g.length===0?c:".".concat(c));if(s.ignore.length===0||!s.ignore.includes(c)){if(s.wrapGlobalFlipSwitch&&(l=!0,s.dontWrapKeys.length&&(l=l&&!s.dontWrapKeys.some(h=>ce(c,h,{caseSensitiveMatch:!0}))),s.dontWrapPaths.length&&(l=l&&!s.dontWrapPaths.some(h=>h===o)),s.preventWrappingIfContains.length&&typeof f[c]=="string"&&(l=l&&!s.preventWrappingIfContains.some(h=>f[c].includes(h)))),$(p[c])||!$(p[c])&&s.whatToDoWhenReferenceIsMissing===2)if(Array.isArray(f[c]))if(s.whatToDoWhenReferenceIsMissing===2||v(p[c]))f[c]=R(f[c],s,l,u);else{if(f[c].every(h=>typeof h=="string"||Array.isArray(h))){let h=!0;f[c].forEach(d=>{Array.isArray(d)&&!d.every(v)&&(h=!1)}),h&&(u=!1)}f[c]=i(f[c],p[c],s,l,u,o)}else w(f[c])?s.whatToDoWhenReferenceIsMissing===2||v(p[c])?f[c]=R(L(f[c],s),s,l,u):l?f[c]=i(f[c],p[c],s,l,u,o):f[c]=i(f[c],p[c],U(O({},s),{wrapGlobalFlipSwitch:!1}),l,u,o):v(f[c])&&(f[c]=i(f[c],p[c],s,l,u,o));else if(typeof f[c]!=typeof p[c]&&s.whatToDoWhenReferenceIsMissing===1)throw new Error("object-flatten-referencing/flattenReferencing(): [THROW_ID_04] resolvedReference object does not have the key ".concat(c," and we need it. TIP: Turn off throwing via opts2.whatToDoWhenReferenceIsMissing."))}}):Array.isArray(f)?Array.isArray(p)?f.forEach((c,o)=>{$(f[o])&&$(p[o])?f[o]=i(f[o],p[o],s,l,u,"".concat(g,"[").concat(o,"]")):f[o]=i(f[o],p[0],s,l,u,"".concat(g,"[").concat(o,"]"))}):v(p)&&(f=R(f,s,l,u)):v(f)&&f.length&&(s.wrapHeadsWith||s.wrapTailsWith)&&(!s.preventDoubleWrapping||(s.wrapHeadsWith===""||!K(f,s.wrapHeadsWith.trim()).length)&&(s.wrapTailsWith===""||!K(f,s.wrapTailsWith.trim()).length))&&(f="".concat(l?s.wrapHeadsWith:"").concat(f).concat(l?s.wrapTailsWith:"")),f}return i(I(e),t,r)}return Oe(et);})();
|
|
11
11
|
/**
|
|
12
12
|
* @name arrayiffy-if-string
|
|
13
13
|
* @fileoverview Put non-empty strings into arrays, turn empty-ones into empty arrays. Bypass everything else.
|
|
14
|
-
* @version 5.2.
|
|
14
|
+
* @version 5.2.2
|
|
15
15
|
* @author Roy Revelt
|
|
16
16
|
* @license MIT
|
|
17
17
|
* {@link https://codsen.com/os/arrayiffy-if-string/}
|
|
18
18
|
*/
|
|
19
|
+
/**
|
|
20
|
+
* @name codsen-format-diagnostic-value
|
|
21
|
+
* @fileoverview Safely format untrusted JavaScript values for diagnostics
|
|
22
|
+
* @version 1.1.0
|
|
23
|
+
* @author Roy Revelt
|
|
24
|
+
* @license MIT
|
|
25
|
+
* {@link https://codsen.com/os/codsen-format-diagnostic-value/}
|
|
26
|
+
*/
|
|
19
27
|
/**
|
|
20
28
|
* @name codsen-utils
|
|
21
29
|
* @fileoverview Various utility functions
|
|
22
|
-
* @version 1.
|
|
30
|
+
* @version 1.10.0
|
|
23
31
|
* @author Roy Revelt
|
|
24
32
|
* @license MIT
|
|
25
33
|
* {@link https://codsen.com/os/codsen-utils/}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "object-flatten-referencing",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.3",
|
|
4
4
|
"description": "Flatten complex nested objects according to a reference objects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"advanced",
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"arrayiffy-if-string": "^5.2.
|
|
70
|
-
"codsen-utils": "^1.
|
|
69
|
+
"arrayiffy-if-string": "^5.2.2",
|
|
70
|
+
"codsen-utils": "^1.10.0",
|
|
71
71
|
"str-indexes-of-plus": "^5.2.1"
|
|
72
72
|
},
|
|
73
73
|
"engines": {
|