@hievilmath/browser-formidavim 1.5.9 → 1.5.10

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/README.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  Quick notes about changes made to this package for each version.
4
4
 
5
+ ## Version 1.5.10
6
+ - Remove file type component from cio event submissions - related to DL
7
+
8
+ ---
9
+
5
10
  ## Version 1.5.9
6
11
  - Reverting 1.5.7
7
12
 
package/index.js CHANGED
@@ -3351,7 +3351,7 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
3351
3351
  border: 1px solid ${e=>e.$btnStyle==="green"?e.theme.colors.primary:e.theme.colors.ivimGreen};
3352
3352
  }
3353
3353
  }
3354
- `,Jj=({formComponent:e})=>{const r=e.props,{label:i="Button",url:s,target:c="_self",btnStyle:d="alt",margin:f}=r||{};return M.jsx(Zj,{href:s,target:c,$btnStyle:d,$margin:f,children:i})},eU={number:"number","number-input":"number",radio:"string","radio-group":"string","checkbox-single":"boolean","checkbox-multi":"any[]",scale:"number",dropdown:"string","titration-select":"string",datepicker:"string","text-input":"string","dosing-custom-units":"string",email:"string",password:"string",phone:"string",otp:"string",address:"object",hidden:"string","ga-client-id":"string",cookie:"string","hipaa-consent":"string",file:"string"},tU={header:yj,image:gj,"weight-loss-chart":bj,"horizontal-rule":Ej,"text-tip":Tj,"small-text":Rj,paragraph:Oj,"refill-request":$j,"addon-request":_j,"hipaa-consent":Yj,"link-button":Jj,video:Wj,"checkbox-single":W5,"checkbox-multi":Y5,radio:wO,"radio-group":wO,number:B5,dropdown:nI,datepicker:tI,scale:q5,"text-input":rI,textarea:G5,"titration-select":oI,"dosing-custom-units":mj,email:pI,password:hI,phone:mI,otp:rj,address:fj,hidden:dj,"ga-client-id":pj,cookie:hj,file:vj},wr=()=>{const e=Fu.useDispatch(),r=Fu.useSelector(J=>$5(J)),i=Fu.useSelector(J=>A5(J)),s=Fu.useSelector(J=>k5(J)),c=Fu.useSelector(J=>P5(J)),d=Fu.useSelector(J=>N5(J)),f=Fu.useSelector(J=>L5(J)),v=Ve.useCallback((J,pe)=>{e(S5({field:J,value:pe}))},[e]),b=Ve.useCallback(J=>r[J],[r]),S=Ve.useCallback(J=>{const pe={};return J.forEach(ce=>{var me;const Te=(me=ce.props)==null?void 0:me.propertyId;Te&&!Te.includes("password")&&(pe[Te]=r[Te])}),pe},[r,d]),E=Ve.useCallback(()=>r,[r]),w=Ve.useCallback(J=>{e(C5(J))},[e]),R=Ve.useCallback(J=>{e(w5(J))},[e]),A=Ve.useCallback((J,pe)=>{e(E5({field:J,error:pe}))},[e]),I=Ve.useCallback(J=>i[J],[i]),P=Ve.useCallback(J=>{e(T5(J))},[e]),U=Ve.useCallback(()=>s,[s]),Y=Ve.useCallback((J,pe)=>{e(I5({[J]:pe}))},[e]),W=Ve.useCallback(J=>{const pe={id:J.customerId??null,profile:J.data};e(M5(pe))},[e]),k=Ve.useCallback(J=>f==null?void 0:f[J],[f]),j=Ve.useCallback(()=>f,[f]),N=Ve.useCallback(J=>{e(R5(J))},[e]),z=Ve.useCallback(()=>c,[c]),ee=Ve.useCallback(J=>{e(O5(J))},[e]),le=Ve.useCallback(()=>d,[d]),ge=Ve.useCallback((J,pe)=>{v(J,pe),Y(J,pe)},[v,Y]),L=Ve.useCallback(J=>{const pe={};return J.flowForms&&J.flowForms.forEach(ce=>{var Te;(Te=ce.form)!=null&&Te.formComponents&&ce.form.formComponents.forEach(me=>{const $e=me.componentId||"";if(eU[$e]){const be=me.props,re=be==null?void 0:be.propertyId;re&&(pe[re]=null)}})}),pe},[]);return{setFlowValue:v,setFlowValues:w,resetAndSetFlowValues:R,getFlowValue:b,getAllFormData:S,getAllFlowData:E,setFlowError:A,getFlowError:I,setDisableSubmitValue:P,getDisableSubmitValue:U,setPatientValue:Y,setPatientValues:W,getPatientValue:k,getFullPatient:j,setCurrentFlowValue:N,getCurrentFlowValue:z,setCurrentFormValue:ee,getCurrentFormValue:le,setFlowAndPatientValue:ge,generateFormDataFromFlow:L}};function A0(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var bC={exports:{}},Y$;function nU(){return Y$||(Y$=1,function(e,r){(function(i){e.exports=i()})(function(){return function(){function i(s,c,d){function f(S,E){if(!c[S]){if(!s[S]){var w=typeof A0=="function"&&A0;if(!E&&w)return w(S,!0);if(v)return v(S,!0);var R=new Error("Cannot find module '"+S+"'");throw R.code="MODULE_NOT_FOUND",R}var A=c[S]={exports:{}};s[S][0].call(A.exports,function(I){var P=s[S][1][I];return f(P||I)},A,A.exports,i,s,c,d)}return c[S].exports}for(var v=typeof A0=="function"&&A0,b=0;b<d.length;b++)f(d[b]);return f}return i}()({1:[function(i,s,c){const d=i("./utils"),f=function(){const v=d.stringToArray,b=["Zero","One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"],S=["Zeroth","First","Second","Third","Fourth","Fifth","Sixth","Seventh","Eighth","Ninth","Tenth","Eleventh","Twelfth","Thirteenth","Fourteenth","Fifteenth","Sixteenth","Seventeenth","Eighteenth","Nineteenth"],E=["Twenty","Thirty","Forty","Fifty","Sixty","Seventy","Eighty","Ninety","Hundred"],w=["Thousand","Million","Billion","Trillion"];function R(Q,oe){var Z=function(ne,De,we){var Fe="";if(ne<=19)Fe=(De?" and ":"")+(we?S[ne]:b[ne]);else if(ne<100){const It=Math.floor(ne/10),Dt=ne%10;Fe=(De?" and ":"")+E[It-2],Dt>0?Fe+="-"+Z(Dt,!1,we):we&&(Fe=Fe.substring(0,Fe.length-1)+"ieth")}else if(ne<1e3){const It=Math.floor(ne/100),Dt=ne%100;Fe=(De?", ":"")+b[It]+" Hundred",Dt>0?Fe+=Z(Dt,!0,we):we&&(Fe+="th")}else{var rt=Math.floor(Math.log10(ne)/3);rt>w.length&&(rt=w.length);const It=Math.pow(10,rt*3),Dt=Math.floor(ne/It),vt=ne-Dt*It;Fe=(De?", ":"")+Z(Dt,!1,!1)+" "+w[rt-1],vt>0?Fe+=Z(vt,!0,we):we&&(Fe+="th")}return Fe},Ee=Z(Q,!1,oe);return Ee}const A={};b.forEach(function(Q,oe){A[Q.toLowerCase()]=oe}),S.forEach(function(Q,oe){A[Q.toLowerCase()]=oe}),E.forEach(function(Q,oe){const Z=Q.toLowerCase();A[Z]=(oe+2)*10,A[Z.substring(0,Q.length-1)+"ieth"]=A[Z]}),A.hundredth=100,w.forEach(function(Q,oe){const Z=Q.toLowerCase(),Ee=Math.pow(10,(oe+1)*3);A[Z]=Ee,A[Z+"th"]=Ee});function I(Q){const Z=Q.split(/,\s|\sand\s|[\s\\-]/).map(De=>A[De]);let Ee=[0];return Z.forEach(De=>{if(De<100){let we=Ee.pop();we>=1e3&&(Ee.push(we),we=0),Ee.push(we+De)}else Ee.push(Ee.pop()*De)}),Ee.reduce((De,we)=>De+we,0)}const P=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],U={M:1e3,D:500,C:100,L:50,X:10,V:5,I:1};function Y(Q){for(var oe=0;oe<P.length;oe++){const Z=P[oe];if(Q>=Z[0])return Z[1]+Y(Q-Z[0])}return""}function W(Q){for(var oe=0,Z=1,Ee=Q.length-1;Ee>=0;Ee--){const ne=Q[Ee],De=U[ne];De<Z?oe-=De:(Z=De,oe+=De)}return oe}function k(Q,oe){for(var Z=[],Ee=oe.charCodeAt(0);Q>0;)Z.unshift(String.fromCharCode((Q-1)%26+Ee)),Q=Math.floor((Q-1)/26);return Z.join("")}function j(Q,oe){for(var Z=oe.charCodeAt(0),Ee=0,ne=0;ne<Q.length;ne++)Ee+=(Q.charCodeAt(Q.length-ne-1)-Z+1)*Math.pow(26,ne);return Ee}function N(Q,oe){if(typeof Q>"u")return;Q=Math.floor(Q);const Z=L(oe);return le(Q,Z)}const z={DECIMAL:"decimal",LETTERS:"letters",ROMAN:"roman",WORDS:"words",SEQUENCE:"sequence"},ee={UPPER:"upper",LOWER:"lower",TITLE:"title"};function le(Q,oe){let Z;const Ee=Q<0;switch(Q=Math.abs(Q),oe.primary){case z.LETTERS:Z=k(Q,oe.case===ee.UPPER?"A":"a");break;case z.ROMAN:Z=Y(Q),oe.case===ee.UPPER&&(Z=Z.toUpperCase());break;case z.WORDS:Z=R(Q,oe.ordinal),oe.case===ee.UPPER?Z=Z.toUpperCase():oe.case===ee.LOWER&&(Z=Z.toLowerCase());break;case z.DECIMAL:Z=""+Q;var ne=oe.mandatoryDigits-Z.length;if(ne>0){var De=new Array(ne+1).join("0");Z=De+Z}if(oe.zeroCode!==48&&(Z=v(Z).map(It=>String.fromCodePoint(It.codePointAt(0)+oe.zeroCode-48)).join("")),oe.regular){const It=Math.floor((Z.length-1)/oe.groupingSeparators.position);for(let Dt=It;Dt>0;Dt--){const vt=Z.length-Dt*oe.groupingSeparators.position;Z=Z.substr(0,vt)+oe.groupingSeparators.character+Z.substr(vt)}}else oe.groupingSeparators.reverse().forEach(It=>{const Dt=Z.length-It.position;Z=Z.substr(0,Dt)+It.character+Z.substr(Dt)});if(oe.ordinal){var we={1:"st",2:"nd",3:"rd"},Fe=Z[Z.length-1],rt=we[Fe];(!rt||Z.length>1&&Z[Z.length-2]==="1")&&(rt="th"),Z=Z+rt}break;case z.SEQUENCE:throw{code:"D3130",value:oe.token}}return Ee&&(Z="-"+Z),Z}const ge=[48,1632,1776,1984,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,42528,43216,43264,43472,43504,43600,44016,65296];function L(Q){const oe={type:"integer",primary:z.DECIMAL,case:ee.LOWER,ordinal:!1};let Z,Ee;const ne=Q.lastIndexOf(";");switch(ne===-1?Z=Q:(Z=Q.substring(0,ne),Ee=Q.substring(ne+1),Ee[0]==="o"&&(oe.ordinal=!0)),Z){case"A":oe.case=ee.UPPER;case"a":oe.primary=z.LETTERS;break;case"I":oe.case=ee.UPPER;case"i":oe.primary=z.ROMAN;break;case"W":oe.case=ee.UPPER,oe.primary=z.WORDS;break;case"Ww":oe.case=ee.TITLE,oe.primary=z.WORDS;break;case"w":oe.primary=z.WORDS;break;default:{let De=null,we=0,Fe=0,rt=[],It=0;if(v(Z).map(vt=>vt.codePointAt(0)).reverse().forEach(vt=>{let yt=!1;for(let St=0;St<ge.length;St++){const lt=ge[St];if(vt>=lt&&vt<=lt+9){if(yt=!0,we++,It++,De===null)De=lt;else if(lt!==De)throw{code:"D3131"};break}}yt||(vt===35?(It++,Fe++):rt.push({position:It,character:String.fromCodePoint(vt)}))}),we>0){oe.primary=z.DECIMAL,oe.zeroCode=De,oe.mandatoryDigits=we,oe.optionalDigits=Fe;const yt=function(St){if(St.length===0)return 0;const lt=St[0].character;for(let un=1;un<St.length;un++)if(St[un].character!==lt)return 0;const sn=St.map(un=>un.position),mn=function(un,Tn){return Tn===0?un:mn(Tn,un%Tn)},dn=sn.reduce(mn);for(let un=1;un<=sn.length;un++)if(sn.indexOf(un*dn)===-1)return 0;return dn}(rt);yt>0?(oe.regular=!0,oe.groupingSeparators={position:yt,character:rt[0].character}):(oe.regular=!1,oe.groupingSeparators=rt)}else oe.primary=z.SEQUENCE,oe.token=Z}}return oe}const J={Y:"1",M:"1",D:"1",d:"1",F:"n",W:"1",w:"1",X:"1",x:"1",H:"1",h:"1",P:"n",m:"01",s:"01",f:"1",Z:"01:01",z:"01:01",C:"n",E:"n"};function pe(Q){var oe=[];const Z={type:"datetime",parts:oe},Ee=function(yt,St){if(St>yt){let lt=Q.substring(yt,St);lt=lt.split("]]").join("]"),oe.push({type:"literal",value:lt})}};for(var ne=0,De=0;De<Q.length;){if(Q.charAt(De)==="["){if(Q.charAt(De+1)==="["){Ee(ne,De),oe.push({type:"literal",value:"["}),De+=2,ne=De;continue}if(Ee(ne,De),ne=De,De=Q.indexOf("]",ne),De===-1)throw{code:"D3135"};let yt=Q.substring(ne+1,De);yt=yt.split(/\s+/).join("");var we={type:"marker",component:yt.charAt(0)},Fe=yt.lastIndexOf(","),rt;if(Fe!==-1){const St=yt.substring(Fe+1),lt=St.indexOf("-");let sn,mn;const dn=function(Tn){if(!(typeof Tn>"u"||Tn==="*"))return parseInt(Tn)};lt===-1?sn=St:(sn=St.substring(0,lt),mn=St.substring(lt+1));const un={min:dn(sn),max:dn(mn)};we.width=un,rt=yt.substring(1,Fe)}else rt=yt.substring(1);if(rt.length===1)we.presentation1=rt;else if(rt.length>1){var It=rt.charAt(rt.length-1);"atco".indexOf(It)!==-1?(we.presentation2=It,It==="o"&&(we.ordinal=!0),we.presentation1=rt.substring(0,rt.length-1)):we.presentation1=rt}else we.presentation1=J[we.component];if(typeof we.presentation1>"u")throw{code:"D3132",value:we.component};if(we.presentation1[0]==="n")we.names=ee.LOWER;else if(we.presentation1[0]==="N")we.presentation1[1]==="n"?we.names=ee.TITLE:we.names=ee.UPPER;else if("YMDdFWwXxHhmsf".indexOf(we.component)!==-1){var Dt=we.presentation1;if(we.presentation2&&(Dt+=";"+we.presentation2),we.integerFormat=L(Dt),we.width&&we.width.min!==void 0&&we.integerFormat.mandatoryDigits<we.width.min&&(we.integerFormat.mandatoryDigits=we.width.min),we.component==="Y")if(we.n=-1,we.width&&we.width.max!==void 0)we.n=we.width.max,we.integerFormat.mandatoryDigits=we.n;else{var vt=we.integerFormat.mandatoryDigits+we.integerFormat.optionalDigits;vt>=2&&(we.n=vt)}const St=oe[oe.length-1];St&&St.integerFormat&&(St.integerFormat.parseWidth=St.integerFormat.mandatoryDigits)}(we.component==="Z"||we.component==="z")&&(we.integerFormat=L(we.presentation1)),oe.push(we),ne=De+1}De++}return Ee(ne,De),Z}const ce=["","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Te=["January","February","March","April","May","June","July","August","September","October","November","December"],me=1e3*60*60*24,$e=function(Q){const oe=Date.UTC(Q.year,Q.month);var Z=new Date(oe).getUTCDay();return Z===0&&(Z=7),Z>4?oe+(8-Z)*me:oe-(Z-1)*me},Re=function(Q,oe){return{year:Q,month:oe,nextMonth:function(){return oe===11?Re(Q+1,0):Re(Q,oe+1)},previousMonth:function(){return oe===0?Re(Q-1,11):Re(Q,oe-1)},nextYear:function(){return Re(Q+1,oe)},previousYear:function(){return Re(Q-1,oe)}}},be=function(Q,oe){return(oe-Q)/(me*7)+1},re=(Q,oe)=>{let Z;switch(oe){case"Y":Z=Q.getUTCFullYear();break;case"M":Z=Q.getUTCMonth()+1;break;case"D":Z=Q.getUTCDate();break;case"d":{const Ee=Date.UTC(Q.getUTCFullYear(),Q.getUTCMonth(),Q.getUTCDate()),ne=Date.UTC(Q.getUTCFullYear(),0);Z=(Ee-ne)/me+1;break}case"F":Z=Q.getUTCDay(),Z===0&&(Z=7);break;case"W":{const Ee=Re(Q.getUTCFullYear(),0),ne=$e(Ee),De=Date.UTC(Ee.year,Q.getUTCMonth(),Q.getUTCDate());let we=be(ne,De);if(we>52){const Fe=$e(Ee.nextYear());De>=Fe&&(we=1)}else if(we<1){const Fe=$e(Ee.previousYear());we=be(Fe,De)}Z=Math.floor(we);break}case"w":{const Ee=Re(Q.getUTCFullYear(),Q.getUTCMonth()),ne=$e(Ee),De=Date.UTC(Ee.year,Ee.month,Q.getUTCDate());let we=be(ne,De);if(we>4){const Fe=$e(Ee.nextMonth());De>=Fe&&(we=1)}else if(we<1){const Fe=$e(Ee.previousMonth());we=be(Fe,De)}Z=Math.floor(we);break}case"X":{const Ee=Re(Q.getUTCFullYear(),0),ne=$e(Ee),De=$e(Ee.nextYear()),we=Q.getTime();we<ne?Z=Ee.year-1:we>=De?Z=Ee.year+1:Z=Ee.year;break}case"x":{const Ee=Re(Q.getUTCFullYear(),Q.getUTCMonth()),ne=$e(Ee),De=Ee.nextMonth(),we=$e(De),Fe=Q.getTime();Fe<ne?Z=Ee.previousMonth().month+1:Fe>=we?Z=De.month+1:Z=Ee.month+1;break}case"H":Z=Q.getUTCHours();break;case"h":Z=Q.getUTCHours(),Z=Z%12,Z===0&&(Z=12);break;case"P":Z=Q.getUTCHours()>=12?"pm":"am";break;case"m":Z=Q.getUTCMinutes();break;case"s":Z=Q.getUTCSeconds();break;case"f":Z=Q.getUTCMilliseconds();break;case"Z":case"z":break;case"C":Z="ISO";break;case"E":Z="ISO";break}return Z};let K=null;function se(Q,oe,Z){var Ee=0,ne=0;if(typeof Z<"u"){const Dt=parseInt(Z);Ee=Math.floor(Dt/100),ne=Dt%100}var De=function(Dt,vt){var yt=re(Dt,vt.component);if("YMDdFWwXxHhms".indexOf(vt.component)!==-1)if(vt.component==="Y"&&vt.n!==-1&&(yt=yt%Math.pow(10,vt.n)),vt.names){if(vt.component==="M"||vt.component==="x")yt=Te[yt-1];else if(vt.component==="F")yt=ce[yt];else throw{code:"D3133",value:vt.component};vt.names===ee.UPPER?yt=yt.toUpperCase():vt.names===ee.LOWER&&(yt=yt.toLowerCase()),vt.width&&yt.length>vt.width.max&&(yt=yt.substring(0,vt.width.max))}else yt=le(yt,vt.integerFormat);else if(vt.component==="f")yt=le(yt,vt.integerFormat);else if(vt.component==="Z"||vt.component==="z"){const St=Ee*100+ne;if(vt.integerFormat.regular)yt=le(St,vt.integerFormat);else{const lt=vt.integerFormat.mandatoryDigits;if(lt===1||lt===2)yt=le(Ee,vt.integerFormat),ne!==0&&(yt+=":"+N(ne,"00"));else if(lt===3||lt===4)yt=le(St,vt.integerFormat);else throw{code:"D3134",value:lt}}St>=0&&(yt="+"+yt),vt.component==="z"&&(yt="GMT"+yt),St===0&&vt.presentation2==="t"&&(yt="Z")}else vt.component==="P"&&vt.names===ee.UPPER&&(yt=yt.toUpperCase());return yt};let we;typeof oe>"u"?(K===null&&(K=pe("[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01].[f001][Z01:01t]")),we=K):we=pe(oe);const Fe=(60*Ee+ne)*60*1e3,rt=new Date(Q+Fe);let It="";return we.parts.forEach(function(Dt){Dt.type==="literal"?It+=Dt.value:It+=De(rt,Dt)}),It}function V(Q){var oe={};if(Q.type==="datetime")oe.type="datetime",oe.parts=Q.parts.map(function(Z){var Ee={};if(Z.type==="literal")Ee.regex=Z.value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");else if(Z.component==="Z"||Z.component==="z"){let De;Array.isArray(Z.integerFormat.groupingSeparators)||(De=Z.integerFormat.groupingSeparators),Ee.regex="",Z.component==="z"&&(Ee.regex="GMT"),Ee.regex+="[-+][0-9]+",De&&(Ee.regex+=De.character+"[0-9]+"),Ee.parse=function(we){Z.component==="z"&&(we=we.substring(3));let Fe=0,rt=0;return De?(Fe=Number.parseInt(we.substring(0,we.indexOf(De.character))),rt=Number.parseInt(we.substring(we.indexOf(De.character)+1))):we.length-1<=2?Fe=Number.parseInt(we):(Fe=Number.parseInt(we.substring(0,3)),rt=Number.parseInt(we.substring(3))),Fe*60+rt}}else if(Z.integerFormat)Ee=V(Z.integerFormat);else{Ee.regex="[a-zA-Z]+";var ne={};if(Z.component==="M"||Z.component==="x")Te.forEach(function(De,we){Z.width&&Z.width.max?ne[De.substring(0,Z.width.max)]=we+1:ne[De]=we+1});else if(Z.component==="F")ce.forEach(function(De,we){we>0&&(Z.width&&Z.width.max?ne[De.substring(0,Z.width.max)]=we:ne[De]=we)});else if(Z.component==="P")ne={am:0,AM:0,pm:1,PM:1};else throw{code:"D3133",value:Z.component};Ee.parse=function(De){return ne[De]}}return Ee.component=Z.component,Ee});else{oe.type="integer";const Z=Q.case===ee.UPPER;switch(Q.primary){case z.LETTERS:oe.regex=Z?"[A-Z]+":"[a-z]+",oe.parse=function(Ee){return j(Ee,Z?"A":"a")};break;case z.ROMAN:oe.regex=Z?"[MDCLXVI]+":"[mdclxvi]+",oe.parse=function(Ee){return W(Z?Ee:Ee.toUpperCase())};break;case z.WORDS:oe.regex="(?:"+Object.keys(A).concat("and","[\\-, ]").join("|")+")+",oe.parse=function(Ee){return I(Ee.toLowerCase())};break;case z.DECIMAL:oe.regex="[0-9]",Q.parseWidth?oe.regex+=`{${Q.parseWidth}}`:oe.regex+="+",Q.ordinal&&(oe.regex+="(?:th|st|nd|rd)"),oe.parse=function(Ee){let ne=Ee;return Q.ordinal&&(ne=Ee.substring(0,Ee.length-2)),Q.regular?ne=ne.split(",").join(""):Q.groupingSeparators.forEach(De=>{ne=ne.split(De.character).join("")}),Q.zeroCode!==48&&(ne=ne.split("").map(De=>String.fromCodePoint(De.codePointAt(0)-Q.zeroCode+48)).join("")),parseInt(ne)};break;case z.SEQUENCE:throw{code:"D3130",value:Q.token}}}return oe}function G(Q,oe){if(typeof Q>"u")return;const Z=L(oe);return V(Z).parse(Q)}function Ce(Q,oe){const Z=pe(oe),Ee=V(Z),ne="^"+Ee.parts.map(rt=>"("+rt.regex+")").join("")+"$";var we=new RegExp(ne,"i").exec(Q);if(we!==null){const lt={};for(let Qe=1;Qe<we.length;Qe++){const B=Ee.parts[Qe-1];B.parse&&(lt[B.component]=B.parse(we[Qe]))}if(Object.getOwnPropertyNames(lt).length===0)return;let sn=0;const mn=Qe=>{sn<<=1,sn+=Qe?1:0},dn=Qe=>!(~Qe&sn)&&!!(Qe&sn);"YXMxWwdD".split("").forEach(Qe=>mn(lt[Qe]));const Tn=!dn(161)&&dn(130),rr=dn(84),or=!rr&&dn(72);sn=0,"PHhmsf".split("").forEach(Qe=>mn(lt[Qe]));const ot=!dn(23)&&dn(47),Rn=(Tn?"YD":rr?"XxwF":or?"XWF":"YMD")+(ot?"Phmsf":"Hmsf"),Dn=this.environment.timestamp;let On=!1,In=!1;if(Rn.split("").forEach(Qe=>{if(typeof lt[Qe]>"u")On?(lt[Qe]="MDd".indexOf(Qe)!==-1?1:0,In=!0):lt[Qe]=re(Dn,Qe);else if(On=!0,In)throw{code:"D3136"}}),lt.M>0?lt.M-=1:lt.M=0,Tn){const Qe=Date.UTC(lt.Y,0),B=(lt.d-1)*1e3*60*60*24,te=new Date(Qe+B);lt.M=te.getUTCMonth(),lt.D=te.getUTCDate()}if(rr)throw{code:"D3136"};if(or)throw{code:"D3136"};ot&&(lt.H=lt.h===12?0:lt.h,lt.P===1&&(lt.H+=12));var Fe=Date.UTC(lt.Y,lt.M,lt.D,lt.H,lt.m,lt.s,lt.f);return(lt.Z||lt.z)&&(Fe-=(lt.Z||lt.z)*60*1e3),Fe}}var je=new RegExp("^\\d{4}(-[01]\\d)*(-[0-3]\\d)*(T[0-2]\\d:[0-5]\\d:[0-5]\\d)*(\\.\\d+)?([+-][0-2]\\d:?[0-5]\\d|Z)?$");function qe(Q,oe){if(!(typeof Q>"u"))if(typeof oe>"u"){if(!je.test(Q))throw{stack:new Error().stack,code:"D3110",value:Q};return Date.parse(Q)}else return Ce.call(this,Q,oe)}function He(Q,oe,Z){if(!(typeof Q>"u"))return se.call(this,Q,oe,Z)}return{formatInteger:N,parseInteger:G,fromMillis:He,toMillis:qe}}();s.exports=f},{"./utils":6}],2:[function(i,s,c){(function(d){(function(){var f=i("./utils");const v=(()=>{var b=f.isNumeric,S=f.isArrayOfStrings,E=f.isArrayOfNumbers,w=f.createSequence,R=f.isSequence,A=f.isFunction,I=f.isLambda,P=f.isPromise,U=f.getFunctionArity,Y=f.isDeepEqual,W=f.stringToArray;function k($){if(!(typeof $>"u")){var F=0;return $.forEach(function(q){F+=q}),F}}function j($){return typeof $>"u"?0:$.length}function N($){if(!(typeof $>"u"||$.length===0))return Math.max.apply(Math,$)}function z($){if(!(typeof $>"u"||$.length===0))return Math.min.apply(Math,$)}function ee($){if(!(typeof $>"u"||$.length===0)){var F=0;return $.forEach(function(q){F+=q}),F/$.length}}function le($,F=!1){if(!(typeof $>"u")){var q;if(typeof $=="string")q=$;else if(A($))q="";else{if(typeof $=="number"&&!isFinite($))throw{code:"D3001",value:$,stack:new Error().stack};var he=F?2:0;Array.isArray($)&&$.outerWrapper&&($=$[0]),q=JSON.stringify($,function(fe,Le){return typeof Le<"u"&&Le!==null&&Le.toPrecision&&b(Le)?Number(Le.toPrecision(15)):Le&&A(Le)?"":Le},he)}return q}}function ge($,F,q){if(!(typeof $>"u")){var he=W($),fe=he.length;if(fe+F<0&&(F=0),typeof q<"u"){if(q<=0)return"";var Le=F>=0?F+q:fe+F+q;return he.slice(F,Le).join("")}return he.slice(F).join("")}}function L($,F){if(!(typeof $>"u")){var q=$.indexOf(F);return q>-1?$.substr(0,q):$}}function J($,F){if(!(typeof $>"u")){var q=$.indexOf(F);return q>-1?$.substr(q+F.length):$}}function pe($){if(!(typeof $>"u"))return $.toLowerCase()}function ce($){if(!(typeof $>"u"))return $.toUpperCase()}function Te($){if(!(typeof $>"u"))return W($).length}function me($){if(!(typeof $>"u")){var F=$.replace(/[ \t\n\r]+/gm," ");return F.charAt(0)===" "&&(F=F.substring(1)),F.charAt(F.length-1)===" "&&(F=F.substring(0,F.length-1)),F}}function $e($,F,q){if(!(typeof $>"u")){(typeof q>"u"||q.length===0)&&(q=" ");var he;F=Math.trunc(F);var fe=Math.abs(F)-Te($);if(fe>0){var Le=new Array(fe+1).join(q);q.length>1&&(Le=ge(Le,0,fe)),F>0?he=$+Le:he=Le+$}else he=$;return he}}async function Re($,F){var q=$.apply(this,[F]);if(P(q)&&(q=await q),q&&!(typeof q.start=="number"||q.end==="number"||Array.isArray(q.groups)||A(q.next)))throw{code:"T1010",stack:new Error().stack};return q}async function be($,F){if(!(typeof $>"u")){var q;if(typeof F=="string")q=$.indexOf(F)!==-1;else{var he=await Re(F,$);q=typeof he<"u"}return q}}async function re($,F,q){if(!(typeof $>"u")){if(q<0)throw{stack:new Error().stack,value:q,code:"D3040",index:3};var he=w();if(typeof q>"u"||q>0){var fe=0,Le=await Re(F,$);if(typeof Le<"u")for(;typeof Le<"u"&&(typeof q>"u"||fe<q);)he.push({match:Le.match,index:Le.start,groups:Le.groups}),Le=await Re(Le.next),fe++}return he}}async function K($,F,q,he){if(!(typeof $>"u")){var fe=this;if(F==="")throw{code:"D3010",stack:new Error().stack,value:F,index:2};if(he<0)throw{code:"D3011",stack:new Error().stack,value:he,index:4};var Le;typeof q=="string"?Le=function(pn){for(var Xn="",an=0,ie=q.indexOf("$",an);ie!==-1&&an<q.length;){Xn+=q.substring(an,ie),an=ie+1;var Ye=q.charAt(an);if(Ye==="$")Xn+="$",an++;else if(Ye==="0")Xn+=pn.match,an++;else{var at;if(pn.groups.length===0?at=1:at=Math.floor(Math.log(pn.groups.length)*Math.LOG10E)+1,ie=parseInt(q.substring(an,an+at),10),at>1&&ie>pn.groups.length&&(ie=parseInt(q.substring(an,an+at-1),10)),isNaN(ie))Xn+="$";else{if(pn.groups.length>0){var _t=pn.groups[ie-1];typeof _t<"u"&&(Xn+=_t)}an+=ie.toString().length}}ie=q.indexOf("$",an)}return Xn+=q.substring(an),Xn}:Le=q;var nt="",Tt=0;if(typeof he>"u"||he>0){var $t=0;if(typeof F=="string"){for(var fn=$.indexOf(F,Tt);fn!==-1&&(typeof he>"u"||$t<he);)nt+=$.substring(Tt,fn),nt+=q,Tt=fn+F.length,$t++,fn=$.indexOf(F,Tt);nt+=$.substring(Tt)}else{var zt=await Re(F,$);if(typeof zt<"u"){for(;typeof zt<"u"&&(typeof he>"u"||$t<he);){nt+=$.substring(Tt,zt.start);var bn=Le.apply(fe,[zt]);if(P(bn)&&(bn=await bn),typeof bn=="string")nt+=bn;else throw{code:"D3012",stack:new Error().stack,value:bn};Tt=zt.start+zt.match.length,$t++,zt=await Re(zt.next)}nt+=$.substring(Tt)}else nt=$}}else nt=$;return nt}}function se($){if(!(typeof $>"u")){var F=typeof window<"u"?window.btoa:function(q){return new d.Buffer.from(q,"binary").toString("base64")};return F($)}}function V($){if(!(typeof $>"u")){var F=typeof window<"u"?window.atob:function(q){return new d.Buffer.from(q,"base64").toString("binary")};return F($)}}function G($){if(!(typeof $>"u")){var F;try{F=encodeURIComponent($)}catch{throw{code:"D3140",stack:new Error().stack,value:$,functionName:"encodeUrlComponent"}}return F}}function Ce($){if(!(typeof $>"u")){var F;try{F=encodeURI($)}catch{throw{code:"D3140",stack:new Error().stack,value:$,functionName:"encodeUrl"}}return F}}function je($){if(!(typeof $>"u")){var F;try{F=decodeURIComponent($)}catch{throw{code:"D3140",stack:new Error().stack,value:$,functionName:"decodeUrlComponent"}}return F}}function qe($){if(!(typeof $>"u")){var F;try{F=decodeURI($)}catch{throw{code:"D3140",stack:new Error().stack,value:$,functionName:"decodeUrl"}}return F}}async function He($,F,q){if(!(typeof $>"u")){if(q<0)throw{code:"D3020",stack:new Error().stack,value:q,index:3};var he=[];if(typeof q>"u"||q>0)if(typeof F=="string")he=$.split(F,q);else{var fe=0,Le=await Re(F,$);if(typeof Le<"u"){for(var nt=0;typeof Le<"u"&&(typeof q>"u"||fe<q);)he.push($.substring(nt,Le.start)),nt=Le.end,Le=await Re(Le.next),fe++;(typeof q>"u"||fe<q)&&he.push($.substring(nt))}else he.push($)}return he}}function Q($,F){if(!(typeof $>"u"))return typeof F>"u"&&(F=""),$.join(F)}function oe($,F,q){if(!(typeof $>"u")){var he={"decimal-separator":".","grouping-separator":",","exponent-separator":"e",infinity:"Infinity","minus-sign":"-",NaN:"NaN",percent:"%","per-mille":"‰","zero-digit":"0",digit:"#","pattern-separator":";"},fe=he;typeof q<"u"&&Object.keys(q).forEach(function(Ht){fe[Ht]=q[Ht]});for(var Le=[],nt=fe["zero-digit"].charCodeAt(0),Tt=nt;Tt<nt+10;Tt++)Le.push(String.fromCharCode(Tt));var $t=Le.concat([fe["decimal-separator"],fe["exponent-separator"],fe["grouping-separator"],fe.digit,fe["pattern-separator"]]),fn=F.split(fe["pattern-separator"]);if(fn.length>2)throw{code:"D3080",stack:new Error().stack};var zt=function(Ht){var Bn=function(){for(var Mn,Rr=0;Rr<Ht.length;Rr++)if(Mn=Ht.charAt(Rr),$t.indexOf(Mn)!==-1&&Mn!==fe["exponent-separator"])return Ht.substring(0,Rr)}(),gr=function(){for(var Mn,Rr=Ht.length-1;Rr>=0;Rr--)if(Mn=Ht.charAt(Rr),$t.indexOf(Mn)!==-1&&Mn!==fe["exponent-separator"])return Ht.substring(Rr+1)}(),yn=Ht.substring(Bn.length,Ht.length-gr.length),so,Tr,To,_i,uo=Ht.indexOf(fe["exponent-separator"],Bn.length);uo===-1||uo>Ht.length-gr.length?(so=yn,Tr=void 0):(so=yn.substring(0,uo),Tr=yn.substring(uo+1));var Zr=so.indexOf(fe["decimal-separator"]);return Zr===-1?(To=so,_i=gr):(To=so.substring(0,Zr),_i=so.substring(Zr+1)),{prefix:Bn,suffix:gr,activePart:yn,mantissaPart:so,exponentPart:Tr,integerPart:To,fractionalPart:_i,subpicture:Ht}},bn=function(Ht){var Bn,gr,yn=Ht.subpicture,so=yn.indexOf(fe["decimal-separator"]);so!==yn.lastIndexOf(fe["decimal-separator"])&&(Bn="D3081"),yn.indexOf(fe.percent)!==yn.lastIndexOf(fe.percent)&&(Bn="D3082"),yn.indexOf(fe["per-mille"])!==yn.lastIndexOf(fe["per-mille"])&&(Bn="D3083"),yn.indexOf(fe.percent)!==-1&&yn.indexOf(fe["per-mille"])!==-1&&(Bn="D3084");var Tr=!1;for(gr=0;gr<Ht.mantissaPart.length;gr++){var To=Ht.mantissaPart.charAt(gr);if(Le.indexOf(To)!==-1||To===fe.digit){Tr=!0;break}}Tr||(Bn="D3085");var _i=Ht.activePart.split("").map(function(Mn){return $t.indexOf(Mn)===-1?"p":"a"}).join("");_i.indexOf("p")!==-1&&(Bn="D3086"),so!==-1?(yn.charAt(so-1)===fe["grouping-separator"]||yn.charAt(so+1)===fe["grouping-separator"])&&(Bn="D3087"):Ht.integerPart.charAt(Ht.integerPart.length-1)===fe["grouping-separator"]&&(Bn="D3088"),yn.indexOf(fe["grouping-separator"]+fe["grouping-separator"])!==-1&&(Bn="D3089");var uo=Ht.integerPart.indexOf(fe.digit);uo!==-1&&Ht.integerPart.substring(0,uo).split("").filter(function(Mn){return Le.indexOf(Mn)>-1}).length>0&&(Bn="D3090"),uo=Ht.fractionalPart.lastIndexOf(fe.digit),uo!==-1&&Ht.fractionalPart.substring(uo).split("").filter(function(Mn){return Le.indexOf(Mn)>-1}).length>0&&(Bn="D3091");var Zr=typeof Ht.exponentPart=="string";if(Zr&&Ht.exponentPart.length>0&&(yn.indexOf(fe.percent)!==-1||yn.indexOf(fe["per-mille"])!==-1)&&(Bn="D3092"),Zr&&(Ht.exponentPart.length===0||Ht.exponentPart.split("").filter(function(Mn){return Le.indexOf(Mn)===-1}).length>0)&&(Bn="D3093"),Bn)throw{code:Bn,stack:new Error().stack}},pn=function(Ht){var Bn=function(Hr,pl){for(var Fi=[],Qo=Hr.indexOf(fe["grouping-separator"]);Qo!==-1;){var hl=(pl?Hr.substring(0,Qo):Hr.substring(Qo)).split("").filter(function(Xo){return Le.indexOf(Xo)!==-1||Xo===fe.digit}).length;Fi.push(hl),Qo=Ht.integerPart.indexOf(fe["grouping-separator"],Qo+1)}return Fi},gr=Bn(Ht.integerPart),yn=function(Hr){if(Hr.length===0)return 0;for(var pl=function(hl,Xo){return Xo===0?hl:pl(Xo,hl%Xo)},Fi=Hr.reduce(pl),Qo=1;Qo<=Hr.length;Qo++)if(Hr.indexOf(Qo*Fi)===-1)return 0;return Fi},so=yn(gr),Tr=Bn(Ht.fractionalPart,!0),To=Ht.integerPart.split("").filter(function(Hr){return Le.indexOf(Hr)!==-1}).length,_i=To,uo=Ht.fractionalPart.split(""),Zr=uo.filter(function(Hr){return Le.indexOf(Hr)!==-1}).length,Mn=uo.filter(function(Hr){return Le.indexOf(Hr)!==-1||Hr===fe.digit}).length,Rr=typeof Ht.exponentPart=="string";To===0&&Mn===0&&(Rr?(Zr=1,Mn=1):To=1),Rr&&To===0&&Ht.integerPart.indexOf(fe.digit)!==-1&&(To=1),To===0&&Zr===0&&(Zr=1);var di=0;return Rr&&(di=Ht.exponentPart.split("").filter(function(Hr){return Le.indexOf(Hr)!==-1}).length),{integerPartGroupingPositions:gr,regularGrouping:so,minimumIntegerPartSize:To,scalingFactor:_i,prefix:Ht.prefix,fractionalPartGroupingPositions:Tr,minimumFactionalPartSize:Zr,maximumFactionalPartSize:Mn,minimumExponentSize:di,suffix:Ht.suffix,picture:Ht.subpicture}},Xn=fn.map(zt);Xn.forEach(bn);var an=Xn.map(pn),ie=fe["minus-sign"],Ye=fe["zero-digit"],at=fe["decimal-separator"],_t=fe["grouping-separator"];an.length===1&&(an.push(JSON.parse(JSON.stringify(an[0]))),an[1].prefix=ie+an[1].prefix);var At;$>=0?At=an[0]:At=an[1];var Wt;At.picture.indexOf(fe.percent)!==-1?Wt=$*100:At.picture.indexOf(fe["per-mille"])!==-1?Wt=$*1e3:Wt=$;var Jt,en;if(At.minimumExponentSize===0)Jt=Wt;else{var Er=Math.pow(10,At.scalingFactor),Zn=Math.pow(10,At.scalingFactor-1);for(Jt=Wt,en=0;Jt<Zn;)Jt*=10,en-=1;for(;Jt>Er;)Jt/=10,en+=1}var ar=Fe(Jt,At.maximumFactionalPartSize),Kr=function(Ht,Bn){var gr=Math.abs(Ht).toFixed(Bn);return Ye!=="0"&&(gr=gr.split("").map(function(yn){return yn>="0"&&yn<="9"?Le[yn.charCodeAt(0)-48]:yn}).join("")),gr},Yt=Kr(ar,At.maximumFactionalPartSize),Jn=Yt.indexOf(".");for(Jn===-1?Yt=Yt+at:Yt=Yt.replace(".",at);Yt.charAt(0)===Ye;)Yt=Yt.substring(1);for(;Yt.charAt(Yt.length-1)===Ye;)Yt=Yt.substring(0,Yt.length-1);Jn=Yt.indexOf(at);var Xt=At.minimumIntegerPartSize-Jn,nn=At.minimumFactionalPartSize-(Yt.length-Jn-1);if(Yt=(Xt>0?new Array(Xt+1).join(Ye):"")+Yt,Yt=Yt+(nn>0?new Array(nn+1).join(Ye):""),Jn=Yt.indexOf(at),At.regularGrouping>0)for(var Xa=Math.floor((Jn-1)/At.regularGrouping),ci=1;ci<=Xa;ci++)Yt=[Yt.slice(0,Jn-ci*At.regularGrouping),_t,Yt.slice(Jn-ci*At.regularGrouping)].join("");else At.integerPartGroupingPositions.forEach(function(Ht){Yt=[Yt.slice(0,Jn-Ht),_t,Yt.slice(Jn-Ht)].join(""),Jn++});if(Jn=Yt.indexOf(at),At.fractionalPartGroupingPositions.forEach(function(Ht){Yt=[Yt.slice(0,Ht+Jn+1),_t,Yt.slice(Ht+Jn+1)].join("")}),Jn=Yt.indexOf(at),(At.picture.indexOf(at)===-1||Jn===Yt.length-1)&&(Yt=Yt.substring(0,Yt.length-1)),typeof en<"u"){var fi=Kr(en,0);Xt=At.minimumExponentSize-fi.length,Xt>0&&(fi=new Array(Xt+1).join(Ye)+fi),Yt=Yt+fe["exponent-separator"]+(en<0?ie:"")+fi}return Yt=At.prefix+Yt+At.suffix,Yt}}function Z($,F){if(!(typeof $>"u")){if($=Fe($),typeof F>"u"?F=10:F=Fe(F),F<2||F>36)throw{code:"D3100",stack:new Error().stack,value:F};var q=$.toString(F);return q}}function Ee($){var F;if(!(typeof $>"u")){if(typeof $=="number")F=$;else if(typeof $=="string"&&/^-?[0-9]+(\.[0-9]+)?([Ee][-+]?[0-9]+)?$/.test($)&&!isNaN(parseFloat($))&&isFinite($))F=parseFloat($);else if(typeof $=="string"&&/^(0[xX][0-9A-Fa-f]+)|(0[oO][0-7]+)|(0[bB][0-1]+)$/.test($))F=Number($);else if($===!0)F=1;else if($===!1)F=0;else throw{code:"D3030",value:$,stack:new Error().stack,index:1};return F}}function ne($){var F;if(!(typeof $>"u"))return F=Math.abs($),F}function De($){var F;if(!(typeof $>"u"))return F=Math.floor($),F}function we($){var F;if(!(typeof $>"u"))return F=Math.ceil($),F}function Fe($,F){var q;if(!(typeof $>"u")){if(F){var he=$.toString().split("e");$=+(he[0]+"e"+(he[1]?+he[1]+F:F))}q=Math.round($);var fe=q-$;return Math.abs(fe)===.5&&Math.abs(q%2)===1&&(q=q-1),F&&(he=q.toString().split("e"),q=+(he[0]+"e"+(he[1]?+he[1]-F:-F))),Object.is(q,-0)&&(q=0),q}}function rt($){var F;if(!(typeof $>"u")){if($<0)throw{stack:new Error().stack,code:"D3060",index:1,value:$};return F=Math.sqrt($),F}}function It($,F){var q;if(!(typeof $>"u")){if(q=Math.pow($,F),!isFinite(q))throw{stack:new Error().stack,code:"D3061",index:1,value:$,exp:F};return q}}function Dt(){return Math.random()}function vt($){if(!(typeof $>"u")){var F=!1;if(Array.isArray($)){if($.length===1)F=vt($[0]);else if($.length>1){var q=$.filter(function(he){return vt(he)});F=q.length>0}}else typeof $=="string"?$.length>0&&(F=!0):b($)?$!==0&&(F=!0):$!==null&&typeof $=="object"&&!A($)?Object.keys($).length>0&&(F=!0):typeof $=="boolean"&&$===!0&&(F=!0);return F}}function yt($){if(!(typeof $>"u"))return!vt($)}function St($,F,q,he){var fe=[F],Le=U($);return Le>=2&&fe.push(q),Le>=3&&fe.push(he),fe}async function lt($,F){if(!(typeof $>"u")){for(var q=w(),he=0;he<$.length;he++){var fe=St(F,$[he],he,$),Le=await F.apply(this,fe);typeof Le<"u"&&q.push(Le)}return q}}async function sn($,F){if(!(typeof $>"u")){for(var q=w(),he=0;he<$.length;he++){var fe=$[he],Le=St(F,fe,he,$),nt=await F.apply(this,Le);vt(nt)&&q.push(fe)}return q}}async function mn($,F){if(!(typeof $>"u")){for(var q=!1,he,fe=0;fe<$.length;fe++){var Le=$[fe],nt=!0;if(typeof F<"u"){var Tt=St(F,Le,fe,$),$t=await F.apply(this,Tt);nt=vt($t)}if(nt)if(!q)he=Le,q=!0;else throw{stack:new Error().stack,code:"D3138",index:fe}}if(!q)throw{stack:new Error().stack,code:"D3139"};return he}}function dn(){for(var $=[],F=Array.prototype.slice.call(arguments),q=Math.min.apply(Math,F.map(function(Le){return Array.isArray(Le)?Le.length:0})),he=0;he<q;he++){var fe=F.map(Le=>Le[he]);$.push(fe)}return $}async function un($,F,q){if(!(typeof $>"u")){var he,fe=U(F);if(fe<2)throw{stack:new Error().stack,code:"D3050",index:1};var Le;for(typeof q>"u"&&$.length>0?(he=$[0],Le=1):(he=q,Le=0);Le<$.length;){var nt=[he,$[Le]];fe>=3&&nt.push(Le),fe>=4&&nt.push($),he=await F.apply(this,nt),Le++}return he}}function Tn($){var F=w();if(Array.isArray($)){var q={};$.forEach(function(he){var fe=Tn(he);fe.forEach(function(Le){q[Le]=!0})}),F=Tn(q)}else $!==null&&typeof $=="object"&&!A($)&&Object.keys($).forEach(he=>F.push(he));return F}function rr($,F){var q;if(Array.isArray($)){q=w();for(var he=0;he<$.length;he++){var fe=rr($[he],F);typeof fe<"u"&&(Array.isArray(fe)?fe.forEach(Le=>q.push(Le)):q.push(fe))}}else $!==null&&typeof $=="object"&&!A($)&&(q=$[F]);return q}function or($,F){return typeof $>"u"?F:typeof F>"u"?$:(Array.isArray($)||($=w($)),Array.isArray(F)||(F=[F]),$.concat(F))}function it($){return!(typeof $>"u")}function ot($){var F=w();if(Array.isArray($))$.forEach(function(fe){F=or(F,ot(fe))});else if($!==null&&typeof $=="object"&&!I($))for(var q in $){var he={};he[q]=$[q],F.push(he)}else F=$;return F}function Ge($){if(!(typeof $>"u")){var F={};return $.forEach(function(q){for(var he in q)F[he]=q[he]}),F}}function cn($){if(!(typeof $>"u")){if($.length<=1)return $;for(var F=$.length,q=new Array(F),he=0;he<F;he++)q[F-he-1]=$[he];return q}}async function Rn($,F){var q=w();for(var he in $){var fe=St(F,$[he],he,$),Le=await F.apply(this,fe);typeof Le<"u"&&q.push(Le)}return q}function Dn($){throw{code:"D3137",stack:new Error().stack,message:$||"$error() function evaluated"}}function On($,F){if(!$)throw{code:"D3141",stack:new Error().stack,message:F||"$assert() statement failed"}}function In($){if($!==void 0)return $===null?"null":b($)?"number":typeof $=="string"?"string":typeof $=="boolean"?"boolean":Array.isArray($)?"array":A($)?"function":"object"}async function Qe($,F){if(!(typeof $>"u")){if($.length<=1)return $;var q;if(typeof F>"u"){if(!E($)&&!S($))throw{stack:new Error().stack,code:"D3070",index:1};q=async function(nt,Tt){return nt>Tt}}else q=F;var he=async function(nt,Tt){var $t=async function(zt,bn,pn){bn.length===0?Array.prototype.push.apply(zt,pn):pn.length===0?Array.prototype.push.apply(zt,bn):await q(bn[0],pn[0])?(zt.push(pn[0]),await $t(zt,bn,pn.slice(1))):(zt.push(bn[0]),await $t(zt,bn.slice(1),pn))},fn=[];return await $t(fn,nt,Tt),fn},fe=async function(nt){if(!Array.isArray(nt)||nt.length<=1)return nt;var Tt=Math.floor(nt.length/2),$t=nt.slice(0,Tt),fn=nt.slice(Tt);return $t=await fe($t),fn=await fe(fn),await he($t,fn)},Le=await fe($);return Le}}function B($){if(!(typeof $>"u")){if($.length<=1)return $;for(var F=new Array($.length),q=0;q<$.length;q++){var he=Math.floor(Math.random()*(q+1));q!==he&&(F[q]=F[he]),F[he]=$[q]}return F}}function te($){if(!(typeof $>"u")){if(!Array.isArray($)||$.length<=1)return $;for(var F=R($)?w():[],q=0;q<$.length;q++){for(var he=$[q],fe=!1,Le=0;Le<F.length;Le++)if(Y(he,F[Le])){fe=!0;break}fe||F.push(he)}return F}}async function ue($,F){var q={};for(var he in $){var fe=$[he],Le=St(F,fe,he,$),nt=await F.apply(this,Le);vt(nt)&&(q[he]=fe)}return Object.keys(q).length===0&&(q=void 0),q}return{sum:k,count:j,max:N,min:z,average:ee,string:le,substring:ge,substringBefore:L,substringAfter:J,lowercase:pe,uppercase:ce,length:Te,trim:me,pad:$e,match:re,contains:be,replace:K,split:He,join:Q,formatNumber:oe,formatBase:Z,number:Ee,floor:De,ceil:we,round:Fe,abs:ne,sqrt:rt,power:It,random:Dt,boolean:vt,not:yt,map:lt,zip:dn,filter:sn,single:mn,foldLeft:un,sift:ue,keys:Tn,lookup:rr,append:or,exists:it,spread:ot,merge:Ge,reverse:cn,each:Rn,error:Dn,assert:On,type:In,sort:Qe,shuffle:B,distinct:te,base64encode:se,base64decode:V,encodeUrlComponent:G,encodeUrl:Ce,decodeUrlComponent:je,decodeUrl:qe}})();s.exports=v}).call(this)}).call(this,typeof oO<"u"?oO:typeof self<"u"?self:typeof window<"u"?window:{})},{"./utils":6}],3:[function(i,s,c){var d=i("./datetime"),f=i("./functions"),v=i("./utils"),b=i("./parser"),S=i("./signature"),E=function(){var w=v.isNumeric,R=v.isArrayOfStrings,A=v.isArrayOfNumbers,I=v.createSequence,P=v.isSequence,U=v.isFunction,Y=v.isLambda,W=v.isIterable,k=v.isPromise,j=v.getFunctionArity,N=v.isDeepEqual,z=Dn(null);async function ee(B,te,ue){var $,F=ue.lookup(Symbol.for("jsonata.__evaluate_entry"));switch(F&&await F(B,te,ue),B.type){case"path":$=await le(B,te,ue);break;case"binary":$=await Te(B,te,ue);break;case"unary":$=await me(B,te,ue);break;case"name":$=$e(B,te);break;case"string":case"number":case"value":$=Re(B);break;case"wildcard":$=be(B,te);break;case"descendant":$=K(B,te);break;case"parent":$=ue.lookup(B.slot.label);break;case"condition":$=await De(B,te,ue);break;case"block":$=await we(B,te,ue);break;case"bind":$=await ne(B,te,ue);break;case"regex":$=Fe(B);break;case"function":$=await St(B,te,ue);break;case"variable":$=rt(B,te,ue);break;case"lambda":$=mn(B,te,ue);break;case"partial":$=await dn(B,te,ue);break;case"apply":$=await yt(B,te,ue);break;case"transform":$=Dt(B,te,ue);break}if(Object.prototype.hasOwnProperty.call(B,"predicate"))for(var q=0;q<B.predicate.length;q++)$=await ce(B.predicate[q].expr,$,ue);B.type!=="path"&&Object.prototype.hasOwnProperty.call(B,"group")&&($=await oe(B.group,$,ue));var he=ue.lookup(Symbol.for("jsonata.__evaluate_exit"));return he&&await he(B,te,ue,$),$&&P($)&&!$.tupleStream&&(B.keepArray&&($.keepSingleton=!0),$.length===0?$=void 0:$.length===1&&($=$.keepSingleton?$:$[0])),$}async function le(B,te,ue){var $;Array.isArray(te)&&B.steps[0].type!=="variable"?$=te:$=I(te);for(var F,q=!1,he=void 0,fe=0;fe<B.steps.length;fe++){var Le=B.steps[fe];if(Le.tuple&&(q=!0),fe===0&&Le.consarray?F=await ee(Le,$,ue):q?he=await pe(Le,$,he,ue):F=await L(Le,$,ue,fe===B.steps.length-1),!q&&(typeof F>"u"||F.length===0))break;typeof Le.focus>"u"&&($=F)}if(q)if(B.tuple)F=he;else for(F=I(),fe=0;fe<he.length;fe++)F.push(he[fe]["@"]);return B.keepSingletonArray&&(Array.isArray(F)&&F.cons&&!F.sequence&&(F=I(F)),F.keepSingleton=!0),B.hasOwnProperty("group")&&(F=await oe(B.group,q?he:F,ue)),F}function ge(B,te){var ue=Dn(B);for(const $ in te)ue.bind($,te[$]);return ue}async function L(B,te,ue,$){var F;if(B.type==="sort")return F=await It(B,te,ue),B.stages&&(F=await J(B.stages,F,ue)),F;F=I();for(var q=0;q<te.length;q++){var he=await ee(B,te[q],ue);if(B.stages)for(var fe=0;fe<B.stages.length;fe++)he=await ce(B.stages[fe].expr,he,ue);typeof he<"u"&&F.push(he)}var Le=I();return $&&F.length===1&&Array.isArray(F[0])&&!P(F[0])?Le=F[0]:F.forEach(function(nt){!Array.isArray(nt)||nt.cons?Le.push(nt):nt.forEach(Tt=>Le.push(Tt))}),Le}async function J(B,te,ue){for(var $=te,F=0;F<B.length;F++){var q=B[F];switch(q.type){case"filter":$=await ce(q.expr,$,ue);break;case"index":for(var he=0;he<$.length;he++){var fe=$[he];fe[q.value]=he}break}}return $}async function pe(B,te,ue,$){var F;if(B.type==="sort"){if(ue)F=await It(B,ue,$);else{var q=await It(B,te,$);F=I(),F.tupleStream=!0;for(var he=0;he<q.length;he++){var fe={"@":q[he]};fe[B.index]=he,F.push(fe)}}return B.stages&&(F=await J(B.stages,F,$)),F}F=I(),F.tupleStream=!0;var Le=$;ue===void 0&&(ue=te.map(fn=>({"@":fn})));for(var nt=0;nt<ue.length;nt++){Le=ge($,ue[nt]);var Tt=await ee(B,ue[nt]["@"],Le);if(typeof Tt<"u"){Array.isArray(Tt)||(Tt=[Tt]);for(var $t=0;$t<Tt.length;$t++)fe={},Object.assign(fe,ue[nt]),Tt.tupleStream?Object.assign(fe,Tt[$t]):(B.focus?(fe[B.focus]=Tt[$t],fe["@"]=ue[nt]["@"]):fe["@"]=Tt[$t],B.index&&(fe[B.index]=$t),B.ancestor&&(fe[B.ancestor.label]=ue[nt]["@"])),F.push(fe)}}return B.stages&&(F=await J(B.stages,F,$)),F}async function ce(B,te,ue){var $=I();if(te&&te.tupleStream&&($.tupleStream=!0),Array.isArray(te)||(te=I(te)),B.type==="number"){var F=Math.floor(B.value);F<0&&(F=te.length+F);var q=await te[F];typeof q<"u"&&(Array.isArray(q)?$=q:$.push(q))}else for(F=0;F<te.length;F++){var q=te[F],he=q,fe=ue;te.tupleStream&&(he=q["@"],fe=ge(ue,q));var Le=await ee(B,he,fe);w(Le)&&(Le=[Le]),A(Le)?Le.forEach(function(Tt){var $t=Math.floor(Tt);$t<0&&($t=te.length+$t),$t===F&&$.push(q)}):f.boolean(Le)&&$.push(q)}return $}async function Te(B,te,ue){var $,F=await ee(B.lhs,te,ue),q=B.value,he=async()=>await ee(B.rhs,te,ue);if(q==="and"||q==="or")try{return await qe(F,he,q)}catch(Le){throw Le.position=B.position,Le.token=q,Le}var fe=await he();try{switch(q){case"+":case"-":case"*":case"/":case"%":$=V(F,fe,q);break;case"=":case"!=":$=G(F,fe,q);break;case"<":case"<=":case">":case">=":$=Ce(F,fe,q);break;case"&":$=Q(F,fe);break;case"..":$=Ee(F,fe);break;case"in":$=je(F,fe);break}}catch(Le){throw Le.position=B.position,Le.token=q,Le}return $}async function me(B,te,ue){var $;switch(B.value){case"-":if($=await ee(B.expression,te,ue),typeof $>"u")$=void 0;else if(w($))$=-$;else throw{code:"D1002",stack:new Error().stack,position:B.position,token:B.value,value:$};break;case"[":$=[];let he=await Promise.all(B.expressions.map(async(fe,Le)=>(ue.isParallelCall=Le>0,[fe,await ee(fe,te,ue)])));for(let fe of he){var[F,q]=fe;typeof q<"u"&&(F.value==="["?$.push(q):$=f.append($,q))}B.consarray&&Object.defineProperty($,"cons",{enumerable:!1,configurable:!1,value:!0});break;case"{":$=await oe(B,te,ue);break}return $}function $e(B,te,ue){return f.lookup(te,B.value)}function Re(B){return B.value}function be(B,te){var ue=I();return Array.isArray(te)&&te.outerWrapper&&te.length>0&&(te=te[0]),te!==null&&typeof te=="object"&&Object.keys(te).forEach(function($){var F=te[$];Array.isArray(F)?(F=re(F),ue=f.append(ue,F)):ue.push(F)}),ue}function re(B,te){return typeof te>"u"&&(te=[]),Array.isArray(B)?B.forEach(function(ue){re(ue,te)}):te.push(B),te}function K(B,te){var ue,$=I();return typeof te<"u"&&(se(te,$),$.length===1?ue=$[0]:ue=$),ue}function se(B,te){Array.isArray(B)||te.push(B),Array.isArray(B)?B.forEach(function(ue){se(ue,te)}):B!==null&&typeof B=="object"&&Object.keys(B).forEach(function(ue){se(B[ue],te)})}function V(B,te,ue){var $;if(typeof B<"u"&&!w(B))throw{code:"T2001",stack:new Error().stack,value:B};if(typeof te<"u"&&!w(te))throw{code:"T2002",stack:new Error().stack,value:te};if(typeof B>"u"||typeof te>"u")return $;switch(ue){case"+":$=B+te;break;case"-":$=B-te;break;case"*":$=B*te;break;case"/":$=B/te;break;case"%":$=B%te;break}return $}function G(B,te,ue){var $,F=typeof B,q=typeof te;if(F==="undefined"||q==="undefined")return!1;switch(ue){case"=":$=N(B,te);break;case"!=":$=!N(B,te);break}return $}function Ce(B,te,ue){var $,F=typeof B,q=typeof te,he=F==="undefined"||F==="string"||F==="number",fe=q==="undefined"||q==="string"||q==="number";if(!he||!fe)throw{code:"T2010",stack:new Error().stack,value:F==="string"||F==="number"?te:B};if(!(F==="undefined"||q==="undefined")){if(F!==q)throw{code:"T2009",stack:new Error().stack,value:B,value2:te};switch(ue){case"<":$=B<te;break;case"<=":$=B<=te;break;case">":$=B>te;break;case">=":$=B>=te;break}return $}}function je(B,te){var ue=!1;if(typeof B>"u"||typeof te>"u")return!1;Array.isArray(te)||(te=[te]);for(var $=0;$<te.length;$++)if(te[$]===B){ue=!0;break}return ue}async function qe(B,te,ue){var $,F=He(B);switch(ue){case"and":$=F&&He(await te());break;case"or":$=F||He(await te());break}return $}function He(B){var te=f.boolean(B);return typeof te>"u"?!1:te}function Q(B,te){var ue,$="",F="";return typeof B<"u"&&($=f.string(B)),typeof te<"u"&&(F=f.string(te)),ue=$.concat(F),ue}async function oe(B,te,ue){var $={},F={},q=!!(te&&te.tupleStream);Array.isArray(te)||(te=I(te)),te.length===0&&te.push(void 0);for(var he=0;he<te.length;he++)for(var fe=te[he],Le=q?ge(ue,fe):ue,nt=0;nt<B.lhs.length;nt++){var Tt=B.lhs[nt],$t=await ee(Tt[0],q?fe["@"]:fe,Le);if(typeof $t!="string"&&$t!==void 0)throw{code:"T1003",stack:new Error().stack,position:B.position,value:$t};if($t!==void 0){var fn={data:fe,exprIndex:nt};if(F.hasOwnProperty($t)){if(F[$t].exprIndex!==nt)throw{code:"D1009",stack:new Error().stack,position:B.position,value:$t};F[$t].data=f.append(F[$t].data,fe)}else F[$t]=fn}}let zt=await Promise.all(Object.keys(F).map(async(pn,Xn)=>{let an=F[pn];var ie=an.data,Ye=ue;if(q){var at=Z(an.data);ie=at["@"],delete at["@"],Ye=ge(ue,at)}return ue.isParallelCall=Xn>0,[pn,await ee(B.lhs[an.exprIndex][1],ie,Ye)]}));for(let pn of zt){var[$t,bn]=await pn;typeof bn<"u"&&($[$t]=bn)}return $}function Z(B){if(!Array.isArray(B))return B;var te={};Object.assign(te,B[0]);for(var ue=1;ue<B.length;ue++)for(const $ in B[ue])te[$]=f.append(te[$],B[ue][$]);return te}function Ee(B,te){var ue;if(typeof B<"u"&&!Number.isInteger(B))throw{code:"T2003",stack:new Error().stack,value:B};if(typeof te<"u"&&!Number.isInteger(te))throw{code:"T2004",stack:new Error().stack,value:te};if(typeof B>"u"||typeof te>"u"||B>te)return ue;var $=te-B+1;if($>1e7)throw{code:"D2014",stack:new Error().stack,value:$};ue=new Array($);for(var F=B,q=0;F<=te;F++,q++)ue[q]=F;return ue.sequence=!0,ue}async function ne(B,te,ue){var $=await ee(B.rhs,te,ue);return ue.bind(B.lhs.value,$),$}async function De(B,te,ue){var $,F=await ee(B.condition,te,ue);return f.boolean(F)?$=await ee(B.then,te,ue):typeof B.else<"u"&&($=await ee(B.else,te,ue)),$}async function we(B,te,ue){for(var $,F=Dn(ue),q=0;q<B.expressions.length;q++)$=await ee(B.expressions[q],te,F);return $}function Fe(B){var te=new Qe.RegexEngine(B.value),ue=function($,F){var q;te.lastIndex=F||0;var he=te.exec($);if(he!==null){if(q={match:he[0],start:he.index,end:he.index+he[0].length,groups:[]},he.length>1)for(var fe=1;fe<he.length;fe++)q.groups.push(he[fe]);q.next=function(){if(!(te.lastIndex>=$.length)){var Le=ue($,te.lastIndex);if(Le&&Le.match==="")throw{code:"D1004",stack:new Error().stack,position:B.position,value:B.value.source};return Le}}}return q};return ue}function rt(B,te,ue){var $;return B.value===""?$=te&&te.outerWrapper?te[0]:te:$=ue.lookup(B.value),$}async function It(B,te,ue){var $,F=te,q=!!te.tupleStream,he=async function(Le,nt){for(var Tt=0,$t=0;Tt===0&&$t<B.terms.length;$t++){var fn=B.terms[$t],zt=Le,bn=ue;q&&(zt=Le["@"],bn=ge(ue,Le));var pn=await ee(fn.expression,zt,bn);zt=nt,bn=ue,q&&(zt=nt["@"],bn=ge(ue,nt));var Xn=await ee(fn.expression,zt,bn),an=typeof pn,ie=typeof Xn;if(an==="undefined"){Tt=ie==="undefined"?0:1;continue}if(ie==="undefined"){Tt=-1;continue}if(!(an==="string"||an==="number")||!(ie==="string"||ie==="number"))throw{code:"T2008",stack:new Error().stack,position:B.position,value:an==="string"||an==="number"?Xn:pn};if(an!==ie)throw{code:"T2007",stack:new Error().stack,position:B.position,value:pn,value2:Xn};pn!==Xn&&(pn<Xn?Tt=-1:Tt=1,fn.descending===!0&&(Tt=-Tt))}return Tt===1},fe={environment:ue,input:te};return $=await f.sort.apply(fe,[F,he]),$}function Dt(B,te,ue){var $=async function(F){if(!(typeof F>"u")){var q=ue.lookup("clone");if(!U(q))throw{code:"T2013",stack:new Error().stack,position:B.position};var he=await lt(q,[F],null,ue),fe=await ee(B.pattern,he,ue);if(typeof fe<"u"){Array.isArray(fe)||(fe=[fe]);for(var Le=0;Le<fe.length;Le++){var nt=fe[Le];if(nt&&(nt.isPrototypeOf(he)||nt instanceof Object.constructor))throw{code:"D1010",stack:new Error().stack,position:B.position};var Tt=await ee(B.update,nt,ue),$t=typeof Tt;if($t!=="undefined"){if($t!=="object"||Tt===null||Array.isArray(Tt))throw{code:"T2011",stack:new Error().stack,position:B.update.position,value:Tt};for(var fn in Tt)nt[fn]=Tt[fn]}if(typeof B.delete<"u"){var zt=await ee(B.delete,nt,ue);if(typeof zt<"u"){var bn=zt;if(Array.isArray(zt)||(zt=[zt]),!R(zt))throw{code:"T2012",stack:new Error().stack,position:B.delete.position,value:bn};for(var pn=0;pn<zt.length;pn++)typeof nt=="object"&&nt!==null&&delete nt[zt[pn]]}}}}return he}};return Ge($,"<(oa):o>")}var vt=b("function($f, $g) { function($x){ $g($f($x)) } }");async function yt(B,te,ue){var $,F=await ee(B.lhs,te,ue);if(B.rhs.type==="function")$=await St(B.rhs,te,ue,{context:F});else{var q=await ee(B.rhs,te,ue);if(!U(q))throw{code:"T2006",stack:new Error().stack,position:B.position,value:q};if(U(F)){var he=await ee(vt,null,ue);$=await lt(he,[F,q],null,ue)}else $=await lt(q,[F],null,ue)}return $}async function St(B,te,ue,$){var F,q=await ee(B.procedure,te,ue);if(typeof q>"u"&&B.procedure.type==="path"&&ue.lookup(B.procedure.steps[0].value))throw{code:"T1005",stack:new Error().stack,position:B.position,token:B.procedure.steps[0].value};var he=[];typeof $<"u"&&he.push($.context);for(var fe=0;fe<B.arguments.length;fe++){const nt=await ee(B.arguments[fe],te,ue);if(U(nt)){const Tt=async function(...$t){return await lt(nt,$t,null,ue)};Tt.arity=j(nt),he.push(Tt)}else he.push(nt)}var Le=B.procedure.type==="path"?B.procedure.steps[0].value:B.procedure.value;try{typeof q=="object"&&(q.token=Le,q.position=B.position),F=await lt(q,he,te,ue)}catch(nt){throw nt.position||(nt.position=B.position),nt.token||(nt.token=Le),nt}return F}async function lt(B,te,ue,$){var F;for(F=await sn(B,te,ue,$);Y(F)&&F.thunk===!0;){var q=await ee(F.body.procedure,F.input,F.environment);F.body.procedure.type==="variable"&&(q.token=F.body.procedure.value),q.position=F.body.procedure.position;for(var he=[],fe=0;fe<F.body.arguments.length;fe++)he.push(await ee(F.body.arguments[fe],F.input,F.environment));F=await sn(q,he,ue,$)}return F}async function sn(B,te,ue,$){var F;try{var q=te;if(B&&(q=un(B.signature,te,ue)),Y(B))F=await Tn(B,q);else if(B&&B._jsonata_function===!0){var he={environment:$,input:ue};F=B.implementation.apply(he,q),W(F)&&(F=F.next().value),k(F)&&(F=await F)}else if(typeof B=="function")F=B.apply(ue,q),k(F)&&(F=await F);else throw{code:"T1006",stack:new Error().stack}}catch(fe){throw B&&(typeof fe.token>"u"&&typeof B.token<"u"&&(fe.token=B.token),fe.position=B.position||fe.position),fe}return F}function mn(B,te,ue){var $={_jsonata_lambda:!0,input:te,environment:ue,arguments:B.arguments,signature:B.signature,body:B.body};return B.thunk===!0&&($.thunk=!0),$.apply=async function(F,q){return await lt($,q,te,F?F.environment:ue)},$}async function dn(B,te,ue){for(var $,F=[],q=0;q<B.arguments.length;q++){var he=B.arguments[q];he.type==="operator"&&he.value==="?"?F.push(he):F.push(await ee(he,te,ue))}var fe=await ee(B.procedure,te,ue);if(typeof fe>"u"&&B.procedure.type==="path"&&ue.lookup(B.procedure.steps[0].value))throw{code:"T1007",stack:new Error().stack,position:B.position,token:B.procedure.steps[0].value};if(Y(fe))$=rr(fe,F);else if(fe&&fe._jsonata_function===!0)$=or(fe.implementation,F);else if(typeof fe=="function")$=or(fe,F);else throw{code:"T1008",stack:new Error().stack,position:B.position,token:B.procedure.type==="path"?B.procedure.steps[0].value:B.procedure.value};return $}function un(B,te,ue){if(typeof B>"u")return te;var $=B.validate(te,ue);return $}async function Tn(B,te){var ue,$=Dn(B.environment);return B.arguments.forEach(function(F,q){$.bind(F.value,te[q])}),typeof B.body=="function"?ue=await it(B.body,$):ue=await ee(B.body,B.input,$),ue}function rr(B,te){var ue=Dn(B.environment),$=[];B.arguments.forEach(function(q,he){var fe=te[he];fe&&fe.type==="operator"&&fe.value==="?"?$.push(q):ue.bind(q.value,fe)});var F={_jsonata_lambda:!0,input:B.input,environment:ue,arguments:$,body:B.body};return F}function or(B,te){var ue=ot(B);ue=ue.map(function(he){return"$"+he.trim()});var $="function("+ue.join(", ")+"){ _ }",F=b($);F.body=B;var q=rr(F,te);return q}async function it(B,te){var ue=ot(B),$=ue.map(function(he){return te.lookup(he.trim())}),F={environment:te},q=B.apply(F,$);return k(q)&&(q=await q),q}function ot(B){var te=B.toString(),ue=/\(([^)]*)\)/.exec(te)[1],$=ue.split(",");return $}function Ge(B,te){var ue={_jsonata_function:!0,implementation:B};return typeof te<"u"&&(ue.signature=S(te)),ue}async function cn(B,te){if(!(typeof B>"u")){var ue=this.input;typeof te<"u"&&(ue=te,Array.isArray(ue)&&!P(ue)&&(ue=I(ue),ue.outerWrapper=!0));try{var $=b(B,!1)}catch(q){throw In(q),{stack:new Error().stack,code:"D3120",value:q.message,error:q}}try{var F=await ee($,ue,this.environment)}catch(q){throw In(q),{stack:new Error().stack,code:"D3121",value:q.message,error:q}}return F}}function Rn(B){if(!(typeof B>"u"))return JSON.parse(f.string(B))}function Dn(B){var te={};const ue={bind:function(F,q){te[F]=q},lookup:function(F){var q;return te.hasOwnProperty(F)?q=te[F]:B&&(q=B.lookup(F)),q},timestamp:B?B.timestamp:null,async:B?B.async:!1,isParallelCall:B?B.isParallelCall:!1,global:B?B.global:{ancestry:[null]}};if(B){var $=B.lookup(Symbol.for("jsonata.__createFrame_push"));$&&$(B,ue)}return ue}z.bind("sum",Ge(f.sum,"<a<n>:n>")),z.bind("count",Ge(f.count,"<a:n>")),z.bind("max",Ge(f.max,"<a<n>:n>")),z.bind("min",Ge(f.min,"<a<n>:n>")),z.bind("average",Ge(f.average,"<a<n>:n>")),z.bind("string",Ge(f.string,"<x-b?:s>")),z.bind("substring",Ge(f.substring,"<s-nn?:s>")),z.bind("substringBefore",Ge(f.substringBefore,"<s-s:s>")),z.bind("substringAfter",Ge(f.substringAfter,"<s-s:s>")),z.bind("lowercase",Ge(f.lowercase,"<s-:s>")),z.bind("uppercase",Ge(f.uppercase,"<s-:s>")),z.bind("length",Ge(f.length,"<s-:n>")),z.bind("trim",Ge(f.trim,"<s-:s>")),z.bind("pad",Ge(f.pad,"<s-ns?:s>")),z.bind("match",Ge(f.match,"<s-f<s:o>n?:a<o>>")),z.bind("contains",Ge(f.contains,"<s-(sf):b>")),z.bind("replace",Ge(f.replace,"<s-(sf)(sf)n?:s>")),z.bind("split",Ge(f.split,"<s-(sf)n?:a<s>>")),z.bind("join",Ge(f.join,"<a<s>s?:s>")),z.bind("formatNumber",Ge(f.formatNumber,"<n-so?:s>")),z.bind("formatBase",Ge(f.formatBase,"<n-n?:s>")),z.bind("formatInteger",Ge(d.formatInteger,"<n-s:s>")),z.bind("parseInteger",Ge(d.parseInteger,"<s-s:n>")),z.bind("number",Ge(f.number,"<(nsb)-:n>")),z.bind("floor",Ge(f.floor,"<n-:n>")),z.bind("ceil",Ge(f.ceil,"<n-:n>")),z.bind("round",Ge(f.round,"<n-n?:n>")),z.bind("abs",Ge(f.abs,"<n-:n>")),z.bind("sqrt",Ge(f.sqrt,"<n-:n>")),z.bind("power",Ge(f.power,"<n-n:n>")),z.bind("random",Ge(f.random,"<:n>")),z.bind("boolean",Ge(f.boolean,"<x-:b>")),z.bind("not",Ge(f.not,"<x-:b>")),z.bind("map",Ge(f.map,"<af>")),z.bind("zip",Ge(f.zip,"<a+>")),z.bind("filter",Ge(f.filter,"<af>")),z.bind("single",Ge(f.single,"<af?>")),z.bind("reduce",Ge(f.foldLeft,"<afj?:j>")),z.bind("sift",Ge(f.sift,"<o-f?:o>")),z.bind("keys",Ge(f.keys,"<x-:a<s>>")),z.bind("lookup",Ge(f.lookup,"<x-s:x>")),z.bind("append",Ge(f.append,"<xx:a>")),z.bind("exists",Ge(f.exists,"<x:b>")),z.bind("spread",Ge(f.spread,"<x-:a<o>>")),z.bind("merge",Ge(f.merge,"<a<o>:o>")),z.bind("reverse",Ge(f.reverse,"<a:a>")),z.bind("each",Ge(f.each,"<o-f:a>")),z.bind("error",Ge(f.error,"<s?:x>")),z.bind("assert",Ge(f.assert,"<bs?:x>")),z.bind("type",Ge(f.type,"<x:s>")),z.bind("sort",Ge(f.sort,"<af?:a>")),z.bind("shuffle",Ge(f.shuffle,"<a:a>")),z.bind("distinct",Ge(f.distinct,"<x:x>")),z.bind("base64encode",Ge(f.base64encode,"<s-:s>")),z.bind("base64decode",Ge(f.base64decode,"<s-:s>")),z.bind("encodeUrlComponent",Ge(f.encodeUrlComponent,"<s-:s>")),z.bind("encodeUrl",Ge(f.encodeUrl,"<s-:s>")),z.bind("decodeUrlComponent",Ge(f.decodeUrlComponent,"<s-:s>")),z.bind("decodeUrl",Ge(f.decodeUrl,"<s-:s>")),z.bind("eval",Ge(cn,"<sx?:x>")),z.bind("toMillis",Ge(d.toMillis,"<s-s?:n>")),z.bind("fromMillis",Ge(d.fromMillis,"<n-s?s?:s>")),z.bind("clone",Ge(Rn,"<(oa)-:o>"));var On={S0101:"String literal must be terminated by a matching quote",S0102:"Number out of range: {{token}}",S0103:"Unsupported escape sequence: \\{{token}}",S0104:"The escape sequence \\u must be followed by 4 hex digits",S0105:"Quoted property name must be terminated with a backquote (`)",S0106:"Comment has no closing tag",S0201:"Syntax error: {{token}}",S0202:"Expected {{value}}, got {{token}}",S0203:"Expected {{value}} before end of expression",S0204:"Unknown operator: {{token}}",S0205:"Unexpected token: {{token}}",S0206:"Unknown expression type: {{token}}",S0207:"Unexpected end of expression",S0208:"Parameter {{value}} of function definition must be a variable name (start with $)",S0209:"A predicate cannot follow a grouping expression in a step",S0210:"Each step can only have one grouping expression",S0211:"The symbol {{token}} cannot be used as a unary operator",S0212:"The left side of := must be a variable name (start with $)",S0213:"The literal value {{value}} cannot be used as a step within a path expression",S0214:"The right side of {{token}} must be a variable name (start with $)",S0215:"A context variable binding must precede any predicates on a step",S0216:"A context variable binding must precede the 'order-by' clause on a step",S0217:"The object representing the 'parent' cannot be derived from this expression",S0301:"Empty regular expressions are not allowed",S0302:"No terminating / in regular expression",S0402:"Choice groups containing parameterized types are not supported",S0401:"Type parameters can only be applied to functions and arrays",S0500:"Attempted to evaluate an expression containing syntax error(s)",T0410:"Argument {{index}} of function {{token}} does not match function signature",T0411:"Context value is not a compatible type with argument {{index}} of function {{token}}",T0412:"Argument {{index}} of function {{token}} must be an array of {{type}}",D1001:"Number out of range: {{value}}",D1002:"Cannot negate a non-numeric value: {{value}}",T1003:"Key in object structure must evaluate to a string; got: {{value}}",D1004:"Regular expression matches zero length string",T1005:"Attempted to invoke a non-function. Did you mean ${{{token}}}?",T1006:"Attempted to invoke a non-function",T1007:"Attempted to partially apply a non-function. Did you mean ${{{token}}}?",T1008:"Attempted to partially apply a non-function",D1009:"Multiple key definitions evaluate to same key: {{value}}",D1010:"Attempted to access the Javascript object prototype",T1010:"The matcher function argument passed to function {{token}} does not return the correct object structure",T2001:"The left side of the {{token}} operator must evaluate to a number",T2002:"The right side of the {{token}} operator must evaluate to a number",T2003:"The left side of the range operator (..) must evaluate to an integer",T2004:"The right side of the range operator (..) must evaluate to an integer",D2005:"The left side of := must be a variable name (start with $)",T2006:"The right side of the function application operator ~> must be a function",T2007:"Type mismatch when comparing values {{value}} and {{value2}} in order-by clause",T2008:"The expressions within an order-by clause must evaluate to numeric or string values",T2009:"The values {{value}} and {{value2}} either side of operator {{token}} must be of the same data type",T2010:"The expressions either side of operator {{token}} must evaluate to numeric or string values",T2011:"The insert/update clause of the transform expression must evaluate to an object: {{value}}",T2012:"The delete clause of the transform expression must evaluate to a string or array of strings: {{value}}",T2013:"The transform expression clones the input object using the $clone() function. This has been overridden in the current scope by a non-function.",D2014:"The size of the sequence allocated by the range operator (..) must not exceed 1e6. Attempted to allocate {{value}}.",D3001:"Attempting to invoke string function on Infinity or NaN",D3010:"Second argument of replace function cannot be an empty string",D3011:"Fourth argument of replace function must evaluate to a positive number",D3012:"Attempted to replace a matched string with a non-string value",D3020:"Third argument of split function must evaluate to a positive number",D3030:"Unable to cast value to a number: {{value}}",D3040:"Third argument of match function must evaluate to a positive number",D3050:"The second argument of reduce function must be a function with at least two arguments",D3060:"The sqrt function cannot be applied to a negative number: {{value}}",D3061:"The power function has resulted in a value that cannot be represented as a JSON number: base={{value}}, exponent={{exp}}",D3070:"The single argument form of the sort function can only be applied to an array of strings or an array of numbers. Use the second argument to specify a comparison function",D3080:"The picture string must only contain a maximum of two sub-pictures",D3081:"The sub-picture must not contain more than one instance of the 'decimal-separator' character",D3082:"The sub-picture must not contain more than one instance of the 'percent' character",D3083:"The sub-picture must not contain more than one instance of the 'per-mille' character",D3084:"The sub-picture must not contain both a 'percent' and a 'per-mille' character",D3085:"The mantissa part of a sub-picture must contain at least one character that is either an 'optional digit character' or a member of the 'decimal digit family'",D3086:"The sub-picture must not contain a passive character that is preceded by an active character and that is followed by another active character",D3087:"The sub-picture must not contain a 'grouping-separator' character that appears adjacent to a 'decimal-separator' character",D3088:"The sub-picture must not contain a 'grouping-separator' at the end of the integer part",D3089:"The sub-picture must not contain two adjacent instances of the 'grouping-separator' character",D3090:"The integer part of the sub-picture must not contain a member of the 'decimal digit family' that is followed by an instance of the 'optional digit character'",D3091:"The fractional part of the sub-picture must not contain an instance of the 'optional digit character' that is followed by a member of the 'decimal digit family'",D3092:"A sub-picture that contains a 'percent' or 'per-mille' character must not contain a character treated as an 'exponent-separator'",D3093:"The exponent part of the sub-picture must comprise only of one or more characters that are members of the 'decimal digit family'",D3100:"The radix of the formatBase function must be between 2 and 36. It was given {{value}}",D3110:"The argument of the toMillis function must be an ISO 8601 formatted timestamp. Given {{value}}",D3120:"Syntax error in expression passed to function eval: {{value}}",D3121:"Dynamic error evaluating the expression passed to function eval: {{value}}",D3130:"Formatting or parsing an integer as a sequence starting with {{value}} is not supported by this implementation",D3131:"In a decimal digit pattern, all digits must be from the same decimal group",D3132:"Unknown component specifier {{value}} in date/time picture string",D3133:"The 'name' modifier can only be applied to months and days in the date/time picture string, not {{value}}",D3134:"The timezone integer format specifier cannot have more than four digits",D3135:"No matching closing bracket ']' in date/time picture string",D3136:"The date/time picture string is missing specifiers required to parse the timestamp",D3137:"{{{message}}}",D3138:"The $single() function expected exactly 1 matching result. Instead it matched more.",D3139:"The $single() function expected exactly 1 matching result. Instead it matched 0.",D3140:"Malformed URL passed to ${{{functionName}}}(): {{value}}",D3141:"{{{message}}}"};function In(B){var te=On[B.code];if(typeof te<"u"){var ue=te.replace(/\{\{\{([^}]+)}}}/g,function(){return B[arguments[1]]});ue=ue.replace(/\{\{([^}]+)}}/g,function(){return JSON.stringify(B[arguments[1]])}),B.message=ue}}function Qe(B,te){var ue,$;try{ue=b(B,te&&te.recover),$=ue.errors,delete ue.errors}catch(he){throw In(he),he}var F=Dn(z),q=new Date;return F.bind("now",Ge(function(he,fe){return d.fromMillis(q.getTime(),he,fe)},"<s?s?:s>")),F.bind("millis",Ge(function(){return q.getTime()},"<:n>")),te&&te.RegexEngine?Qe.RegexEngine=te.RegexEngine:Qe.RegexEngine=RegExp,{evaluate:async function(he,fe,Le){if(typeof $<"u"){var nt={code:"S0500",position:0};throw In(nt),nt}if(typeof fe<"u"){var Tt;Tt=Dn(F);for(var $t in fe)Tt.bind($t,fe[$t])}else Tt=F;Tt.bind("$",he),q=new Date,Tt.timestamp=q,Array.isArray(he)&&!P(he)&&(he=I(he),he.outerWrapper=!0);var fn;try{return fn=await ee(ue,he,Tt),typeof Le=="function"&&Le(null,fn),fn}catch(zt){throw In(zt),zt}},assign:function(he,fe){F.bind(he,fe)},registerFunction:function(he,fe,Le){var nt=Ge(fe,Le);F.bind(he,nt)},ast:function(){return ue},errors:function(){return $}}}return Qe.parser=b,Qe}();s.exports=E},{"./datetime":1,"./functions":2,"./parser":4,"./signature":5,"./utils":6}],4:[function(i,s,c){var d=i("./signature");const f=(()=>{var v={".":75,"[":80,"]":0,"{":70,"}":0,"(":80,")":0,",":0,"@":80,"#":80,";":80,":":80,"?":20,"+":50,"-":50,"*":60,"/":60,"%":60,"|":20,"=":40,"<":40,">":40,"^":40,"**":60,"..":20,":=":10,"!=":40,"<=":40,">=":40,"~>":40,"?:":40,"??":40,and:30,or:25,in:40,"&":50,"!":0,"~":0},b={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
3354
+ `,Jj=({formComponent:e})=>{const r=e.props,{label:i="Button",url:s,target:c="_self",btnStyle:d="alt",margin:f}=r||{};return M.jsx(Zj,{href:s,target:c,$btnStyle:d,$margin:f,children:i})},eU={number:"number","number-input":"number",radio:"string","radio-group":"string","checkbox-single":"boolean","checkbox-multi":"any[]",scale:"number",dropdown:"string","titration-select":"string",datepicker:"string","text-input":"string","dosing-custom-units":"string",email:"string",password:"string",phone:"string",otp:"string",address:"object",hidden:"string","ga-client-id":"string",cookie:"string","hipaa-consent":"string",file:"string"},tU={header:yj,image:gj,"weight-loss-chart":bj,"horizontal-rule":Ej,"text-tip":Tj,"small-text":Rj,paragraph:Oj,"refill-request":$j,"addon-request":_j,"hipaa-consent":Yj,"link-button":Jj,video:Wj,"checkbox-single":W5,"checkbox-multi":Y5,radio:wO,"radio-group":wO,number:B5,dropdown:nI,datepicker:tI,scale:q5,"text-input":rI,textarea:G5,"titration-select":oI,"dosing-custom-units":mj,email:pI,password:hI,phone:mI,otp:rj,address:fj,hidden:dj,"ga-client-id":pj,cookie:hj,file:vj},wr=()=>{const e=Fu.useDispatch(),r=Fu.useSelector(J=>$5(J)),i=Fu.useSelector(J=>A5(J)),s=Fu.useSelector(J=>k5(J)),c=Fu.useSelector(J=>P5(J)),d=Fu.useSelector(J=>N5(J)),f=Fu.useSelector(J=>L5(J)),v=Ve.useCallback((J,pe)=>{e(S5({field:J,value:pe}))},[e]),b=Ve.useCallback(J=>r[J],[r]),S=Ve.useCallback(J=>{const pe={};return J.forEach(ce=>{var me;const Te=(me=ce.props)==null?void 0:me.propertyId;Te&&!Te.includes("password")&&ce.componentId!=="file"&&(pe[Te]=r[Te])}),pe},[r,d]),E=Ve.useCallback(()=>r,[r]),w=Ve.useCallback(J=>{e(C5(J))},[e]),R=Ve.useCallback(J=>{e(w5(J))},[e]),A=Ve.useCallback((J,pe)=>{e(E5({field:J,error:pe}))},[e]),I=Ve.useCallback(J=>i[J],[i]),P=Ve.useCallback(J=>{e(T5(J))},[e]),U=Ve.useCallback(()=>s,[s]),Y=Ve.useCallback((J,pe)=>{e(I5({[J]:pe}))},[e]),W=Ve.useCallback(J=>{const pe={id:J.customerId??null,profile:J.data};e(M5(pe))},[e]),k=Ve.useCallback(J=>f==null?void 0:f[J],[f]),j=Ve.useCallback(()=>f,[f]),N=Ve.useCallback(J=>{e(R5(J))},[e]),z=Ve.useCallback(()=>c,[c]),ee=Ve.useCallback(J=>{e(O5(J))},[e]),le=Ve.useCallback(()=>d,[d]),ge=Ve.useCallback((J,pe)=>{v(J,pe),Y(J,pe)},[v,Y]),L=Ve.useCallback(J=>{const pe={};return J.flowForms&&J.flowForms.forEach(ce=>{var Te;(Te=ce.form)!=null&&Te.formComponents&&ce.form.formComponents.forEach(me=>{const $e=me.componentId||"";if(eU[$e]){const be=me.props,re=be==null?void 0:be.propertyId;re&&(pe[re]=null)}})}),pe},[]);return{setFlowValue:v,setFlowValues:w,resetAndSetFlowValues:R,getFlowValue:b,getAllFormData:S,getAllFlowData:E,setFlowError:A,getFlowError:I,setDisableSubmitValue:P,getDisableSubmitValue:U,setPatientValue:Y,setPatientValues:W,getPatientValue:k,getFullPatient:j,setCurrentFlowValue:N,getCurrentFlowValue:z,setCurrentFormValue:ee,getCurrentFormValue:le,setFlowAndPatientValue:ge,generateFormDataFromFlow:L}};function A0(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var bC={exports:{}},Y$;function nU(){return Y$||(Y$=1,function(e,r){(function(i){e.exports=i()})(function(){return function(){function i(s,c,d){function f(S,E){if(!c[S]){if(!s[S]){var w=typeof A0=="function"&&A0;if(!E&&w)return w(S,!0);if(v)return v(S,!0);var R=new Error("Cannot find module '"+S+"'");throw R.code="MODULE_NOT_FOUND",R}var A=c[S]={exports:{}};s[S][0].call(A.exports,function(I){var P=s[S][1][I];return f(P||I)},A,A.exports,i,s,c,d)}return c[S].exports}for(var v=typeof A0=="function"&&A0,b=0;b<d.length;b++)f(d[b]);return f}return i}()({1:[function(i,s,c){const d=i("./utils"),f=function(){const v=d.stringToArray,b=["Zero","One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"],S=["Zeroth","First","Second","Third","Fourth","Fifth","Sixth","Seventh","Eighth","Ninth","Tenth","Eleventh","Twelfth","Thirteenth","Fourteenth","Fifteenth","Sixteenth","Seventeenth","Eighteenth","Nineteenth"],E=["Twenty","Thirty","Forty","Fifty","Sixty","Seventy","Eighty","Ninety","Hundred"],w=["Thousand","Million","Billion","Trillion"];function R(Q,oe){var Z=function(ne,De,we){var Fe="";if(ne<=19)Fe=(De?" and ":"")+(we?S[ne]:b[ne]);else if(ne<100){const It=Math.floor(ne/10),Dt=ne%10;Fe=(De?" and ":"")+E[It-2],Dt>0?Fe+="-"+Z(Dt,!1,we):we&&(Fe=Fe.substring(0,Fe.length-1)+"ieth")}else if(ne<1e3){const It=Math.floor(ne/100),Dt=ne%100;Fe=(De?", ":"")+b[It]+" Hundred",Dt>0?Fe+=Z(Dt,!0,we):we&&(Fe+="th")}else{var rt=Math.floor(Math.log10(ne)/3);rt>w.length&&(rt=w.length);const It=Math.pow(10,rt*3),Dt=Math.floor(ne/It),vt=ne-Dt*It;Fe=(De?", ":"")+Z(Dt,!1,!1)+" "+w[rt-1],vt>0?Fe+=Z(vt,!0,we):we&&(Fe+="th")}return Fe},Ee=Z(Q,!1,oe);return Ee}const A={};b.forEach(function(Q,oe){A[Q.toLowerCase()]=oe}),S.forEach(function(Q,oe){A[Q.toLowerCase()]=oe}),E.forEach(function(Q,oe){const Z=Q.toLowerCase();A[Z]=(oe+2)*10,A[Z.substring(0,Q.length-1)+"ieth"]=A[Z]}),A.hundredth=100,w.forEach(function(Q,oe){const Z=Q.toLowerCase(),Ee=Math.pow(10,(oe+1)*3);A[Z]=Ee,A[Z+"th"]=Ee});function I(Q){const Z=Q.split(/,\s|\sand\s|[\s\\-]/).map(De=>A[De]);let Ee=[0];return Z.forEach(De=>{if(De<100){let we=Ee.pop();we>=1e3&&(Ee.push(we),we=0),Ee.push(we+De)}else Ee.push(Ee.pop()*De)}),Ee.reduce((De,we)=>De+we,0)}const P=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],U={M:1e3,D:500,C:100,L:50,X:10,V:5,I:1};function Y(Q){for(var oe=0;oe<P.length;oe++){const Z=P[oe];if(Q>=Z[0])return Z[1]+Y(Q-Z[0])}return""}function W(Q){for(var oe=0,Z=1,Ee=Q.length-1;Ee>=0;Ee--){const ne=Q[Ee],De=U[ne];De<Z?oe-=De:(Z=De,oe+=De)}return oe}function k(Q,oe){for(var Z=[],Ee=oe.charCodeAt(0);Q>0;)Z.unshift(String.fromCharCode((Q-1)%26+Ee)),Q=Math.floor((Q-1)/26);return Z.join("")}function j(Q,oe){for(var Z=oe.charCodeAt(0),Ee=0,ne=0;ne<Q.length;ne++)Ee+=(Q.charCodeAt(Q.length-ne-1)-Z+1)*Math.pow(26,ne);return Ee}function N(Q,oe){if(typeof Q>"u")return;Q=Math.floor(Q);const Z=L(oe);return le(Q,Z)}const z={DECIMAL:"decimal",LETTERS:"letters",ROMAN:"roman",WORDS:"words",SEQUENCE:"sequence"},ee={UPPER:"upper",LOWER:"lower",TITLE:"title"};function le(Q,oe){let Z;const Ee=Q<0;switch(Q=Math.abs(Q),oe.primary){case z.LETTERS:Z=k(Q,oe.case===ee.UPPER?"A":"a");break;case z.ROMAN:Z=Y(Q),oe.case===ee.UPPER&&(Z=Z.toUpperCase());break;case z.WORDS:Z=R(Q,oe.ordinal),oe.case===ee.UPPER?Z=Z.toUpperCase():oe.case===ee.LOWER&&(Z=Z.toLowerCase());break;case z.DECIMAL:Z=""+Q;var ne=oe.mandatoryDigits-Z.length;if(ne>0){var De=new Array(ne+1).join("0");Z=De+Z}if(oe.zeroCode!==48&&(Z=v(Z).map(It=>String.fromCodePoint(It.codePointAt(0)+oe.zeroCode-48)).join("")),oe.regular){const It=Math.floor((Z.length-1)/oe.groupingSeparators.position);for(let Dt=It;Dt>0;Dt--){const vt=Z.length-Dt*oe.groupingSeparators.position;Z=Z.substr(0,vt)+oe.groupingSeparators.character+Z.substr(vt)}}else oe.groupingSeparators.reverse().forEach(It=>{const Dt=Z.length-It.position;Z=Z.substr(0,Dt)+It.character+Z.substr(Dt)});if(oe.ordinal){var we={1:"st",2:"nd",3:"rd"},Fe=Z[Z.length-1],rt=we[Fe];(!rt||Z.length>1&&Z[Z.length-2]==="1")&&(rt="th"),Z=Z+rt}break;case z.SEQUENCE:throw{code:"D3130",value:oe.token}}return Ee&&(Z="-"+Z),Z}const ge=[48,1632,1776,1984,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,42528,43216,43264,43472,43504,43600,44016,65296];function L(Q){const oe={type:"integer",primary:z.DECIMAL,case:ee.LOWER,ordinal:!1};let Z,Ee;const ne=Q.lastIndexOf(";");switch(ne===-1?Z=Q:(Z=Q.substring(0,ne),Ee=Q.substring(ne+1),Ee[0]==="o"&&(oe.ordinal=!0)),Z){case"A":oe.case=ee.UPPER;case"a":oe.primary=z.LETTERS;break;case"I":oe.case=ee.UPPER;case"i":oe.primary=z.ROMAN;break;case"W":oe.case=ee.UPPER,oe.primary=z.WORDS;break;case"Ww":oe.case=ee.TITLE,oe.primary=z.WORDS;break;case"w":oe.primary=z.WORDS;break;default:{let De=null,we=0,Fe=0,rt=[],It=0;if(v(Z).map(vt=>vt.codePointAt(0)).reverse().forEach(vt=>{let yt=!1;for(let St=0;St<ge.length;St++){const lt=ge[St];if(vt>=lt&&vt<=lt+9){if(yt=!0,we++,It++,De===null)De=lt;else if(lt!==De)throw{code:"D3131"};break}}yt||(vt===35?(It++,Fe++):rt.push({position:It,character:String.fromCodePoint(vt)}))}),we>0){oe.primary=z.DECIMAL,oe.zeroCode=De,oe.mandatoryDigits=we,oe.optionalDigits=Fe;const yt=function(St){if(St.length===0)return 0;const lt=St[0].character;for(let un=1;un<St.length;un++)if(St[un].character!==lt)return 0;const sn=St.map(un=>un.position),mn=function(un,Tn){return Tn===0?un:mn(Tn,un%Tn)},dn=sn.reduce(mn);for(let un=1;un<=sn.length;un++)if(sn.indexOf(un*dn)===-1)return 0;return dn}(rt);yt>0?(oe.regular=!0,oe.groupingSeparators={position:yt,character:rt[0].character}):(oe.regular=!1,oe.groupingSeparators=rt)}else oe.primary=z.SEQUENCE,oe.token=Z}}return oe}const J={Y:"1",M:"1",D:"1",d:"1",F:"n",W:"1",w:"1",X:"1",x:"1",H:"1",h:"1",P:"n",m:"01",s:"01",f:"1",Z:"01:01",z:"01:01",C:"n",E:"n"};function pe(Q){var oe=[];const Z={type:"datetime",parts:oe},Ee=function(yt,St){if(St>yt){let lt=Q.substring(yt,St);lt=lt.split("]]").join("]"),oe.push({type:"literal",value:lt})}};for(var ne=0,De=0;De<Q.length;){if(Q.charAt(De)==="["){if(Q.charAt(De+1)==="["){Ee(ne,De),oe.push({type:"literal",value:"["}),De+=2,ne=De;continue}if(Ee(ne,De),ne=De,De=Q.indexOf("]",ne),De===-1)throw{code:"D3135"};let yt=Q.substring(ne+1,De);yt=yt.split(/\s+/).join("");var we={type:"marker",component:yt.charAt(0)},Fe=yt.lastIndexOf(","),rt;if(Fe!==-1){const St=yt.substring(Fe+1),lt=St.indexOf("-");let sn,mn;const dn=function(Tn){if(!(typeof Tn>"u"||Tn==="*"))return parseInt(Tn)};lt===-1?sn=St:(sn=St.substring(0,lt),mn=St.substring(lt+1));const un={min:dn(sn),max:dn(mn)};we.width=un,rt=yt.substring(1,Fe)}else rt=yt.substring(1);if(rt.length===1)we.presentation1=rt;else if(rt.length>1){var It=rt.charAt(rt.length-1);"atco".indexOf(It)!==-1?(we.presentation2=It,It==="o"&&(we.ordinal=!0),we.presentation1=rt.substring(0,rt.length-1)):we.presentation1=rt}else we.presentation1=J[we.component];if(typeof we.presentation1>"u")throw{code:"D3132",value:we.component};if(we.presentation1[0]==="n")we.names=ee.LOWER;else if(we.presentation1[0]==="N")we.presentation1[1]==="n"?we.names=ee.TITLE:we.names=ee.UPPER;else if("YMDdFWwXxHhmsf".indexOf(we.component)!==-1){var Dt=we.presentation1;if(we.presentation2&&(Dt+=";"+we.presentation2),we.integerFormat=L(Dt),we.width&&we.width.min!==void 0&&we.integerFormat.mandatoryDigits<we.width.min&&(we.integerFormat.mandatoryDigits=we.width.min),we.component==="Y")if(we.n=-1,we.width&&we.width.max!==void 0)we.n=we.width.max,we.integerFormat.mandatoryDigits=we.n;else{var vt=we.integerFormat.mandatoryDigits+we.integerFormat.optionalDigits;vt>=2&&(we.n=vt)}const St=oe[oe.length-1];St&&St.integerFormat&&(St.integerFormat.parseWidth=St.integerFormat.mandatoryDigits)}(we.component==="Z"||we.component==="z")&&(we.integerFormat=L(we.presentation1)),oe.push(we),ne=De+1}De++}return Ee(ne,De),Z}const ce=["","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Te=["January","February","March","April","May","June","July","August","September","October","November","December"],me=1e3*60*60*24,$e=function(Q){const oe=Date.UTC(Q.year,Q.month);var Z=new Date(oe).getUTCDay();return Z===0&&(Z=7),Z>4?oe+(8-Z)*me:oe-(Z-1)*me},Re=function(Q,oe){return{year:Q,month:oe,nextMonth:function(){return oe===11?Re(Q+1,0):Re(Q,oe+1)},previousMonth:function(){return oe===0?Re(Q-1,11):Re(Q,oe-1)},nextYear:function(){return Re(Q+1,oe)},previousYear:function(){return Re(Q-1,oe)}}},be=function(Q,oe){return(oe-Q)/(me*7)+1},re=(Q,oe)=>{let Z;switch(oe){case"Y":Z=Q.getUTCFullYear();break;case"M":Z=Q.getUTCMonth()+1;break;case"D":Z=Q.getUTCDate();break;case"d":{const Ee=Date.UTC(Q.getUTCFullYear(),Q.getUTCMonth(),Q.getUTCDate()),ne=Date.UTC(Q.getUTCFullYear(),0);Z=(Ee-ne)/me+1;break}case"F":Z=Q.getUTCDay(),Z===0&&(Z=7);break;case"W":{const Ee=Re(Q.getUTCFullYear(),0),ne=$e(Ee),De=Date.UTC(Ee.year,Q.getUTCMonth(),Q.getUTCDate());let we=be(ne,De);if(we>52){const Fe=$e(Ee.nextYear());De>=Fe&&(we=1)}else if(we<1){const Fe=$e(Ee.previousYear());we=be(Fe,De)}Z=Math.floor(we);break}case"w":{const Ee=Re(Q.getUTCFullYear(),Q.getUTCMonth()),ne=$e(Ee),De=Date.UTC(Ee.year,Ee.month,Q.getUTCDate());let we=be(ne,De);if(we>4){const Fe=$e(Ee.nextMonth());De>=Fe&&(we=1)}else if(we<1){const Fe=$e(Ee.previousMonth());we=be(Fe,De)}Z=Math.floor(we);break}case"X":{const Ee=Re(Q.getUTCFullYear(),0),ne=$e(Ee),De=$e(Ee.nextYear()),we=Q.getTime();we<ne?Z=Ee.year-1:we>=De?Z=Ee.year+1:Z=Ee.year;break}case"x":{const Ee=Re(Q.getUTCFullYear(),Q.getUTCMonth()),ne=$e(Ee),De=Ee.nextMonth(),we=$e(De),Fe=Q.getTime();Fe<ne?Z=Ee.previousMonth().month+1:Fe>=we?Z=De.month+1:Z=Ee.month+1;break}case"H":Z=Q.getUTCHours();break;case"h":Z=Q.getUTCHours(),Z=Z%12,Z===0&&(Z=12);break;case"P":Z=Q.getUTCHours()>=12?"pm":"am";break;case"m":Z=Q.getUTCMinutes();break;case"s":Z=Q.getUTCSeconds();break;case"f":Z=Q.getUTCMilliseconds();break;case"Z":case"z":break;case"C":Z="ISO";break;case"E":Z="ISO";break}return Z};let K=null;function se(Q,oe,Z){var Ee=0,ne=0;if(typeof Z<"u"){const Dt=parseInt(Z);Ee=Math.floor(Dt/100),ne=Dt%100}var De=function(Dt,vt){var yt=re(Dt,vt.component);if("YMDdFWwXxHhms".indexOf(vt.component)!==-1)if(vt.component==="Y"&&vt.n!==-1&&(yt=yt%Math.pow(10,vt.n)),vt.names){if(vt.component==="M"||vt.component==="x")yt=Te[yt-1];else if(vt.component==="F")yt=ce[yt];else throw{code:"D3133",value:vt.component};vt.names===ee.UPPER?yt=yt.toUpperCase():vt.names===ee.LOWER&&(yt=yt.toLowerCase()),vt.width&&yt.length>vt.width.max&&(yt=yt.substring(0,vt.width.max))}else yt=le(yt,vt.integerFormat);else if(vt.component==="f")yt=le(yt,vt.integerFormat);else if(vt.component==="Z"||vt.component==="z"){const St=Ee*100+ne;if(vt.integerFormat.regular)yt=le(St,vt.integerFormat);else{const lt=vt.integerFormat.mandatoryDigits;if(lt===1||lt===2)yt=le(Ee,vt.integerFormat),ne!==0&&(yt+=":"+N(ne,"00"));else if(lt===3||lt===4)yt=le(St,vt.integerFormat);else throw{code:"D3134",value:lt}}St>=0&&(yt="+"+yt),vt.component==="z"&&(yt="GMT"+yt),St===0&&vt.presentation2==="t"&&(yt="Z")}else vt.component==="P"&&vt.names===ee.UPPER&&(yt=yt.toUpperCase());return yt};let we;typeof oe>"u"?(K===null&&(K=pe("[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01].[f001][Z01:01t]")),we=K):we=pe(oe);const Fe=(60*Ee+ne)*60*1e3,rt=new Date(Q+Fe);let It="";return we.parts.forEach(function(Dt){Dt.type==="literal"?It+=Dt.value:It+=De(rt,Dt)}),It}function V(Q){var oe={};if(Q.type==="datetime")oe.type="datetime",oe.parts=Q.parts.map(function(Z){var Ee={};if(Z.type==="literal")Ee.regex=Z.value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");else if(Z.component==="Z"||Z.component==="z"){let De;Array.isArray(Z.integerFormat.groupingSeparators)||(De=Z.integerFormat.groupingSeparators),Ee.regex="",Z.component==="z"&&(Ee.regex="GMT"),Ee.regex+="[-+][0-9]+",De&&(Ee.regex+=De.character+"[0-9]+"),Ee.parse=function(we){Z.component==="z"&&(we=we.substring(3));let Fe=0,rt=0;return De?(Fe=Number.parseInt(we.substring(0,we.indexOf(De.character))),rt=Number.parseInt(we.substring(we.indexOf(De.character)+1))):we.length-1<=2?Fe=Number.parseInt(we):(Fe=Number.parseInt(we.substring(0,3)),rt=Number.parseInt(we.substring(3))),Fe*60+rt}}else if(Z.integerFormat)Ee=V(Z.integerFormat);else{Ee.regex="[a-zA-Z]+";var ne={};if(Z.component==="M"||Z.component==="x")Te.forEach(function(De,we){Z.width&&Z.width.max?ne[De.substring(0,Z.width.max)]=we+1:ne[De]=we+1});else if(Z.component==="F")ce.forEach(function(De,we){we>0&&(Z.width&&Z.width.max?ne[De.substring(0,Z.width.max)]=we:ne[De]=we)});else if(Z.component==="P")ne={am:0,AM:0,pm:1,PM:1};else throw{code:"D3133",value:Z.component};Ee.parse=function(De){return ne[De]}}return Ee.component=Z.component,Ee});else{oe.type="integer";const Z=Q.case===ee.UPPER;switch(Q.primary){case z.LETTERS:oe.regex=Z?"[A-Z]+":"[a-z]+",oe.parse=function(Ee){return j(Ee,Z?"A":"a")};break;case z.ROMAN:oe.regex=Z?"[MDCLXVI]+":"[mdclxvi]+",oe.parse=function(Ee){return W(Z?Ee:Ee.toUpperCase())};break;case z.WORDS:oe.regex="(?:"+Object.keys(A).concat("and","[\\-, ]").join("|")+")+",oe.parse=function(Ee){return I(Ee.toLowerCase())};break;case z.DECIMAL:oe.regex="[0-9]",Q.parseWidth?oe.regex+=`{${Q.parseWidth}}`:oe.regex+="+",Q.ordinal&&(oe.regex+="(?:th|st|nd|rd)"),oe.parse=function(Ee){let ne=Ee;return Q.ordinal&&(ne=Ee.substring(0,Ee.length-2)),Q.regular?ne=ne.split(",").join(""):Q.groupingSeparators.forEach(De=>{ne=ne.split(De.character).join("")}),Q.zeroCode!==48&&(ne=ne.split("").map(De=>String.fromCodePoint(De.codePointAt(0)-Q.zeroCode+48)).join("")),parseInt(ne)};break;case z.SEQUENCE:throw{code:"D3130",value:Q.token}}}return oe}function G(Q,oe){if(typeof Q>"u")return;const Z=L(oe);return V(Z).parse(Q)}function Ce(Q,oe){const Z=pe(oe),Ee=V(Z),ne="^"+Ee.parts.map(rt=>"("+rt.regex+")").join("")+"$";var we=new RegExp(ne,"i").exec(Q);if(we!==null){const lt={};for(let Qe=1;Qe<we.length;Qe++){const B=Ee.parts[Qe-1];B.parse&&(lt[B.component]=B.parse(we[Qe]))}if(Object.getOwnPropertyNames(lt).length===0)return;let sn=0;const mn=Qe=>{sn<<=1,sn+=Qe?1:0},dn=Qe=>!(~Qe&sn)&&!!(Qe&sn);"YXMxWwdD".split("").forEach(Qe=>mn(lt[Qe]));const Tn=!dn(161)&&dn(130),rr=dn(84),or=!rr&&dn(72);sn=0,"PHhmsf".split("").forEach(Qe=>mn(lt[Qe]));const ot=!dn(23)&&dn(47),Rn=(Tn?"YD":rr?"XxwF":or?"XWF":"YMD")+(ot?"Phmsf":"Hmsf"),Dn=this.environment.timestamp;let On=!1,In=!1;if(Rn.split("").forEach(Qe=>{if(typeof lt[Qe]>"u")On?(lt[Qe]="MDd".indexOf(Qe)!==-1?1:0,In=!0):lt[Qe]=re(Dn,Qe);else if(On=!0,In)throw{code:"D3136"}}),lt.M>0?lt.M-=1:lt.M=0,Tn){const Qe=Date.UTC(lt.Y,0),B=(lt.d-1)*1e3*60*60*24,te=new Date(Qe+B);lt.M=te.getUTCMonth(),lt.D=te.getUTCDate()}if(rr)throw{code:"D3136"};if(or)throw{code:"D3136"};ot&&(lt.H=lt.h===12?0:lt.h,lt.P===1&&(lt.H+=12));var Fe=Date.UTC(lt.Y,lt.M,lt.D,lt.H,lt.m,lt.s,lt.f);return(lt.Z||lt.z)&&(Fe-=(lt.Z||lt.z)*60*1e3),Fe}}var je=new RegExp("^\\d{4}(-[01]\\d)*(-[0-3]\\d)*(T[0-2]\\d:[0-5]\\d:[0-5]\\d)*(\\.\\d+)?([+-][0-2]\\d:?[0-5]\\d|Z)?$");function qe(Q,oe){if(!(typeof Q>"u"))if(typeof oe>"u"){if(!je.test(Q))throw{stack:new Error().stack,code:"D3110",value:Q};return Date.parse(Q)}else return Ce.call(this,Q,oe)}function He(Q,oe,Z){if(!(typeof Q>"u"))return se.call(this,Q,oe,Z)}return{formatInteger:N,parseInteger:G,fromMillis:He,toMillis:qe}}();s.exports=f},{"./utils":6}],2:[function(i,s,c){(function(d){(function(){var f=i("./utils");const v=(()=>{var b=f.isNumeric,S=f.isArrayOfStrings,E=f.isArrayOfNumbers,w=f.createSequence,R=f.isSequence,A=f.isFunction,I=f.isLambda,P=f.isPromise,U=f.getFunctionArity,Y=f.isDeepEqual,W=f.stringToArray;function k($){if(!(typeof $>"u")){var F=0;return $.forEach(function(q){F+=q}),F}}function j($){return typeof $>"u"?0:$.length}function N($){if(!(typeof $>"u"||$.length===0))return Math.max.apply(Math,$)}function z($){if(!(typeof $>"u"||$.length===0))return Math.min.apply(Math,$)}function ee($){if(!(typeof $>"u"||$.length===0)){var F=0;return $.forEach(function(q){F+=q}),F/$.length}}function le($,F=!1){if(!(typeof $>"u")){var q;if(typeof $=="string")q=$;else if(A($))q="";else{if(typeof $=="number"&&!isFinite($))throw{code:"D3001",value:$,stack:new Error().stack};var he=F?2:0;Array.isArray($)&&$.outerWrapper&&($=$[0]),q=JSON.stringify($,function(fe,Le){return typeof Le<"u"&&Le!==null&&Le.toPrecision&&b(Le)?Number(Le.toPrecision(15)):Le&&A(Le)?"":Le},he)}return q}}function ge($,F,q){if(!(typeof $>"u")){var he=W($),fe=he.length;if(fe+F<0&&(F=0),typeof q<"u"){if(q<=0)return"";var Le=F>=0?F+q:fe+F+q;return he.slice(F,Le).join("")}return he.slice(F).join("")}}function L($,F){if(!(typeof $>"u")){var q=$.indexOf(F);return q>-1?$.substr(0,q):$}}function J($,F){if(!(typeof $>"u")){var q=$.indexOf(F);return q>-1?$.substr(q+F.length):$}}function pe($){if(!(typeof $>"u"))return $.toLowerCase()}function ce($){if(!(typeof $>"u"))return $.toUpperCase()}function Te($){if(!(typeof $>"u"))return W($).length}function me($){if(!(typeof $>"u")){var F=$.replace(/[ \t\n\r]+/gm," ");return F.charAt(0)===" "&&(F=F.substring(1)),F.charAt(F.length-1)===" "&&(F=F.substring(0,F.length-1)),F}}function $e($,F,q){if(!(typeof $>"u")){(typeof q>"u"||q.length===0)&&(q=" ");var he;F=Math.trunc(F);var fe=Math.abs(F)-Te($);if(fe>0){var Le=new Array(fe+1).join(q);q.length>1&&(Le=ge(Le,0,fe)),F>0?he=$+Le:he=Le+$}else he=$;return he}}async function Re($,F){var q=$.apply(this,[F]);if(P(q)&&(q=await q),q&&!(typeof q.start=="number"||q.end==="number"||Array.isArray(q.groups)||A(q.next)))throw{code:"T1010",stack:new Error().stack};return q}async function be($,F){if(!(typeof $>"u")){var q;if(typeof F=="string")q=$.indexOf(F)!==-1;else{var he=await Re(F,$);q=typeof he<"u"}return q}}async function re($,F,q){if(!(typeof $>"u")){if(q<0)throw{stack:new Error().stack,value:q,code:"D3040",index:3};var he=w();if(typeof q>"u"||q>0){var fe=0,Le=await Re(F,$);if(typeof Le<"u")for(;typeof Le<"u"&&(typeof q>"u"||fe<q);)he.push({match:Le.match,index:Le.start,groups:Le.groups}),Le=await Re(Le.next),fe++}return he}}async function K($,F,q,he){if(!(typeof $>"u")){var fe=this;if(F==="")throw{code:"D3010",stack:new Error().stack,value:F,index:2};if(he<0)throw{code:"D3011",stack:new Error().stack,value:he,index:4};var Le;typeof q=="string"?Le=function(pn){for(var Xn="",an=0,ie=q.indexOf("$",an);ie!==-1&&an<q.length;){Xn+=q.substring(an,ie),an=ie+1;var Ye=q.charAt(an);if(Ye==="$")Xn+="$",an++;else if(Ye==="0")Xn+=pn.match,an++;else{var at;if(pn.groups.length===0?at=1:at=Math.floor(Math.log(pn.groups.length)*Math.LOG10E)+1,ie=parseInt(q.substring(an,an+at),10),at>1&&ie>pn.groups.length&&(ie=parseInt(q.substring(an,an+at-1),10)),isNaN(ie))Xn+="$";else{if(pn.groups.length>0){var _t=pn.groups[ie-1];typeof _t<"u"&&(Xn+=_t)}an+=ie.toString().length}}ie=q.indexOf("$",an)}return Xn+=q.substring(an),Xn}:Le=q;var nt="",Tt=0;if(typeof he>"u"||he>0){var $t=0;if(typeof F=="string"){for(var fn=$.indexOf(F,Tt);fn!==-1&&(typeof he>"u"||$t<he);)nt+=$.substring(Tt,fn),nt+=q,Tt=fn+F.length,$t++,fn=$.indexOf(F,Tt);nt+=$.substring(Tt)}else{var zt=await Re(F,$);if(typeof zt<"u"){for(;typeof zt<"u"&&(typeof he>"u"||$t<he);){nt+=$.substring(Tt,zt.start);var bn=Le.apply(fe,[zt]);if(P(bn)&&(bn=await bn),typeof bn=="string")nt+=bn;else throw{code:"D3012",stack:new Error().stack,value:bn};Tt=zt.start+zt.match.length,$t++,zt=await Re(zt.next)}nt+=$.substring(Tt)}else nt=$}}else nt=$;return nt}}function se($){if(!(typeof $>"u")){var F=typeof window<"u"?window.btoa:function(q){return new d.Buffer.from(q,"binary").toString("base64")};return F($)}}function V($){if(!(typeof $>"u")){var F=typeof window<"u"?window.atob:function(q){return new d.Buffer.from(q,"base64").toString("binary")};return F($)}}function G($){if(!(typeof $>"u")){var F;try{F=encodeURIComponent($)}catch{throw{code:"D3140",stack:new Error().stack,value:$,functionName:"encodeUrlComponent"}}return F}}function Ce($){if(!(typeof $>"u")){var F;try{F=encodeURI($)}catch{throw{code:"D3140",stack:new Error().stack,value:$,functionName:"encodeUrl"}}return F}}function je($){if(!(typeof $>"u")){var F;try{F=decodeURIComponent($)}catch{throw{code:"D3140",stack:new Error().stack,value:$,functionName:"decodeUrlComponent"}}return F}}function qe($){if(!(typeof $>"u")){var F;try{F=decodeURI($)}catch{throw{code:"D3140",stack:new Error().stack,value:$,functionName:"decodeUrl"}}return F}}async function He($,F,q){if(!(typeof $>"u")){if(q<0)throw{code:"D3020",stack:new Error().stack,value:q,index:3};var he=[];if(typeof q>"u"||q>0)if(typeof F=="string")he=$.split(F,q);else{var fe=0,Le=await Re(F,$);if(typeof Le<"u"){for(var nt=0;typeof Le<"u"&&(typeof q>"u"||fe<q);)he.push($.substring(nt,Le.start)),nt=Le.end,Le=await Re(Le.next),fe++;(typeof q>"u"||fe<q)&&he.push($.substring(nt))}else he.push($)}return he}}function Q($,F){if(!(typeof $>"u"))return typeof F>"u"&&(F=""),$.join(F)}function oe($,F,q){if(!(typeof $>"u")){var he={"decimal-separator":".","grouping-separator":",","exponent-separator":"e",infinity:"Infinity","minus-sign":"-",NaN:"NaN",percent:"%","per-mille":"‰","zero-digit":"0",digit:"#","pattern-separator":";"},fe=he;typeof q<"u"&&Object.keys(q).forEach(function(Ht){fe[Ht]=q[Ht]});for(var Le=[],nt=fe["zero-digit"].charCodeAt(0),Tt=nt;Tt<nt+10;Tt++)Le.push(String.fromCharCode(Tt));var $t=Le.concat([fe["decimal-separator"],fe["exponent-separator"],fe["grouping-separator"],fe.digit,fe["pattern-separator"]]),fn=F.split(fe["pattern-separator"]);if(fn.length>2)throw{code:"D3080",stack:new Error().stack};var zt=function(Ht){var Bn=function(){for(var Mn,Rr=0;Rr<Ht.length;Rr++)if(Mn=Ht.charAt(Rr),$t.indexOf(Mn)!==-1&&Mn!==fe["exponent-separator"])return Ht.substring(0,Rr)}(),gr=function(){for(var Mn,Rr=Ht.length-1;Rr>=0;Rr--)if(Mn=Ht.charAt(Rr),$t.indexOf(Mn)!==-1&&Mn!==fe["exponent-separator"])return Ht.substring(Rr+1)}(),yn=Ht.substring(Bn.length,Ht.length-gr.length),so,Tr,To,_i,uo=Ht.indexOf(fe["exponent-separator"],Bn.length);uo===-1||uo>Ht.length-gr.length?(so=yn,Tr=void 0):(so=yn.substring(0,uo),Tr=yn.substring(uo+1));var Zr=so.indexOf(fe["decimal-separator"]);return Zr===-1?(To=so,_i=gr):(To=so.substring(0,Zr),_i=so.substring(Zr+1)),{prefix:Bn,suffix:gr,activePart:yn,mantissaPart:so,exponentPart:Tr,integerPart:To,fractionalPart:_i,subpicture:Ht}},bn=function(Ht){var Bn,gr,yn=Ht.subpicture,so=yn.indexOf(fe["decimal-separator"]);so!==yn.lastIndexOf(fe["decimal-separator"])&&(Bn="D3081"),yn.indexOf(fe.percent)!==yn.lastIndexOf(fe.percent)&&(Bn="D3082"),yn.indexOf(fe["per-mille"])!==yn.lastIndexOf(fe["per-mille"])&&(Bn="D3083"),yn.indexOf(fe.percent)!==-1&&yn.indexOf(fe["per-mille"])!==-1&&(Bn="D3084");var Tr=!1;for(gr=0;gr<Ht.mantissaPart.length;gr++){var To=Ht.mantissaPart.charAt(gr);if(Le.indexOf(To)!==-1||To===fe.digit){Tr=!0;break}}Tr||(Bn="D3085");var _i=Ht.activePart.split("").map(function(Mn){return $t.indexOf(Mn)===-1?"p":"a"}).join("");_i.indexOf("p")!==-1&&(Bn="D3086"),so!==-1?(yn.charAt(so-1)===fe["grouping-separator"]||yn.charAt(so+1)===fe["grouping-separator"])&&(Bn="D3087"):Ht.integerPart.charAt(Ht.integerPart.length-1)===fe["grouping-separator"]&&(Bn="D3088"),yn.indexOf(fe["grouping-separator"]+fe["grouping-separator"])!==-1&&(Bn="D3089");var uo=Ht.integerPart.indexOf(fe.digit);uo!==-1&&Ht.integerPart.substring(0,uo).split("").filter(function(Mn){return Le.indexOf(Mn)>-1}).length>0&&(Bn="D3090"),uo=Ht.fractionalPart.lastIndexOf(fe.digit),uo!==-1&&Ht.fractionalPart.substring(uo).split("").filter(function(Mn){return Le.indexOf(Mn)>-1}).length>0&&(Bn="D3091");var Zr=typeof Ht.exponentPart=="string";if(Zr&&Ht.exponentPart.length>0&&(yn.indexOf(fe.percent)!==-1||yn.indexOf(fe["per-mille"])!==-1)&&(Bn="D3092"),Zr&&(Ht.exponentPart.length===0||Ht.exponentPart.split("").filter(function(Mn){return Le.indexOf(Mn)===-1}).length>0)&&(Bn="D3093"),Bn)throw{code:Bn,stack:new Error().stack}},pn=function(Ht){var Bn=function(Hr,pl){for(var Fi=[],Qo=Hr.indexOf(fe["grouping-separator"]);Qo!==-1;){var hl=(pl?Hr.substring(0,Qo):Hr.substring(Qo)).split("").filter(function(Xo){return Le.indexOf(Xo)!==-1||Xo===fe.digit}).length;Fi.push(hl),Qo=Ht.integerPart.indexOf(fe["grouping-separator"],Qo+1)}return Fi},gr=Bn(Ht.integerPart),yn=function(Hr){if(Hr.length===0)return 0;for(var pl=function(hl,Xo){return Xo===0?hl:pl(Xo,hl%Xo)},Fi=Hr.reduce(pl),Qo=1;Qo<=Hr.length;Qo++)if(Hr.indexOf(Qo*Fi)===-1)return 0;return Fi},so=yn(gr),Tr=Bn(Ht.fractionalPart,!0),To=Ht.integerPart.split("").filter(function(Hr){return Le.indexOf(Hr)!==-1}).length,_i=To,uo=Ht.fractionalPart.split(""),Zr=uo.filter(function(Hr){return Le.indexOf(Hr)!==-1}).length,Mn=uo.filter(function(Hr){return Le.indexOf(Hr)!==-1||Hr===fe.digit}).length,Rr=typeof Ht.exponentPart=="string";To===0&&Mn===0&&(Rr?(Zr=1,Mn=1):To=1),Rr&&To===0&&Ht.integerPart.indexOf(fe.digit)!==-1&&(To=1),To===0&&Zr===0&&(Zr=1);var di=0;return Rr&&(di=Ht.exponentPart.split("").filter(function(Hr){return Le.indexOf(Hr)!==-1}).length),{integerPartGroupingPositions:gr,regularGrouping:so,minimumIntegerPartSize:To,scalingFactor:_i,prefix:Ht.prefix,fractionalPartGroupingPositions:Tr,minimumFactionalPartSize:Zr,maximumFactionalPartSize:Mn,minimumExponentSize:di,suffix:Ht.suffix,picture:Ht.subpicture}},Xn=fn.map(zt);Xn.forEach(bn);var an=Xn.map(pn),ie=fe["minus-sign"],Ye=fe["zero-digit"],at=fe["decimal-separator"],_t=fe["grouping-separator"];an.length===1&&(an.push(JSON.parse(JSON.stringify(an[0]))),an[1].prefix=ie+an[1].prefix);var At;$>=0?At=an[0]:At=an[1];var Wt;At.picture.indexOf(fe.percent)!==-1?Wt=$*100:At.picture.indexOf(fe["per-mille"])!==-1?Wt=$*1e3:Wt=$;var Jt,en;if(At.minimumExponentSize===0)Jt=Wt;else{var Er=Math.pow(10,At.scalingFactor),Zn=Math.pow(10,At.scalingFactor-1);for(Jt=Wt,en=0;Jt<Zn;)Jt*=10,en-=1;for(;Jt>Er;)Jt/=10,en+=1}var ar=Fe(Jt,At.maximumFactionalPartSize),Kr=function(Ht,Bn){var gr=Math.abs(Ht).toFixed(Bn);return Ye!=="0"&&(gr=gr.split("").map(function(yn){return yn>="0"&&yn<="9"?Le[yn.charCodeAt(0)-48]:yn}).join("")),gr},Yt=Kr(ar,At.maximumFactionalPartSize),Jn=Yt.indexOf(".");for(Jn===-1?Yt=Yt+at:Yt=Yt.replace(".",at);Yt.charAt(0)===Ye;)Yt=Yt.substring(1);for(;Yt.charAt(Yt.length-1)===Ye;)Yt=Yt.substring(0,Yt.length-1);Jn=Yt.indexOf(at);var Xt=At.minimumIntegerPartSize-Jn,nn=At.minimumFactionalPartSize-(Yt.length-Jn-1);if(Yt=(Xt>0?new Array(Xt+1).join(Ye):"")+Yt,Yt=Yt+(nn>0?new Array(nn+1).join(Ye):""),Jn=Yt.indexOf(at),At.regularGrouping>0)for(var Xa=Math.floor((Jn-1)/At.regularGrouping),ci=1;ci<=Xa;ci++)Yt=[Yt.slice(0,Jn-ci*At.regularGrouping),_t,Yt.slice(Jn-ci*At.regularGrouping)].join("");else At.integerPartGroupingPositions.forEach(function(Ht){Yt=[Yt.slice(0,Jn-Ht),_t,Yt.slice(Jn-Ht)].join(""),Jn++});if(Jn=Yt.indexOf(at),At.fractionalPartGroupingPositions.forEach(function(Ht){Yt=[Yt.slice(0,Ht+Jn+1),_t,Yt.slice(Ht+Jn+1)].join("")}),Jn=Yt.indexOf(at),(At.picture.indexOf(at)===-1||Jn===Yt.length-1)&&(Yt=Yt.substring(0,Yt.length-1)),typeof en<"u"){var fi=Kr(en,0);Xt=At.minimumExponentSize-fi.length,Xt>0&&(fi=new Array(Xt+1).join(Ye)+fi),Yt=Yt+fe["exponent-separator"]+(en<0?ie:"")+fi}return Yt=At.prefix+Yt+At.suffix,Yt}}function Z($,F){if(!(typeof $>"u")){if($=Fe($),typeof F>"u"?F=10:F=Fe(F),F<2||F>36)throw{code:"D3100",stack:new Error().stack,value:F};var q=$.toString(F);return q}}function Ee($){var F;if(!(typeof $>"u")){if(typeof $=="number")F=$;else if(typeof $=="string"&&/^-?[0-9]+(\.[0-9]+)?([Ee][-+]?[0-9]+)?$/.test($)&&!isNaN(parseFloat($))&&isFinite($))F=parseFloat($);else if(typeof $=="string"&&/^(0[xX][0-9A-Fa-f]+)|(0[oO][0-7]+)|(0[bB][0-1]+)$/.test($))F=Number($);else if($===!0)F=1;else if($===!1)F=0;else throw{code:"D3030",value:$,stack:new Error().stack,index:1};return F}}function ne($){var F;if(!(typeof $>"u"))return F=Math.abs($),F}function De($){var F;if(!(typeof $>"u"))return F=Math.floor($),F}function we($){var F;if(!(typeof $>"u"))return F=Math.ceil($),F}function Fe($,F){var q;if(!(typeof $>"u")){if(F){var he=$.toString().split("e");$=+(he[0]+"e"+(he[1]?+he[1]+F:F))}q=Math.round($);var fe=q-$;return Math.abs(fe)===.5&&Math.abs(q%2)===1&&(q=q-1),F&&(he=q.toString().split("e"),q=+(he[0]+"e"+(he[1]?+he[1]-F:-F))),Object.is(q,-0)&&(q=0),q}}function rt($){var F;if(!(typeof $>"u")){if($<0)throw{stack:new Error().stack,code:"D3060",index:1,value:$};return F=Math.sqrt($),F}}function It($,F){var q;if(!(typeof $>"u")){if(q=Math.pow($,F),!isFinite(q))throw{stack:new Error().stack,code:"D3061",index:1,value:$,exp:F};return q}}function Dt(){return Math.random()}function vt($){if(!(typeof $>"u")){var F=!1;if(Array.isArray($)){if($.length===1)F=vt($[0]);else if($.length>1){var q=$.filter(function(he){return vt(he)});F=q.length>0}}else typeof $=="string"?$.length>0&&(F=!0):b($)?$!==0&&(F=!0):$!==null&&typeof $=="object"&&!A($)?Object.keys($).length>0&&(F=!0):typeof $=="boolean"&&$===!0&&(F=!0);return F}}function yt($){if(!(typeof $>"u"))return!vt($)}function St($,F,q,he){var fe=[F],Le=U($);return Le>=2&&fe.push(q),Le>=3&&fe.push(he),fe}async function lt($,F){if(!(typeof $>"u")){for(var q=w(),he=0;he<$.length;he++){var fe=St(F,$[he],he,$),Le=await F.apply(this,fe);typeof Le<"u"&&q.push(Le)}return q}}async function sn($,F){if(!(typeof $>"u")){for(var q=w(),he=0;he<$.length;he++){var fe=$[he],Le=St(F,fe,he,$),nt=await F.apply(this,Le);vt(nt)&&q.push(fe)}return q}}async function mn($,F){if(!(typeof $>"u")){for(var q=!1,he,fe=0;fe<$.length;fe++){var Le=$[fe],nt=!0;if(typeof F<"u"){var Tt=St(F,Le,fe,$),$t=await F.apply(this,Tt);nt=vt($t)}if(nt)if(!q)he=Le,q=!0;else throw{stack:new Error().stack,code:"D3138",index:fe}}if(!q)throw{stack:new Error().stack,code:"D3139"};return he}}function dn(){for(var $=[],F=Array.prototype.slice.call(arguments),q=Math.min.apply(Math,F.map(function(Le){return Array.isArray(Le)?Le.length:0})),he=0;he<q;he++){var fe=F.map(Le=>Le[he]);$.push(fe)}return $}async function un($,F,q){if(!(typeof $>"u")){var he,fe=U(F);if(fe<2)throw{stack:new Error().stack,code:"D3050",index:1};var Le;for(typeof q>"u"&&$.length>0?(he=$[0],Le=1):(he=q,Le=0);Le<$.length;){var nt=[he,$[Le]];fe>=3&&nt.push(Le),fe>=4&&nt.push($),he=await F.apply(this,nt),Le++}return he}}function Tn($){var F=w();if(Array.isArray($)){var q={};$.forEach(function(he){var fe=Tn(he);fe.forEach(function(Le){q[Le]=!0})}),F=Tn(q)}else $!==null&&typeof $=="object"&&!A($)&&Object.keys($).forEach(he=>F.push(he));return F}function rr($,F){var q;if(Array.isArray($)){q=w();for(var he=0;he<$.length;he++){var fe=rr($[he],F);typeof fe<"u"&&(Array.isArray(fe)?fe.forEach(Le=>q.push(Le)):q.push(fe))}}else $!==null&&typeof $=="object"&&!A($)&&(q=$[F]);return q}function or($,F){return typeof $>"u"?F:typeof F>"u"?$:(Array.isArray($)||($=w($)),Array.isArray(F)||(F=[F]),$.concat(F))}function it($){return!(typeof $>"u")}function ot($){var F=w();if(Array.isArray($))$.forEach(function(fe){F=or(F,ot(fe))});else if($!==null&&typeof $=="object"&&!I($))for(var q in $){var he={};he[q]=$[q],F.push(he)}else F=$;return F}function Ge($){if(!(typeof $>"u")){var F={};return $.forEach(function(q){for(var he in q)F[he]=q[he]}),F}}function cn($){if(!(typeof $>"u")){if($.length<=1)return $;for(var F=$.length,q=new Array(F),he=0;he<F;he++)q[F-he-1]=$[he];return q}}async function Rn($,F){var q=w();for(var he in $){var fe=St(F,$[he],he,$),Le=await F.apply(this,fe);typeof Le<"u"&&q.push(Le)}return q}function Dn($){throw{code:"D3137",stack:new Error().stack,message:$||"$error() function evaluated"}}function On($,F){if(!$)throw{code:"D3141",stack:new Error().stack,message:F||"$assert() statement failed"}}function In($){if($!==void 0)return $===null?"null":b($)?"number":typeof $=="string"?"string":typeof $=="boolean"?"boolean":Array.isArray($)?"array":A($)?"function":"object"}async function Qe($,F){if(!(typeof $>"u")){if($.length<=1)return $;var q;if(typeof F>"u"){if(!E($)&&!S($))throw{stack:new Error().stack,code:"D3070",index:1};q=async function(nt,Tt){return nt>Tt}}else q=F;var he=async function(nt,Tt){var $t=async function(zt,bn,pn){bn.length===0?Array.prototype.push.apply(zt,pn):pn.length===0?Array.prototype.push.apply(zt,bn):await q(bn[0],pn[0])?(zt.push(pn[0]),await $t(zt,bn,pn.slice(1))):(zt.push(bn[0]),await $t(zt,bn.slice(1),pn))},fn=[];return await $t(fn,nt,Tt),fn},fe=async function(nt){if(!Array.isArray(nt)||nt.length<=1)return nt;var Tt=Math.floor(nt.length/2),$t=nt.slice(0,Tt),fn=nt.slice(Tt);return $t=await fe($t),fn=await fe(fn),await he($t,fn)},Le=await fe($);return Le}}function B($){if(!(typeof $>"u")){if($.length<=1)return $;for(var F=new Array($.length),q=0;q<$.length;q++){var he=Math.floor(Math.random()*(q+1));q!==he&&(F[q]=F[he]),F[he]=$[q]}return F}}function te($){if(!(typeof $>"u")){if(!Array.isArray($)||$.length<=1)return $;for(var F=R($)?w():[],q=0;q<$.length;q++){for(var he=$[q],fe=!1,Le=0;Le<F.length;Le++)if(Y(he,F[Le])){fe=!0;break}fe||F.push(he)}return F}}async function ue($,F){var q={};for(var he in $){var fe=$[he],Le=St(F,fe,he,$),nt=await F.apply(this,Le);vt(nt)&&(q[he]=fe)}return Object.keys(q).length===0&&(q=void 0),q}return{sum:k,count:j,max:N,min:z,average:ee,string:le,substring:ge,substringBefore:L,substringAfter:J,lowercase:pe,uppercase:ce,length:Te,trim:me,pad:$e,match:re,contains:be,replace:K,split:He,join:Q,formatNumber:oe,formatBase:Z,number:Ee,floor:De,ceil:we,round:Fe,abs:ne,sqrt:rt,power:It,random:Dt,boolean:vt,not:yt,map:lt,zip:dn,filter:sn,single:mn,foldLeft:un,sift:ue,keys:Tn,lookup:rr,append:or,exists:it,spread:ot,merge:Ge,reverse:cn,each:Rn,error:Dn,assert:On,type:In,sort:Qe,shuffle:B,distinct:te,base64encode:se,base64decode:V,encodeUrlComponent:G,encodeUrl:Ce,decodeUrlComponent:je,decodeUrl:qe}})();s.exports=v}).call(this)}).call(this,typeof oO<"u"?oO:typeof self<"u"?self:typeof window<"u"?window:{})},{"./utils":6}],3:[function(i,s,c){var d=i("./datetime"),f=i("./functions"),v=i("./utils"),b=i("./parser"),S=i("./signature"),E=function(){var w=v.isNumeric,R=v.isArrayOfStrings,A=v.isArrayOfNumbers,I=v.createSequence,P=v.isSequence,U=v.isFunction,Y=v.isLambda,W=v.isIterable,k=v.isPromise,j=v.getFunctionArity,N=v.isDeepEqual,z=Dn(null);async function ee(B,te,ue){var $,F=ue.lookup(Symbol.for("jsonata.__evaluate_entry"));switch(F&&await F(B,te,ue),B.type){case"path":$=await le(B,te,ue);break;case"binary":$=await Te(B,te,ue);break;case"unary":$=await me(B,te,ue);break;case"name":$=$e(B,te);break;case"string":case"number":case"value":$=Re(B);break;case"wildcard":$=be(B,te);break;case"descendant":$=K(B,te);break;case"parent":$=ue.lookup(B.slot.label);break;case"condition":$=await De(B,te,ue);break;case"block":$=await we(B,te,ue);break;case"bind":$=await ne(B,te,ue);break;case"regex":$=Fe(B);break;case"function":$=await St(B,te,ue);break;case"variable":$=rt(B,te,ue);break;case"lambda":$=mn(B,te,ue);break;case"partial":$=await dn(B,te,ue);break;case"apply":$=await yt(B,te,ue);break;case"transform":$=Dt(B,te,ue);break}if(Object.prototype.hasOwnProperty.call(B,"predicate"))for(var q=0;q<B.predicate.length;q++)$=await ce(B.predicate[q].expr,$,ue);B.type!=="path"&&Object.prototype.hasOwnProperty.call(B,"group")&&($=await oe(B.group,$,ue));var he=ue.lookup(Symbol.for("jsonata.__evaluate_exit"));return he&&await he(B,te,ue,$),$&&P($)&&!$.tupleStream&&(B.keepArray&&($.keepSingleton=!0),$.length===0?$=void 0:$.length===1&&($=$.keepSingleton?$:$[0])),$}async function le(B,te,ue){var $;Array.isArray(te)&&B.steps[0].type!=="variable"?$=te:$=I(te);for(var F,q=!1,he=void 0,fe=0;fe<B.steps.length;fe++){var Le=B.steps[fe];if(Le.tuple&&(q=!0),fe===0&&Le.consarray?F=await ee(Le,$,ue):q?he=await pe(Le,$,he,ue):F=await L(Le,$,ue,fe===B.steps.length-1),!q&&(typeof F>"u"||F.length===0))break;typeof Le.focus>"u"&&($=F)}if(q)if(B.tuple)F=he;else for(F=I(),fe=0;fe<he.length;fe++)F.push(he[fe]["@"]);return B.keepSingletonArray&&(Array.isArray(F)&&F.cons&&!F.sequence&&(F=I(F)),F.keepSingleton=!0),B.hasOwnProperty("group")&&(F=await oe(B.group,q?he:F,ue)),F}function ge(B,te){var ue=Dn(B);for(const $ in te)ue.bind($,te[$]);return ue}async function L(B,te,ue,$){var F;if(B.type==="sort")return F=await It(B,te,ue),B.stages&&(F=await J(B.stages,F,ue)),F;F=I();for(var q=0;q<te.length;q++){var he=await ee(B,te[q],ue);if(B.stages)for(var fe=0;fe<B.stages.length;fe++)he=await ce(B.stages[fe].expr,he,ue);typeof he<"u"&&F.push(he)}var Le=I();return $&&F.length===1&&Array.isArray(F[0])&&!P(F[0])?Le=F[0]:F.forEach(function(nt){!Array.isArray(nt)||nt.cons?Le.push(nt):nt.forEach(Tt=>Le.push(Tt))}),Le}async function J(B,te,ue){for(var $=te,F=0;F<B.length;F++){var q=B[F];switch(q.type){case"filter":$=await ce(q.expr,$,ue);break;case"index":for(var he=0;he<$.length;he++){var fe=$[he];fe[q.value]=he}break}}return $}async function pe(B,te,ue,$){var F;if(B.type==="sort"){if(ue)F=await It(B,ue,$);else{var q=await It(B,te,$);F=I(),F.tupleStream=!0;for(var he=0;he<q.length;he++){var fe={"@":q[he]};fe[B.index]=he,F.push(fe)}}return B.stages&&(F=await J(B.stages,F,$)),F}F=I(),F.tupleStream=!0;var Le=$;ue===void 0&&(ue=te.map(fn=>({"@":fn})));for(var nt=0;nt<ue.length;nt++){Le=ge($,ue[nt]);var Tt=await ee(B,ue[nt]["@"],Le);if(typeof Tt<"u"){Array.isArray(Tt)||(Tt=[Tt]);for(var $t=0;$t<Tt.length;$t++)fe={},Object.assign(fe,ue[nt]),Tt.tupleStream?Object.assign(fe,Tt[$t]):(B.focus?(fe[B.focus]=Tt[$t],fe["@"]=ue[nt]["@"]):fe["@"]=Tt[$t],B.index&&(fe[B.index]=$t),B.ancestor&&(fe[B.ancestor.label]=ue[nt]["@"])),F.push(fe)}}return B.stages&&(F=await J(B.stages,F,$)),F}async function ce(B,te,ue){var $=I();if(te&&te.tupleStream&&($.tupleStream=!0),Array.isArray(te)||(te=I(te)),B.type==="number"){var F=Math.floor(B.value);F<0&&(F=te.length+F);var q=await te[F];typeof q<"u"&&(Array.isArray(q)?$=q:$.push(q))}else for(F=0;F<te.length;F++){var q=te[F],he=q,fe=ue;te.tupleStream&&(he=q["@"],fe=ge(ue,q));var Le=await ee(B,he,fe);w(Le)&&(Le=[Le]),A(Le)?Le.forEach(function(Tt){var $t=Math.floor(Tt);$t<0&&($t=te.length+$t),$t===F&&$.push(q)}):f.boolean(Le)&&$.push(q)}return $}async function Te(B,te,ue){var $,F=await ee(B.lhs,te,ue),q=B.value,he=async()=>await ee(B.rhs,te,ue);if(q==="and"||q==="or")try{return await qe(F,he,q)}catch(Le){throw Le.position=B.position,Le.token=q,Le}var fe=await he();try{switch(q){case"+":case"-":case"*":case"/":case"%":$=V(F,fe,q);break;case"=":case"!=":$=G(F,fe,q);break;case"<":case"<=":case">":case">=":$=Ce(F,fe,q);break;case"&":$=Q(F,fe);break;case"..":$=Ee(F,fe);break;case"in":$=je(F,fe);break}}catch(Le){throw Le.position=B.position,Le.token=q,Le}return $}async function me(B,te,ue){var $;switch(B.value){case"-":if($=await ee(B.expression,te,ue),typeof $>"u")$=void 0;else if(w($))$=-$;else throw{code:"D1002",stack:new Error().stack,position:B.position,token:B.value,value:$};break;case"[":$=[];let he=await Promise.all(B.expressions.map(async(fe,Le)=>(ue.isParallelCall=Le>0,[fe,await ee(fe,te,ue)])));for(let fe of he){var[F,q]=fe;typeof q<"u"&&(F.value==="["?$.push(q):$=f.append($,q))}B.consarray&&Object.defineProperty($,"cons",{enumerable:!1,configurable:!1,value:!0});break;case"{":$=await oe(B,te,ue);break}return $}function $e(B,te,ue){return f.lookup(te,B.value)}function Re(B){return B.value}function be(B,te){var ue=I();return Array.isArray(te)&&te.outerWrapper&&te.length>0&&(te=te[0]),te!==null&&typeof te=="object"&&Object.keys(te).forEach(function($){var F=te[$];Array.isArray(F)?(F=re(F),ue=f.append(ue,F)):ue.push(F)}),ue}function re(B,te){return typeof te>"u"&&(te=[]),Array.isArray(B)?B.forEach(function(ue){re(ue,te)}):te.push(B),te}function K(B,te){var ue,$=I();return typeof te<"u"&&(se(te,$),$.length===1?ue=$[0]:ue=$),ue}function se(B,te){Array.isArray(B)||te.push(B),Array.isArray(B)?B.forEach(function(ue){se(ue,te)}):B!==null&&typeof B=="object"&&Object.keys(B).forEach(function(ue){se(B[ue],te)})}function V(B,te,ue){var $;if(typeof B<"u"&&!w(B))throw{code:"T2001",stack:new Error().stack,value:B};if(typeof te<"u"&&!w(te))throw{code:"T2002",stack:new Error().stack,value:te};if(typeof B>"u"||typeof te>"u")return $;switch(ue){case"+":$=B+te;break;case"-":$=B-te;break;case"*":$=B*te;break;case"/":$=B/te;break;case"%":$=B%te;break}return $}function G(B,te,ue){var $,F=typeof B,q=typeof te;if(F==="undefined"||q==="undefined")return!1;switch(ue){case"=":$=N(B,te);break;case"!=":$=!N(B,te);break}return $}function Ce(B,te,ue){var $,F=typeof B,q=typeof te,he=F==="undefined"||F==="string"||F==="number",fe=q==="undefined"||q==="string"||q==="number";if(!he||!fe)throw{code:"T2010",stack:new Error().stack,value:F==="string"||F==="number"?te:B};if(!(F==="undefined"||q==="undefined")){if(F!==q)throw{code:"T2009",stack:new Error().stack,value:B,value2:te};switch(ue){case"<":$=B<te;break;case"<=":$=B<=te;break;case">":$=B>te;break;case">=":$=B>=te;break}return $}}function je(B,te){var ue=!1;if(typeof B>"u"||typeof te>"u")return!1;Array.isArray(te)||(te=[te]);for(var $=0;$<te.length;$++)if(te[$]===B){ue=!0;break}return ue}async function qe(B,te,ue){var $,F=He(B);switch(ue){case"and":$=F&&He(await te());break;case"or":$=F||He(await te());break}return $}function He(B){var te=f.boolean(B);return typeof te>"u"?!1:te}function Q(B,te){var ue,$="",F="";return typeof B<"u"&&($=f.string(B)),typeof te<"u"&&(F=f.string(te)),ue=$.concat(F),ue}async function oe(B,te,ue){var $={},F={},q=!!(te&&te.tupleStream);Array.isArray(te)||(te=I(te)),te.length===0&&te.push(void 0);for(var he=0;he<te.length;he++)for(var fe=te[he],Le=q?ge(ue,fe):ue,nt=0;nt<B.lhs.length;nt++){var Tt=B.lhs[nt],$t=await ee(Tt[0],q?fe["@"]:fe,Le);if(typeof $t!="string"&&$t!==void 0)throw{code:"T1003",stack:new Error().stack,position:B.position,value:$t};if($t!==void 0){var fn={data:fe,exprIndex:nt};if(F.hasOwnProperty($t)){if(F[$t].exprIndex!==nt)throw{code:"D1009",stack:new Error().stack,position:B.position,value:$t};F[$t].data=f.append(F[$t].data,fe)}else F[$t]=fn}}let zt=await Promise.all(Object.keys(F).map(async(pn,Xn)=>{let an=F[pn];var ie=an.data,Ye=ue;if(q){var at=Z(an.data);ie=at["@"],delete at["@"],Ye=ge(ue,at)}return ue.isParallelCall=Xn>0,[pn,await ee(B.lhs[an.exprIndex][1],ie,Ye)]}));for(let pn of zt){var[$t,bn]=await pn;typeof bn<"u"&&($[$t]=bn)}return $}function Z(B){if(!Array.isArray(B))return B;var te={};Object.assign(te,B[0]);for(var ue=1;ue<B.length;ue++)for(const $ in B[ue])te[$]=f.append(te[$],B[ue][$]);return te}function Ee(B,te){var ue;if(typeof B<"u"&&!Number.isInteger(B))throw{code:"T2003",stack:new Error().stack,value:B};if(typeof te<"u"&&!Number.isInteger(te))throw{code:"T2004",stack:new Error().stack,value:te};if(typeof B>"u"||typeof te>"u"||B>te)return ue;var $=te-B+1;if($>1e7)throw{code:"D2014",stack:new Error().stack,value:$};ue=new Array($);for(var F=B,q=0;F<=te;F++,q++)ue[q]=F;return ue.sequence=!0,ue}async function ne(B,te,ue){var $=await ee(B.rhs,te,ue);return ue.bind(B.lhs.value,$),$}async function De(B,te,ue){var $,F=await ee(B.condition,te,ue);return f.boolean(F)?$=await ee(B.then,te,ue):typeof B.else<"u"&&($=await ee(B.else,te,ue)),$}async function we(B,te,ue){for(var $,F=Dn(ue),q=0;q<B.expressions.length;q++)$=await ee(B.expressions[q],te,F);return $}function Fe(B){var te=new Qe.RegexEngine(B.value),ue=function($,F){var q;te.lastIndex=F||0;var he=te.exec($);if(he!==null){if(q={match:he[0],start:he.index,end:he.index+he[0].length,groups:[]},he.length>1)for(var fe=1;fe<he.length;fe++)q.groups.push(he[fe]);q.next=function(){if(!(te.lastIndex>=$.length)){var Le=ue($,te.lastIndex);if(Le&&Le.match==="")throw{code:"D1004",stack:new Error().stack,position:B.position,value:B.value.source};return Le}}}return q};return ue}function rt(B,te,ue){var $;return B.value===""?$=te&&te.outerWrapper?te[0]:te:$=ue.lookup(B.value),$}async function It(B,te,ue){var $,F=te,q=!!te.tupleStream,he=async function(Le,nt){for(var Tt=0,$t=0;Tt===0&&$t<B.terms.length;$t++){var fn=B.terms[$t],zt=Le,bn=ue;q&&(zt=Le["@"],bn=ge(ue,Le));var pn=await ee(fn.expression,zt,bn);zt=nt,bn=ue,q&&(zt=nt["@"],bn=ge(ue,nt));var Xn=await ee(fn.expression,zt,bn),an=typeof pn,ie=typeof Xn;if(an==="undefined"){Tt=ie==="undefined"?0:1;continue}if(ie==="undefined"){Tt=-1;continue}if(!(an==="string"||an==="number")||!(ie==="string"||ie==="number"))throw{code:"T2008",stack:new Error().stack,position:B.position,value:an==="string"||an==="number"?Xn:pn};if(an!==ie)throw{code:"T2007",stack:new Error().stack,position:B.position,value:pn,value2:Xn};pn!==Xn&&(pn<Xn?Tt=-1:Tt=1,fn.descending===!0&&(Tt=-Tt))}return Tt===1},fe={environment:ue,input:te};return $=await f.sort.apply(fe,[F,he]),$}function Dt(B,te,ue){var $=async function(F){if(!(typeof F>"u")){var q=ue.lookup("clone");if(!U(q))throw{code:"T2013",stack:new Error().stack,position:B.position};var he=await lt(q,[F],null,ue),fe=await ee(B.pattern,he,ue);if(typeof fe<"u"){Array.isArray(fe)||(fe=[fe]);for(var Le=0;Le<fe.length;Le++){var nt=fe[Le];if(nt&&(nt.isPrototypeOf(he)||nt instanceof Object.constructor))throw{code:"D1010",stack:new Error().stack,position:B.position};var Tt=await ee(B.update,nt,ue),$t=typeof Tt;if($t!=="undefined"){if($t!=="object"||Tt===null||Array.isArray(Tt))throw{code:"T2011",stack:new Error().stack,position:B.update.position,value:Tt};for(var fn in Tt)nt[fn]=Tt[fn]}if(typeof B.delete<"u"){var zt=await ee(B.delete,nt,ue);if(typeof zt<"u"){var bn=zt;if(Array.isArray(zt)||(zt=[zt]),!R(zt))throw{code:"T2012",stack:new Error().stack,position:B.delete.position,value:bn};for(var pn=0;pn<zt.length;pn++)typeof nt=="object"&&nt!==null&&delete nt[zt[pn]]}}}}return he}};return Ge($,"<(oa):o>")}var vt=b("function($f, $g) { function($x){ $g($f($x)) } }");async function yt(B,te,ue){var $,F=await ee(B.lhs,te,ue);if(B.rhs.type==="function")$=await St(B.rhs,te,ue,{context:F});else{var q=await ee(B.rhs,te,ue);if(!U(q))throw{code:"T2006",stack:new Error().stack,position:B.position,value:q};if(U(F)){var he=await ee(vt,null,ue);$=await lt(he,[F,q],null,ue)}else $=await lt(q,[F],null,ue)}return $}async function St(B,te,ue,$){var F,q=await ee(B.procedure,te,ue);if(typeof q>"u"&&B.procedure.type==="path"&&ue.lookup(B.procedure.steps[0].value))throw{code:"T1005",stack:new Error().stack,position:B.position,token:B.procedure.steps[0].value};var he=[];typeof $<"u"&&he.push($.context);for(var fe=0;fe<B.arguments.length;fe++){const nt=await ee(B.arguments[fe],te,ue);if(U(nt)){const Tt=async function(...$t){return await lt(nt,$t,null,ue)};Tt.arity=j(nt),he.push(Tt)}else he.push(nt)}var Le=B.procedure.type==="path"?B.procedure.steps[0].value:B.procedure.value;try{typeof q=="object"&&(q.token=Le,q.position=B.position),F=await lt(q,he,te,ue)}catch(nt){throw nt.position||(nt.position=B.position),nt.token||(nt.token=Le),nt}return F}async function lt(B,te,ue,$){var F;for(F=await sn(B,te,ue,$);Y(F)&&F.thunk===!0;){var q=await ee(F.body.procedure,F.input,F.environment);F.body.procedure.type==="variable"&&(q.token=F.body.procedure.value),q.position=F.body.procedure.position;for(var he=[],fe=0;fe<F.body.arguments.length;fe++)he.push(await ee(F.body.arguments[fe],F.input,F.environment));F=await sn(q,he,ue,$)}return F}async function sn(B,te,ue,$){var F;try{var q=te;if(B&&(q=un(B.signature,te,ue)),Y(B))F=await Tn(B,q);else if(B&&B._jsonata_function===!0){var he={environment:$,input:ue};F=B.implementation.apply(he,q),W(F)&&(F=F.next().value),k(F)&&(F=await F)}else if(typeof B=="function")F=B.apply(ue,q),k(F)&&(F=await F);else throw{code:"T1006",stack:new Error().stack}}catch(fe){throw B&&(typeof fe.token>"u"&&typeof B.token<"u"&&(fe.token=B.token),fe.position=B.position||fe.position),fe}return F}function mn(B,te,ue){var $={_jsonata_lambda:!0,input:te,environment:ue,arguments:B.arguments,signature:B.signature,body:B.body};return B.thunk===!0&&($.thunk=!0),$.apply=async function(F,q){return await lt($,q,te,F?F.environment:ue)},$}async function dn(B,te,ue){for(var $,F=[],q=0;q<B.arguments.length;q++){var he=B.arguments[q];he.type==="operator"&&he.value==="?"?F.push(he):F.push(await ee(he,te,ue))}var fe=await ee(B.procedure,te,ue);if(typeof fe>"u"&&B.procedure.type==="path"&&ue.lookup(B.procedure.steps[0].value))throw{code:"T1007",stack:new Error().stack,position:B.position,token:B.procedure.steps[0].value};if(Y(fe))$=rr(fe,F);else if(fe&&fe._jsonata_function===!0)$=or(fe.implementation,F);else if(typeof fe=="function")$=or(fe,F);else throw{code:"T1008",stack:new Error().stack,position:B.position,token:B.procedure.type==="path"?B.procedure.steps[0].value:B.procedure.value};return $}function un(B,te,ue){if(typeof B>"u")return te;var $=B.validate(te,ue);return $}async function Tn(B,te){var ue,$=Dn(B.environment);return B.arguments.forEach(function(F,q){$.bind(F.value,te[q])}),typeof B.body=="function"?ue=await it(B.body,$):ue=await ee(B.body,B.input,$),ue}function rr(B,te){var ue=Dn(B.environment),$=[];B.arguments.forEach(function(q,he){var fe=te[he];fe&&fe.type==="operator"&&fe.value==="?"?$.push(q):ue.bind(q.value,fe)});var F={_jsonata_lambda:!0,input:B.input,environment:ue,arguments:$,body:B.body};return F}function or(B,te){var ue=ot(B);ue=ue.map(function(he){return"$"+he.trim()});var $="function("+ue.join(", ")+"){ _ }",F=b($);F.body=B;var q=rr(F,te);return q}async function it(B,te){var ue=ot(B),$=ue.map(function(he){return te.lookup(he.trim())}),F={environment:te},q=B.apply(F,$);return k(q)&&(q=await q),q}function ot(B){var te=B.toString(),ue=/\(([^)]*)\)/.exec(te)[1],$=ue.split(",");return $}function Ge(B,te){var ue={_jsonata_function:!0,implementation:B};return typeof te<"u"&&(ue.signature=S(te)),ue}async function cn(B,te){if(!(typeof B>"u")){var ue=this.input;typeof te<"u"&&(ue=te,Array.isArray(ue)&&!P(ue)&&(ue=I(ue),ue.outerWrapper=!0));try{var $=b(B,!1)}catch(q){throw In(q),{stack:new Error().stack,code:"D3120",value:q.message,error:q}}try{var F=await ee($,ue,this.environment)}catch(q){throw In(q),{stack:new Error().stack,code:"D3121",value:q.message,error:q}}return F}}function Rn(B){if(!(typeof B>"u"))return JSON.parse(f.string(B))}function Dn(B){var te={};const ue={bind:function(F,q){te[F]=q},lookup:function(F){var q;return te.hasOwnProperty(F)?q=te[F]:B&&(q=B.lookup(F)),q},timestamp:B?B.timestamp:null,async:B?B.async:!1,isParallelCall:B?B.isParallelCall:!1,global:B?B.global:{ancestry:[null]}};if(B){var $=B.lookup(Symbol.for("jsonata.__createFrame_push"));$&&$(B,ue)}return ue}z.bind("sum",Ge(f.sum,"<a<n>:n>")),z.bind("count",Ge(f.count,"<a:n>")),z.bind("max",Ge(f.max,"<a<n>:n>")),z.bind("min",Ge(f.min,"<a<n>:n>")),z.bind("average",Ge(f.average,"<a<n>:n>")),z.bind("string",Ge(f.string,"<x-b?:s>")),z.bind("substring",Ge(f.substring,"<s-nn?:s>")),z.bind("substringBefore",Ge(f.substringBefore,"<s-s:s>")),z.bind("substringAfter",Ge(f.substringAfter,"<s-s:s>")),z.bind("lowercase",Ge(f.lowercase,"<s-:s>")),z.bind("uppercase",Ge(f.uppercase,"<s-:s>")),z.bind("length",Ge(f.length,"<s-:n>")),z.bind("trim",Ge(f.trim,"<s-:s>")),z.bind("pad",Ge(f.pad,"<s-ns?:s>")),z.bind("match",Ge(f.match,"<s-f<s:o>n?:a<o>>")),z.bind("contains",Ge(f.contains,"<s-(sf):b>")),z.bind("replace",Ge(f.replace,"<s-(sf)(sf)n?:s>")),z.bind("split",Ge(f.split,"<s-(sf)n?:a<s>>")),z.bind("join",Ge(f.join,"<a<s>s?:s>")),z.bind("formatNumber",Ge(f.formatNumber,"<n-so?:s>")),z.bind("formatBase",Ge(f.formatBase,"<n-n?:s>")),z.bind("formatInteger",Ge(d.formatInteger,"<n-s:s>")),z.bind("parseInteger",Ge(d.parseInteger,"<s-s:n>")),z.bind("number",Ge(f.number,"<(nsb)-:n>")),z.bind("floor",Ge(f.floor,"<n-:n>")),z.bind("ceil",Ge(f.ceil,"<n-:n>")),z.bind("round",Ge(f.round,"<n-n?:n>")),z.bind("abs",Ge(f.abs,"<n-:n>")),z.bind("sqrt",Ge(f.sqrt,"<n-:n>")),z.bind("power",Ge(f.power,"<n-n:n>")),z.bind("random",Ge(f.random,"<:n>")),z.bind("boolean",Ge(f.boolean,"<x-:b>")),z.bind("not",Ge(f.not,"<x-:b>")),z.bind("map",Ge(f.map,"<af>")),z.bind("zip",Ge(f.zip,"<a+>")),z.bind("filter",Ge(f.filter,"<af>")),z.bind("single",Ge(f.single,"<af?>")),z.bind("reduce",Ge(f.foldLeft,"<afj?:j>")),z.bind("sift",Ge(f.sift,"<o-f?:o>")),z.bind("keys",Ge(f.keys,"<x-:a<s>>")),z.bind("lookup",Ge(f.lookup,"<x-s:x>")),z.bind("append",Ge(f.append,"<xx:a>")),z.bind("exists",Ge(f.exists,"<x:b>")),z.bind("spread",Ge(f.spread,"<x-:a<o>>")),z.bind("merge",Ge(f.merge,"<a<o>:o>")),z.bind("reverse",Ge(f.reverse,"<a:a>")),z.bind("each",Ge(f.each,"<o-f:a>")),z.bind("error",Ge(f.error,"<s?:x>")),z.bind("assert",Ge(f.assert,"<bs?:x>")),z.bind("type",Ge(f.type,"<x:s>")),z.bind("sort",Ge(f.sort,"<af?:a>")),z.bind("shuffle",Ge(f.shuffle,"<a:a>")),z.bind("distinct",Ge(f.distinct,"<x:x>")),z.bind("base64encode",Ge(f.base64encode,"<s-:s>")),z.bind("base64decode",Ge(f.base64decode,"<s-:s>")),z.bind("encodeUrlComponent",Ge(f.encodeUrlComponent,"<s-:s>")),z.bind("encodeUrl",Ge(f.encodeUrl,"<s-:s>")),z.bind("decodeUrlComponent",Ge(f.decodeUrlComponent,"<s-:s>")),z.bind("decodeUrl",Ge(f.decodeUrl,"<s-:s>")),z.bind("eval",Ge(cn,"<sx?:x>")),z.bind("toMillis",Ge(d.toMillis,"<s-s?:n>")),z.bind("fromMillis",Ge(d.fromMillis,"<n-s?s?:s>")),z.bind("clone",Ge(Rn,"<(oa)-:o>"));var On={S0101:"String literal must be terminated by a matching quote",S0102:"Number out of range: {{token}}",S0103:"Unsupported escape sequence: \\{{token}}",S0104:"The escape sequence \\u must be followed by 4 hex digits",S0105:"Quoted property name must be terminated with a backquote (`)",S0106:"Comment has no closing tag",S0201:"Syntax error: {{token}}",S0202:"Expected {{value}}, got {{token}}",S0203:"Expected {{value}} before end of expression",S0204:"Unknown operator: {{token}}",S0205:"Unexpected token: {{token}}",S0206:"Unknown expression type: {{token}}",S0207:"Unexpected end of expression",S0208:"Parameter {{value}} of function definition must be a variable name (start with $)",S0209:"A predicate cannot follow a grouping expression in a step",S0210:"Each step can only have one grouping expression",S0211:"The symbol {{token}} cannot be used as a unary operator",S0212:"The left side of := must be a variable name (start with $)",S0213:"The literal value {{value}} cannot be used as a step within a path expression",S0214:"The right side of {{token}} must be a variable name (start with $)",S0215:"A context variable binding must precede any predicates on a step",S0216:"A context variable binding must precede the 'order-by' clause on a step",S0217:"The object representing the 'parent' cannot be derived from this expression",S0301:"Empty regular expressions are not allowed",S0302:"No terminating / in regular expression",S0402:"Choice groups containing parameterized types are not supported",S0401:"Type parameters can only be applied to functions and arrays",S0500:"Attempted to evaluate an expression containing syntax error(s)",T0410:"Argument {{index}} of function {{token}} does not match function signature",T0411:"Context value is not a compatible type with argument {{index}} of function {{token}}",T0412:"Argument {{index}} of function {{token}} must be an array of {{type}}",D1001:"Number out of range: {{value}}",D1002:"Cannot negate a non-numeric value: {{value}}",T1003:"Key in object structure must evaluate to a string; got: {{value}}",D1004:"Regular expression matches zero length string",T1005:"Attempted to invoke a non-function. Did you mean ${{{token}}}?",T1006:"Attempted to invoke a non-function",T1007:"Attempted to partially apply a non-function. Did you mean ${{{token}}}?",T1008:"Attempted to partially apply a non-function",D1009:"Multiple key definitions evaluate to same key: {{value}}",D1010:"Attempted to access the Javascript object prototype",T1010:"The matcher function argument passed to function {{token}} does not return the correct object structure",T2001:"The left side of the {{token}} operator must evaluate to a number",T2002:"The right side of the {{token}} operator must evaluate to a number",T2003:"The left side of the range operator (..) must evaluate to an integer",T2004:"The right side of the range operator (..) must evaluate to an integer",D2005:"The left side of := must be a variable name (start with $)",T2006:"The right side of the function application operator ~> must be a function",T2007:"Type mismatch when comparing values {{value}} and {{value2}} in order-by clause",T2008:"The expressions within an order-by clause must evaluate to numeric or string values",T2009:"The values {{value}} and {{value2}} either side of operator {{token}} must be of the same data type",T2010:"The expressions either side of operator {{token}} must evaluate to numeric or string values",T2011:"The insert/update clause of the transform expression must evaluate to an object: {{value}}",T2012:"The delete clause of the transform expression must evaluate to a string or array of strings: {{value}}",T2013:"The transform expression clones the input object using the $clone() function. This has been overridden in the current scope by a non-function.",D2014:"The size of the sequence allocated by the range operator (..) must not exceed 1e6. Attempted to allocate {{value}}.",D3001:"Attempting to invoke string function on Infinity or NaN",D3010:"Second argument of replace function cannot be an empty string",D3011:"Fourth argument of replace function must evaluate to a positive number",D3012:"Attempted to replace a matched string with a non-string value",D3020:"Third argument of split function must evaluate to a positive number",D3030:"Unable to cast value to a number: {{value}}",D3040:"Third argument of match function must evaluate to a positive number",D3050:"The second argument of reduce function must be a function with at least two arguments",D3060:"The sqrt function cannot be applied to a negative number: {{value}}",D3061:"The power function has resulted in a value that cannot be represented as a JSON number: base={{value}}, exponent={{exp}}",D3070:"The single argument form of the sort function can only be applied to an array of strings or an array of numbers. Use the second argument to specify a comparison function",D3080:"The picture string must only contain a maximum of two sub-pictures",D3081:"The sub-picture must not contain more than one instance of the 'decimal-separator' character",D3082:"The sub-picture must not contain more than one instance of the 'percent' character",D3083:"The sub-picture must not contain more than one instance of the 'per-mille' character",D3084:"The sub-picture must not contain both a 'percent' and a 'per-mille' character",D3085:"The mantissa part of a sub-picture must contain at least one character that is either an 'optional digit character' or a member of the 'decimal digit family'",D3086:"The sub-picture must not contain a passive character that is preceded by an active character and that is followed by another active character",D3087:"The sub-picture must not contain a 'grouping-separator' character that appears adjacent to a 'decimal-separator' character",D3088:"The sub-picture must not contain a 'grouping-separator' at the end of the integer part",D3089:"The sub-picture must not contain two adjacent instances of the 'grouping-separator' character",D3090:"The integer part of the sub-picture must not contain a member of the 'decimal digit family' that is followed by an instance of the 'optional digit character'",D3091:"The fractional part of the sub-picture must not contain an instance of the 'optional digit character' that is followed by a member of the 'decimal digit family'",D3092:"A sub-picture that contains a 'percent' or 'per-mille' character must not contain a character treated as an 'exponent-separator'",D3093:"The exponent part of the sub-picture must comprise only of one or more characters that are members of the 'decimal digit family'",D3100:"The radix of the formatBase function must be between 2 and 36. It was given {{value}}",D3110:"The argument of the toMillis function must be an ISO 8601 formatted timestamp. Given {{value}}",D3120:"Syntax error in expression passed to function eval: {{value}}",D3121:"Dynamic error evaluating the expression passed to function eval: {{value}}",D3130:"Formatting or parsing an integer as a sequence starting with {{value}} is not supported by this implementation",D3131:"In a decimal digit pattern, all digits must be from the same decimal group",D3132:"Unknown component specifier {{value}} in date/time picture string",D3133:"The 'name' modifier can only be applied to months and days in the date/time picture string, not {{value}}",D3134:"The timezone integer format specifier cannot have more than four digits",D3135:"No matching closing bracket ']' in date/time picture string",D3136:"The date/time picture string is missing specifiers required to parse the timestamp",D3137:"{{{message}}}",D3138:"The $single() function expected exactly 1 matching result. Instead it matched more.",D3139:"The $single() function expected exactly 1 matching result. Instead it matched 0.",D3140:"Malformed URL passed to ${{{functionName}}}(): {{value}}",D3141:"{{{message}}}"};function In(B){var te=On[B.code];if(typeof te<"u"){var ue=te.replace(/\{\{\{([^}]+)}}}/g,function(){return B[arguments[1]]});ue=ue.replace(/\{\{([^}]+)}}/g,function(){return JSON.stringify(B[arguments[1]])}),B.message=ue}}function Qe(B,te){var ue,$;try{ue=b(B,te&&te.recover),$=ue.errors,delete ue.errors}catch(he){throw In(he),he}var F=Dn(z),q=new Date;return F.bind("now",Ge(function(he,fe){return d.fromMillis(q.getTime(),he,fe)},"<s?s?:s>")),F.bind("millis",Ge(function(){return q.getTime()},"<:n>")),te&&te.RegexEngine?Qe.RegexEngine=te.RegexEngine:Qe.RegexEngine=RegExp,{evaluate:async function(he,fe,Le){if(typeof $<"u"){var nt={code:"S0500",position:0};throw In(nt),nt}if(typeof fe<"u"){var Tt;Tt=Dn(F);for(var $t in fe)Tt.bind($t,fe[$t])}else Tt=F;Tt.bind("$",he),q=new Date,Tt.timestamp=q,Array.isArray(he)&&!P(he)&&(he=I(he),he.outerWrapper=!0);var fn;try{return fn=await ee(ue,he,Tt),typeof Le=="function"&&Le(null,fn),fn}catch(zt){throw In(zt),zt}},assign:function(he,fe){F.bind(he,fe)},registerFunction:function(he,fe,Le){var nt=Ge(fe,Le);F.bind(he,nt)},ast:function(){return ue},errors:function(){return $}}}return Qe.parser=b,Qe}();s.exports=E},{"./datetime":1,"./functions":2,"./parser":4,"./signature":5,"./utils":6}],4:[function(i,s,c){var d=i("./signature");const f=(()=>{var v={".":75,"[":80,"]":0,"{":70,"}":0,"(":80,")":0,",":0,"@":80,"#":80,";":80,":":80,"?":20,"+":50,"-":50,"*":60,"/":60,"%":60,"|":20,"=":40,"<":40,">":40,"^":40,"**":60,"..":20,":=":10,"!=":40,"<=":40,">=":40,"~>":40,"?:":40,"??":40,and:30,or:25,in:40,"&":50,"!":0,"~":0},b={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
3355
3355
  `,r:"\r",t:" "},S=function(w){var R=0,A=w.length,I=function(Y,W){var k={type:Y,value:W,position:R};return k},P=function(){for(var Y=R,W=0,k,j,N=function(ee){if(w.charAt(ee)==="/"&&W===0){for(var le=0;w.charAt(ee-(le+1))==="\\";)le++;if(le%2===0)return!0}return!1};R<A;){var z=w.charAt(R);if(N(R)){if(k=w.substring(Y,R),k==="")throw{code:"S0301",stack:new Error().stack,position:R};for(R++,z=w.charAt(R),Y=R;z==="i"||z==="m";)R++,z=w.charAt(R);return j=w.substring(Y,R)+"g",new RegExp(k,j)}(z==="("||z==="["||z==="{")&&w.charAt(R-1)!=="\\"&&W++,(z===")"||z==="]"||z==="}")&&w.charAt(R-1)!=="\\"&&W--,R++}throw{code:"S0302",stack:new Error().stack,position:R}},U=function(Y){if(R>=A)return null;for(var W=w.charAt(R);R<A&&`
