json-variables 12.0.7 → 12.0.9

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