json-variables 12.0.10 → 12.0.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/dist/json-variables.esm.js +7 -7
- package/dist/json-variables.umd.js +41 -41
- package/package.json +9 -9
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name json-variables
|
|
3
3
|
* @fileoverview Resolves custom-marked, cross-referenced paths in parsed JSON
|
|
4
|
-
* @version 12.0.
|
|
4
|
+
* @version 12.0.12
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/json-variables/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import{matchLeftIncl as k,matchRightIncl as x}from"string-match-left-right";import{remDup as F}from"string-remove-duplicate-heads-tails";import{strFindHeadsTails as I}from"string-find-heads-tails";import{getByKey as _}from"ast-get-values-by-key";import{arrayiffy as B}from"arrayiffy-if-string";import{traverse as L}from"ast-monkey-traverse";import{rApply as O}from"ranges-apply";import h from"object-path";import{Ranges as U}from"ranges-push";import{isMatch as M}from"matcher";import{isPlainObject as w,existy as q,isBool as A,isNull as N,isStr as o,isNum as K}from"codsen-utils";var j="12.0.
|
|
11
|
-
`;c=s.reduce((D,
|
|
10
|
+
import{matchLeftIncl as k,matchRightIncl as x}from"string-match-left-right";import{remDup as F}from"string-remove-duplicate-heads-tails";import{strFindHeadsTails as I}from"string-find-heads-tails";import{getByKey as _}from"ast-get-values-by-key";import{arrayiffy as B}from"arrayiffy-if-string";import{traverse as L}from"ast-monkey-traverse";import{rApply as O}from"ranges-apply";import h from"object-path";import{Ranges as U}from"ranges-push";import{isMatch as M}from"matcher";import{isPlainObject as w,existy as q,isBool as A,isNull as N,isStr as o,isNum as K}from"codsen-utils";var j="12.0.12";var ce=j,G=Object.prototype.hasOwnProperty,z={heads:"%%_",tails:"_%%",headsNoWrap:"%%-",tailsNoWrap:"-%%",lookForDataContainers:!0,dataContainerIdentifierTails:"_data",wrapHeadsWith:"",wrapTailsWith:"",dontWrapVars:[],preventDoubleWrapping:!0,wrapGlobalFlipSwitch:!0,noSingleMarkers:!1,resolveToBoolIfAnyValuesContainBool:!0,resolveToFalseIfAnyValuesContainBool:!0,throwWhenNonStringInsertedInString:!1,allowUnresolved:!1};function g(r){return o(r)?r.trim():r}function Y(r){if(o(r)&&r.length&&r.indexOf(".")!==-1){for(let e=0,t=r.length;e<t;e++)if(r[e]===".")return r.slice(0,e)}return r}function Q(r){if(o(r)&&r.length&&r.indexOf(".")!==-1){for(let e=0,t=r.length;e<t;e++)if(r[e]===".")return r.slice(e+1)}return r}function J(r){if(o(r)&&r.length&&r.indexOf(".")!==-1){for(let e=r.length;e--;)if(r[e]===".")return r.slice(0,e)}return r}function P(r){if(o(r)&&r.length&&r.indexOf(".")!==-1){for(let e=r.length;e--;)if(r[e]===".")return r.slice(e+1)}return r}function T(r,e){return!o(r)||!r.trim()?!1:!!(r.includes(e.heads)||r.includes(e.tails)||o(e.headsNoWrap)&&e.headsNoWrap.length&&r.includes(e.headsNoWrap)||o(e.tailsNoWrap)&&e.tailsNoWrap.length&&r.includes(e.tailsNoWrap))}function X(r,e,t){let l,s;return o(r)&&r.length&&x(r,0,e,{trimBeforeMatching:!0,cb:(n,a,i)=>(l=i,!0)})&&k(r,r.length-1,t,{trimBeforeMatching:!0,cb:(n,a,i)=>(s=(i||0)+1,!0)})?r.slice(l,s):r}function H(r,e,t=!1,l,s,n){if(e.wrapHeadsWith||(e.wrapHeadsWith=""),e.wrapTailsWith||(e.wrapTailsWith=""),o(r)&&!t&&e.wrapGlobalFlipSwitch&&!e.dontWrapVars.some(a=>M(n,a))&&(!e.preventDoubleWrapping||e.preventDoubleWrapping&&o(r)&&!r.includes(e.wrapHeadsWith)&&!r.includes(e.wrapTailsWith)))return`${e.wrapHeadsWith}${r}${e.wrapTailsWith}`;if(t){if(!o(r))return r;let a=F(r,{heads:e.wrapHeadsWith,tails:e.wrapTailsWith});return o(a)?X(a,e.wrapHeadsWith,e.wrapTailsWith):a}return r}function Z(r,e,t,l){let s;if(t.indexOf(".")!==-1){let n=t,a=!0;if(l.lookForDataContainers&&o(l.dataContainerIdentifierTails)&&l.dataContainerIdentifierTails.length&&!n.endsWith(l.dataContainerIdentifierTails)){let i=h.get(r,n+l.dataContainerIdentifierTails);w(i)&&h.get(i,e)&&(s=h.get(i,e),a=!1)}for(;a&&n.indexOf(".")!==-1;){if(n=J(n),P(n)===e)throw new Error(`json-variables/findValues(): [THROW_ID_20] While trying to resolve: "${e}" at path "${t}", we encountered a closed loop. The parent key "${P(n)}" is called the same as the variable "${e}" we're looking for.`);if(l.lookForDataContainers&&o(l.dataContainerIdentifierTails)&&l.dataContainerIdentifierTails.length&&!n.endsWith(l.dataContainerIdentifierTails)){let i=h.get(r,n+l.dataContainerIdentifierTails);w(i)&&h.get(i,e)&&(s=h.get(i,e),a=!1)}if(s===void 0){let i=h.get(r,n);w(i)&&h.get(i,e)&&(s=h.get(i,e),a=!1)}}}if(s===void 0){let n=h.get(r,e);n!==void 0&&(s=n)}if(s===void 0)if(e.indexOf(".")===-1){let n=_(r,e);if(n.length){for(let a=0,i=n.length;a<i;a++)if(o(n[a].val)||A(n[a].val)||N(n[a].val)){s=n[a].val;break}else if(K(n[a].val)){s=String(n[a].val);break}else if(Array.isArray(n[a].val)){s=n[a].val.join("");break}}}else{let n=_(r,Y(e));if(n.length)for(let a=0,i=n.length;a<i;a++){let m=h.get(n[a].val,Q(e));m&&o(m)&&(s=m)}}return s}function R(r,e,t,l,s=[]){if(s.includes(t)){let c="";if(s.length>1){let y=` \u2192
|
|
11
|
+
`;c=s.reduce((D,b,S)=>D+(S===0?"":y)+(b===t?"\u{1F4A5} ":" ")+b,` Here's the path we travelled up until we hit the recursion:
|
|
12
12
|
|
|
13
|
-
`),c+=`${
|
|
14
|
-
${c}`)}let W=!1;d.length===1&&O(e,[[d[0].headsStartAt,d[0].tailsEndAt]]).trim()===""&&(W=!0);let $=m(d,!1,W);if(typeof $=="boolean"||$===null)return $;try{d=I(e,l.headsNoWrap,l.tailsNoWrap,{source:"",throwWhenSomethingWrongIsDetected:!1})}catch(c){throw new Error(`json-variables/resolveString(): [THROW_ID_22] While trying to resolve string: "${e}" at path ${
|
|
15
|
-
${c}`)}d.length===1&&O(e,[[d[0].headsStartAt,d[0].tailsEndAt]]).trim()===""&&(W=!0);let E=m(d,!0,W);return A(E)||N(E)?E:i?.current()?O(e,i.current()):e}function pe(
|
|
16
|
-
Please check the following key: ${a}`);if(i!==void 0?n=i:n=a,n==="")return n;if(
|
|
13
|
+
`),c+=`${y}\u{1F4A5} ${t}`}throw new Error(`json-variables/resolveString(): [THROW_ID_19] While trying to resolve: "${e}" at path "${t}", we encountered a closed loop, the key is referencing itself."${c}`)}let n={},a=Array.from(s);a.push(t);let i=new U;function m(c,y,D){for(let b=0,S=c.length;b<S;b++){let f=c[b],p=e.slice(f.headsEndAt,f.tailsStartAt);if(p.length===0)i.push(f.headsStartAt,f.tailsEndAt);else if(G.call(n,p)&&o(n[p]))i.push(f.headsStartAt,f.tailsEndAt,n[p]);else{let u=Z(r,p.trim(),t,l);if(u===void 0)if(l.allowUnresolved===!0)u="";else if(o(l.allowUnresolved))u=l.allowUnresolved;else throw new Error(`json-variables/processHeadsAndTails(): [THROW_ID_18] We couldn't find the value to resolve the variable ${e.slice(f.headsEndAt,f.tailsStartAt)}. We're at path: "${t}".`);if(!D&&l.throwWhenNonStringInsertedInString&&!o(u))throw new Error(`json-variables/processHeadsAndTails(): [THROW_ID_23] While resolving the variable ${e.slice(f.headsEndAt,f.tailsStartAt)} at path ${t}, it resolved into a non-string value, ${JSON.stringify(u,null,4)}. This is happening because options setting "throwWhenNonStringInsertedInString" is active (set to "true").`);if(A(u)){if(l.resolveToBoolIfAnyValuesContainBool)return i.wipe(),l.resolveToFalseIfAnyValuesContainBool?!1:u;u=""}else{if(N(u)&&D)return i.wipe(),u;Array.isArray(u)?u=String(u.join("")):N(u)?u="":u=String(u)}let v=t.includes(".")?`${J(t)}.${p}`:p;if(T(u,l)){let V=H(R(r,u,v,l,a),l,y,a,v,p.trim());o(V)&&i.push(f.headsStartAt,f.tailsEndAt,V)}else{n[p]=u;let V=H(u,l,y,a,v,p.trim());o(V)&&i.push(f.headsStartAt,f.tailsEndAt,V)}}}}let d;try{d=I(e,l.heads,l.tails,{source:"",throwWhenSomethingWrongIsDetected:!1})}catch(c){throw new Error(`json-variables/resolveString(): [THROW_ID_17] While trying to resolve string: "${e}" at path ${t}, something wrong with heads and tails was detected! Here's the internal error message:
|
|
14
|
+
${c}`)}let W=!1;d.length===1&&O(e,[[d[0].headsStartAt,d[0].tailsEndAt]]).trim()===""&&(W=!0);let $=m(d,!1,W);if(typeof $=="boolean"||$===null)return $;try{d=I(e,l.headsNoWrap,l.tailsNoWrap,{source:"",throwWhenSomethingWrongIsDetected:!1})}catch(c){throw new Error(`json-variables/resolveString(): [THROW_ID_22] While trying to resolve string: "${e}" at path ${t}, something wrong with no-wrap heads and no-wrap tails was detected! Here's the internal error message:
|
|
15
|
+
${c}`)}d.length===1&&O(e,[[d[0].headsStartAt,d[0].tailsEndAt]]).trim()===""&&(W=!0);let E=m(d,!0,W);return A(E)||N(E)?E:i?.current()?O(e,i.current()):e}function pe(r,e){if(!arguments.length)throw new Error("json-variables/jVar(): [THROW_ID_01] Alas! Inputs are missing!");if(!w(r))throw new TypeError(`json-variables/jVar(): [THROW_ID_02] Alas! The input must be a plain object! Currently it's: ${Array.isArray(r)?"array":typeof r}`);if(e&&!w(e))throw new TypeError(`json-variables/jVar(): [THROW_ID_03] Alas! An Optional Options Object must be a plain object! Currently it's: ${Array.isArray(e)?"array":typeof e}`);let t={...z,...e};t.dontWrapVars?Array.isArray(t.dontWrapVars)||(t.dontWrapVars=B(t.dontWrapVars)):t.dontWrapVars=[];let l,s;if(t.dontWrapVars.length&&!t.dontWrapVars.every((a,i)=>o(a)?!0:(l=a,s=i,!1)))throw new Error(`json-variables/jVar(): [THROW_ID_05] Alas! All variable names set in resolvedOpts.dontWrapVars should be of a string type. Computer detected a value "${l}" at index ${s}, which is not string but ${Array.isArray(l)?"array":typeof l}!`);if(t.heads==="")throw new Error("json-variables/jVar(): [THROW_ID_06] Alas! resolvedOpts.heads are empty!");if(t.tails==="")throw new Error("json-variables/jVar(): [THROW_ID_07] Alas! resolvedOpts.tails are empty!");if(t.lookForDataContainers&&t.dataContainerIdentifierTails==="")throw new Error("json-variables/jVar(): [THROW_ID_08] Alas! resolvedOpts.dataContainerIdentifierTails is empty!");if(t.heads===t.tails)throw new Error("json-variables/jVar(): [THROW_ID_09] Alas! resolvedOpts.heads and resolvedOpts.tails can't be equal!");if(t.heads===t.headsNoWrap)throw new Error("json-variables/jVar(): [THROW_ID_10] Alas! resolvedOpts.heads and resolvedOpts.headsNoWrap can't be equal!");if(t.tails===t.tailsNoWrap)throw new Error("json-variables/jVar(): [THROW_ID_11] Alas! resolvedOpts.tails and resolvedOpts.tailsNoWrap can't be equal!");if(t.headsNoWrap==="")throw new Error("json-variables/jVar(): [THROW_ID_12] Alas! resolvedOpts.headsNoWrap is an empty string!");if(t.tailsNoWrap==="")throw new Error("json-variables/jVar(): [THROW_ID_13] Alas! resolvedOpts.tailsNoWrap is an empty string!");if(t.headsNoWrap===t.tailsNoWrap)throw new Error("json-variables/jVar(): [THROW_ID_14] Alas! resolvedOpts.headsNoWrap and resolvedOpts.tailsNoWrap can't be equal!");let n;return L(r,(a,i,m)=>{if(q(i)&&T(a,t))throw new Error(`json-variables/jVar(): [THROW_ID_15] Alas! Object keys can't contain variables!
|
|
16
|
+
Please check the following key: ${a}`);if(i!==void 0?n=i:n=a,n==="")return n;if(t.heads.length&&g(n)===g(t.heads)||t.tails.length&&g(n)===g(t.tails)||t.headsNoWrap.length&&g(n)===g(t.headsNoWrap)||t.tailsNoWrap.length&&g(n)===g(t.tailsNoWrap)){if(!t.noSingleMarkers)return n;throw new Error(`json-variables/jVar(): [THROW_ID_16] Alas! While processing the input, we stumbled upon ${g(n)} which is equal to ${g(n)===g(t.heads)?"heads":""}${g(n)===g(t.tails)?"tails":""}${o(t.headsNoWrap)&&g(n)===g(t.headsNoWrap)?"headsNoWrap":""}${o(t.tailsNoWrap)&&g(n)===g(t.tailsNoWrap)?"tailsNoWrap":""}. If you wouldn't have set resolvedOpts.noSingleMarkers to "true" this error would not happen and computer would have left the current element (${g(n)}) alone`)}return o(n)&&T(n,t)?R(r,n,m.path,t):n})}export{z as defaults,pe as jVar,ce as version};
|
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name json-variables
|
|
3
3
|
* @fileoverview Resolves custom-marked, cross-referenced paths in parsed JSON
|
|
4
|
-
* @version 12.0.
|
|
4
|
+
* @version 12.0.12
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/json-variables/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
"use strict";var jsonVariables=(()=>{var Zr=Object.create;var U=Object.defineProperty,Yr=Object.defineProperties,Xr=Object.getOwnPropertyDescriptor,et=Object.getOwnPropertyDescriptors,rt=Object.getOwnPropertyNames,Je=Object.getOwnPropertySymbols,tt=Object.getPrototypeOf,Fe=Object.prototype.hasOwnProperty,nt=Object.prototype.propertyIsEnumerable;var de=(e,r,t)=>r in e?U(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,v=(e,r)=>{for(var t in r||(r={}))Fe.call(r,t)&&de(e,t,r[t]);if(Je)for(var t of Je(r))nt.call(r,t)&&de(e,t,r[t]);return e},K=(e,r)=>Yr(e,et(r));var ke=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),it=(e,r)=>{for(var t in r)U(e,t,{get:r[t],enumerable:!0})},Le=(e,r,t,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let l of rt(r))!Fe.call(e,l)&&l!==t&&U(e,l,{get:()=>r[l],enumerable:!(i=Xr(r,l))||i.enumerable});return e};var ye=(e,r,t)=>(t=e!=null?Zr(tt(e)):{},Le(r||!e||!e.__esModule?U(t,"default",{value:e,enumerable:!0}):t,e)),at=e=>Le(U({},"__esModule",{value:!0}),e);var me=(e,r,t)=>(de(e,typeof r!="symbol"?r+"":r,t),t);var Re=ke((Z,F)=>{var pt=200,hr="__lodash_hash_undefined__",gr=9007199254740991,Se="[object Arguments]",dt="[object Array]",pr="[object Boolean]",dr="[object Date]",yt="[object Error]",Ee="[object Function]",yr="[object GeneratorFunction]",te="[object Map]",mr="[object Number]",We="[object Object]",rr="[object Promise]",wr="[object RegExp]",ne="[object Set]",br="[object String]",Tr="[object Symbol]",$e="[object WeakMap]",$r="[object ArrayBuffer]",ie="[object DataView]",vr="[object Float32Array]",Or="[object Float64Array]",Ar="[object Int8Array]",_r="[object Int16Array]",Ir="[object Int32Array]",Sr="[object Uint8Array]",Er="[object Uint8ClampedArray]",Wr="[object Uint16Array]",Dr="[object Uint32Array]",mt=/[\\^$.*+?()[\]{}|]/g,wt=/\w*$/,bt=/^\[object .+?Constructor\]$/,Tt=/^(?:0|[1-9]\d*)$/,O={};O[Se]=O[dt]=O[$r]=O[ie]=O[pr]=O[dr]=O[vr]=O[Or]=O[Ar]=O[_r]=O[Ir]=O[te]=O[mr]=O[We]=O[wr]=O[ne]=O[br]=O[Tr]=O[Sr]=O[Er]=O[Wr]=O[Dr]=!0;O[yt]=O[Ee]=O[$e]=!1;var $t=typeof global=="object"&&global&&global.Object===Object&&global,vt=typeof self=="object"&&self&&self.Object===Object&&self,C=$t||vt||Function("return this")(),xr=typeof Z=="object"&&Z&&!Z.nodeType&&Z,tr=xr&&typeof F=="object"&&F&&!F.nodeType&&F,Ot=tr&&tr.exports===xr;function At(e,r){return e.set(r[0],r[1]),e}function _t(e,r){return e.add(r),e}function It(e,r){for(var t=-1,i=e?e.length:0;++t<i&&r(e[t],t,e)!==!1;);return e}function St(e,r){for(var t=-1,i=r.length,l=e.length;++t<i;)e[l+t]=r[t];return e}function Nr(e,r,t,i){var l=-1,n=e?e.length:0;for(i&&n&&(t=e[++l]);++l<n;)t=r(t,e[l],l,e);return t}function Et(e,r){for(var t=-1,i=Array(e);++t<e;)i[t]=r(t);return i}function Wt(e,r){return e==null?void 0:e[r]}function Cr(e){var r=!1;if(e!=null&&typeof e.toString!="function")try{r=!!(e+"")}catch(t){}return r}function nr(e){var r=-1,t=Array(e.size);return e.forEach(function(i,l){t[++r]=[l,i]}),t}function De(e,r){return function(t){return e(r(t))}}function ir(e){var r=-1,t=Array(e.size);return e.forEach(function(i){t[++r]=i}),t}var Dt=Array.prototype,xt=Function.prototype,ae=Object.prototype,Te=C["__core-js_shared__"],ar=function(){var e=/[^.]+$/.exec(Te&&Te.keys&&Te.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Rr=xt.toString,V=ae.hasOwnProperty,se=ae.toString,Nt=RegExp("^"+Rr.call(V).replace(mt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),sr=Ot?C.Buffer:void 0,or=C.Symbol,lr=C.Uint8Array,Ct=De(Object.getPrototypeOf,Object),Rt=Object.create,Vt=ae.propertyIsEnumerable,jt=Dt.splice,ur=Object.getOwnPropertySymbols,Ht=sr?sr.isBuffer:void 0,Mt=De(Object.keys,Object),ve=q(C,"DataView"),Y=q(C,"Map"),Oe=q(C,"Promise"),Ae=q(C,"Set"),_e=q(C,"WeakMap"),X=q(Object,"create"),Pt=M(ve),Bt=M(Y),Jt=M(Oe),Ft=M(Ae),kt=M(_e),fr=or?or.prototype:void 0,cr=fr?fr.valueOf:void 0;function H(e){var r=-1,t=e?e.length:0;for(this.clear();++r<t;){var i=e[r];this.set(i[0],i[1])}}function Lt(){this.__data__=X?X(null):{}}function qt(e){return this.has(e)&&delete this.__data__[e]}function Ut(e){var r=this.__data__;if(X){var t=r[e];return t===hr?void 0:t}return V.call(r,e)?r[e]:void 0}function Kt(e){var r=this.__data__;return X?r[e]!==void 0:V.call(r,e)}function Gt(e,r){var t=this.__data__;return t[e]=X&&r===void 0?hr:r,this}H.prototype.clear=Lt;H.prototype.delete=qt;H.prototype.get=Ut;H.prototype.has=Kt;H.prototype.set=Gt;function R(e){var r=-1,t=e?e.length:0;for(this.clear();++r<t;){var i=e[r];this.set(i[0],i[1])}}function Qt(){this.__data__=[]}function zt(e){var r=this.__data__,t=oe(r,e);if(t<0)return!1;var i=r.length-1;return t==i?r.pop():jt.call(r,t,1),!0}function Zt(e){var r=this.__data__,t=oe(r,e);return t<0?void 0:r[t][1]}function Yt(e){return oe(this.__data__,e)>-1}function Xt(e,r){var t=this.__data__,i=oe(t,e);return i<0?t.push([e,r]):t[i][1]=r,this}R.prototype.clear=Qt;R.prototype.delete=zt;R.prototype.get=Zt;R.prototype.has=Yt;R.prototype.set=Xt;function k(e){var r=-1,t=e?e.length:0;for(this.clear();++r<t;){var i=e[r];this.set(i[0],i[1])}}function en(){this.__data__={hash:new H,map:new(Y||R),string:new H}}function rn(e){return le(this,e).delete(e)}function tn(e){return le(this,e).get(e)}function nn(e){return le(this,e).has(e)}function an(e,r){return le(this,e).set(e,r),this}k.prototype.clear=en;k.prototype.delete=rn;k.prototype.get=tn;k.prototype.has=nn;k.prototype.set=an;function L(e){this.__data__=new R(e)}function sn(){this.__data__=new R}function on(e){return this.__data__.delete(e)}function ln(e){return this.__data__.get(e)}function un(e){return this.__data__.has(e)}function fn(e,r){var t=this.__data__;if(t instanceof R){var i=t.__data__;if(!Y||i.length<pt-1)return i.push([e,r]),this;t=this.__data__=new k(i)}return t.set(e,r),this}L.prototype.clear=sn;L.prototype.delete=on;L.prototype.get=ln;L.prototype.has=un;L.prototype.set=fn;function cn(e,r){var t=Ne(e)||Vn(e)?Et(e.length,String):[],i=t.length,l=!!i;for(var n in e)(r||V.call(e,n))&&!(l&&(n=="length"||xn(n,i)))&&t.push(n);return t}function Vr(e,r,t){var i=e[r];(!(V.call(e,r)&&Pr(i,t))||t===void 0&&!(r in e))&&(e[r]=t)}function oe(e,r){for(var t=e.length;t--;)if(Pr(e[t][0],r))return t;return-1}function hn(e,r){return e&&jr(r,Ce(r),e)}function Ie(e,r,t,i,l,n,o){var s;if(i&&(s=n?i(e,l,n,o):i(e)),s!==void 0)return s;if(!ue(e))return e;var p=Ne(e);if(p){if(s=En(e),!r)return _n(e,s)}else{var a=j(e),c=a==Ee||a==yr;if(Hn(e))return wn(e,r);if(a==We||a==Se||c&&!n){if(Cr(e))return n?e:{};if(s=Wn(c?{}:e),!r)return In(e,hn(s,e))}else{if(!O[a])return n?e:{};s=Dn(e,a,Ie,r)}}o||(o=new L);var h=o.get(e);if(h)return h;if(o.set(e,s),!p)var T=t?Sn(e):Ce(e);return It(T||e,function(y,f){T&&(f=y,y=e[f]),Vr(s,f,Ie(y,r,t,i,f,e,o))}),s}function gn(e){return ue(e)?Rt(e):{}}function pn(e,r,t){var i=r(e);return Ne(e)?i:St(i,t(e))}function dn(e){return se.call(e)}function yn(e){if(!ue(e)||Cn(e))return!1;var r=Jr(e)||Cr(e)?Nt:bt;return r.test(M(e))}function mn(e){if(!Mr(e))return Mt(e);var r=[];for(var t in Object(e))V.call(e,t)&&t!="constructor"&&r.push(t);return r}function wn(e,r){if(r)return e.slice();var t=new e.constructor(e.length);return e.copy(t),t}function xe(e){var r=new e.constructor(e.byteLength);return new lr(r).set(new lr(e)),r}function bn(e,r){var t=r?xe(e.buffer):e.buffer;return new e.constructor(t,e.byteOffset,e.byteLength)}function Tn(e,r,t){var i=r?t(nr(e),!0):nr(e);return Nr(i,At,new e.constructor)}function $n(e){var r=new e.constructor(e.source,wt.exec(e));return r.lastIndex=e.lastIndex,r}function vn(e,r,t){var i=r?t(ir(e),!0):ir(e);return Nr(i,_t,new e.constructor)}function On(e){return cr?Object(cr.call(e)):{}}function An(e,r){var t=r?xe(e.buffer):e.buffer;return new e.constructor(t,e.byteOffset,e.length)}function _n(e,r){var t=-1,i=e.length;for(r||(r=Array(i));++t<i;)r[t]=e[t];return r}function jr(e,r,t,i){t||(t={});for(var l=-1,n=r.length;++l<n;){var o=r[l],s=i?i(t[o],e[o],o,t,e):void 0;Vr(t,o,s===void 0?e[o]:s)}return t}function In(e,r){return jr(e,Hr(e),r)}function Sn(e){return pn(e,Ce,Hr)}function le(e,r){var t=e.__data__;return Nn(r)?t[typeof r=="string"?"string":"hash"]:t.map}function q(e,r){var t=Wt(e,r);return yn(t)?t:void 0}var Hr=ur?De(ur,Object):Bn,j=dn;(ve&&j(new ve(new ArrayBuffer(1)))!=ie||Y&&j(new Y)!=te||Oe&&j(Oe.resolve())!=rr||Ae&&j(new Ae)!=ne||_e&&j(new _e)!=$e)&&(j=function(e){var r=se.call(e),t=r==We?e.constructor:void 0,i=t?M(t):void 0;if(i)switch(i){case Pt:return ie;case Bt:return te;case Jt:return rr;case Ft:return ne;case kt:return $e}return r});function En(e){var r=e.length,t=e.constructor(r);return r&&typeof e[0]=="string"&&V.call(e,"index")&&(t.index=e.index,t.input=e.input),t}function Wn(e){return typeof e.constructor=="function"&&!Mr(e)?gn(Ct(e)):{}}function Dn(e,r,t,i){var l=e.constructor;switch(r){case $r:return xe(e);case pr:case dr:return new l(+e);case ie:return bn(e,i);case vr:case Or:case Ar:case _r:case Ir:case Sr:case Er:case Wr:case Dr:return An(e,i);case te:return Tn(e,i,t);case mr:case br:return new l(e);case wr:return $n(e);case ne:return vn(e,i,t);case Tr:return On(e)}}function xn(e,r){return r=r==null?gr:r,!!r&&(typeof e=="number"||Tt.test(e))&&e>-1&&e%1==0&&e<r}function Nn(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}function Cn(e){return!!ar&&ar in e}function Mr(e){var r=e&&e.constructor,t=typeof r=="function"&&r.prototype||ae;return e===t}function M(e){if(e!=null){try{return Rr.call(e)}catch(r){}try{return e+""}catch(r){}}return""}function Rn(e){return Ie(e,!0,!0)}function Pr(e,r){return e===r||e!==e&&r!==r}function Vn(e){return jn(e)&&V.call(e,"callee")&&(!Vt.call(e,"callee")||se.call(e)==Se)}var Ne=Array.isArray;function Br(e){return e!=null&&Mn(e.length)&&!Jr(e)}function jn(e){return Pn(e)&&Br(e)}var Hn=Ht||Jn;function Jr(e){var r=ue(e)?se.call(e):"";return r==Ee||r==yr}function Mn(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=gr}function ue(e){var r=typeof e;return!!e&&(r=="object"||r=="function")}function Pn(e){return!!e&&typeof e=="object"}function Ce(e){return Br(e)?cn(e):mn(e)}function Bn(){return[]}function Jn(){return!1}F.exports=Rn});var Lr=ke((kr,ge)=>{(function(e,r){"use strict";typeof ge=="object"&&typeof ge.exports=="object"?ge.exports=r():typeof define=="function"&&define.amd?define([],r):e.objectPath=r()})(kr,function(){"use strict";var e=Object.prototype.toString;function r(c,h){return c==null?!1:Object.prototype.hasOwnProperty.call(c,h)}function t(c){if(!c||n(c)&&c.length===0)return!0;if(typeof c!="string"){for(var h in c)if(r(c,h))return!1;return!0}return!1}function i(c){return e.call(c)}function l(c){return typeof c=="object"&&i(c)==="[object Object]"}var n=Array.isArray||function(c){return e.call(c)==="[object Array]"};function o(c){return typeof c=="boolean"||i(c)==="[object Boolean]"}function s(c){var h=parseInt(c);return h.toString()===c?h:c}function p(c){c=c||{};var h=function(d){return Object.keys(h).reduce(function(u,g){return g==="create"||typeof h[g]=="function"&&(u[g]=h[g].bind(h,d)),u},{})},T;c.includeInheritedProps?T=function(){return!0}:T=function(d,u){return typeof u=="number"&&Array.isArray(d)||r(d,u)};function y(d,u){if(T(d,u))return d[u]}var f;c.includeInheritedProps?f=function(d,u){typeof u!="string"&&typeof u!="number"&&(u=String(u));var g=y(d,u);if(u==="__proto__"||u==="prototype"||u==="constructor"&&typeof g=="function")throw new Error("For security reasons, object's magic properties cannot be set");return g}:f=function(d,u){return y(d,u)};function w(d,u,g,m){if(typeof u=="number"&&(u=[u]),!u||u.length===0)return d;if(typeof u=="string")return w(d,u.split(".").map(s),g,m);var b=u[0],A=f(d,b);return u.length===1?((A===void 0||!m)&&(d[b]=g),A):(A===void 0&&(typeof u[1]=="number"?d[b]=[]:d[b]={}),w(d[b],u.slice(1),g,m))}return h.has=function(d,u){if(typeof u=="number"?u=[u]:typeof u=="string"&&(u=u.split(".")),!u||u.length===0)return!!d;for(var g=0;g<u.length;g++){var m=s(u[g]);if(typeof m=="number"&&n(d)&&m<d.length||(c.includeInheritedProps?m in Object(d):r(d,m)))d=d[m];else return!1}return!0},h.ensureExists=function(d,u,g){return w(d,u,g,!0)},h.set=function(d,u,g,m){return w(d,u,g,m)},h.insert=function(d,u,g,m){var b=h.get(d,u);m=~~m,n(b)||(b=[],h.set(d,u,b)),b.splice(m,0,g)},h.empty=function(d,u){if(!t(u)&&d!=null){var g,m;if(g=h.get(d,u)){if(typeof g=="string")return h.set(d,u,"");if(o(g))return h.set(d,u,!1);if(typeof g=="number")return h.set(d,u,0);if(n(g))g.length=0;else if(l(g))for(m in g)T(g,m)&&delete g[m];else return h.set(d,u,null)}}},h.push=function(d,u){var g=h.get(d,u);n(g)||(g=[],h.set(d,u,g)),g.push.apply(g,Array.prototype.slice.call(arguments,2))},h.coalesce=function(d,u,g){for(var m,b=0,A=u.length;b<A;b++)if((m=h.get(d,u[b]))!==void 0)return m;return g},h.get=function(d,u,g){if(typeof u=="number"&&(u=[u]),!u||u.length===0)return d;if(d==null)return g;if(typeof u=="string")return h.get(d,u.split("."),g);var m=s(u[0]),b=f(d,m);return b===void 0?g:u.length===1?b:h.get(d[m],u.slice(1),g)},h.del=function(u,g){if(typeof g=="number"&&(g=[g]),u==null||t(g))return u;if(typeof g=="string")return h.del(u,g.split("."));var m=s(g[0]);if(f(u,m),!T(u,m))return u;if(g.length===1)n(u)?u.splice(m,1):delete u[m];else return h.del(u[m],g.slice(1));return u},h}var a=p();return a.create=p,a.withInheritedProps=p({includeInheritedProps:!0}),a})});var Xn={};it(Xn,{defaults:()=>Gr,jVar:()=>Yn,version:()=>Un});function S(e){return typeof e!="string"?e:e.length?[e]:[]}function I(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 $(e){return typeof e=="string"}function qe(e){return Number.isFinite(e)}function N(e){return Number.isSafeInteger(e)&&e>=0}function ee(e){return typeof e=="boolean"}function G(e){return e===null}function W(e){return e!=null}function Ue(e,r){return I(e)&&$(r)&&Object.prototype.hasOwnProperty.call(e,r)}var Ke={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},st=e=>e+1;function ot(e,r,t,i,l=!1,n=st){let o=typeof t=="function"?t():t;if(+r<0&&l&&o==="EOL")return o;let s=v(v({},Ke),i);if(r>=e.length&&!l)return!1;let p=l?1:t.length,a=0,c=!1,h=!1,T=!1,y=s.maxMismatches,f=r,w=!1,d=!1,u=!1;function g(){return a===1&&y<s.maxMismatches-1}for(;e[f];){let m=n(f);if(s.trimBeforeMatching&&e[f].trim()===""){if(!e[m]&&l&&t==="EOL")return!0;f=n(f);continue}if(s&&!s.i&&s.trimCharsBeforeMatching&&s.trimCharsBeforeMatching.includes(e[f])||s!=null&&s.i&&s.trimCharsBeforeMatching&&s.trimCharsBeforeMatching.map(A=>A.toLowerCase()).includes(e[f].toLowerCase())){if(l&&t==="EOL"&&!e[m])return!0;f=n(f);continue}let b=m>f?t[t.length-p]:t[p-1];if(!s.i&&e[f]===b||s.i&&e[f].toLowerCase()===b.toLowerCase()){if(w||(w=!0),T||(T=!0),p===t.length){if(d=!0,y!==s.maxMismatches)return!1}else p===1&&(u=!0);if(p-=1,a++,g())return!1;if(!p)return a!==t.length||y===s.maxMismatches||!c?f:!1}else if(!c&&!a&&(c=!0),s.maxMismatches&&y&&f){y-=1;for(let A=0;A<=y;A++){let E=m>f?t[t.length-p+1+A]:t[p-2-A],pe=e[n(f)];if(E&&(!s.i&&e[f]===E||s.i&&e[f].toLowerCase()===E.toLowerCase())&&(!s.firstMustMatch||p!==t.length)){if(a++,g())return!1;p-=2,w=!0;break}else if(pe&&E&&(!s.i&&pe===E||s.i&&pe.toLowerCase()===E.toLowerCase())&&(!s.firstMustMatch||p!==t.length)){if(!a&&!s.hungry)return!1;p-=1,w=!0;break}else if(E===void 0&&y>=0&&w&&(!s.firstMustMatch||d)&&(!s.lastMustMatch||u))return f}w||(h=f)}else return f===0&&p===1&&!s.lastMustMatch&&T?0:!1;if(h!==!1&&h!==f&&(h=!1),p<1)return f;f=n(f)}if(p>0)return l&&o==="EOL"?!0:s&&s.maxMismatches>=p&&T?h||0:!1}function Ge(e,r,t,i,l){var c,h;if(I(l)&&Ue(l,"trimBeforeMatching")&&l&&typeof l.trimBeforeMatching!="boolean")throw new Error(`string-match-left-right/${e}(): [THROW_ID_09] opts.trimBeforeMatching should be boolean!${Array.isArray(l.trimBeforeMatching)?" Did you mean to use opts.trimCharsBeforeMatching?":""}`);let n=v(v({},Ke),l);if(typeof n.trimCharsBeforeMatching=="string"&&(n.trimCharsBeforeMatching=S(n.trimCharsBeforeMatching)),n.trimCharsBeforeMatching=n.trimCharsBeforeMatching.map(T=>$(T)?T:String(T)),!$(r)||!r.length)return!1;if(!Number.isInteger(t)||t<0)throw new Error(`string-match-left-right/${e}(): [THROW_ID_03] the second argument should be a natural number. Currently it's of a type: ${typeof t}, equal to:
|
|
11
|
-
${JSON.stringify(
|
|
12
|
-
${JSON.stringify(
|
|
13
|
-
${JSON.stringify(l,null,4)}`);let
|
|
14
|
-
`:"\r",
|
|
15
|
-
`;if(!
|
|
16
|
-
`.includes(
|
|
17
|
-
${JSON.stringify(r,null,4)} (type ${typeof r})`);else
|
|
18
|
-
${JSON.stringify(
|
|
19
|
-
${JSON.stringify(r,null,4)} (type ${typeof r})`);else
|
|
20
|
-
${JSON.stringify(e,null,4)}`);let
|
|
21
|
-
`||
|
|
22
|
-
${JSON.stringify(r,null,4)}`)}else if(
|
|
23
|
-
${JSON.stringify(r,null,4)}.`)}else if(l.relaxedAPI){if(r=r.filter(
|
|
24
|
-
${JSON.stringify(
|
|
25
|
-
${JSON.stringify(r,null,4)}`);if(
|
|
26
|
-
${JSON.stringify(
|
|
27
|
-
${JSON.stringify(
|
|
28
|
-
${JSON.stringify(
|
|
29
|
-
${JSON.stringify(
|
|
10
|
+
"use strict";var jsonVariables=(()=>{var xe=Object.create;var M=Object.defineProperty,Re=Object.defineProperties,Ve=Object.getOwnPropertyDescriptor,Ce=Object.getOwnPropertyDescriptors,Me=Object.getOwnPropertyNames,se=Object.getOwnPropertySymbols,He=Object.getPrototypeOf,ae=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable;var K=(e,r,n)=>r in e?M(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n,A=(e,r)=>{for(var n in r||(r={}))ae.call(r,n)&&K(e,n,r[n]);if(se)for(var n of se(r))je.call(r,n)&&K(e,n,r[n]);return e},H=(e,r)=>Re(e,Ce(r));var oe=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),Be=(e,r)=>{for(var n in r)M(e,n,{get:r[n],enumerable:!0})},le=(e,r,n,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let l of Me(r))!ae.call(e,l)&&l!==n&&M(e,l,{get:()=>r[l],enumerable:!(a=Ve(r,l))||a.enumerable});return e};var z=(e,r,n)=>(n=e!=null?xe(He(e)):{},le(r||!e||!e.__esModule?M(n,"default",{value:e,enumerable:!0}):n,e)),Pe=e=>le(M({},"__esModule",{value:!0}),e);var G=(e,r,n)=>(K(e,typeof r!="symbol"?r+"":r,n),n);var Y=oe((Kr,be)=>{"use strict";be.exports=Ge;function C(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function Ge(e){if(e=e||{},e.circles)return Qe(e);return e.proto?a:n;function r(l,t){for(var o=Object.keys(l),s=new Array(o.length),u=0;u<o.length;u++){var i=o[u],g=l[i];typeof g!="object"||g===null?s[i]=g:g instanceof Date?s[i]=new Date(g):ArrayBuffer.isView(g)?s[i]=C(g):s[i]=t(g)}return s}function n(l){if(typeof l!="object"||l===null)return l;if(l instanceof Date)return new Date(l);if(Array.isArray(l))return r(l,n);if(l instanceof Map)return new Map(r(Array.from(l),n));if(l instanceof Set)return new Set(r(Array.from(l),n));var t={};for(var o in l)if(Object.hasOwnProperty.call(l,o)!==!1){var s=l[o];typeof s!="object"||s===null?t[o]=s:s instanceof Date?t[o]=new Date(s):s instanceof Map?t[o]=new Map(r(Array.from(s),n)):s instanceof Set?t[o]=new Set(r(Array.from(s),n)):ArrayBuffer.isView(s)?t[o]=C(s):t[o]=n(s)}return t}function a(l){if(typeof l!="object"||l===null)return l;if(l instanceof Date)return new Date(l);if(Array.isArray(l))return r(l,a);if(l instanceof Map)return new Map(r(Array.from(l),a));if(l instanceof Set)return new Set(r(Array.from(l),a));var t={};for(var o in l){var s=l[o];typeof s!="object"||s===null?t[o]=s:s instanceof Date?t[o]=new Date(s):s instanceof Map?t[o]=new Map(r(Array.from(s),a)):s instanceof Set?t[o]=new Set(r(Array.from(s),a)):ArrayBuffer.isView(s)?t[o]=C(s):t[o]=a(s)}return t}}function Qe(e){var r=[],n=[];return e.proto?t:l;function a(o,s){for(var u=Object.keys(o),i=new Array(u.length),g=0;g<u.length;g++){var c=u[g],b=o[c];if(typeof b!="object"||b===null)i[c]=b;else if(b instanceof Date)i[c]=new Date(b);else if(ArrayBuffer.isView(b))i[c]=C(b);else{var y=r.indexOf(b);y!==-1?i[c]=n[y]:i[c]=s(b)}}return i}function l(o){if(typeof o!="object"||o===null)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return a(o,l);if(o instanceof Map)return new Map(a(Array.from(o),l));if(o instanceof Set)return new Set(a(Array.from(o),l));var s={};r.push(o),n.push(s);for(var u in o)if(Object.hasOwnProperty.call(o,u)!==!1){var i=o[u];if(typeof i!="object"||i===null)s[u]=i;else if(i instanceof Date)s[u]=new Date(i);else if(i instanceof Map)s[u]=new Map(a(Array.from(i),l));else if(i instanceof Set)s[u]=new Set(a(Array.from(i),l));else if(ArrayBuffer.isView(i))s[u]=C(i);else{var g=r.indexOf(i);g!==-1?s[u]=n[g]:s[u]=l(i)}}return r.pop(),n.pop(),s}function t(o){if(typeof o!="object"||o===null)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return a(o,t);if(o instanceof Map)return new Map(a(Array.from(o),t));if(o instanceof Set)return new Set(a(Array.from(o),t));var s={};r.push(o),n.push(s);for(var u in o){var i=o[u];if(typeof i!="object"||i===null)s[u]=i;else if(i instanceof Date)s[u]=new Date(i);else if(i instanceof Map)s[u]=new Map(a(Array.from(i),t));else if(i instanceof Set)s[u]=new Set(a(Array.from(i),t));else if(ArrayBuffer.isView(i))s[u]=C(i);else{var g=r.indexOf(i);g!==-1?s[u]=n[g]:s[u]=t(i)}}return r.pop(),n.pop(),s}}});var Ee=oe((Oe,q)=>{(function(e,r){"use strict";typeof q=="object"&&typeof q.exports=="object"?q.exports=r():typeof define=="function"&&define.amd?define([],r):e.objectPath=r()})(Oe,function(){"use strict";var e=Object.prototype.toString;function r(g,c){return g==null?!1:Object.prototype.hasOwnProperty.call(g,c)}function n(g){if(!g||t(g)&&g.length===0)return!0;if(typeof g!="string"){for(var c in g)if(r(g,c))return!1;return!0}return!1}function a(g){return e.call(g)}function l(g){return typeof g=="object"&&a(g)==="[object Object]"}var t=Array.isArray||function(g){return e.call(g)==="[object Array]"};function o(g){return typeof g=="boolean"||a(g)==="[object Boolean]"}function s(g){var c=parseInt(g);return c.toString()===g?c:g}function u(g){g=g||{};var c=function(d){return Object.keys(c).reduce(function(f,p){return p==="create"||typeof c[p]=="function"&&(f[p]=c[p].bind(c,d)),f},{})},b;g.includeInheritedProps?b=function(){return!0}:b=function(d,f){return typeof f=="number"&&Array.isArray(d)||r(d,f)};function y(d,f){if(b(d,f))return d[f]}var h;g.includeInheritedProps?h=function(d,f){typeof f!="string"&&typeof f!="number"&&(f=String(f));var p=y(d,f);if(f==="__proto__"||f==="prototype"||f==="constructor"&&typeof p=="function")throw new Error("For security reasons, object's magic properties cannot be set");return p}:h=function(d,f){return y(d,f)};function w(d,f,p,m){if(typeof f=="number"&&(f=[f]),!f||f.length===0)return d;if(typeof f=="string")return w(d,f.split(".").map(s),p,m);var $=f[0],T=h(d,$);return f.length===1?((T===void 0||!m)&&(d[$]=p),T):(T===void 0&&(typeof f[1]=="number"?d[$]=[]:d[$]={}),w(d[$],f.slice(1),p,m))}return c.has=function(d,f){if(typeof f=="number"?f=[f]:typeof f=="string"&&(f=f.split(".")),!f||f.length===0)return!!d;for(var p=0;p<f.length;p++){var m=s(f[p]);if(typeof m=="number"&&t(d)&&m<d.length||(g.includeInheritedProps?m in Object(d):r(d,m)))d=d[m];else return!1}return!0},c.ensureExists=function(d,f,p){return w(d,f,p,!0)},c.set=function(d,f,p,m){return w(d,f,p,m)},c.insert=function(d,f,p,m){var $=c.get(d,f);m=~~m,t($)||($=[],c.set(d,f,$)),$.splice(m,0,p)},c.empty=function(d,f){if(!n(f)&&d!=null){var p,m;if(p=c.get(d,f)){if(typeof p=="string")return c.set(d,f,"");if(o(p))return c.set(d,f,!1);if(typeof p=="number")return c.set(d,f,0);if(t(p))p.length=0;else if(l(p))for(m in p)b(p,m)&&delete p[m];else return c.set(d,f,null)}}},c.push=function(d,f){var p=c.get(d,f);t(p)||(p=[],c.set(d,f,p)),p.push.apply(p,Array.prototype.slice.call(arguments,2))},c.coalesce=function(d,f,p){for(var m,$=0,T=f.length;$<T;$++)if((m=c.get(d,f[$]))!==void 0)return m;return p},c.get=function(d,f,p){if(typeof f=="number"&&(f=[f]),!f||f.length===0)return d;if(d==null)return p;if(typeof f=="string")return c.get(d,f.split("."),p);var m=s(f[0]),$=h(d,m);return $===void 0?p:f.length===1?$:c.get(d[m],f.slice(1),p)},c.del=function(f,p){if(typeof p=="number"&&(p=[p]),f==null||n(p))return f;if(typeof p=="string")return c.del(f,p.split("."));var m=s(p[0]);if(h(f,m),!b(f,m))return f;if(p.length===1)t(f)?f.splice(m,1):delete f[m];else return c.del(f[m],p.slice(1));return f},c}var i=u();return i.create=u,i.withInheritedProps=u({includeInheritedProps:!0}),i})});var lr={};Be(lr,{defaults:()=>De,jVar:()=>or,version:()=>rr});function W(e){return typeof e!="string"?e:e.length?[e]:[]}function E(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 v(e){return typeof e=="string"}function fe(e){return Number.isFinite(e)}function _(e){return Number.isSafeInteger(e)&&e>=0}function J(e){return typeof e=="boolean"}function j(e){return e===null}function S(e){return e!=null}function ue(e,r){return E(e)&&v(r)&&r in e}var ge={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},Je=e=>e+1;function Fe(e,r,n,a,l=!1,t=Je){let o=typeof n=="function"?n():n;if(+r<0&&l&&o==="EOL")return o;let s=A(A({},ge),a);if(r>=e.length&&!l)return!1;let u=l?1:n.length,i=0,g=!1,c=!1,b=!1,y=s.maxMismatches,h=r,w=!1,d=!1,f=!1;function p(){return i===1&&y<s.maxMismatches-1}for(;e[h];){let m=t(h);if(s.trimBeforeMatching&&e[h].trim()===""){if(!e[m]&&l&&n==="EOL")return!0;h=t(h);continue}if(s&&!s.i&&s.trimCharsBeforeMatching&&s.trimCharsBeforeMatching.includes(e[h])||s!=null&&s.i&&s.trimCharsBeforeMatching&&s.trimCharsBeforeMatching.map(T=>T.toLowerCase()).includes(e[h].toLowerCase())){if(l&&n==="EOL"&&!e[m])return!0;h=t(h);continue}let $=m>h?n[n.length-u]:n[u-1];if(!s.i&&e[h]===$||s.i&&e[h].toLowerCase()===$.toLowerCase()){if(w||(w=!0),b||(b=!0),u===n.length){if(d=!0,y!==s.maxMismatches)return!1}else u===1&&(f=!0);if(u-=1,i++,p())return!1;if(!u)return i!==n.length||y===s.maxMismatches||!g?h:!1}else if(!g&&!i&&(g=!0),s.maxMismatches&&y&&h){y-=1;for(let T=0;T<=y;T++){let I=m>h?n[n.length-u+1+T]:n[u-2-T],U=e[t(h)];if(I&&(!s.i&&e[h]===I||s.i&&e[h].toLowerCase()===I.toLowerCase())&&(!s.firstMustMatch||u!==n.length)){if(i++,p())return!1;u-=2,w=!0;break}else if(U&&I&&(!s.i&&U===I||s.i&&U.toLowerCase()===I.toLowerCase())&&(!s.firstMustMatch||u!==n.length)){if(!i&&!s.hungry)return!1;u-=1,w=!0;break}else if(I===void 0&&y>=0&&w&&(!s.firstMustMatch||d)&&(!s.lastMustMatch||f))return h}w||(c=h)}else return h===0&&u===1&&!s.lastMustMatch&&b?0:!1;if(c!==!1&&c!==h&&(c=!1),u<1)return h;h=t(h)}if(u>0)return l&&o==="EOL"?!0:s&&s.maxMismatches>=u&&b?c||0:!1}function he(e,r,n,a,l){var g,c;if(E(l)&&ue(l,"trimBeforeMatching")&&l&&typeof l.trimBeforeMatching!="boolean")throw new Error(`string-match-left-right/${e}(): [THROW_ID_09] opts.trimBeforeMatching should be boolean!${Array.isArray(l.trimBeforeMatching)?" Did you mean to use opts.trimCharsBeforeMatching?":""}`);let t=A(A({},ge),l);if(typeof t.trimCharsBeforeMatching=="string"&&(t.trimCharsBeforeMatching=W(t.trimCharsBeforeMatching)),t.trimCharsBeforeMatching=t.trimCharsBeforeMatching.map(b=>v(b)?b:String(b)),!v(r)||!r.length)return!1;if(!Number.isInteger(n)||n<0)throw new Error(`string-match-left-right/${e}(): [THROW_ID_03] the second argument should be a natural number. Currently it's of a type: ${typeof n}, equal to:
|
|
11
|
+
${JSON.stringify(n,null,4)}`);let o,s;if(v(a))o=[a];else if(Array.isArray(a))o=a;else if(!a)o=a;else if(typeof a=="function")o=[],o.push(a);else throw new Error(`string-match-left-right/${e}(): [THROW_ID_05] the third argument, whatToMatch, is neither string nor array of strings! It's ${typeof a}, equal to:
|
|
12
|
+
${JSON.stringify(a,null,4)}`);if(l&&!E(l))throw new Error(`string-match-left-right/${e}(): [THROW_ID_06] the fourth argument, options object, should be a plain object. Currently it's of a type "${typeof l}", and equal to:
|
|
13
|
+
${JSON.stringify(l,null,4)}`);let u=0,i="";if(t!=null&&t.trimCharsBeforeMatching&&t.trimCharsBeforeMatching.some((b,y)=>b.length>1?(u=y,i=b,!0):!1))throw new Error(`string-match-left-right/${e}(): [THROW_ID_07] the fourth argument, options object contains trimCharsBeforeMatching. It was meant to list the single characters but one of the entries at index ${u} is longer than 1 character, ${i.length} (equals to ${i}). Please split it into separate characters and put into array as separate elements.`);if(!o||!Array.isArray(o)||Array.isArray(o)&&!o.length||Array.isArray(o)&&o.length===1&&v(o[0])&&!o[0].trim()){if(typeof t.cb=="function"){let y,h=n;if((e==="matchLeftIncl"||e==="matchRight")&&(h+=1),e[5]==="L")for(let p=h;p--;){let m=r[p];if((!t.trimBeforeMatching||t.trimBeforeMatching&&m!==void 0&&m.trim())&&(!((g=t.trimCharsBeforeMatching)!=null&&g.length)||m!==void 0&&!t.trimCharsBeforeMatching.includes(m))){y=p;break}}else if(e.startsWith("matchRight"))for(let p=h;p<r.length;p++){let m=r[p];if((!t.trimBeforeMatching||t.trimBeforeMatching&&m.trim())&&(!((c=t.trimCharsBeforeMatching)!=null&&c.length)||!t.trimCharsBeforeMatching.includes(m))){y=p;break}}if(y===void 0)return!1;let w=r[y],d=y+1,f="";return d&&d>0&&(f=r.slice(0,d)),e[5]==="L"||y&&y>0&&(f=r.slice(y)),t.cb(w,f,y)}let b="";throw l||(b=" More so, the whole options object, the fourth input argument, is missing!"),new Error(`string-match-left-right/${e}(): [THROW_ID_08] the third argument, "whatToMatch", was given as an empty string. This means, you intend to match purely by a callback. The callback was not set though, the opts key "cb" is not set!${b}`)}for(let b=0,y=o.length;b<y;b++){s=typeof o[b]=="function";let h=o[b],w,d,f="",p=n;e==="matchRight"?p+=1:e==="matchLeft"&&(p-=1);let m=Fe(r,p,h,t,s,$=>e[5]==="L"?$-1:$+1);if(m&&s&&typeof h=="function"&&h()==="EOL")return h()&&(!t.cb||t.cb(w,f,d))?h():!1;if(Number.isInteger(m)&&(d=e.startsWith("matchLeft")?m-1:m+1,e[5]==="L"?f=r.slice(0,m):f=r.slice(d)),d<0&&(d=void 0),r[d]&&(w=r[d]),Number.isInteger(m)&&(!t.cb||t.cb(w,f,d)))return h}return!1}function x(e,r,n,a){return he("matchLeftIncl",e,r,n,a)}function D(e,r,n,a){return he("matchRightIncl",e,r,n,a)}function F(e,r=1){let n="\xA0";function a(t){return Array.from(t).reverse().join("")}function l(t,o,s){let u=s?`
|
|
14
|
+
`:"\r",i=s?"\r":`
|
|
15
|
+
`;if(!t)return t;let g=0,c=0,b="";for(let y=0,h=t.length;y<h;y++)(t[y]===u||t[y]===i&&t[y-1]!==u)&&c++,`\r
|
|
16
|
+
`.includes(t[y])||t[y]===n?(g=0,t[y]===n?b+=t[y]:t[y]===u?c<=o&&(b+=t[y],t[y+1]===i&&(b+=t[y+1],y++)):t[y]===i&&(t==null?void 0:t[y-1])!==u&&c<=o&&(b+=t[y])):(g++,!t[y+1]&&!c&&(b+=" "));return b}if(typeof e=="string"&&e.length){let t=1;typeof+r=="number"&&Number.isInteger(+r)&&+r>=0&&(t=+r);let o="",s="";if(!e.trim())o=e;else if(!e[0].trim()){for(let u=0,i=e.length;u<i;u++)if(e[u].trim()){o=e.slice(0,u);break}}if(e.trim()&&(e.slice(-1).trim()===""||e.slice(-1)===n)){for(let u=e.length;u--;)if(e[u].trim()){s=e.slice(u+1);break}}return`${l(o,t,!1)}${e.trim()}${a(l(a(s),t,!0))}`}return e}var Le={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function R(e,r){if(!Array.isArray(e)||!e.length)return e;let n=A(A({},Le),r),a,l;if(n.strictlyTwoElementsInRangeArrays&&!e.every((s,u)=>!Array.isArray(s)||s.length!==2?(a=u,l=s.length,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_03] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ${a}th range (${JSON.stringify(e[a],null,4)}) has not two but ${l} elements!`);if(!e.every((s,u)=>!Array.isArray(s)||!Number.isInteger(s[0])||s[0]<0||!Number.isInteger(s[1])||s[1]<0?(a=u,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_04] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ${a}th range (${JSON.stringify(e[a],null,4)}) does not consist of only natural numbers!`);let t=e.length**2,o=0;return Array.from(e).sort((s,u)=>(n.progressFn&&(o+=1,n.progressFn(Math.floor(o*100/t))),s[0]===u[0]?s[1]<u[1]?-1:s[1]>u[1]?1:0:s[0]<u[0]?-1:1))}var ce={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function ke(e,r){function n(i){return!!i&&typeof i=="object"&&!Array.isArray(i)}if(!Array.isArray(e)||!e.length)return null;let a;if(r)if(n(r)){if(a=A(A({},ce),r),a.progressFn&&n(a.progressFn)&&!Object.keys(a.progressFn).length)a.progressFn=null;else if(a.progressFn&&typeof a.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] resolvedOpts.progressFn must be a function! It was given of a type: "${typeof a.progressFn}", equal to ${JSON.stringify(a.progressFn,null,4)}`);if(![1,2,"1","2"].includes(a.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "${typeof a.mergeType}", equal to ${JSON.stringify(a.mergeType,null,4)}`);if(typeof a.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] resolvedOpts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof a.joinRangesThatTouchEdges}", equal to ${JSON.stringify(a.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:
|
|
17
|
+
${JSON.stringify(r,null,4)} (type ${typeof r})`);else a=A({},ce);let l=e.filter(i=>Array.isArray(i)).map(i=>[...i]).filter(i=>i[2]!==void 0||i[0]!==i[1]),t,o,s;a.progressFn?t=R(l,{progressFn:i=>{s=Math.floor(i/5),s!==o&&(o=s,a.progressFn(s))}}):t=R(l);let u=t.length-1;for(let i=u;i>0;i--)a.progressFn&&(s=Math.floor((1-i/u)*78)+21,s!==o&&s>o&&(o=s,a.progressFn(s))),(t[i][0]<=t[i-1][0]||!a.joinRangesThatTouchEdges&&t[i][0]<t[i-1][1]||a.joinRangesThatTouchEdges&&t[i][0]<=t[i-1][1])&&(t[i-1][0]=Math.min(t[i][0],t[i-1][0]),t[i-1][1]=Math.max(t[i][1],t[i-1][1]),t[i][2]!==void 0&&(t[i-1][0]>=t[i][0]||t[i-1][1]<=t[i][1])&&t[i-1][2]!==null&&(t[i][2]===null&&t[i-1][2]!==null?t[i-1][2]=null:t[i-1][2]!=null?+a.mergeType==2&&t[i-1][0]===t[i][0]?t[i-1][2]=t[i][2]:t[i-1][2]+=t[i][2]:t[i-1][2]=t[i][2]),t.splice(i,1),i=t.length);return t.length?t:null}var qe={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1},B=class{constructor(e){G(this,"ranges");G(this,"opts");let r=A(A({},qe),e);if(r.mergeType&&r.mergeType!==1&&r.mergeType!==2)if(v(r.mergeType)&&r.mergeType.trim()==="1")r.mergeType=1;else if(v(r.mergeType)&&r.mergeType.trim()==="2")r.mergeType=2;else throw new Error(`ranges-push: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof r.mergeType}", equal to ${JSON.stringify(r.mergeType,null,4)}`);this.opts=r,this.ranges=[]}add(e,r,n){var t;if(e==null&&r==null)return;if(S(e)&&!S(r)){if(Array.isArray(e)){if(e.length){if(e.some(o=>Array.isArray(o))){e.forEach(o=>{Array.isArray(o)&&this.add(...o)});return}e.length&&_(+e[0])&&_(+e[1])&&this.add(...e)}return}throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_12] the first input argument, "from" is set (${JSON.stringify(e,null,0)}) but second-one, "to" is not (${JSON.stringify(r,null,0)})`)}else if(!S(e)&&S(r))throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_13] the second input argument, "to" is set (${JSON.stringify(r,null,0)}) but first-one, "from" is not (${JSON.stringify(e,null,0)})`);let a=+e,l=+r;if(_(n)&&(n=String(n)),_(a)&&_(l)){if(S(n)&&!v(n)&&!_(n))throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_08] The third argument, the value to add, was given not as string but ${typeof n}, equal to:
|
|
18
|
+
${JSON.stringify(n,null,4)}`);if(S(this.ranges)&&Array.isArray(this.last())&&a===this.last()[1]){if(this.last()[1]=l,this.last()[2],this.last()[2]!==null&&S(n)){let o=this.last()[2]&&this.last()[2].length&&(!((t=this.opts)!=null&&t.mergeType)||this.opts.mergeType===1)?`${this.last()[2]}${n}`:n;this.opts.limitToBeAddedWhitespace&&(o=F(o,this.opts.limitLinebreaksCount)),v(o)&&!o.length||(this.last()[2]=o)}}else{this.ranges||(this.ranges=[]);let o=n!==void 0&&!(v(n)&&!n.length)?[a,l,n&&this.opts.limitToBeAddedWhitespace?F(n,this.opts.limitLinebreaksCount):n]:[a,l];this.ranges.push(o)}}else throw _(a)&&a>=0?new TypeError(`ranges-push/Ranges/add(): [THROW_ID_10] "to" value, the second input argument, must be a natural number or zero! Currently it's of a type "${typeof l}" equal to: ${JSON.stringify(l,null,4)}`):new TypeError(`ranges-push/Ranges/add(): [THROW_ID_09] "from" value, the first input argument, must be a natural number or zero! Currently it's of a type "${typeof a}" equal to: ${JSON.stringify(a,null,4)}`)}push(e,r,n){this.add(e,r,n)}current(){return Array.isArray(this.ranges)&&this.ranges.length?(this.ranges=ke(this.ranges,{mergeType:this.opts.mergeType}),this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>S(e[2])?[e[0],e[1],F(e[2],this.opts.limitLinebreaksCount)]:e):this.ranges):null}wipe(){this.ranges=[]}replace(e){if(Array.isArray(e)&&e.length)if(Array.isArray(e[0])&&_(e[0][0]))this.ranges=Array.from(e);else throw new Error(`ranges-push/Ranges/replace(): [THROW_ID_11] Single range was given but we expected array of arrays! The first element, ${JSON.stringify(e[0],null,4)} should be an array and its first element should be an integer, a string index.`);else this.ranges=[]}last(){return Array.isArray(this.ranges)&&this.ranges.length?this.ranges[this.ranges.length-1]:null}};var pe={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function de(e,r){function n(i){return!!i&&typeof i=="object"&&!Array.isArray(i)}if(!Array.isArray(e)||!e.length)return null;let a;if(r)if(n(r)){if(a=A(A({},pe),r),a.progressFn&&n(a.progressFn)&&!Object.keys(a.progressFn).length)a.progressFn=null;else if(a.progressFn&&typeof a.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] opts.progressFn must be a function! It was given of a type: "${typeof a.progressFn}", equal to ${JSON.stringify(a.progressFn,null,4)}`);if(![1,2,"1","2"].includes(a.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof a.mergeType}", equal to ${JSON.stringify(a.mergeType,null,4)}`);if(typeof a.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof a.joinRangesThatTouchEdges}", equal to ${JSON.stringify(a.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:
|
|
19
|
+
${JSON.stringify(r,null,4)} (type ${typeof r})`);else a=A({},pe);let l=e.filter(i=>Array.isArray(i)).map(i=>[...i]).filter(i=>i[2]!==void 0||i[0]!==i[1]),t,o,s;a.progressFn?t=R(l,{progressFn:i=>{s=Math.floor(i/5),s!==o&&(o=s,a.progressFn(s))}}):t=R(l);let u=t.length-1;for(let i=u;i>0;i--)a.progressFn&&(s=Math.floor((1-i/u)*78)+21,s!==o&&s>o&&(o=s,a.progressFn(s))),(t[i][0]<=t[i-1][0]||!a.joinRangesThatTouchEdges&&t[i][0]<t[i-1][1]||a.joinRangesThatTouchEdges&&t[i][0]<=t[i-1][1])&&(t[i-1][0]=Math.min(t[i][0],t[i-1][0]),t[i-1][1]=Math.max(t[i][1],t[i-1][1]),t[i][2]!==void 0&&(t[i-1][0]>=t[i][0]||t[i-1][1]<=t[i][1])&&t[i-1][2]!==null&&(t[i][2]===null&&t[i-1][2]!==null?t[i-1][2]=null:t[i-1][2]!=null?+a.mergeType==2&&t[i-1][0]===t[i][0]?t[i-1][2]=t[i][2]:t[i-1][2]+=t[i][2]:t[i-1][2]=t[i][2]),t.splice(i,1),i=t.length);return t.length?t:null}var Ue=!0,Q="Invariant failed";function ye(e,r){if(!e){if(Ue)throw new Error(Q);var n=typeof r=="function"?r():r,a=n?"".concat(Q,": ").concat(n):Q;throw new Error(a)}}function V(e,r,n){let a=0,l=0;if(arguments.length===0)throw new Error("ranges-apply: [THROW_ID_01] inputs missing!");if(typeof e!="string")throw new TypeError(`ranges-apply: [THROW_ID_02] first input argument must be a string! Currently it's: ${typeof e}, equal to: ${JSON.stringify(e,null,4)}`);if(r&&!Array.isArray(r))throw new TypeError(`ranges-apply: [THROW_ID_03] second input argument must be an array (or null)! Currently it's: ${typeof r}, equal to: ${JSON.stringify(r,null,4)}`);if(n&&typeof n!="function")throw new TypeError(`ranges-apply: [THROW_ID_04] the third input argument must be a function (or falsey)! Currently it's: ${typeof n}, equal to: ${JSON.stringify(n,null,4)}`);if(!(r!=null&&r.filter(g=>g).length))return e;let t;Array.isArray(r)&&Number.isInteger(r[0])&&Number.isInteger(r[1])?t=[Array.from(r)]:t=Array.from(r);let o=t.length,s=0;t.filter(g=>g).forEach((g,c)=>{if(n&&(a=Math.floor(s/o*10),a!==l&&(l=a,n(a))),!Array.isArray(g))throw new TypeError(`ranges-apply: [THROW_ID_05] ranges array, second input arg., has ${c}th element not an array: ${JSON.stringify(g,null,4)}, which is ${typeof g}`);if(!Number.isInteger(g[0])){if(!Number.isInteger(+g[0])||+g[0]<0)throw new TypeError(`ranges-apply: [THROW_ID_06] ranges array, second input arg. has ${c}th element, array ${JSON.stringify(g,null,0)}. Its first element is not an integer, string index, but ${typeof g[0]}, equal to: ${JSON.stringify(g[0],null,4)}.`);t[c][0]=+t[c][0]}if(!Number.isInteger(g[1])){if(!Number.isInteger(+g[1])||+g[1]<0)throw new TypeError(`ranges-apply: [THROW_ID_07] ranges array, second input arg. has ${c}th element, array ${JSON.stringify(g,null,0)}. Its second element is not an integer, string index, but ${typeof g[1]}, equal to: ${JSON.stringify(g[1],null,4)}.`);t[c][1]=+t[c][1]}s+=1});let u=de(t,{progressFn:g=>{n&&(a=10+Math.floor(g/10),a!==l&&(l=a,n(a)))}});ye(u);let i=u.length;if(i>0){let g=e.slice(u[i-1][1]);e=u.reduce((c,b,y,h)=>{n&&(a=20+Math.floor(y/i*80),a!==l&&(l=a,n(a)));let w=y===0?0:h[y-1][1],d=h[y][0];return`${c}${e.slice(w,d)}${h[y][2]||""}`},""),e+=g}return e}var Ke={classicTrim:!1,cr:!1,lf:!1,tab:!1,space:!0,nbsp:!1};function P(e,r){if(typeof e!="string")throw new Error(`string-trim-spaces-only: [THROW_ID_01] input must be string! It was given as ${typeof e}, equal to:
|
|
20
|
+
${JSON.stringify(e,null,4)}`);let n=A(A({},Ke),r);function a(o){return n.classicTrim&&!o.trim()||!n.classicTrim&&(n.space&&o===" "||n.cr&&o==="\r"||n.lf&&o===`
|
|
21
|
+
`||n.tab&&o===" "||n.nbsp&&o==="\xA0")}let l,t;if(e.length){if(a(e[0]))for(let o=0,s=e.length;o<s;o++){if(!a(e[o])){l=o;break}if(o===e.length-1)return{res:"",ranges:[[0,e.length]]}}if(a(e[e.length-1])){for(let o=e.length;o--;)if(!a(e[o])){t=o+1;break}}return l?t?{res:e.slice(l,t),ranges:[[0,l],[t,e.length]]}:{res:e.slice(l),ranges:[[0,l]]}:t?{res:e.slice(0,t),ranges:[[t,e.length]]}:{res:e,ranges:[]}}return{res:"",ranges:[]}}var ze={heads:["{{"],tails:["}}"]};function me(e,r){let n=Object.prototype.hasOwnProperty;if(e===void 0)throw new Error("string-remove-duplicate-heads-tails: [THROW_ID_01] The input is missing!");if(typeof e!="string")return e;if(r&&!E(r))throw new Error(`string-remove-duplicate-heads-tails: [THROW_ID_03] The given options are not a plain object but ${typeof r}!`);let a=A({},r);if(a&&n.call(a,"heads"))if(W(a.heads).every(w=>typeof w=="string"||Array.isArray(w)))typeof a.heads=="string"&&(a.heads=W(a.heads));else throw new Error("string-remove-duplicate-heads-tails: [THROW_ID_04] The resolvedOpts.heads contains elements which are not string-type!");if(a&&n.call(a,"tails"))if(W(a.tails).every(w=>typeof w=="string"||Array.isArray(w)))typeof a.tails=="string"&&(a.tails=W(a.tails));else throw new Error("string-remove-duplicate-heads-tails: [THROW_ID_05] The resolvedOpts.tails contains elements which are not string-type!");let l=P(e).res;if(l.length===0)return e;e=l;let t=A(A({},ze),a);t.heads=t.heads.map(w=>w.trim()),t.tails=t.tails.map(w=>w.trim());let o=!1,s=!1,u=new B({limitToBeAddedWhitespace:!0}),i=new B({limitToBeAddedWhitespace:!0}),g=!0,c=!0,b="";function y(w,d){let f;return D(w,0,d.heads,{trimBeforeMatching:!0,cb:(p,m,$)=>(f=$,!0)})&&D(w,f,d.tails,{trimBeforeMatching:!0,cb:(p,m,$)=>(f=$,!0)})?w.slice(f):w}for(;e!==y(e,t);)e=P(y(e,t)).res;function h(w,d){let f;return!x(w,w.length-1,d.tails,{trimBeforeMatching:!0,cb:(p,m,$)=>(f=$,!0)})||!f?w:x(w,f,d.heads,{trimBeforeMatching:!0,cb:(p,m,$)=>(f=$,!0)})?w.slice(0,f+1):w}for(;e!==h(e,t);)e=P(h(e,t)).res;if(!t.heads.length||!D(e,0,t.heads,{trimBeforeMatching:!0})||!t.tails.length||!x(e,e.length-1,t.tails,{trimBeforeMatching:!0}))return P(e).res;for(let w=0,d=e.length;w<d;w++)if(e[w].trim()!==""){let f;if(D(e,w,t.heads,{trimBeforeMatching:!0,cb:(p,m,$)=>(f=$,!0)})&&f){c=!0,g&&(g=!0);let p;D(e,f,t.tails,{trimBeforeMatching:!0,cb:(m,$,T)=>(p=T,!0)})&&u.push(w,p),i.current()&&o&&b!=="tails"&&u.push(i.current()),o||i.current()&&(u.push(i.current()),i.wipe()),i.push(w,f),b="heads",w=f-1;continue}if(D(e,w,t.tails,{trimBeforeMatching:!0,cb:(p,m,$)=>(f=Number.isInteger($)?$:e.length,!0)})&&f){c=!0,g?(b==="heads"&&i.wipe(),g=!1):i.push(w,f),b="tails",w=f-1;continue}g&&(g=!0),c&&!o?(o=!0,c=!1):c&&!s?(s=!0,g=!0,c=!1,b==="heads"&&i.wipe()):c&&s&&i.wipe()}return i.current()&&u.push(i.current()),u.current()?V(e,u.current()).trim():e.trim()}var we={fromIndex:0,throwWhenSomethingWrongIsDetected:!0,allowWholeValueToBeOnlyHeadsOrTails:!0,source:"string-find-heads-tails",matchHeadsAndTailsStrictlyInPairsByTheirOrder:!1,relaxedAPI:!1};function Z(e,r,n,a){if(S(a)&&!E(a))throw new TypeError(`string-find-heads-tails: [THROW_ID_01] the fourth input argument, an Optional Options Object, must be a plain object! Currently it's equal to: ${a} (type: ${typeof a})`);let l=A(A({},we),a);if(v(l.fromIndex)&&/^\d*$/.test(l.fromIndex))l.fromIndex=Number(l.fromIndex);else if(!Number.isInteger(l.fromIndex)||l.fromIndex<0)throw new TypeError(`${l.source} [THROW_ID_18] the fourth input argument must be a natural number or zero! Currently it's: ${l.fromIndex}`);if(!v(e)||e.length===0){if(l.relaxedAPI)return[];throw new TypeError(`string-find-heads-tails: [THROW_ID_02] the first input argument, input string, must be a non-zero-length string! Currently it's: ${typeof e}, equal to: ${e}`)}let t,o;if(!v(r)&&!Array.isArray(r)){if(l.relaxedAPI)return[];throw new TypeError(`string-find-heads-tails: [THROW_ID_03] the second input argument, heads, must be either a string or an array of strings! Currently it's: ${typeof r}, equal to:
|
|
22
|
+
${JSON.stringify(r,null,4)}`)}else if(v(r))if(r.length===0){if(l.relaxedAPI)return[];throw new TypeError("string-find-heads-tails: [THROW_ID_04] the second input argument, heads, must be a non-empty string! Currently it's empty.")}else r=W(r);else if(Array.isArray(r))if(r.length===0){if(l.relaxedAPI)return[];throw new TypeError("string-find-heads-tails: [THROW_ID_05] the second input argument, heads, must be a non-empty array and contain at least one string! Currently it's empty.")}else if(r.every((h,w)=>(t=h,o=w,v(h)))){if(!r.every((h,w)=>(o=w,v(h)&&h.length&&h.trim()!=="")))if(l.relaxedAPI){if(r=r.filter(h=>v(h)&&h.length),r.length===0)return[]}else throw new TypeError(`string-find-heads-tails: [THROW_ID_07] the second input argument, heads, should not contain empty strings! For example, there's one detected at index ${o} of heads array:
|
|
23
|
+
${JSON.stringify(r,null,4)}.`)}else if(l.relaxedAPI){if(r=r.filter(h=>v(h)&&h.length),r.length===0)return[]}else throw new TypeError(`string-find-heads-tails: [THROW_ID_06] the second input argument, heads, contains non-string elements! For example, element at ${o}th index is ${typeof t}, equal to:
|
|
24
|
+
${JSON.stringify(t,null,4)}. Whole heads array looks like:
|
|
25
|
+
${JSON.stringify(r,null,4)}`);if(!v(n)&&!Array.isArray(n)){if(l.relaxedAPI)return[];throw new TypeError(`string-find-heads-tails: [THROW_ID_08] the third input argument, tails, must be either a string or an array of strings! Currently it's: ${typeof n}, equal to:
|
|
26
|
+
${JSON.stringify(n,null,4)}`)}else if(v(n))if(n.length===0){if(l.relaxedAPI)return[];throw new TypeError("string-find-heads-tails: [THROW_ID_09] the third input argument, tails, must be a non-empty string! Currently it's empty.")}else n=W(n);else if(Array.isArray(n))if(n.length===0){if(l.relaxedAPI)return[];throw new TypeError("string-find-heads-tails: [THROW_ID_10] the third input argument, tails, must be a non-empty array and contain at least one string! Currently it's empty.")}else if(n.every((h,w)=>(t=h,o=w,v(h)))){if(!n.every((h,w)=>(o=w,v(h)&&h.length&&h.trim()!=="")))if(l.relaxedAPI){if(n=n.filter(h=>v(h)&&h.length),n.length===0)return[]}else throw new TypeError(`string-find-heads-tails: [THROW_ID_12] the third input argument, tails, should not contain empty strings! For example, there's one detected at index ${o}. Whole tails array is equal to:
|
|
27
|
+
${JSON.stringify(n,null,4)}`)}else if(l.relaxedAPI){if(n=n.filter(h=>v(h)&&h.length),n.length===0)return[]}else throw new TypeError(`string-find-heads-tails: [THROW_ID_11] the third input argument, tails, contains non-string elements! For example, element at ${o}th index is ${typeof t}, equal to:
|
|
28
|
+
${JSON.stringify(t,null,4)}. Whole tails array is equal to:
|
|
29
|
+
${JSON.stringify(n,null,4)}`);let s=l.source===we.source;if(l.throwWhenSomethingWrongIsDetected&&!l.allowWholeValueToBeOnlyHeadsOrTails){if(W(r).includes(e))throw new Error(`${l.source}${s?": [THROW_ID_16]":""} the whole input string can't be equal to ${v(r)?"":"one of "}heads (${e})!`);if(W(n).includes(e))throw new Error(`${l.source}${s?": [THROW_ID_17]":""} the whole input string can't be equal to ${v(n)?"":"one of "}tails (${e})!`)}let u=r.concat(n).map(h=>h.charAt(0)).reduce((h,w)=>w.charCodeAt(0)>h[1]?[h[0],w.charCodeAt(0)]:w.charCodeAt(0)<h[0]?[w.charCodeAt(0),h[1]]:h,[r[0].charCodeAt(0),r[0].charCodeAt(0)]),i=[],g=!1,c={},b="",y;for(let h=l.fromIndex,w=e.length;h<w;h++){let d=e[h].charCodeAt(0);if(d<=u[1]&&d>=u[0]){let f=D(e,h,r);if(f&&l.matchHeadsAndTailsStrictlyInPairsByTheirOrder){for(let m=r.length;m--;)if(r[m]===f){y=m;break}}if(v(f))if(g){if(l.throwWhenSomethingWrongIsDetected)throw new TypeError(`${l.source}${s?": [THROW_ID_19]":""} When processing "${e}", we found heads (${e.slice(h,h+f.length)}) starting at character with index number "${h}" and there was another set of heads before it! Generally speaking, there should be "heads-tails-heads-tails", not "heads-heads-tails"!
|
|
30
30
|
We're talking about the area of the code:
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
--------------------------------------starts
|
|
34
|
-
${e.slice(Math.max(
|
|
35
|
-
\x1B[33m------->\x1B[39m ${`\x1B[31m${e.slice(
|
|
36
|
-
${e.slice(f
|
|
34
|
+
${e.slice(Math.max(h-200,0),h)}
|
|
35
|
+
\x1B[33m------->\x1B[39m ${`\x1B[31m${e.slice(h,h+f.length)}\x1B[39m`} \x1B[33m<-------\x1B[39m
|
|
36
|
+
${e.slice(h+f.length,Math.min(w,h+200))}
|
|
37
37
|
--------------------------------------ends
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
To turn off this error being thrown, set resolvedOpts.throwWhenSomethingWrongIsDetected to Boolean false.`)}else{
|
|
41
|
-
`;y=l.reduce((w,d,
|
|
40
|
+
To turn off this error being thrown, set resolvedOpts.throwWhenSomethingWrongIsDetected to Boolean false.`)}else{c={},c.headsStartAt=h,c.headsEndAt=h+f.length,g=!0,h+=f.length-1,b&&(b="");continue}let p=D(e,h,n);if(g&&p&&l.matchHeadsAndTailsStrictlyInPairsByTheirOrder&&y!==void 0&&n[y]!==void 0&&n[y]!==p){let m;for(let $=n.length;$--;)if(n[$]===p){m=$;break}throw new TypeError(`${l.source}${s?": [THROW_ID_20]":""} When processing "${e}", we had "resolvedOpts.matchHeadsAndTailsStrictlyInPairsByTheirOrder" on. We found heads (${r[y]}) but the tails the followed it were not of the same index, ${y} (${n[y]}) but ${m} (${p}).`)}if(v(p))if(g){c.tailsStartAt=h,c.tailsEndAt=h+p.length,i.push(c),c={},g=!1,h+=p.length-1;continue}else l.throwWhenSomethingWrongIsDetected&&(b=`${l.source}${s?": [THROW_ID_21]":""} When processing "${e}", we found tails (${e.slice(h,h+p.length)}) starting at character with index number "${h}" but there were no heads preceding it. That's very naughty!`)}if(l.throwWhenSomethingWrongIsDetected&&h===w-1){if(Object.keys(c).length!==0)throw new TypeError(`${l.source}${s?": [THROW_ID_22]":""} When processing "${e}", we reached the end of the string and yet didn't find any tails (${JSON.stringify(n,null,4)}) to match the last detected heads (${e.slice(c.headsStartAt,c.headsEndAt)})!`);if(b)throw new Error(b)}}return i}var $e=z(Y(),1);function Ze(e){if(e.includes(".")){let r=e.lastIndexOf(".");if(!e.slice(0,r).includes("."))return e.slice(0,r);for(let n=r-1;n--;)if(e[n]===".")return e.slice(n+1,r)}return null}var X=Ze;var ee=(0,$e.default)();function L(e,r){let n={now:!1};function a(l,t,o,s){let u=ee(l),i,g=A({depth:-1,path:""},o);if(g.depth+=1,Array.isArray(u))for(let c=0,b=u.length;c<b&&!s.now;c++){let y=g.path?`${g.path}.${c}`:`${c}`;u[c]!==void 0?(g.parent=ee(u),g.parentType="array",g.parentKey=X(y),i=a(t(u[c],void 0,H(A({},g),{path:y}),s),t,H(A({},g),{path:y}),s),Number.isNaN(i)&&c<u.length?(u.splice(c,1),c-=1):u[c]=i):u.splice(c,1)}else if(E(u))for(let c in u){if(s.now&&c!=null)break;let b=g.path?`${g.path}.${c}`:c;g.depth===0&&c!=null&&(g.topmostKey=c),g.parent=ee(u),g.parentType="object",g.parentKey=X(b),i=a(t(c,u[c],H(A({},g),{path:b}),s),t,H(A({},g),{path:b}),s),Number.isNaN(i)?delete u[c]:u[c]=i}return u}return a(e,r,{},n)}function re(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var te=new Map,ve=(e,r)=>{if(!Array.isArray(e))switch(typeof e){case"string":e=[e];break;case"undefined":e=[];break;default:throw new TypeError(`Expected '${r}' to be a string or an array, but got a type of '${typeof e}'`)}return e.filter(n=>{if(typeof n!="string"){if(typeof n>"u")return!1;throw new TypeError(`Expected '${r}' to be an array of strings, but found a type of '${typeof n}' in the array`)}return!0})},Ye=(e,r)=>{r=A({caseSensitive:!1},r);let n=e+JSON.stringify(r);if(te.has(n))return te.get(n);let a=e[0]==="!";a&&(e=e.slice(1)),e=re(e).replace(/\\\*/g,"[\\s\\S]*");let l=new RegExp(`^${e}$`,r.caseSensitive?"":"i");return l.negated=a,te.set(n,l),l},Xe=(e,r,n,a)=>{if(e=ve(e,"inputs"),r=ve(r,"patterns"),r.length===0)return[];r=r.map(o=>Ye(o,n));let{allPatterns:l}=n||{},t=[];for(let o of e){let s,u=[...r].fill(!1);for(let[i,g]of r.entries())if(g.test(o)&&(u[i]=!0,s=!g.negated,!s))break;if(!(s===!1||s===void 0&&r.some(i=>!i.negated)||l&&u.some((i,g)=>!i&&!r[g].negated))&&(t.push(o),a))break}return t};function k(e,r,n){return Xe(e,r,n,!0).length>0}var Te=z(Y(),1);var Ae=(0,Te.default)();function ne(e,r,n){let a;n!==void 0&&(a=Array.isArray(n)?Ae(n):[Ae(n)]);let l=[],t=L(e,(o,s,u)=>{let i=s!==void 0?s:o;if(s!==void 0&&k(o,r,{caseSensitive:!0})){if(a===void 0)l.push({val:s,path:u.path});else if(a.length)return a.shift()}return i});return a===void 0?l:t}var N=z(Ee(),1);var We="12.0.12";var rr=We,tr=Object.prototype.hasOwnProperty,De={heads:"%%_",tails:"_%%",headsNoWrap:"%%-",tailsNoWrap:"-%%",lookForDataContainers:!0,dataContainerIdentifierTails:"_data",wrapHeadsWith:"",wrapTailsWith:"",dontWrapVars:[],preventDoubleWrapping:!0,wrapGlobalFlipSwitch:!0,noSingleMarkers:!1,resolveToBoolIfAnyValuesContainBool:!0,resolveToFalseIfAnyValuesContainBool:!0,throwWhenNonStringInsertedInString:!1,allowUnresolved:!1};function O(e){return v(e)?e.trim():e}function nr(e){if(v(e)&&e.length&&e.indexOf(".")!==-1){for(let r=0,n=e.length;r<n;r++)if(e[r]===".")return e.slice(0,r)}return e}function ir(e){if(v(e)&&e.length&&e.indexOf(".")!==-1){for(let r=0,n=e.length;r<n;r++)if(e[r]===".")return e.slice(r+1)}return e}function Ne(e){if(v(e)&&e.length&&e.indexOf(".")!==-1){for(let r=e.length;r--;)if(e[r]===".")return e.slice(0,r)}return e}function Ie(e){if(v(e)&&e.length&&e.indexOf(".")!==-1){for(let r=e.length;r--;)if(e[r]===".")return e.slice(r+1)}return e}function ie(e,r){return!v(e)||!e.trim()?!1:!!(e.includes(r.heads)||e.includes(r.tails)||v(r.headsNoWrap)&&r.headsNoWrap.length&&e.includes(r.headsNoWrap)||v(r.tailsNoWrap)&&r.tailsNoWrap.length&&e.includes(r.tailsNoWrap))}function sr(e,r,n){let a,l;return v(e)&&e.length&&D(e,0,r,{trimBeforeMatching:!0,cb:(t,o,s)=>(a=s,!0)})&&x(e,e.length-1,n,{trimBeforeMatching:!0,cb:(t,o,s)=>(l=(s||0)+1,!0)})?e.slice(a,l):e}function Se(e,r,n=!1,a,l,t){if(r.wrapHeadsWith||(r.wrapHeadsWith=""),r.wrapTailsWith||(r.wrapTailsWith=""),v(e)&&!n&&r.wrapGlobalFlipSwitch&&!r.dontWrapVars.some(o=>k(t,o))&&(!r.preventDoubleWrapping||r.preventDoubleWrapping&&v(e)&&!e.includes(r.wrapHeadsWith)&&!e.includes(r.wrapTailsWith)))return`${r.wrapHeadsWith}${e}${r.wrapTailsWith}`;if(n){if(!v(e))return e;let o=me(e,{heads:r.wrapHeadsWith,tails:r.wrapTailsWith});return v(o)?sr(o,r.wrapHeadsWith,r.wrapTailsWith):o}return e}function ar(e,r,n,a){let l;if(n.indexOf(".")!==-1){let t=n,o=!0;if(a.lookForDataContainers&&v(a.dataContainerIdentifierTails)&&a.dataContainerIdentifierTails.length&&!t.endsWith(a.dataContainerIdentifierTails)){let s=N.default.get(e,t+a.dataContainerIdentifierTails);E(s)&&N.default.get(s,r)&&(l=N.default.get(s,r),o=!1)}for(;o&&t.indexOf(".")!==-1;){if(t=Ne(t),Ie(t)===r)throw new Error(`json-variables/findValues(): [THROW_ID_20] While trying to resolve: "${r}" at path "${n}", we encountered a closed loop. The parent key "${Ie(t)}" is called the same as the variable "${r}" we're looking for.`);if(a.lookForDataContainers&&v(a.dataContainerIdentifierTails)&&a.dataContainerIdentifierTails.length&&!t.endsWith(a.dataContainerIdentifierTails)){let s=N.default.get(e,t+a.dataContainerIdentifierTails);E(s)&&N.default.get(s,r)&&(l=N.default.get(s,r),o=!1)}if(l===void 0){let s=N.default.get(e,t);E(s)&&N.default.get(s,r)&&(l=N.default.get(s,r),o=!1)}}}if(l===void 0){let t=N.default.get(e,r);t!==void 0&&(l=t)}if(l===void 0)if(r.indexOf(".")===-1){let t=ne(e,r);if(t.length){for(let o=0,s=t.length;o<s;o++)if(v(t[o].val)||J(t[o].val)||j(t[o].val)){l=t[o].val;break}else if(fe(t[o].val)){l=String(t[o].val);break}else if(Array.isArray(t[o].val)){l=t[o].val.join("");break}}}else{let t=ne(e,nr(r));if(t.length)for(let o=0,s=t.length;o<s;o++){let u=N.default.get(t[o].val,ir(r));u&&v(u)&&(l=u)}}return l}function _e(e,r,n,a,l=[]){if(l.includes(n)){let y="";if(l.length>1){let h=` \u2192
|
|
41
|
+
`;y=l.reduce((w,d,f)=>w+(f===0?"":h)+(d===n?"\u{1F4A5} ":" ")+d,` Here's the path we travelled up until we hit the recursion:
|
|
42
42
|
|
|
43
|
-
`),y+=`${
|
|
44
|
-
${y}`)}let
|
|
45
|
-
${y}`)}
|
|
46
|
-
Please check the following key: ${o}`);if(s!==void 0?
|
|
43
|
+
`),y+=`${h}\u{1F4A5} ${n}`}throw new Error(`json-variables/resolveString(): [THROW_ID_19] While trying to resolve: "${r}" at path "${n}", we encountered a closed loop, the key is referencing itself."${y}`)}let t={},o=Array.from(l);o.push(n);let s=new B;function u(y,h,w){for(let d=0,f=y.length;d<f;d++){let p=y[d],m=r.slice(p.headsEndAt,p.tailsStartAt);if(m.length===0)s.push(p.headsStartAt,p.tailsEndAt);else if(tr.call(t,m)&&v(t[m]))s.push(p.headsStartAt,p.tailsEndAt,t[m]);else{let $=ar(e,m.trim(),n,a);if($===void 0)if(a.allowUnresolved===!0)$="";else if(v(a.allowUnresolved))$=a.allowUnresolved;else throw new Error(`json-variables/processHeadsAndTails(): [THROW_ID_18] We couldn't find the value to resolve the variable ${r.slice(p.headsEndAt,p.tailsStartAt)}. We're at path: "${n}".`);if(!w&&a.throwWhenNonStringInsertedInString&&!v($))throw new Error(`json-variables/processHeadsAndTails(): [THROW_ID_23] While resolving the variable ${r.slice(p.headsEndAt,p.tailsStartAt)} at path ${n}, it resolved into a non-string value, ${JSON.stringify($,null,4)}. This is happening because options setting "throwWhenNonStringInsertedInString" is active (set to "true").`);if(J($)){if(a.resolveToBoolIfAnyValuesContainBool)return s.wipe(),a.resolveToFalseIfAnyValuesContainBool?!1:$;$=""}else{if(j($)&&w)return s.wipe(),$;Array.isArray($)?$=String($.join("")):j($)?$="":$=String($)}let T=n.includes(".")?`${Ne(n)}.${m}`:m;if(ie($,a)){let I=Se(_e(e,$,T,a,o),a,h,o,T,m.trim());v(I)&&s.push(p.headsStartAt,p.tailsEndAt,I)}else{t[m]=$;let I=Se($,a,h,o,T,m.trim());v(I)&&s.push(p.headsStartAt,p.tailsEndAt,I)}}}}let i;try{i=Z(r,a.heads,a.tails,{source:"",throwWhenSomethingWrongIsDetected:!1})}catch(y){throw new Error(`json-variables/resolveString(): [THROW_ID_17] While trying to resolve string: "${r}" at path ${n}, something wrong with heads and tails was detected! Here's the internal error message:
|
|
44
|
+
${y}`)}let g=!1;i.length===1&&V(r,[[i[0].headsStartAt,i[0].tailsEndAt]]).trim()===""&&(g=!0);let c=u(i,!1,g);if(typeof c=="boolean"||c===null)return c;try{i=Z(r,a.headsNoWrap,a.tailsNoWrap,{source:"",throwWhenSomethingWrongIsDetected:!1})}catch(y){throw new Error(`json-variables/resolveString(): [THROW_ID_22] While trying to resolve string: "${r}" at path ${n}, something wrong with no-wrap heads and no-wrap tails was detected! Here's the internal error message:
|
|
45
|
+
${y}`)}i.length===1&&V(r,[[i[0].headsStartAt,i[0].tailsEndAt]]).trim()===""&&(g=!0);let b=u(i,!0,g);return J(b)||j(b)?b:s!=null&&s.current()?V(r,s.current()):r}function or(e,r){if(!arguments.length)throw new Error("json-variables/jVar(): [THROW_ID_01] Alas! Inputs are missing!");if(!E(e))throw new TypeError(`json-variables/jVar(): [THROW_ID_02] Alas! The input must be a plain object! Currently it's: ${Array.isArray(e)?"array":typeof e}`);if(r&&!E(r))throw new TypeError(`json-variables/jVar(): [THROW_ID_03] Alas! An Optional Options Object must be a plain object! Currently it's: ${Array.isArray(r)?"array":typeof r}`);let n=A(A({},De),r);n.dontWrapVars?Array.isArray(n.dontWrapVars)||(n.dontWrapVars=W(n.dontWrapVars)):n.dontWrapVars=[];let a,l;if(n.dontWrapVars.length&&!n.dontWrapVars.every((o,s)=>v(o)?!0:(a=o,l=s,!1)))throw new Error(`json-variables/jVar(): [THROW_ID_05] Alas! All variable names set in resolvedOpts.dontWrapVars should be of a string type. Computer detected a value "${a}" at index ${l}, which is not string but ${Array.isArray(a)?"array":typeof a}!`);if(n.heads==="")throw new Error("json-variables/jVar(): [THROW_ID_06] Alas! resolvedOpts.heads are empty!");if(n.tails==="")throw new Error("json-variables/jVar(): [THROW_ID_07] Alas! resolvedOpts.tails are empty!");if(n.lookForDataContainers&&n.dataContainerIdentifierTails==="")throw new Error("json-variables/jVar(): [THROW_ID_08] Alas! resolvedOpts.dataContainerIdentifierTails is empty!");if(n.heads===n.tails)throw new Error("json-variables/jVar(): [THROW_ID_09] Alas! resolvedOpts.heads and resolvedOpts.tails can't be equal!");if(n.heads===n.headsNoWrap)throw new Error("json-variables/jVar(): [THROW_ID_10] Alas! resolvedOpts.heads and resolvedOpts.headsNoWrap can't be equal!");if(n.tails===n.tailsNoWrap)throw new Error("json-variables/jVar(): [THROW_ID_11] Alas! resolvedOpts.tails and resolvedOpts.tailsNoWrap can't be equal!");if(n.headsNoWrap==="")throw new Error("json-variables/jVar(): [THROW_ID_12] Alas! resolvedOpts.headsNoWrap is an empty string!");if(n.tailsNoWrap==="")throw new Error("json-variables/jVar(): [THROW_ID_13] Alas! resolvedOpts.tailsNoWrap is an empty string!");if(n.headsNoWrap===n.tailsNoWrap)throw new Error("json-variables/jVar(): [THROW_ID_14] Alas! resolvedOpts.headsNoWrap and resolvedOpts.tailsNoWrap can't be equal!");let t;return L(e,(o,s,u)=>{if(S(s)&&ie(o,n))throw new Error(`json-variables/jVar(): [THROW_ID_15] Alas! Object keys can't contain variables!
|
|
46
|
+
Please check the following key: ${o}`);if(s!==void 0?t=s:t=o,t==="")return t;if(n.heads.length&&O(t)===O(n.heads)||n.tails.length&&O(t)===O(n.tails)||n.headsNoWrap.length&&O(t)===O(n.headsNoWrap)||n.tailsNoWrap.length&&O(t)===O(n.tailsNoWrap)){if(!n.noSingleMarkers)return t;throw new Error(`json-variables/jVar(): [THROW_ID_16] Alas! While processing the input, we stumbled upon ${O(t)} which is equal to ${O(t)===O(n.heads)?"heads":""}${O(t)===O(n.tails)?"tails":""}${v(n.headsNoWrap)&&O(t)===O(n.headsNoWrap)?"headsNoWrap":""}${v(n.tailsNoWrap)&&O(t)===O(n.tailsNoWrap)?"tailsNoWrap":""}. If you wouldn't have set resolvedOpts.noSingleMarkers to "true" this error would not happen and computer would have left the current element (${O(t)}) alone`)}return v(t)&&ie(t,n)?_e(e,t,u.path,n):t})}return Pe(lr);})();
|
|
47
47
|
/**
|
|
48
48
|
* @name arrayiffy-if-string
|
|
49
49
|
* @fileoverview Put non-empty strings into arrays, turn empty-ones into empty arrays. Bypass everything else.
|
|
@@ -55,7 +55,7 @@ Please check the following key: ${o}`);if(s!==void 0?n=s:n=o,n==="")return n;if(
|
|
|
55
55
|
/**
|
|
56
56
|
* @name codsen-utils
|
|
57
57
|
* @fileoverview Various utility functions
|
|
58
|
-
* @version 1.
|
|
58
|
+
* @version 1.5.0
|
|
59
59
|
* @author Roy Revelt, Codsen Ltd
|
|
60
60
|
* @license MIT
|
|
61
61
|
* {@link https://codsen.com/os/codsen-utils/}
|
|
@@ -63,7 +63,7 @@ Please check the following key: ${o}`);if(s!==void 0?n=s:n=o,n==="")return n;if(
|
|
|
63
63
|
/**
|
|
64
64
|
* @name string-match-left-right
|
|
65
65
|
* @fileoverview Match substrings on the left or right of a given index, ignoring whitespace
|
|
66
|
-
* @version 9.0.
|
|
66
|
+
* @version 9.0.12
|
|
67
67
|
* @author Roy Revelt, Codsen Ltd
|
|
68
68
|
* @license MIT
|
|
69
69
|
* {@link https://codsen.com/os/string-match-left-right/}
|
|
@@ -79,7 +79,7 @@ Please check the following key: ${o}`);if(s!==void 0?n=s:n=o,n==="")return n;if(
|
|
|
79
79
|
/**
|
|
80
80
|
* @name ranges-sort
|
|
81
81
|
* @fileoverview Sort string index ranges
|
|
82
|
-
* @version 6.0.
|
|
82
|
+
* @version 6.0.8
|
|
83
83
|
* @author Roy Revelt, Codsen Ltd
|
|
84
84
|
* @license MIT
|
|
85
85
|
* {@link https://codsen.com/os/ranges-sort/}
|
|
@@ -87,7 +87,7 @@ Please check the following key: ${o}`);if(s!==void 0?n=s:n=o,n==="")return n;if(
|
|
|
87
87
|
/**
|
|
88
88
|
* @name ranges-push
|
|
89
89
|
* @fileoverview Gather string index ranges
|
|
90
|
-
* @version 7.0.
|
|
90
|
+
* @version 7.0.9
|
|
91
91
|
* @author Roy Revelt, Codsen Ltd
|
|
92
92
|
* @license MIT
|
|
93
93
|
* {@link https://codsen.com/os/ranges-push/}
|
|
@@ -95,7 +95,7 @@ Please check the following key: ${o}`);if(s!==void 0?n=s:n=o,n==="")return n;if(
|
|
|
95
95
|
/**
|
|
96
96
|
* @name ranges-merge
|
|
97
97
|
* @fileoverview Merge and sort string index ranges
|
|
98
|
-
* @version 9.0.
|
|
98
|
+
* @version 9.0.9
|
|
99
99
|
* @author Roy Revelt, Codsen Ltd
|
|
100
100
|
* @license MIT
|
|
101
101
|
* {@link https://codsen.com/os/ranges-merge/}
|
|
@@ -103,7 +103,7 @@ Please check the following key: ${o}`);if(s!==void 0?n=s:n=o,n==="")return n;if(
|
|
|
103
103
|
/**
|
|
104
104
|
* @name ranges-apply
|
|
105
105
|
* @fileoverview Take an array of string index ranges, delete/replace the string according to them
|
|
106
|
-
* @version 7.0.
|
|
106
|
+
* @version 7.0.9
|
|
107
107
|
* @author Roy Revelt, Codsen Ltd
|
|
108
108
|
* @license MIT
|
|
109
109
|
* {@link https://codsen.com/os/ranges-apply/}
|
|
@@ -119,7 +119,7 @@ Please check the following key: ${o}`);if(s!==void 0?n=s:n=o,n==="")return n;if(
|
|
|
119
119
|
/**
|
|
120
120
|
* @name string-remove-duplicate-heads-tails
|
|
121
121
|
* @fileoverview Detect and (recursively) remove head and tail wrappings around the input string
|
|
122
|
-
* @version 7.0.
|
|
122
|
+
* @version 7.0.12
|
|
123
123
|
* @author Roy Revelt, Codsen Ltd
|
|
124
124
|
* @license MIT
|
|
125
125
|
* {@link https://codsen.com/os/string-remove-duplicate-heads-tails/}
|
|
@@ -127,7 +127,7 @@ Please check the following key: ${o}`);if(s!==void 0?n=s:n=o,n==="")return n;if(
|
|
|
127
127
|
/**
|
|
128
128
|
* @name string-find-heads-tails
|
|
129
129
|
* @fileoverview Finds where are arbitrary templating marker heads and tails located
|
|
130
|
-
* @version 6.0.
|
|
130
|
+
* @version 6.0.12
|
|
131
131
|
* @author Roy Revelt, Codsen Ltd
|
|
132
132
|
* @license MIT
|
|
133
133
|
* {@link https://codsen.com/os/string-find-heads-tails/}
|
|
@@ -135,7 +135,7 @@ Please check the following key: ${o}`);if(s!==void 0?n=s:n=o,n==="")return n;if(
|
|
|
135
135
|
/**
|
|
136
136
|
* @name ast-monkey-util
|
|
137
137
|
* @fileoverview Utility library of AST helper functions
|
|
138
|
-
* @version 3.0.
|
|
138
|
+
* @version 3.0.6
|
|
139
139
|
* @author Roy Revelt, Codsen Ltd
|
|
140
140
|
* @license MIT
|
|
141
141
|
* {@link https://codsen.com/os/ast-monkey-util/}
|
|
@@ -143,7 +143,7 @@ Please check the following key: ${o}`);if(s!==void 0?n=s:n=o,n==="")return n;if(
|
|
|
143
143
|
/**
|
|
144
144
|
* @name ast-monkey-traverse
|
|
145
145
|
* @fileoverview Utility library to traverse AST
|
|
146
|
-
* @version 4.0.
|
|
146
|
+
* @version 4.0.10
|
|
147
147
|
* @author Roy Revelt, Codsen Ltd
|
|
148
148
|
* @license MIT
|
|
149
149
|
* {@link https://codsen.com/os/ast-monkey-traverse/}
|
|
@@ -151,7 +151,7 @@ Please check the following key: ${o}`);if(s!==void 0?n=s:n=o,n==="")return n;if(
|
|
|
151
151
|
/**
|
|
152
152
|
* @name ast-get-values-by-key
|
|
153
153
|
* @fileoverview Extract values and paths from AST by keys OR set them by keys
|
|
154
|
-
* @version 5.0.
|
|
154
|
+
* @version 5.0.12
|
|
155
155
|
* @author Roy Revelt, Codsen Ltd
|
|
156
156
|
* @license MIT
|
|
157
157
|
* {@link https://codsen.com/os/ast-get-values-by-key/}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "json-variables",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.12",
|
|
4
4
|
"description": "Resolves custom-marked, cross-referenced paths in parsed JSON",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"comb",
|
|
@@ -79,15 +79,15 @@
|
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"arrayiffy-if-string": "^5.0.5",
|
|
82
|
-
"ast-get-values-by-key": "^5.0.
|
|
83
|
-
"ast-monkey-traverse": "^4.0.
|
|
84
|
-
"codsen-utils": "^1.
|
|
82
|
+
"ast-get-values-by-key": "^5.0.12",
|
|
83
|
+
"ast-monkey-traverse": "^4.0.10",
|
|
84
|
+
"codsen-utils": "^1.5.0",
|
|
85
85
|
"matcher": "^5.0.0",
|
|
86
86
|
"object-path": "^0.11.8",
|
|
87
|
-
"ranges-apply": "^7.0.
|
|
88
|
-
"ranges-push": "^7.0.
|
|
89
|
-
"string-find-heads-tails": "^6.0.
|
|
90
|
-
"string-match-left-right": "^9.0.
|
|
91
|
-
"string-remove-duplicate-heads-tails": "^7.0.
|
|
87
|
+
"ranges-apply": "^7.0.9",
|
|
88
|
+
"ranges-push": "^7.0.9",
|
|
89
|
+
"string-find-heads-tails": "^6.0.12",
|
|
90
|
+
"string-match-left-right": "^9.0.12",
|
|
91
|
+
"string-remove-duplicate-heads-tails": "^7.0.12"
|
|
92
92
|
}
|
|
93
93
|
}
|