3356
3356
  \r\v`.indexOf(W)>-1;)R++,W=w.charAt(R);if(W==="/"&&w.charAt(R+1)==="*"){var k=R;for(R+=2,W=w.charAt(R);!(W==="*"&&w.charAt(R+1)==="/");)if(W=w.charAt(++R),R>=A)throw{code:"S0106",stack:new Error().stack,position:k};return R+=2,W=w.charAt(R),U(Y)}if(Y!==!0&&W==="/")return R++,I("regex",P());if(W==="."&&w.charAt(R+1)===".")return R+=2,I("operator","..");if(W===":"&&w.charAt(R+1)==="=")return R+=2,I("operator",":=");if(W==="!"&&w.charAt(R+1)==="=")return R+=2,I("operator","!=");if(W===">"&&w.charAt(R+1)==="=")return R+=2,I("operator",">=");if(W==="<"&&w.charAt(R+1)==="=")return R+=2,I("operator","<=");if(W==="*"&&w.charAt(R+1)==="*")return R+=2,I("operator","**");if(W==="~"&&w.charAt(R+1)===">")return R+=2,I("operator","~>");if(W==="?"&&w.charAt(R+1)===":")return R+=2,I("operator","?:");if(W==="?"&&w.charAt(R+1)==="?")return R+=2,I("operator","??");if(Object.prototype.hasOwnProperty.call(v,W))return R++,I("operator",W);if(W==='"'||W==="'"){var j=W;R++;for(var N="";R<A;){if(W=w.charAt(R),W==="\\")if(R++,W=w.charAt(R),Object.prototype.hasOwnProperty.call(b,W))N+=b[W];else if(W==="u"){var z=w.substr(R+1,4);if(/^[0-9a-fA-F]+$/.test(z)){var ee=parseInt(z,16);N+=String.fromCharCode(ee),R+=4}else throw{code:"S0104",stack:new Error().stack,position:R}}else throw{code:"S0103",stack:new Error().stack,position:R,token:W};else{if(W===j)return R++,I("string",N);N+=W}R++}throw{code:"S0101",stack:new Error().stack,position:R}}var le=/^-?(0|([1-9][0-9]*))(\.[0-9]+)?([Ee][-+]?[0-9]+)?/,ge=le.exec(w.substring(R));if(ge!==null){var L=parseFloat(ge[0]);if(!isNaN(L)&&isFinite(L))return R+=ge[0].length,I("number",L);throw{code:"S0102",stack:new Error().stack,position:R,token:ge[0]}}var J;if(W==="`"){R++;var pe=w.indexOf("`",R);if(pe!==-1)return J=w.substring(R,pe),R=pe+1,I("name",J);throw R=A,{code:"S0105",stack:new Error().stack,position:R}}for(var ce=R,Te;;)if(Te=w.charAt(ce),ce===A||`
3357
3357
  \r\v`.indexOf(Te)>-1||Object.prototype.hasOwnProperty.call(v,Te)){if(w.charAt(R)==="$")return J=w.substring(R+1,ce),R=ce,I("variable",J);switch(J=w.substring(R,ce),R=ce,J){case"or":case"in":case"and":return I("operator",J);case"true":return I("value",!0);case"false":return I("value",!1);case"null":return I("value",null);default:return R===A&&J===""?null:I("name",J)}}else ce++};return U},E=function(w,R){var A,I,P={},U=[],Y=function(){var V=[];A.id!=="(end)"&&V.push({type:A.type,value:A.value,position:A.position});for(var G=I();G!==null;)V.push(G),G=I();return V},W={nud:function(){var V={code:"S0211",token:this.value,position:this.position};if(R)return V.remaining=Y(),V.type="error",U.push(V),V;throw V.stack=new Error().stack,V}},k=function(V,G){var Ce=P[V];return G=G||0,Ce?G>=Ce.lbp&&(Ce.lbp=G):(Ce=Object.create(W),Ce.id=Ce.value=V,Ce.lbp=G,P[V]=Ce),Ce},j=function(V){if(R){V.remaining=Y(),U.push(V);var G=P["(error)"];return A=Object.create(G),A.error=V,A.type="(error)",A}else throw V.stack=new Error().stack,V},N=function(V,G){if(V&&A.id!==V){var Ce;A.id==="(end)"?Ce="S0203":Ce="S0202";var je={code:Ce,position:A.position,token:A.value,value:V};return j(je)}var qe=I(G);if(qe===null)return A=P["(end)"],A.position=w.length,A;var He=qe.value,Q=qe.type,oe;switch(Q){case"name":case"variable":oe=P["(name)"];break;case"operator":if(oe=P[He],!oe)return j({code:"S0204",stack:new Error().stack,position:qe.position,token:He});break;case"string":case"number":case"value":oe=P["(literal)"];break;case"regex":Q="regex",oe=P["(regex)"];break;default:return j({code:"S0205",stack:new Error().stack,position:qe.position,token:He})}return A=Object.create(oe),A.value=He,A.type=Q,A.position=qe.position,A},z=function(V){var G,Ce=A;for(N(null,!0),G=Ce.nud();V<A.lbp;)Ce=A,N(),G=Ce.led(G);return G},ee=function(V){var G=k(V,0);G.nud=function(){return this}},le=function(V,G,Ce){var je=G||v[V],qe=k(V,je);return qe.led=Ce||function(He){return this.lhs=He,this.rhs=z(je),this.type="binary",this},qe},ge=function(V,G,Ce){var je=k(V,G);return je.led=Ce,je},L=function(V,G){var Ce=k(V);return Ce.nud=G||function(){return this.expression=z(70),this.type="unary",this},Ce};ee("(end)"),ee("(name)"),ee("(literal)"),ee("(regex)"),k(":"),k(";"),k(","),k(")"),k("]"),k("}"),k(".."),le("."),le("+"),le("-"),le("*"),le("/"),le("%"),le("="),le("<"),le(">"),le("!="),le("<="),le(">="),le("&"),le("and"),le("or"),le("in"),ee("and"),ee("or"),ee("in"),L("-"),le("~>"),le("??",v["??"],function(V){return this.type="condition",this.condition={type:"function",value:"(",procedure:{type:"variable",value:"exists"},arguments:[V]},this.then=V,this.else=z(0),this}),ge("(error)",10,function(V){return this.lhs=V,this.error=A.error,this.remaining=Y(),this.type="error",this}),L("*",function(){return this.type="wildcard",this}),L("**",function(){return this.type="descendant",this}),L("%",function(){return this.type="parent",this}),le("(",v["("],function(V){if(this.procedure=V,this.type="function",this.arguments=[],A.id!==")")for(;A.type==="operator"&&A.id==="?"?(this.type="partial",this.arguments.push(A),N("?")):this.arguments.push(z(0)),A.id===",";)N(",");if(N(")",!0),V.type==="name"&&(V.value==="function"||V.value==="λ")){if(this.arguments.forEach(function(He,Q){if(He.type!=="variable")return j({code:"S0208",stack:new Error().stack,position:He.position,token:He.value,value:Q+1})}),this.type="lambda",A.id==="<"){for(var G=A.position,Ce=1,je="<";Ce>0&&A.id!=="{"&&A.id!=="(end)";){var qe=N();qe.id===">"?Ce--:qe.id==="<"&&Ce++,je+=qe.value}N(">");try{this.signature=d(je)}catch(He){return He.position=G+He.offset,j(He)}}N("{"),this.body=z(0),N("}")}return this}),L("(",function(){for(var V=[];A.id!==")"&&(V.push(z(0)),A.id===";");)N(";");return N(")",!0),this.type="block",this.expressions=V,this}),L("[",function(){var V=[];if(A.id!=="]")for(;;){var G=z(0);if(A.id===".."){var Ce={type:"binary",value:"..",position:A.position,lhs:G};N(".."),Ce.rhs=z(0),G=Ce}if(V.push(G),A.id!==",")break;N(",")}return N("]",!0),this.expressions=V,this.type="unary",this}),le("[",v["["],function(V){if(A.id==="]"){for(var G=V;G&&G.type==="binary"&&G.value==="[";)G=G.lhs;return G.keepArray=!0,N("]"),V}else return this.lhs=V,this.rhs=z(v["]"]),this.type="binary",N("]",!0),this}),le("^",v["^"],function(V){N("(");for(var G=[];;){var Ce={descending:!1};if(A.id==="<"?N("<"):A.id===">"&&(Ce.descending=!0,N(">")),Ce.expression=z(0),G.push(Ce),A.id!==",")break;N(",")}return N(")"),this.lhs=V,this.rhs=G,this.type="binary",this});var J=function(V){var G=[];if(A.id!=="}")for(;;){var Ce=z(0);N(":");var je=z(0);if(G.push([Ce,je]),A.id!==",")break;N(",")}return N("}",!0),typeof V>"u"?(this.lhs=G,this.type="unary"):(this.lhs=V,this.rhs=G,this.type="binary"),this};L("{",J),le("{",v["{"],J),ge(":=",v[":="],function(V){return V.type!=="variable"?j({code:"S0212",stack:new Error().stack,position:V.position,token:V.value}):(this.lhs=V,this.rhs=z(v[":="]-1),this.type="binary",this)}),le("@",v["@"],function(V){return this.lhs=V,this.rhs=z(v["@"]),this.rhs.type!=="variable"?j({code:"S0214",stack:new Error().stack,position:this.rhs.position,token:"@"}):(this.type="binary",this)}),le("#",v["#"],function(V){return this.lhs=V,this.rhs=z(v["#"]),this.rhs.type!=="variable"?j({code:"S0214",stack:new Error().stack,position:this.rhs.position,token:"#"}):(this.type="binary",this)}),le("?",v["?"],function(V){return this.type="condition",this.condition=V,this.then=z(0),A.id===":"&&(N(":"),this.else=z(0)),this}),le("?:",v["?:"],function(V){return this.type="condition",this.condition=V,this.then=V,this.else=z(0),this}),L("|",function(){return this.type="transform",this.pattern=z(0),N("|"),this.update=z(0),A.id===","&&(N(","),this.delete=z(0)),N("|"),this});var pe=function(V){var G;if(V.type==="function"&&!V.predicate){var Ce={type:"lambda",thunk:!0,arguments:[],position:V.position};Ce.body=V,G=Ce}else if(V.type==="condition")V.then=pe(V.then),typeof V.else<"u"&&(V.else=pe(V.else)),G=V;else if(V.type==="block"){var je=V.expressions.length;je>0&&(V.expressions[je-1]=pe(V.expressions[je-1])),G=V}else G=V;return G},ce=0,Te=0,me=[],$e=function(V,G){switch(V.type){case"name":case"wildcard":G.level--,G.level===0&&(typeof V.ancestor>"u"||(me[G.index].slot.label=V.ancestor.label),V.ancestor=G,V.tuple=!0);break;case"parent":G.level++;break;case"block":V.expressions.length>0&&(V.tuple=!0,G=$e(V.expressions[V.expressions.length-1],G));break;case"path":V.tuple=!0;var Ce=V.steps.length-1;for(G=$e(V.steps[Ce--],G);G.level>0&&Ce>=0;)G=$e(V.steps[Ce--],G);break;default:throw{code:"S0217",token:V.type,position:V.position}}return G},Re=function(V,G){if(typeof G.seekingParent<"u"||G.type==="parent"){var Ce=typeof G.seekingParent<"u"?G.seekingParent:[];G.type==="parent"&&Ce.push(G.slot),typeof V.seekingParent>"u"?V.seekingParent=Ce:Array.prototype.push.apply(V.seekingParent,Ce)}},be=function(V){var G=V.steps.length-1,Ce=V.steps[G],je=typeof Ce.seekingParent<"u"?Ce.seekingParent:[];Ce.type==="parent"&&je.push(Ce.slot);for(var qe=0;qe<je.length;qe++){var He=je[qe];for(G=V.steps.length-2;He.level>0;){if(G<0){typeof V.seekingParent>"u"?V.seekingParent=[He]:V.seekingParent.push(He);break}for(var Q=V.steps[G--];G>=0&&Q.focus&&V.steps[G].focus;)Q=V.steps[G--];He=$e(Q,He)}}},re=function(V){var G;switch(V.type){case"binary":switch(V.value){case".":var Ce=re(V.lhs);Ce.type==="path"?G=Ce:G={type:"path",steps:[Ce]},Ce.type==="parent"&&(G.seekingParent=[Ce.slot]);var je=re(V.rhs);je.type==="function"&&je.procedure.type==="path"&&je.procedure.steps.length===1&&je.procedure.steps[0].type==="name"&&G.steps[G.steps.length-1].type==="function"&&(G.steps[G.steps.length-1].nextFunction=je.procedure.steps[0].value),je.type==="path"?Array.prototype.push.apply(G.steps,je.steps):(typeof je.predicate<"u"&&(je.stages=je.predicate,delete je.predicate),G.steps.push(je)),G.steps.filter(function(Fe){if(Fe.type==="number"||Fe.type==="value")throw{code:"S0213",stack:new Error().stack,position:Fe.position,value:Fe.value};return Fe.type==="string"}).forEach(function(Fe){Fe.type="name"}),G.steps.filter(function(Fe){return Fe.keepArray===!0}).length>0&&(G.keepSingletonArray=!0);var qe=G.steps[0];qe.type==="unary"&&qe.value==="["&&(qe.consarray=!0);var He=G.steps[G.steps.length-1];He.type==="unary"&&He.value==="["&&(He.consarray=!0),be(G);break;case"[":G=re(V.lhs);var Q=G,oe="predicate";if(G.type==="path"&&(Q=G.steps[G.steps.length-1],oe="stages"),typeof Q.group<"u")throw{code:"S0209",stack:new Error().stack,position:V.position};typeof Q[oe]>"u"&&(Q[oe]=[]);var Z=re(V.rhs);typeof Z.seekingParent<"u"&&(Z.seekingParent.forEach(Fe=>{Fe.level===1?$e(Q,Fe):Fe.level--}),Re(Q,Z)),Q[oe].push({type:"filter",expr:Z,position:V.position});break;case"{":if(G=re(V.lhs),typeof G.group<"u")throw{code:"S0210",stack:new Error().stack,position:V.position};G.group={lhs:V.rhs.map(function(Fe){return[re(Fe[0]),re(Fe[1])]}),position:V.position};break;case"^":G=re(V.lhs),G.type!=="path"&&(G={type:"path",steps:[G]});var Ee={type:"sort",position:V.position};Ee.terms=V.rhs.map(function(Fe){var rt=re(Fe.expression);return Re(Ee,rt),{descending:Fe.descending,expression:rt}}),G.steps.push(Ee),be(G);break;case":=":G={type:"bind",value:V.value,position:V.position},G.lhs=re(V.lhs),G.rhs=re(V.rhs),Re(G,G.rhs);break;case"@":if(G=re(V.lhs),Q=G,G.type==="path"&&(Q=G.steps[G.steps.length-1]),typeof Q.stages<"u"||typeof Q.predicate<"u")throw{code:"S0215",stack:new Error().stack,position:V.position};if(Q.type==="sort")throw{code:"S0216",stack:new Error().stack,position:V.position};V.keepArray&&(Q.keepArray=!0),Q.focus=V.rhs.value,Q.tuple=!0;break;case"#":G=re(V.lhs),Q=G,G.type==="path"?Q=G.steps[G.steps.length-1]:(G={type:"path",steps:[G]},typeof Q.predicate<"u"&&(Q.stages=Q.predicate,delete Q.predicate)),typeof Q.stages>"u"?Q.index=V.rhs.value:Q.stages.push({type:"index",value:V.rhs.value,position:V.position}),Q.tuple=!0;break;case"~>":G={type:"apply",value:V.value,position:V.position},G.lhs=re(V.lhs),G.rhs=re(V.rhs),G.keepArray=G.lhs.keepArray||G.rhs.keepArray;break;default:G={type:V.type,value:V.value,position:V.position},G.lhs=re(V.lhs),G.rhs=re(V.rhs),Re(G,G.lhs),Re(G,G.rhs)}break;case"unary":G={type:V.type,value:V.value,position:V.position},V.value==="["?G.expressions=V.expressions.map(function(Fe){var rt=re(Fe);return Re(G,rt),rt}):V.value==="{"?G.lhs=V.lhs.map(function(Fe){var rt=re(Fe[0]);Re(G,rt);var It=re(Fe[1]);return Re(G,It),[rt,It]}):(G.expression=re(V.expression),V.value==="-"&&G.expression.type==="number"?(G=G.expression,G.value=-G.value):Re(G,G.expression));break;case"function":case"partial":G={type:V.type,name:V.name,value:V.value,position:V.position},G.arguments=V.arguments.map(function(Fe){var rt=re(Fe);return Re(G,rt),rt}),G.procedure=re(V.procedure);break;case"lambda":G={type:V.type,arguments:V.arguments,signature:V.signature,position:V.position};var ne=re(V.body);G.body=pe(ne);break;case"condition":G={type:V.type,position:V.position},G.condition=re(V.condition),Re(G,G.condition),G.then=re(V.then),Re(G,G.then),typeof V.else<"u"&&(G.else=re(V.else),Re(G,G.else));break;case"transform":G={type:V.type,position:V.position},G.pattern=re(V.pattern),G.update=re(V.update),typeof V.delete<"u"&&(G.delete=re(V.delete));break;case"block":G={type:V.type,position:V.position},G.expressions=V.expressions.map(function(Fe){var rt=re(Fe);return Re(G,rt),(rt.consarray||rt.type==="path"&&rt.steps[0].consarray)&&(G.consarray=!0),rt});break;case"name":G={type:"path",steps:[V]},V.keepArray&&(G.keepSingletonArray=!0);break;case"parent":G={type:"parent",slot:{label:"!"+ce++,level:1,index:Te++}},me.push(G);break;case"string":case"number":case"value":case"wildcard":case"descendant":case"variable":case"regex":G=V;break;case"operator":if(V.value==="and"||V.value==="or"||V.value==="in")V.type="name",G=re(V);else if(V.value==="?")G=V;else throw{code:"S0201",stack:new Error().stack,position:V.position,token:V.value};break;case"error":G=V,V.lhs&&(G=re(V.lhs));break;default:var De="S0206";V.id==="(end)"&&(De="S0207");var we={code:De,position:V.position,token:V.value};if(R)return U.push(we),{type:"error",error:we};throw we.stack=new Error().stack,we}return V.keepArray&&(G.keepArray=!0),G};I=S(w),N();var K=z(0);if(A.id!=="(end)"){var se={code:"S0201",position:A.position,token:A.value};j(se)}if(K=re(K),K.type==="parent"||typeof K.seekingParent<"u")throw{code:"S0217",token:K.type,position:K.position};return U.length>0&&(K.errors=U),K};return E})();s.exports=f},{"./signature":5}],5:[function(i,s,c){var d=i("./utils");const f=(()=>{var v={a:"arrays",b:"booleans",f:"functions",n:"numbers",o:"objects",s:"strings"};function b(S){for(var E=1,w=[],R={},A=R;E<S.length;){var I=S.charAt(E);if(I===":")break;var P=function(){w.push(R),A=R,R={}},U=function(le,ge,L,J){for(var pe=1,ce=ge;ce<le.length;)if(ce++,I=le.charAt(ce),I===J){if(pe--,pe===0)break}else I===L&&pe++;return ce};switch(I){case"s":case"n":case"b":case"l":case"o":R.regex="["+I+"m]",R.type=I,P();break;case"a":R.regex="[asnblfom]",R.type=I,R.array=!0,P();break;case"f":R.regex="f",R.type=I,P();break;case"j":R.regex="[asnblom]",R.type=I,P();break;case"x":R.regex="[asnblfom]",R.type=I,P();break;case"-":A.context=!0,A.contextRegex=new RegExp(A.regex),A.regex+="?";break;case"?":case"+":A.regex+=I;break;case"(":var Y=U(S,E,"(",")"),W=S.substring(E+1,Y);if(W.indexOf("<")===-1)R.regex="["+W+"m]";else throw{code:"S0402",stack:new Error().stack,value:W,offset:E};R.type="("+W+")",E=Y,P();break;case"<":if(A.type==="a"||A.type==="f"){var k=U(S,E,"<",">");A.subtype=S.substring(E+1,k),E=k}else throw{code:"S0401",stack:new Error().stack,value:A.type,offset:E};break}E++}var j="^"+w.map(function(le){return"("+le.regex+")"}).join("")+"$",N=new RegExp(j),z=function(le){var ge;if(d.isFunction(le))ge="f";else{var L=typeof le;switch(L){case"string":ge="s";break;case"number":ge="n";break;case"boolean":ge="b";break;case"object":le===null?ge="l":Array.isArray(le)?ge="a":ge="o";break;case"undefined":default:ge="m"}}return ge},ee=function(le,ge){for(var L="^",J=0,pe=0;pe<w.length;pe++){L+=w[pe].regex;var ce=ge.match(L);if(ce===null)throw{code:"T0410",stack:new Error().stack,value:le[J],index:J+1};J=ce[0].length}throw{code:"T0410",stack:new Error().stack,value:le[J],index:J+1}};return{definition:S,validate:function(le,ge){var L="";le.forEach(function(Te){L+=z(Te)});var J=N.exec(L);if(J){var pe=[],ce=0;return w.forEach(function(Te,me){var $e=le[ce],Re=J[me+1];if(Re==="")if(Te.context&&Te.contextRegex){var be=z(ge);if(Te.contextRegex.test(be))pe.push(ge);else throw{code:"T0411",stack:new Error().stack,value:ge,index:ce+1}}else pe.push($e),ce++;else Re.split("").forEach(function(re){if(Te.type==="a"){if(re==="m")$e=void 0;else{$e=le[ce];var K=!0;if(typeof Te.subtype<"u"){if(re!=="a"&&Re!==Te.subtype)K=!1;else if(re==="a"&&$e.length>0){var se=z($e[0]);if(se!==Te.subtype.charAt(0))K=!1;else{var V=$e.filter(function(G){return z(G)!==se});K=V.length===0}}}if(!K)throw{code:"T0412",stack:new Error().stack,value:$e,index:ce+1,type:v[Te.subtype]};re!=="a"&&($e=[$e])}pe.push($e),ce++}else pe.push($e),ce++})}),pe}ee(le,L)}}}return b})();s.exports=f},{"./utils":6}],6:[function(i,s,c){const d=(()=>{function f(k){var j=!1;if(typeof k=="number"&&(j=!isNaN(k),j&&!isFinite(k)))throw{code:"D1001",value:k,stack:new Error().stack};return j}function v(k){var j=!1;return Array.isArray(k)&&(j=k.filter(function(N){return typeof N!="string"}).length===0),j}function b(k){var j=!1;return Array.isArray(k)&&(j=k.filter(function(N){return!f(N)}).length===0),j}function S(){var k=[];return k.sequence=!0,arguments.length===1&&k.push(arguments[0]),k}function E(k){return k.sequence===!0&&Array.isArray(k)}function w(k){return k&&(k._jsonata_function===!0||k._jsonata_lambda===!0)||typeof k=="function"}function R(k){var j=typeof k.arity=="number"?k.arity:typeof k.implementation=="function"?k.implementation.length:typeof k.length=="number"?k.length:k.arguments.length;return j}function A(k){return k&&k._jsonata_lambda===!0}var I=(typeof Symbol=="function"?Symbol:{}).iterator||"@@iterator";function P(k){return typeof k=="object"&&k!==null&&I in k&&"next"in k&&typeof k.next=="function"}function U(k,j){if(k===j)return!0;if(typeof k=="object"&&typeof j=="object"&&k!==null&&j!==null){if(Array.isArray(k)&&Array.isArray(j)){if(k.length!==j.length)return!1;for(var N=0;N<k.length;N++)if(!U(k[N],j[N]))return!1;return!0}var z=Object.getOwnPropertyNames(k),ee=Object.getOwnPropertyNames(j);if(z.length!==ee.length)return!1;for(z=z.sort(),ee=ee.sort(),N=0;N<z.length;N++)if(z[N]!==ee[N])return!1;for(N=0;N<z.length;N++){var le=z[N];if(!U(k[le],j[le]))return!1}return!0}return!1}function Y(k){return typeof k=="object"&&k!==null&&"then"in k&&typeof k.then=="function"}function W(k){var j=[];for(let N of k)j.push(N);return j}return{isNumeric:f,isArrayOfStrings:v,isArrayOfNumbers:b,createSequence:S,isSequence:E,isFunction:w,isLambda:A,isIterable:P,getFunctionArity:R,isDeepEqual:U,stringToArray:W,isPromise:Y}})();s.exports=d},{}]},{},[3])(3)})}(bC)),bC.exports}var rU=nU();const GA=WC(rU),oU=async(e,r,i)=>{const{operand:s,operator:c,value:d}=e;if(c==="jsonata")try{const S=d.toString(),E=i();return await GA(S).evaluate(E)}catch(S){return console.log("JSONata evaluation error:",S),!1}const f=r(s),v=String(f||"").toLowerCase().trim(),b=String(d||"").toLowerCase().trim();switch(c){case"==":case"===":return v===b;case"!=":case"!==":return v!==b;case">":const S=parseFloat(v),E=parseFloat(b);return!isNaN(S)&&!isNaN(E)&&S>E;case">=":const w=parseFloat(v),R=parseFloat(b);return!isNaN(w)&&!isNaN(R)&&w>=R;case"<":const A=parseFloat(v),I=parseFloat(b);return!isNaN(A)&&!isNaN(I)&&A<I;case"<=":const P=parseFloat(v),U=parseFloat(b);return!isNaN(P)&&!isNaN(U)&&P<=U;case"contains":case"includes":return Array.isArray(f)?f.some(k=>String(k).toLowerCase().trim().includes(b)):v.includes(b);case"not_contains":case"not_includes":return Array.isArray(f)?!f.some(k=>String(k).toLowerCase().trim().includes(b)):!v.includes(b);case"starts_with":return v.startsWith(b);case"ends_with":return v.endsWith(b);case"exists":case"is_not_empty":return f!=null&&v!=="";case"not_exists":case"is_empty":return f==null||v==="";case"in":return Array.isArray(d)?d.some(k=>String(k).toLowerCase().trim()===v):String(d).split(",").map(k=>k.toLowerCase().trim()).includes(v);case"not_in":return Array.isArray(d)?!d.some(k=>String(k).toLowerCase().trim()===v):!String(d).split(",").map(k=>k.toLowerCase().trim()).includes(v);case"regex":case"matches":try{return new RegExp(String(d),"i").test(v)}catch{return console.warn("Invalid regex pattern:",d),!1}default:return console.warn("Unknown operator:",c),!1}},WA=async(e,r,i)=>{if(!e||!e.conditions||e.conditions.length===0)return!0;for(const s of e.conditions){let c=!0;for(const d of s)if(!await oU(d,r,i)){c=!1;break}if(c)return!0}return!1},aU=()=>{const{getPatientValue:e,getFullPatient:r}=wr();return{evaluateCondition:Ve.useMemo(()=>async s=>await WA(s,e,r),[e,r])}},iU=e=>{var i;const r=(i=e.props)==null?void 0:i.required;return typeof r=="boolean"?r:typeof r=="string"?b3(r):!1},q$=(e,r,i)=>{var c,d;const s=e.filter(f=>f.shouldRender);for(const f of s){if(iU(f)&&!lU(f,r))return console.warn(`Required field is missing: ${f.name||((c=f.props)==null?void 0:c.propertyId)||f.id}`),!1;if((d=f.props)!=null&&d.propertyId&&i(f.props.propertyId))return!1}return!0},lU=(e,r)=>{var c;const i=(c=e.props)==null?void 0:c.propertyId;if(!i)return!0;const s=r(i);return!(s==null||e.componentId==="checkbox-single"&&s===!1||typeof s=="string"&&s.trim()===""||Array.isArray(s)&&s.length===0)},YA=({flow:e,isPreview:r,$bgColor:i,onSubmit:s,onNextStep:c,onPrevStep:d,onFormInit:f,shouldRedirect:v=!0,formidavimHost:b})=>{const[S,E]=Ve.useState(0),[w,R]=Ve.useState([]),[A,I]=Ve.useState(!0),{evaluateCondition:P}=aU(),{getFlowValue:U,getAllFlowData:Y,setDisableSubmitValue:W,getDisableSubmitValue:k,getFlowError:j,setCurrentFormValue:N,getAllFormData:z}=wr(),ee=Y(),le=Ve.useRef(new Set),ge=async be=>{if(!be)return[];const re=[];for(const K of be){const se=!K.condition||await P(K.condition),V=se;re.push({...K,isVisible:se,shouldRender:V,hasCondition:!!K.condition})}return re};Ve.useEffect(()=>{E(0),le.current.clear()},[e.slug]),Ve.useEffect(()=>{const be=async()=>{var K;if(!e.flowForms){R([]),I(!1);return}const re=[];for(const se of e.flowForms)if(!se.condition||await P(se.condition)){const G=(K=se.form)!=null&&K.formComponents?await ge(se.form.formComponents):[];re.push({...se,evaluatedFormComponents:G})}R(re),I(!1)};I(!0),be()},[e.flowForms,P]),Ve.useEffect(()=>{if(!A&&w.length>0&&S<w.length){const be=w[S],re=(be==null?void 0:be.evaluatedFormComponents)||[],K=q$(re,U,j);W(!K)}},[w,S,A,ee,U,W]);const L=w.length,J=w[S],pe=k();if(Ve.useEffect(()=>{var be;if(J){N(J);const re=(be=J.form)!=null&&be.id&&J.formId?`${J.form.id}-${J.formId}`:null;f&&re&&!le.current.has(re)&&(le.current.add(re),f({form:J}))}},[J,N,f]),A)return M.jsx("div",{children:"Loading..."});if(!J)return null;const ce=w[0]===J,Te=S===L-1,me=(J==null?void 0:J.evaluatedFormComponents)||[],$e=()=>{if(q$(me,U,j)){if(J.submit){s({flowData:Y(),formData:z(me),flow:e,form:J},v);return}c&&c({formData:z(me),flow:e,form:J}),S<L-1&&(E(re=>re+1),setTimeout(()=>{window.scrollTo({top:0,behavior:"smooth"})},0))}},Re=()=>{S>0&&(d&&d({flow:e,form:J}),E(be=>be-1)),window.scrollTo({top:0,behavior:"smooth"})};return M.jsxs(iM,{children:[M.jsxs(dM,{$tracker:!0,id:"FormHeaderMobile",children:[M.jsx(uO,{src:"https://media-s3-cdn.ivimhealth.com/assets/images/logos/ivim-black.svg"}),M.jsx(fM,{id:"FlowStepTrackerContainerMobile"}),!ce&&M.jsx(lM,{onClick:Re})]}),M.jsx(J$,{currentStep:S+1,totalSteps:L,showOnDesktop:!0,showOnMobile:!1}),M.jsx(bp,{$xSmall:!0,$bgColor:"white",$bRad:"10px 10px 0px 0px",children:M.jsxs(cM,{id:"FormHeaderDesktop",children:[!ce&&M.jsx(K$,{onClick:Re}),M.jsx(uO,{src:"https://media-s3-cdn.ivimhealth.com/assets/images/logos/ivim-black.svg"})]})}),M.jsx(KA,{$bgColor:J.bgColor,children:M.jsx(qA,{flowForm:J,isPreview:r,evaluatedFormComponents:me,formidavimHost:b})}),M.jsx(bp,{$xSmall:!0,$bgColor:"white",$bRad:"0px 0px 10px 10px",children:M.jsx(sM,{$borderOff:!!J.bgColor,children:M.jsx(sO,{type:"submit",onClick:$e,$isLastStep:Te,$radius:"41px",$margin:"0 0 15px 0",$btnStyle:"black",$disable:pe,children:J.navButtonText?J.navButtonText:"Next"})})}),M.jsx(pM,{id:"BtnFlowBtnWrapperMobile",children:M.jsx(sO,{type:"submit",onClick:$e,$isLastStep:Te,$radius:"41px",$margin:"0 0 15px 0",$btnStyle:"black",$disable:pe,$allowDisableClick:!0,children:J.navButtonText?J.navButtonText:"Next"})})]})},sU=async(e,r)=>{if(!e||typeof e!="string"||!r)return e;const i=/\{\{\s*([^}]+)\s*\}\}/g;let s=e,c;for(;(c=i.exec(e))!==null;){const d=c[0],f=c[1].trim();try{const v=await GA(f).evaluate(r),b=v??"";typeof b!="object"?s=s.replace(d,String(b)):s=b}catch(v){console.warn(`Failed to process template expression: "${f}"`,v)}}return s},HC=async(e,r)=>{if(!e||!r)return e;if(typeof e=="string")return await sU(e,r);if(Array.isArray(e))return Promise.all(e.map(i=>HC(i,r)));if(typeof e=="object"){const i={};for(const[s,c]of Object.entries(e))i[s]=await HC(c,r);return i}return e},uU=async(e,r)=>{var i;if(!e||!r)return e;try{const s=JSON.parse(JSON.stringify(e));if(s.flowForms){for(const c of s.flowForms)if((i=c.form)!=null&&i.formComponents)for(const d of c.form.formComponents)d.props&&(d.props=await HC(d.props,r))}return s}catch(s){return console.error("Error processing flow config templates:",s),e}},Sw=({data:e,config:r,isPreview:i,onSubmit:s,onNextStep:c,onPrevStep:d,onFlowInit:f,onFormInit:v,shouldRedirect:b,formidavimHost:S})=>{const{resetAndSetFlowValues:E,generateFormDataFromFlow:w,setPatientValues:R,getFullPatient:A,setCurrentFlowValue:I}=wr(),[P,U]=Ve.useState(null),[Y,W]=Ve.useState(!0),[k,j]=Ve.useState(!1),N=async(ee,le=!1,ge=!1)=>{try{const L=await uU(r,ee);if(U(L),I(L),ge&&f&&(r!=null&&r.id)&&(r!=null&&r.slug)&&f({flow:r}),le){const J=w(L);E(J)}}catch(L){if(console.error("Error processing config:",L),U(r),I(r),ge&&f&&(r!=null&&r.id)&&(r!=null&&r.slug)&&f({flow:r}),le){const J=w(r);E(J)}}};Ve.useEffect(()=>{(async()=>{W(!0),e&&R(e),await N(e,!0,!0),j(!0),W(!1)})()},[e,r]);const z=A();return Ve.useEffect(()=>{k&&z&&N(z,!1,!1)},[z,k]),Y||!P?M.jsx("div",{children:"Processing form..."}):M.jsx(YA,{flow:P,isPreview:i,onSubmit:s,onNextStep:c,onPrevStep:d,onFormInit:v,shouldRedirect:b,formidavimHost:S})},cU={lightPalettePine120:"#5A6859",darkGreenTint:"#7B867A",lightGreen:"#D9E7CE",lightGreenTint:"#ECF3E7",paleLeaf:"#C5D5B9",brandDarkGray:"#32312D",mediumGray:"#474642",gray:"#706F6C",lightGray:"#ADADAB",ltGray:"#D2D2D2",lightGrayTint:"#F5F5F5",brandTan:"#C2925B",neutral50:"#CAC8BE",neutralTint1:"#E5E3D7",neutralTint2:"#EAE9DF",neutralTint3:"#FAF9F7",transparent:"transparent",errorRed:"#DD1818",purple:"#8A61AF",ltPurple:"#E3D9EC",blue:"#6186AF",ltBlue:"#C8E2FE",focus:"#b17bb2",xltGray:"#E1E2E7",white:"#FFFFFF",transp:"transparent",primary:"#32312D",ivimGreen:"#85AF61",success:"#6F9351",pine120:"#5A6859",pine100:"#7B867A",pine60:"#ACB3AC",neutral0:"#FFFFFF",neutral20:"#F5F4F2",neutral30:"#F1EFED",neutral40:"#D8D6CA",gray60:"#ADADAB",danger:"#B94E36"},fU={playfair:'"Playfair Display", serif',poppins:"Poppins, sans-serif",karmina:"Karmina, serif"},dU={xs:"only screen and (min-width: 400px)",sm:"only screen and (min-width: 576px)",md:"only screen and (min-width: 766px)",lg:"only screen and (min-width: 992px)",xl:"only screen and (min-width: 1200px)"},pU={colors:cU,fonts:fU,mediaQuery:dU},hU=s5({reducer:{[V0.name]:V0.reducer,[F0.name]:F0.reducer}}),mU=ye.div`
package/index.mjs CHANGED
@@ -44139,7 +44139,7 @@ const Wj = _e.div`
44139
44139
  return J.forEach((ce) => {
44140
44140
  var me;
44141
44141
  const Ee = (me = ce.props) == null ? void 0 : me.propertyId;
44142
- Ee && !Ee.includes("password") && (pe[Ee] = r[Ee]);
44142
+ Ee && !Ee.includes("password") && ce.componentId !== "file" && (pe[Ee] = r[Ee]);
44143
44143
  }), pe;
44144
44144
  }, [r, f]), E = hr(() => r, [r]), w = hr((J) => {
44145
44145
  e(T5(J));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hievilmath/browser-formidavim",
3
- "version": "1.5.9",
3
+ "version": "1.5.10",
4
4
  "main": "./index.js",
5
5
  "module": "./index.mjs",
6
6
  "typings": "./index.d.ts",