@hievilmath/browser-formidavim 1.4.23 → 1.4.24

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,7 +2,7 @@
2
2
 
3
3
  Quick notes about changes made to this package for each version.
4
4
 
5
- ## Version 1.4.20 - 23
5
+ ## Version 1.4.20 - 24
6
6
  - Testing pipeline rendering optimizations.
7
7
 
8
8
  ---
package/index.js CHANGED
@@ -3354,7 +3354,7 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
3354
3354
  `,Kj=({formComponent:e})=>{const r=e.props,{label:i="Button",url:s,target:c="_self",btnStyle:p="alt",margin:f}=r||{};return I.jsx(Xj,{href:s,target:c,$btnStyle:p,$margin:f,children:i})},Zj={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","hipaa-consent":"string",file:"string"},Jj={header:mj,image:vj,"weight-loss-chart":yj,"horizontal-rule":Cj,"text-tip":wj,"small-text":Ej,paragraph:Tj,"refill-request":Rj,"addon-request":Lj,"hipaa-consent":Gj,"link-button":Kj,video:Hj,"checkbox-single":W5,"checkbox-multi":Y5,radio:wO,"radio-group":wO,number:B5,dropdown:nL,datepicker:tL,scale:q5,"text-input":rL,textarea:G5,"titration-select":oL,"dosing-custom-units":pj,email:pL,password:hL,phone:mL,otp:rj,address:fj,hidden:dj,file:hj},Nr=()=>{const e=Fu.useDispatch(),r=Fu.useSelector(M=>$5(M)),i=Fu.useSelector(M=>A5(M)),s=Fu.useSelector(M=>k5(M)),c=Fu.useSelector(M=>P5(M)),p=Fu.useSelector(M=>N5(M)),f=Fu.useSelector(M=>I5(M)),v=Ve.useCallback((M,ue)=>{e(S5({field:M,value:ue}))},[e]),b=Ve.useCallback(M=>r[M],[r]),S=Ve.useCallback(()=>r,[r]),T=Ve.useCallback(M=>{e(C5(M))},[e]),w=Ve.useCallback(M=>{e(w5(M))},[e]),R=Ve.useCallback((M,ue)=>{e(E5({field:M,error:ue}))},[e]),A=Ve.useCallback(M=>i[M],[i]),L=Ve.useCallback(M=>{e(T5(M))},[e]),P=Ve.useCallback(()=>s,[s]),j=Ve.useCallback((M,ue)=>{e(L5({[M]:ue}))},[e]),G=Ve.useCallback(M=>{const ue={id:M.customerId??null,profile:M.data};e(M5(ue))},[e]),W=Ve.useCallback(M=>f==null?void 0:f[M],[f]),k=Ve.useCallback(()=>f,[f]),V=Ve.useCallback(M=>{e(R5(M))},[e]),N=Ve.useCallback(()=>c,[c]),z=Ve.useCallback(M=>{e(O5(M))},[e]),Z=Ve.useCallback(()=>p,[p]),ie=Ve.useCallback((M,ue)=>{v(M,ue),j(M,ue)},[v,j]),ye=Ve.useCallback(M=>{const ue={};return M.flowForms&&M.flowForms.forEach(Re=>{var he;(he=Re.form)!=null&&he.formComponents&&Re.form.formComponents.forEach(ve=>{const ne=ve.componentId||"";if(Zj[ne]){const ge=ve.props,pe=ge==null?void 0:ge.propertyId;pe&&(ue[pe]=null)}})}),ue},[]);return{setFlowValue:v,setFlowValues:T,resetAndSetFlowValues:w,getFlowValue:b,getAllFlowData:S,setFlowError:R,getFlowError:A,setDisableSubmitValue:L,getDisableSubmitValue:P,setPatientValue:j,setPatientValues:G,getPatientValue:W,getFullPatient:k,setCurrentFlowValue:V,getCurrentFlowValue:N,setCurrentFormValue:z,getCurrentFormValue:Z,setFlowAndPatientValue:ie,generateFormDataFromFlow:ye}};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 eU(){return Y$||(Y$=1,function(e,r){(function(i){e.exports=i()})(function(){return function(){function i(s,c,p){function f(S,T){if(!c[S]){if(!s[S]){var w=typeof A0=="function"&&A0;if(!T&&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(L){var P=s[S][1][L];return f(P||L)},A,A.exports,i,s,c,p)}return c[S].exports}for(var v=typeof A0=="function"&&A0,b=0;b<p.length;b++)f(p[b]);return f}return i}()({1:[function(i,s,c){const p=i("./utils"),f=function(){const v=p.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"],T=["Twenty","Thirty","Forty","Fifty","Sixty","Seventy","Eighty","Ninety","Hundred"],w=["Thousand","Million","Billion","Trillion"];function R(X,oe){var K=function(ee,De,we){var Fe="";if(ee<=19)Fe=(De?" and ":"")+(we?S[ee]:b[ee]);else if(ee<100){const It=Math.floor(ee/10),Mt=ee%10;Fe=(De?" and ":"")+T[It-2],Mt>0?Fe+="-"+K(Mt,!1,we):we&&(Fe=Fe.substring(0,Fe.length-1)+"ieth")}else if(ee<1e3){const It=Math.floor(ee/100),Mt=ee%100;Fe=(De?", ":"")+b[It]+" Hundred",Mt>0?Fe+=K(Mt,!0,we):we&&(Fe+="th")}else{var et=Math.floor(Math.log10(ee)/3);et>w.length&&(et=w.length);const It=Math.pow(10,et*3),Mt=Math.floor(ee/It),vt=ee-Mt*It;Fe=(De?", ":"")+K(Mt,!1,!1)+" "+w[et-1],vt>0?Fe+=K(vt,!0,we):we&&(Fe+="th")}return Fe},Ee=K(X,!1,oe);return Ee}const A={};b.forEach(function(X,oe){A[X.toLowerCase()]=oe}),S.forEach(function(X,oe){A[X.toLowerCase()]=oe}),T.forEach(function(X,oe){const K=X.toLowerCase();A[K]=(oe+2)*10,A[K.substring(0,X.length-1)+"ieth"]=A[K]}),A.hundredth=100,w.forEach(function(X,oe){const K=X.toLowerCase(),Ee=Math.pow(10,(oe+1)*3);A[K]=Ee,A[K+"th"]=Ee});function L(X){const K=X.split(/,\s|\sand\s|[\s\\-]/).map(De=>A[De]);let Ee=[0];return K.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"]],j={M:1e3,D:500,C:100,L:50,X:10,V:5,I:1};function G(X){for(var oe=0;oe<P.length;oe++){const K=P[oe];if(X>=K[0])return K[1]+G(X-K[0])}return""}function W(X){for(var oe=0,K=1,Ee=X.length-1;Ee>=0;Ee--){const ee=X[Ee],De=j[ee];De<K?oe-=De:(K=De,oe+=De)}return oe}function k(X,oe){for(var K=[],Ee=oe.charCodeAt(0);X>0;)K.unshift(String.fromCharCode((X-1)%26+Ee)),X=Math.floor((X-1)/26);return K.join("")}function V(X,oe){for(var K=oe.charCodeAt(0),Ee=0,ee=0;ee<X.length;ee++)Ee+=(X.charCodeAt(X.length-ee-1)-K+1)*Math.pow(26,ee);return Ee}function N(X,oe){if(typeof X>"u")return;X=Math.floor(X);const K=M(oe);return ie(X,K)}const z={DECIMAL:"decimal",LETTERS:"letters",ROMAN:"roman",WORDS:"words",SEQUENCE:"sequence"},Z={UPPER:"upper",LOWER:"lower",TITLE:"title"};function ie(X,oe){let K;const Ee=X<0;switch(X=Math.abs(X),oe.primary){case z.LETTERS:K=k(X,oe.case===Z.UPPER?"A":"a");break;case z.ROMAN:K=G(X),oe.case===Z.UPPER&&(K=K.toUpperCase());break;case z.WORDS:K=R(X,oe.ordinal),oe.case===Z.UPPER?K=K.toUpperCase():oe.case===Z.LOWER&&(K=K.toLowerCase());break;case z.DECIMAL:K=""+X;var ee=oe.mandatoryDigits-K.length;if(ee>0){var De=new Array(ee+1).join("0");K=De+K}if(oe.zeroCode!==48&&(K=v(K).map(It=>String.fromCodePoint(It.codePointAt(0)+oe.zeroCode-48)).join("")),oe.regular){const It=Math.floor((K.length-1)/oe.groupingSeparators.position);for(let Mt=It;Mt>0;Mt--){const vt=K.length-Mt*oe.groupingSeparators.position;K=K.substr(0,vt)+oe.groupingSeparators.character+K.substr(vt)}}else oe.groupingSeparators.reverse().forEach(It=>{const Mt=K.length-It.position;K=K.substr(0,Mt)+It.character+K.substr(Mt)});if(oe.ordinal){var we={1:"st",2:"nd",3:"rd"},Fe=K[K.length-1],et=we[Fe];(!et||K.length>1&&K[K.length-2]==="1")&&(et="th"),K=K+et}break;case z.SEQUENCE:throw{code:"D3130",value:oe.token}}return Ee&&(K="-"+K),K}const ye=[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 M(X){const oe={type:"integer",primary:z.DECIMAL,case:Z.LOWER,ordinal:!1};let K,Ee;const ee=X.lastIndexOf(";");switch(ee===-1?K=X:(K=X.substring(0,ee),Ee=X.substring(ee+1),Ee[0]==="o"&&(oe.ordinal=!0)),K){case"A":oe.case=Z.UPPER;case"a":oe.primary=z.LETTERS;break;case"I":oe.case=Z.UPPER;case"i":oe.primary=z.ROMAN;break;case"W":oe.case=Z.UPPER,oe.primary=z.WORDS;break;case"Ww":oe.case=Z.TITLE,oe.primary=z.WORDS;break;case"w":oe.primary=z.WORDS;break;default:{let De=null,we=0,Fe=0,et=[],It=0;if(v(K).map(vt=>vt.codePointAt(0)).reverse().forEach(vt=>{let gt=!1;for(let Ct=0;Ct<ye.length;Ct++){const lt=ye[Ct];if(vt>=lt&&vt<=lt+9){if(gt=!0,we++,It++,De===null)De=lt;else if(lt!==De)throw{code:"D3131"};break}}gt||(vt===35?(It++,Fe++):et.push({position:It,character:String.fromCodePoint(vt)}))}),we>0){oe.primary=z.DECIMAL,oe.zeroCode=De,oe.mandatoryDigits=we,oe.optionalDigits=Fe;const gt=function(Ct){if(Ct.length===0)return 0;const lt=Ct[0].character;for(let un=1;un<Ct.length;un++)if(Ct[un].character!==lt)return 0;const sn=Ct.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}(et);gt>0?(oe.regular=!0,oe.groupingSeparators={position:gt,character:et[0].character}):(oe.regular=!1,oe.groupingSeparators=et)}else oe.primary=z.SEQUENCE,oe.token=K}}return oe}const ue={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 Re(X){var oe=[];const K={type:"datetime",parts:oe},Ee=function(gt,Ct){if(Ct>gt){let lt=X.substring(gt,Ct);lt=lt.split("]]").join("]"),oe.push({type:"literal",value:lt})}};for(var ee=0,De=0;De<X.length;){if(X.charAt(De)==="["){if(X.charAt(De+1)==="["){Ee(ee,De),oe.push({type:"literal",value:"["}),De+=2,ee=De;continue}if(Ee(ee,De),ee=De,De=X.indexOf("]",ee),De===-1)throw{code:"D3135"};let gt=X.substring(ee+1,De);gt=gt.split(/\s+/).join("");var we={type:"marker",component:gt.charAt(0)},Fe=gt.lastIndexOf(","),et;if(Fe!==-1){const Ct=gt.substring(Fe+1),lt=Ct.indexOf("-");let sn,mn;const dn=function(Tn){if(!(typeof Tn>"u"||Tn==="*"))return parseInt(Tn)};lt===-1?sn=Ct:(sn=Ct.substring(0,lt),mn=Ct.substring(lt+1));const un={min:dn(sn),max:dn(mn)};we.width=un,et=gt.substring(1,Fe)}else et=gt.substring(1);if(et.length===1)we.presentation1=et;else if(et.length>1){var It=et.charAt(et.length-1);"atco".indexOf(It)!==-1?(we.presentation2=It,It==="o"&&(we.ordinal=!0),we.presentation1=et.substring(0,et.length-1)):we.presentation1=et}else we.presentation1=ue[we.component];if(typeof we.presentation1>"u")throw{code:"D3132",value:we.component};if(we.presentation1[0]==="n")we.names=Z.LOWER;else if(we.presentation1[0]==="N")we.presentation1[1]==="n"?we.names=Z.TITLE:we.names=Z.UPPER;else if("YMDdFWwXxHhmsf".indexOf(we.component)!==-1){var Mt=we.presentation1;if(we.presentation2&&(Mt+=";"+we.presentation2),we.integerFormat=M(Mt),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 Ct=oe[oe.length-1];Ct&&Ct.integerFormat&&(Ct.integerFormat.parseWidth=Ct.integerFormat.mandatoryDigits)}(we.component==="Z"||we.component==="z")&&(we.integerFormat=M(we.presentation1)),oe.push(we),ee=De+1}De++}return Ee(ee,De),K}const he=["","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],ve=["January","February","March","April","May","June","July","August","September","October","November","December"],ne=1e3*60*60*24,ce=function(X){const oe=Date.UTC(X.year,X.month);var K=new Date(oe).getUTCDay();return K===0&&(K=7),K>4?oe+(8-K)*ne:oe-(K-1)*ne},ge=function(X,oe){return{year:X,month:oe,nextMonth:function(){return oe===11?ge(X+1,0):ge(X,oe+1)},previousMonth:function(){return oe===0?ge(X-1,11):ge(X,oe-1)},nextYear:function(){return ge(X+1,oe)},previousYear:function(){return ge(X-1,oe)}}},pe=function(X,oe){return(oe-X)/(ne*7)+1},le=(X,oe)=>{let K;switch(oe){case"Y":K=X.getUTCFullYear();break;case"M":K=X.getUTCMonth()+1;break;case"D":K=X.getUTCDate();break;case"d":{const Ee=Date.UTC(X.getUTCFullYear(),X.getUTCMonth(),X.getUTCDate()),ee=Date.UTC(X.getUTCFullYear(),0);K=(Ee-ee)/ne+1;break}case"F":K=X.getUTCDay(),K===0&&(K=7);break;case"W":{const Ee=ge(X.getUTCFullYear(),0),ee=ce(Ee),De=Date.UTC(Ee.year,X.getUTCMonth(),X.getUTCDate());let we=pe(ee,De);if(we>52){const Fe=ce(Ee.nextYear());De>=Fe&&(we=1)}else if(we<1){const Fe=ce(Ee.previousYear());we=pe(Fe,De)}K=Math.floor(we);break}case"w":{const Ee=ge(X.getUTCFullYear(),X.getUTCMonth()),ee=ce(Ee),De=Date.UTC(Ee.year,Ee.month,X.getUTCDate());let we=pe(ee,De);if(we>4){const Fe=ce(Ee.nextMonth());De>=Fe&&(we=1)}else if(we<1){const Fe=ce(Ee.previousMonth());we=pe(Fe,De)}K=Math.floor(we);break}case"X":{const Ee=ge(X.getUTCFullYear(),0),ee=ce(Ee),De=ce(Ee.nextYear()),we=X.getTime();we<ee?K=Ee.year-1:we>=De?K=Ee.year+1:K=Ee.year;break}case"x":{const Ee=ge(X.getUTCFullYear(),X.getUTCMonth()),ee=ce(Ee),De=Ee.nextMonth(),we=ce(De),Fe=X.getTime();Fe<ee?K=Ee.previousMonth().month+1:Fe>=we?K=De.month+1:K=Ee.month+1;break}case"H":K=X.getUTCHours();break;case"h":K=X.getUTCHours(),K=K%12,K===0&&(K=12);break;case"P":K=X.getUTCHours()>=12?"pm":"am";break;case"m":K=X.getUTCMinutes();break;case"s":K=X.getUTCSeconds();break;case"f":K=X.getUTCMilliseconds();break;case"Z":case"z":break;case"C":K="ISO";break;case"E":K="ISO";break}return K};let te=null;function Te(X,oe,K){var Ee=0,ee=0;if(typeof K<"u"){const Mt=parseInt(K);Ee=Math.floor(Mt/100),ee=Mt%100}var De=function(Mt,vt){var gt=le(Mt,vt.component);if("YMDdFWwXxHhms".indexOf(vt.component)!==-1)if(vt.component==="Y"&&vt.n!==-1&&(gt=gt%Math.pow(10,vt.n)),vt.names){if(vt.component==="M"||vt.component==="x")gt=ve[gt-1];else if(vt.component==="F")gt=he[gt];else throw{code:"D3133",value:vt.component};vt.names===Z.UPPER?gt=gt.toUpperCase():vt.names===Z.LOWER&&(gt=gt.toLowerCase()),vt.width&&gt.length>vt.width.max&&(gt=gt.substring(0,vt.width.max))}else gt=ie(gt,vt.integerFormat);else if(vt.component==="f")gt=ie(gt,vt.integerFormat);else if(vt.component==="Z"||vt.component==="z"){const Ct=Ee*100+ee;if(vt.integerFormat.regular)gt=ie(Ct,vt.integerFormat);else{const lt=vt.integerFormat.mandatoryDigits;if(lt===1||lt===2)gt=ie(Ee,vt.integerFormat),ee!==0&&(gt+=":"+N(ee,"00"));else if(lt===3||lt===4)gt=ie(Ct,vt.integerFormat);else throw{code:"D3134",value:lt}}Ct>=0&&(gt="+"+gt),vt.component==="z"&&(gt="GMT"+gt),Ct===0&&vt.presentation2==="t"&&(gt="Z")}else vt.component==="P"&&vt.names===Z.UPPER&&(gt=gt.toUpperCase());return gt};let we;typeof oe>"u"?(te===null&&(te=Re("[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01].[f001][Z01:01t]")),we=te):we=Re(oe);const Fe=(60*Ee+ee)*60*1e3,et=new Date(X+Fe);let It="";return we.parts.forEach(function(Mt){Mt.type==="literal"?It+=Mt.value:It+=De(et,Mt)}),It}function B(X){var oe={};if(X.type==="datetime")oe.type="datetime",oe.parts=X.parts.map(function(K){var Ee={};if(K.type==="literal")Ee.regex=K.value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");else if(K.component==="Z"||K.component==="z"){let De;Array.isArray(K.integerFormat.groupingSeparators)||(De=K.integerFormat.groupingSeparators),Ee.regex="",K.component==="z"&&(Ee.regex="GMT"),Ee.regex+="[-+][0-9]+",De&&(Ee.regex+=De.character+"[0-9]+"),Ee.parse=function(we){K.component==="z"&&(we=we.substring(3));let Fe=0,et=0;return De?(Fe=Number.parseInt(we.substring(0,we.indexOf(De.character))),et=Number.parseInt(we.substring(we.indexOf(De.character)+1))):we.length-1<=2?Fe=Number.parseInt(we):(Fe=Number.parseInt(we.substring(0,3)),et=Number.parseInt(we.substring(3))),Fe*60+et}}else if(K.integerFormat)Ee=B(K.integerFormat);else{Ee.regex="[a-zA-Z]+";var ee={};if(K.component==="M"||K.component==="x")ve.forEach(function(De,we){K.width&&K.width.max?ee[De.substring(0,K.width.max)]=we+1:ee[De]=we+1});else if(K.component==="F")he.forEach(function(De,we){we>0&&(K.width&&K.width.max?ee[De.substring(0,K.width.max)]=we:ee[De]=we)});else if(K.component==="P")ee={am:0,AM:0,pm:1,PM:1};else throw{code:"D3133",value:K.component};Ee.parse=function(De){return ee[De]}}return Ee.component=K.component,Ee});else{oe.type="integer";const K=X.case===Z.UPPER;switch(X.primary){case z.LETTERS:oe.regex=K?"[A-Z]+":"[a-z]+",oe.parse=function(Ee){return V(Ee,K?"A":"a")};break;case z.ROMAN:oe.regex=K?"[MDCLXVI]+":"[mdclxvi]+",oe.parse=function(Ee){return W(K?Ee:Ee.toUpperCase())};break;case z.WORDS:oe.regex="(?:"+Object.keys(A).concat("and","[\\-, ]").join("|")+")+",oe.parse=function(Ee){return L(Ee.toLowerCase())};break;case z.DECIMAL:oe.regex="[0-9]",X.parseWidth?oe.regex+=`{${X.parseWidth}}`:oe.regex+="+",X.ordinal&&(oe.regex+="(?:th|st|nd|rd)"),oe.parse=function(Ee){let ee=Ee;return X.ordinal&&(ee=Ee.substring(0,Ee.length-2)),X.regular?ee=ee.split(",").join(""):X.groupingSeparators.forEach(De=>{ee=ee.split(De.character).join("")}),X.zeroCode!==48&&(ee=ee.split("").map(De=>String.fromCodePoint(De.codePointAt(0)-X.zeroCode+48)).join("")),parseInt(ee)};break;case z.SEQUENCE:throw{code:"D3130",value:X.token}}}return oe}function Y(X,oe){if(typeof X>"u")return;const K=M(oe);return B(K).parse(X)}function $e(X,oe){const K=Re(oe),Ee=B(K),ee="^"+Ee.parts.map(et=>"("+et.regex+")").join("")+"$";var we=new RegExp(ee,"i").exec(X);if(we!==null){const lt={};for(let Qe=1;Qe<we.length;Qe++){const U=Ee.parts[Qe-1];U.parse&&(lt[U.component]=U.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,Ln=!1;if(Rn.split("").forEach(Qe=>{if(typeof lt[Qe]>"u")On?(lt[Qe]="MDd".indexOf(Qe)!==-1?1:0,Ln=!0):lt[Qe]=le(Dn,Qe);else if(On=!0,Ln)throw{code:"D3136"}}),lt.M>0?lt.M-=1:lt.M=0,Tn){const Qe=Date.UTC(lt.Y,0),U=(lt.d-1)*1e3*60*60*24,J=new Date(Qe+U);lt.M=J.getUTCMonth(),lt.D=J.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 ze=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(X,oe){if(!(typeof X>"u"))if(typeof oe>"u"){if(!ze.test(X))throw{stack:new Error().stack,code:"D3110",value:X};return Date.parse(X)}else return $e.call(this,X,oe)}function We(X,oe,K){if(!(typeof X>"u"))return Te.call(this,X,oe,K)}return{formatInteger:N,parseInteger:Y,fromMillis:We,toMillis:qe}}();s.exports=f},{"./utils":6}],2:[function(i,s,c){(function(p){(function(){var f=i("./utils");const v=(()=>{var b=f.isNumeric,S=f.isArrayOfStrings,T=f.isArrayOfNumbers,w=f.createSequence,R=f.isSequence,A=f.isFunction,L=f.isLambda,P=f.isPromise,j=f.getFunctionArity,G=f.isDeepEqual,W=f.stringToArray;function k($){if(!(typeof $>"u")){var F=0;return $.forEach(function(q){F+=q}),F}}function V($){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 Z($){if(!(typeof $>"u"||$.length===0)){var F=0;return $.forEach(function(q){F+=q}),F/$.length}}function ie($,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 me=F?2:0;Array.isArray($)&&$.outerWrapper&&($=$[0]),q=JSON.stringify($,function(fe,Ie){return typeof Ie<"u"&&Ie!==null&&Ie.toPrecision&&b(Ie)?Number(Ie.toPrecision(15)):Ie&&A(Ie)?"":Ie},me)}return q}}function ye($,F,q){if(!(typeof $>"u")){var me=W($),fe=me.length;if(fe+F<0&&(F=0),typeof q<"u"){if(q<=0)return"";var Ie=F>=0?F+q:fe+F+q;return me.slice(F,Ie).join("")}return me.slice(F).join("")}}function M($,F){if(!(typeof $>"u")){var q=$.indexOf(F);return q>-1?$.substr(0,q):$}}function ue($,F){if(!(typeof $>"u")){var q=$.indexOf(F);return q>-1?$.substr(q+F.length):$}}function Re($){if(!(typeof $>"u"))return $.toLowerCase()}function he($){if(!(typeof $>"u"))return $.toUpperCase()}function ve($){if(!(typeof $>"u"))return W($).length}function ne($){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 ce($,F,q){if(!(typeof $>"u")){(typeof q>"u"||q.length===0)&&(q=" ");var me;F=Math.trunc(F);var fe=Math.abs(F)-ve($);if(fe>0){var Ie=new Array(fe+1).join(q);q.length>1&&(Ie=ye(Ie,0,fe)),F>0?me=$+Ie:me=Ie+$}else me=$;return me}}async function ge($,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 pe($,F){if(!(typeof $>"u")){var q;if(typeof F=="string")q=$.indexOf(F)!==-1;else{var me=await ge(F,$);q=typeof me<"u"}return q}}async function le($,F,q){if(!(typeof $>"u")){if(q<0)throw{stack:new Error().stack,value:q,code:"D3040",index:3};var me=w();if(typeof q>"u"||q>0){var fe=0,Ie=await ge(F,$);if(typeof Ie<"u")for(;typeof Ie<"u"&&(typeof q>"u"||fe<q);)me.push({match:Ie.match,index:Ie.start,groups:Ie.groups}),Ie=await ge(Ie.next),fe++}return me}}async function te($,F,q,me){if(!(typeof $>"u")){var fe=this;if(F==="")throw{code:"D3010",stack:new Error().stack,value:F,index:2};if(me<0)throw{code:"D3011",stack:new Error().stack,value:me,index:4};var Ie;typeof q=="string"?Ie=function(pn){for(var Xn="",an=0,ae=q.indexOf("$",an);ae!==-1&&an<q.length;){Xn+=q.substring(an,ae),an=ae+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,ae=parseInt(q.substring(an,an+at),10),at>1&&ae>pn.groups.length&&(ae=parseInt(q.substring(an,an+at-1),10)),isNaN(ae))Xn+="$";else{if(pn.groups.length>0){var _t=pn.groups[ae-1];typeof _t<"u"&&(Xn+=_t)}an+=ae.toString().length}}ae=q.indexOf("$",an)}return Xn+=q.substring(an),Xn}:Ie=q;var rt="",Tt=0;if(typeof me>"u"||me>0){var $t=0;if(typeof F=="string"){for(var fn=$.indexOf(F,Tt);fn!==-1&&(typeof me>"u"||$t<me);)rt+=$.substring(Tt,fn),rt+=q,Tt=fn+F.length,$t++,fn=$.indexOf(F,Tt);rt+=$.substring(Tt)}else{var zt=await ge(F,$);if(typeof zt<"u"){for(;typeof zt<"u"&&(typeof me>"u"||$t<me);){rt+=$.substring(Tt,zt.start);var bn=Ie.apply(fe,[zt]);if(P(bn)&&(bn=await bn),typeof bn=="string")rt+=bn;else throw{code:"D3012",stack:new Error().stack,value:bn};Tt=zt.start+zt.match.length,$t++,zt=await ge(zt.next)}rt+=$.substring(Tt)}else rt=$}}else rt=$;return rt}}function Te($){if(!(typeof $>"u")){var F=typeof window<"u"?window.btoa:function(q){return new p.Buffer.from(q,"binary").toString("base64")};return F($)}}function B($){if(!(typeof $>"u")){var F=typeof window<"u"?window.atob:function(q){return new p.Buffer.from(q,"base64").toString("binary")};return F($)}}function Y($){if(!(typeof $>"u")){var F;try{F=encodeURIComponent($)}catch{throw{code:"D3140",stack:new Error().stack,value:$,functionName:"encodeUrlComponent"}}return F}}function $e($){if(!(typeof $>"u")){var F;try{F=encodeURI($)}catch{throw{code:"D3140",stack:new Error().stack,value:$,functionName:"encodeUrl"}}return F}}function ze($){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 We($,F,q){if(!(typeof $>"u")){if(q<0)throw{code:"D3020",stack:new Error().stack,value:q,index:3};var me=[];if(typeof q>"u"||q>0)if(typeof F=="string")me=$.split(F,q);else{var fe=0,Ie=await ge(F,$);if(typeof Ie<"u"){for(var rt=0;typeof Ie<"u"&&(typeof q>"u"||fe<q);)me.push($.substring(rt,Ie.start)),rt=Ie.end,Ie=await ge(Ie.next),fe++;(typeof q>"u"||fe<q)&&me.push($.substring(rt))}else me.push($)}return me}}function X($,F){if(!(typeof $>"u"))return typeof F>"u"&&(F=""),$.join(F)}function oe($,F,q){if(!(typeof $>"u")){var me={"decimal-separator":".","grouping-separator":",","exponent-separator":"e",infinity:"Infinity","minus-sign":"-",NaN:"NaN",percent:"%","per-mille":"‰","zero-digit":"0",digit:"#","pattern-separator":";"},fe=me;typeof q<"u"&&Object.keys(q).forEach(function(Ht){fe[Ht]=q[Ht]});for(var Ie=[],rt=fe["zero-digit"].charCodeAt(0),Tt=rt;Tt<rt+10;Tt++)Ie.push(String.fromCharCode(Tt));var $t=Ie.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,Tr=0;Tr<Ht.length;Tr++)if(Mn=Ht.charAt(Tr),$t.indexOf(Mn)!==-1&&Mn!==fe["exponent-separator"])return Ht.substring(0,Tr)}(),gr=function(){for(var Mn,Tr=Ht.length-1;Tr>=0;Tr--)if(Mn=Ht.charAt(Tr),$t.indexOf(Mn)!==-1&&Mn!==fe["exponent-separator"])return Ht.substring(Tr+1)}(),yn=Ht.substring(Bn.length,Ht.length-gr.length),so,Er,To,_i,uo=Ht.indexOf(fe["exponent-separator"],Bn.length);uo===-1||uo>Ht.length-gr.length?(so=yn,Er=void 0):(so=yn.substring(0,uo),Er=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:Er,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 Er=!1;for(gr=0;gr<Ht.mantissaPart.length;gr++){var To=Ht.mantissaPart.charAt(gr);if(Ie.indexOf(To)!==-1||To===fe.digit){Er=!0;break}}Er||(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 Ie.indexOf(Mn)>-1}).length>0&&(Bn="D3090"),uo=Ht.fractionalPart.lastIndexOf(fe.digit),uo!==-1&&Ht.fractionalPart.substring(uo).split("").filter(function(Mn){return Ie.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 Ie.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 Ie.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),Er=Bn(Ht.fractionalPart,!0),To=Ht.integerPart.split("").filter(function(Hr){return Ie.indexOf(Hr)!==-1}).length,_i=To,uo=Ht.fractionalPart.split(""),Zr=uo.filter(function(Hr){return Ie.indexOf(Hr)!==-1}).length,Mn=uo.filter(function(Hr){return Ie.indexOf(Hr)!==-1||Hr===fe.digit}).length,Tr=typeof Ht.exponentPart=="string";To===0&&Mn===0&&(Tr?(Zr=1,Mn=1):To=1),Tr&&To===0&&Ht.integerPart.indexOf(fe.digit)!==-1&&(To=1),To===0&&Zr===0&&(Zr=1);var di=0;return Tr&&(di=Ht.exponentPart.split("").filter(function(Hr){return Ie.indexOf(Hr)!==-1}).length),{integerPartGroupingPositions:gr,regularGrouping:so,minimumIntegerPartSize:To,scalingFactor:_i,prefix:Ht.prefix,fractionalPartGroupingPositions:Er,minimumFactionalPartSize:Zr,maximumFactionalPartSize:Mn,minimumExponentSize:di,suffix:Ht.suffix,picture:Ht.subpicture}},Xn=fn.map(zt);Xn.forEach(bn);var an=Xn.map(pn),ae=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=ae+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 wr=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>wr;)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"?Ie[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 Qa=Math.floor((Jn-1)/At.regularGrouping),ci=1;ci<=Qa;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?ae:"")+fi}return Yt=At.prefix+Yt+At.suffix,Yt}}function K($,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 ee($){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 me=$.toString().split("e");$=+(me[0]+"e"+(me[1]?+me[1]+F:F))}q=Math.round($);var fe=q-$;return Math.abs(fe)===.5&&Math.abs(q%2)===1&&(q=q-1),F&&(me=q.toString().split("e"),q=+(me[0]+"e"+(me[1]?+me[1]-F:-F))),Object.is(q,-0)&&(q=0),q}}function et($){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 Mt(){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(me){return vt(me)});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 gt($){if(!(typeof $>"u"))return!vt($)}function Ct($,F,q,me){var fe=[F],Ie=j($);return Ie>=2&&fe.push(q),Ie>=3&&fe.push(me),fe}async function lt($,F){if(!(typeof $>"u")){for(var q=w(),me=0;me<$.length;me++){var fe=Ct(F,$[me],me,$),Ie=await F.apply(this,fe);typeof Ie<"u"&&q.push(Ie)}return q}}async function sn($,F){if(!(typeof $>"u")){for(var q=w(),me=0;me<$.length;me++){var fe=$[me],Ie=Ct(F,fe,me,$),rt=await F.apply(this,Ie);vt(rt)&&q.push(fe)}return q}}async function mn($,F){if(!(typeof $>"u")){for(var q=!1,me,fe=0;fe<$.length;fe++){var Ie=$[fe],rt=!0;if(typeof F<"u"){var Tt=Ct(F,Ie,fe,$),$t=await F.apply(this,Tt);rt=vt($t)}if(rt)if(!q)me=Ie,q=!0;else throw{stack:new Error().stack,code:"D3138",index:fe}}if(!q)throw{stack:new Error().stack,code:"D3139"};return me}}function dn(){for(var $=[],F=Array.prototype.slice.call(arguments),q=Math.min.apply(Math,F.map(function(Ie){return Array.isArray(Ie)?Ie.length:0})),me=0;me<q;me++){var fe=F.map(Ie=>Ie[me]);$.push(fe)}return $}async function un($,F,q){if(!(typeof $>"u")){var me,fe=j(F);if(fe<2)throw{stack:new Error().stack,code:"D3050",index:1};var Ie;for(typeof q>"u"&&$.length>0?(me=$[0],Ie=1):(me=q,Ie=0);Ie<$.length;){var rt=[me,$[Ie]];fe>=3&&rt.push(Ie),fe>=4&&rt.push($),me=await F.apply(this,rt),Ie++}return me}}function Tn($){var F=w();if(Array.isArray($)){var q={};$.forEach(function(me){var fe=Tn(me);fe.forEach(function(Ie){q[Ie]=!0})}),F=Tn(q)}else $!==null&&typeof $=="object"&&!A($)&&Object.keys($).forEach(me=>F.push(me));return F}function rr($,F){var q;if(Array.isArray($)){q=w();for(var me=0;me<$.length;me++){var fe=rr($[me],F);typeof fe<"u"&&(Array.isArray(fe)?fe.forEach(Ie=>q.push(Ie)):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"&&!L($))for(var q in $){var me={};me[q]=$[q],F.push(me)}else F=$;return F}function He($){if(!(typeof $>"u")){var F={};return $.forEach(function(q){for(var me in q)F[me]=q[me]}),F}}function cn($){if(!(typeof $>"u")){if($.length<=1)return $;for(var F=$.length,q=new Array(F),me=0;me<F;me++)q[F-me-1]=$[me];return q}}async function Rn($,F){var q=w();for(var me in $){var fe=Ct(F,$[me],me,$),Ie=await F.apply(this,fe);typeof Ie<"u"&&q.push(Ie)}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 Ln($){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(!T($)&&!S($))throw{stack:new Error().stack,code:"D3070",index:1};q=async function(rt,Tt){return rt>Tt}}else q=F;var me=async function(rt,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,rt,Tt),fn},fe=async function(rt){if(!Array.isArray(rt)||rt.length<=1)return rt;var Tt=Math.floor(rt.length/2),$t=rt.slice(0,Tt),fn=rt.slice(Tt);return $t=await fe($t),fn=await fe(fn),await me($t,fn)},Ie=await fe($);return Ie}}function U($){if(!(typeof $>"u")){if($.length<=1)return $;for(var F=new Array($.length),q=0;q<$.length;q++){var me=Math.floor(Math.random()*(q+1));q!==me&&(F[q]=F[me]),F[me]=$[q]}return F}}function J($){if(!(typeof $>"u")){if(!Array.isArray($)||$.length<=1)return $;for(var F=R($)?w():[],q=0;q<$.length;q++){for(var me=$[q],fe=!1,Ie=0;Ie<F.length;Ie++)if(G(me,F[Ie])){fe=!0;break}fe||F.push(me)}return F}}async function se($,F){var q={};for(var me in $){var fe=$[me],Ie=Ct(F,fe,me,$),rt=await F.apply(this,Ie);vt(rt)&&(q[me]=fe)}return Object.keys(q).length===0&&(q=void 0),q}return{sum:k,count:V,max:N,min:z,average:Z,string:ie,substring:ye,substringBefore:M,substringAfter:ue,lowercase:Re,uppercase:he,length:ve,trim:ne,pad:ce,match:le,contains:pe,replace:te,split:We,join:X,formatNumber:oe,formatBase:K,number:Ee,floor:De,ceil:we,round:Fe,abs:ee,sqrt:et,power:It,random:Mt,boolean:vt,not:gt,map:lt,zip:dn,filter:sn,single:mn,foldLeft:un,sift:se,keys:Tn,lookup:rr,append:or,exists:it,spread:ot,merge:He,reverse:cn,each:Rn,error:Dn,assert:On,type:Ln,sort:Qe,shuffle:U,distinct:J,base64encode:Te,base64decode:B,encodeUrlComponent:Y,encodeUrl:$e,decodeUrlComponent:ze,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 p=i("./datetime"),f=i("./functions"),v=i("./utils"),b=i("./parser"),S=i("./signature"),T=function(){var w=v.isNumeric,R=v.isArrayOfStrings,A=v.isArrayOfNumbers,L=v.createSequence,P=v.isSequence,j=v.isFunction,G=v.isLambda,W=v.isIterable,k=v.isPromise,V=v.getFunctionArity,N=v.isDeepEqual,z=Dn(null);async function Z(U,J,se){var $,F=se.lookup(Symbol.for("jsonata.__evaluate_entry"));switch(F&&await F(U,J,se),U.type){case"path":$=await ie(U,J,se);break;case"binary":$=await ve(U,J,se);break;case"unary":$=await ne(U,J,se);break;case"name":$=ce(U,J);break;case"string":case"number":case"value":$=ge(U);break;case"wildcard":$=pe(U,J);break;case"descendant":$=te(U,J);break;case"parent":$=se.lookup(U.slot.label);break;case"condition":$=await De(U,J,se);break;case"block":$=await we(U,J,se);break;case"bind":$=await ee(U,J,se);break;case"regex":$=Fe(U);break;case"function":$=await Ct(U,J,se);break;case"variable":$=et(U,J,se);break;case"lambda":$=mn(U,J,se);break;case"partial":$=await dn(U,J,se);break;case"apply":$=await gt(U,J,se);break;case"transform":$=Mt(U,J,se);break}if(Object.prototype.hasOwnProperty.call(U,"predicate"))for(var q=0;q<U.predicate.length;q++)$=await he(U.predicate[q].expr,$,se);U.type!=="path"&&Object.prototype.hasOwnProperty.call(U,"group")&&($=await oe(U.group,$,se));var me=se.lookup(Symbol.for("jsonata.__evaluate_exit"));return me&&await me(U,J,se,$),$&&P($)&&!$.tupleStream&&(U.keepArray&&($.keepSingleton=!0),$.length===0?$=void 0:$.length===1&&($=$.keepSingleton?$:$[0])),$}async function ie(U,J,se){var $;Array.isArray(J)&&U.steps[0].type!=="variable"?$=J:$=L(J);for(var F,q=!1,me=void 0,fe=0;fe<U.steps.length;fe++){var Ie=U.steps[fe];if(Ie.tuple&&(q=!0),fe===0&&Ie.consarray?F=await Z(Ie,$,se):q?me=await Re(Ie,$,me,se):F=await M(Ie,$,se,fe===U.steps.length-1),!q&&(typeof F>"u"||F.length===0))break;typeof Ie.focus>"u"&&($=F)}if(q)if(U.tuple)F=me;else for(F=L(),fe=0;fe<me.length;fe++)F.push(me[fe]["@"]);return U.keepSingletonArray&&(Array.isArray(F)&&F.cons&&!F.sequence&&(F=L(F)),F.keepSingleton=!0),U.hasOwnProperty("group")&&(F=await oe(U.group,q?me:F,se)),F}function ye(U,J){var se=Dn(U);for(const $ in J)se.bind($,J[$]);return se}async function M(U,J,se,$){var F;if(U.type==="sort")return F=await It(U,J,se),U.stages&&(F=await ue(U.stages,F,se)),F;F=L();for(var q=0;q<J.length;q++){var me=await Z(U,J[q],se);if(U.stages)for(var fe=0;fe<U.stages.length;fe++)me=await he(U.stages[fe].expr,me,se);typeof me<"u"&&F.push(me)}var Ie=L();return $&&F.length===1&&Array.isArray(F[0])&&!P(F[0])?Ie=F[0]:F.forEach(function(rt){!Array.isArray(rt)||rt.cons?Ie.push(rt):rt.forEach(Tt=>Ie.push(Tt))}),Ie}async function ue(U,J,se){for(var $=J,F=0;F<U.length;F++){var q=U[F];switch(q.type){case"filter":$=await he(q.expr,$,se);break;case"index":for(var me=0;me<$.length;me++){var fe=$[me];fe[q.value]=me}break}}return $}async function Re(U,J,se,$){var F;if(U.type==="sort"){if(se)F=await It(U,se,$);else{var q=await It(U,J,$);F=L(),F.tupleStream=!0;for(var me=0;me<q.length;me++){var fe={"@":q[me]};fe[U.index]=me,F.push(fe)}}return U.stages&&(F=await ue(U.stages,F,$)),F}F=L(),F.tupleStream=!0;var Ie=$;se===void 0&&(se=J.map(fn=>({"@":fn})));for(var rt=0;rt<se.length;rt++){Ie=ye($,se[rt]);var Tt=await Z(U,se[rt]["@"],Ie);if(typeof Tt<"u"){Array.isArray(Tt)||(Tt=[Tt]);for(var $t=0;$t<Tt.length;$t++)fe={},Object.assign(fe,se[rt]),Tt.tupleStream?Object.assign(fe,Tt[$t]):(U.focus?(fe[U.focus]=Tt[$t],fe["@"]=se[rt]["@"]):fe["@"]=Tt[$t],U.index&&(fe[U.index]=$t),U.ancestor&&(fe[U.ancestor.label]=se[rt]["@"])),F.push(fe)}}return U.stages&&(F=await ue(U.stages,F,$)),F}async function he(U,J,se){var $=L();if(J&&J.tupleStream&&($.tupleStream=!0),Array.isArray(J)||(J=L(J)),U.type==="number"){var F=Math.floor(U.value);F<0&&(F=J.length+F);var q=await J[F];typeof q<"u"&&(Array.isArray(q)?$=q:$.push(q))}else for(F=0;F<J.length;F++){var q=J[F],me=q,fe=se;J.tupleStream&&(me=q["@"],fe=ye(se,q));var Ie=await Z(U,me,fe);w(Ie)&&(Ie=[Ie]),A(Ie)?Ie.forEach(function(Tt){var $t=Math.floor(Tt);$t<0&&($t=J.length+$t),$t===F&&$.push(q)}):f.boolean(Ie)&&$.push(q)}return $}async function ve(U,J,se){var $,F=await Z(U.lhs,J,se),q=U.value,me=async()=>await Z(U.rhs,J,se);if(q==="and"||q==="or")try{return await qe(F,me,q)}catch(Ie){throw Ie.position=U.position,Ie.token=q,Ie}var fe=await me();try{switch(q){case"+":case"-":case"*":case"/":case"%":$=B(F,fe,q);break;case"=":case"!=":$=Y(F,fe,q);break;case"<":case"<=":case">":case">=":$=$e(F,fe,q);break;case"&":$=X(F,fe);break;case"..":$=Ee(F,fe);break;case"in":$=ze(F,fe);break}}catch(Ie){throw Ie.position=U.position,Ie.token=q,Ie}return $}async function ne(U,J,se){var $;switch(U.value){case"-":if($=await Z(U.expression,J,se),typeof $>"u")$=void 0;else if(w($))$=-$;else throw{code:"D1002",stack:new Error().stack,position:U.position,token:U.value,value:$};break;case"[":$=[];let me=await Promise.all(U.expressions.map(async(fe,Ie)=>(se.isParallelCall=Ie>0,[fe,await Z(fe,J,se)])));for(let fe of me){var[F,q]=fe;typeof q<"u"&&(F.value==="["?$.push(q):$=f.append($,q))}U.consarray&&Object.defineProperty($,"cons",{enumerable:!1,configurable:!1,value:!0});break;case"{":$=await oe(U,J,se);break}return $}function ce(U,J,se){return f.lookup(J,U.value)}function ge(U){return U.value}function pe(U,J){var se=L();return Array.isArray(J)&&J.outerWrapper&&J.length>0&&(J=J[0]),J!==null&&typeof J=="object"&&Object.keys(J).forEach(function($){var F=J[$];Array.isArray(F)?(F=le(F),se=f.append(se,F)):se.push(F)}),se}function le(U,J){return typeof J>"u"&&(J=[]),Array.isArray(U)?U.forEach(function(se){le(se,J)}):J.push(U),J}function te(U,J){var se,$=L();return typeof J<"u"&&(Te(J,$),$.length===1?se=$[0]:se=$),se}function Te(U,J){Array.isArray(U)||J.push(U),Array.isArray(U)?U.forEach(function(se){Te(se,J)}):U!==null&&typeof U=="object"&&Object.keys(U).forEach(function(se){Te(U[se],J)})}function B(U,J,se){var $;if(typeof U<"u"&&!w(U))throw{code:"T2001",stack:new Error().stack,value:U};if(typeof J<"u"&&!w(J))throw{code:"T2002",stack:new Error().stack,value:J};if(typeof U>"u"||typeof J>"u")return $;switch(se){case"+":$=U+J;break;case"-":$=U-J;break;case"*":$=U*J;break;case"/":$=U/J;break;case"%":$=U%J;break}return $}function Y(U,J,se){var $,F=typeof U,q=typeof J;if(F==="undefined"||q==="undefined")return!1;switch(se){case"=":$=N(U,J);break;case"!=":$=!N(U,J);break}return $}function $e(U,J,se){var $,F=typeof U,q=typeof J,me=F==="undefined"||F==="string"||F==="number",fe=q==="undefined"||q==="string"||q==="number";if(!me||!fe)throw{code:"T2010",stack:new Error().stack,value:F==="string"||F==="number"?J:U};if(!(F==="undefined"||q==="undefined")){if(F!==q)throw{code:"T2009",stack:new Error().stack,value:U,value2:J};switch(se){case"<":$=U<J;break;case"<=":$=U<=J;break;case">":$=U>J;break;case">=":$=U>=J;break}return $}}function ze(U,J){var se=!1;if(typeof U>"u"||typeof J>"u")return!1;Array.isArray(J)||(J=[J]);for(var $=0;$<J.length;$++)if(J[$]===U){se=!0;break}return se}async function qe(U,J,se){var $,F=We(U);switch(se){case"and":$=F&&We(await J());break;case"or":$=F||We(await J());break}return $}function We(U){var J=f.boolean(U);return typeof J>"u"?!1:J}function X(U,J){var se,$="",F="";return typeof U<"u"&&($=f.string(U)),typeof J<"u"&&(F=f.string(J)),se=$.concat(F),se}async function oe(U,J,se){var $={},F={},q=!!(J&&J.tupleStream);Array.isArray(J)||(J=L(J)),J.length===0&&J.push(void 0);for(var me=0;me<J.length;me++)for(var fe=J[me],Ie=q?ye(se,fe):se,rt=0;rt<U.lhs.length;rt++){var Tt=U.lhs[rt],$t=await Z(Tt[0],q?fe["@"]:fe,Ie);if(typeof $t!="string"&&$t!==void 0)throw{code:"T1003",stack:new Error().stack,position:U.position,value:$t};if($t!==void 0){var fn={data:fe,exprIndex:rt};if(F.hasOwnProperty($t)){if(F[$t].exprIndex!==rt)throw{code:"D1009",stack:new Error().stack,position:U.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 ae=an.data,Ye=se;if(q){var at=K(an.data);ae=at["@"],delete at["@"],Ye=ye(se,at)}return se.isParallelCall=Xn>0,[pn,await Z(U.lhs[an.exprIndex][1],ae,Ye)]}));for(let pn of zt){var[$t,bn]=await pn;typeof bn<"u"&&($[$t]=bn)}return $}function K(U){if(!Array.isArray(U))return U;var J={};Object.assign(J,U[0]);for(var se=1;se<U.length;se++)for(const $ in U[se])J[$]=f.append(J[$],U[se][$]);return J}function Ee(U,J){var se;if(typeof U<"u"&&!Number.isInteger(U))throw{code:"T2003",stack:new Error().stack,value:U};if(typeof J<"u"&&!Number.isInteger(J))throw{code:"T2004",stack:new Error().stack,value:J};if(typeof U>"u"||typeof J>"u"||U>J)return se;var $=J-U+1;if($>1e7)throw{code:"D2014",stack:new Error().stack,value:$};se=new Array($);for(var F=U,q=0;F<=J;F++,q++)se[q]=F;return se.sequence=!0,se}async function ee(U,J,se){var $=await Z(U.rhs,J,se);return se.bind(U.lhs.value,$),$}async function De(U,J,se){var $,F=await Z(U.condition,J,se);return f.boolean(F)?$=await Z(U.then,J,se):typeof U.else<"u"&&($=await Z(U.else,J,se)),$}async function we(U,J,se){for(var $,F=Dn(se),q=0;q<U.expressions.length;q++)$=await Z(U.expressions[q],J,F);return $}function Fe(U){var J=new Qe.RegexEngine(U.value),se=function($,F){var q;J.lastIndex=F||0;var me=J.exec($);if(me!==null){if(q={match:me[0],start:me.index,end:me.index+me[0].length,groups:[]},me.length>1)for(var fe=1;fe<me.length;fe++)q.groups.push(me[fe]);q.next=function(){if(!(J.lastIndex>=$.length)){var Ie=se($,J.lastIndex);if(Ie&&Ie.match==="")throw{code:"D1004",stack:new Error().stack,position:U.position,value:U.value.source};return Ie}}}return q};return se}function et(U,J,se){var $;return U.value===""?$=J&&J.outerWrapper?J[0]:J:$=se.lookup(U.value),$}async function It(U,J,se){var $,F=J,q=!!J.tupleStream,me=async function(Ie,rt){for(var Tt=0,$t=0;Tt===0&&$t<U.terms.length;$t++){var fn=U.terms[$t],zt=Ie,bn=se;q&&(zt=Ie["@"],bn=ye(se,Ie));var pn=await Z(fn.expression,zt,bn);zt=rt,bn=se,q&&(zt=rt["@"],bn=ye(se,rt));var Xn=await Z(fn.expression,zt,bn),an=typeof pn,ae=typeof Xn;if(an==="undefined"){Tt=ae==="undefined"?0:1;continue}if(ae==="undefined"){Tt=-1;continue}if(!(an==="string"||an==="number")||!(ae==="string"||ae==="number"))throw{code:"T2008",stack:new Error().stack,position:U.position,value:an==="string"||an==="number"?Xn:pn};if(an!==ae)throw{code:"T2007",stack:new Error().stack,position:U.position,value:pn,value2:Xn};pn!==Xn&&(pn<Xn?Tt=-1:Tt=1,fn.descending===!0&&(Tt=-Tt))}return Tt===1},fe={environment:se,input:J};return $=await f.sort.apply(fe,[F,me]),$}function Mt(U,J,se){var $=async function(F){if(!(typeof F>"u")){var q=se.lookup("clone");if(!j(q))throw{code:"T2013",stack:new Error().stack,position:U.position};var me=await lt(q,[F],null,se),fe=await Z(U.pattern,me,se);if(typeof fe<"u"){Array.isArray(fe)||(fe=[fe]);for(var Ie=0;Ie<fe.length;Ie++){var rt=fe[Ie];if(rt&&(rt.isPrototypeOf(me)||rt instanceof Object.constructor))throw{code:"D1010",stack:new Error().stack,position:U.position};var Tt=await Z(U.update,rt,se),$t=typeof Tt;if($t!=="undefined"){if($t!=="object"||Tt===null||Array.isArray(Tt))throw{code:"T2011",stack:new Error().stack,position:U.update.position,value:Tt};for(var fn in Tt)rt[fn]=Tt[fn]}if(typeof U.delete<"u"){var zt=await Z(U.delete,rt,se);if(typeof zt<"u"){var bn=zt;if(Array.isArray(zt)||(zt=[zt]),!R(zt))throw{code:"T2012",stack:new Error().stack,position:U.delete.position,value:bn};for(var pn=0;pn<zt.length;pn++)typeof rt=="object"&&rt!==null&&delete rt[zt[pn]]}}}}return me}};return He($,"<(oa):o>")}var vt=b("function($f, $g) { function($x){ $g($f($x)) } }");async function gt(U,J,se){var $,F=await Z(U.lhs,J,se);if(U.rhs.type==="function")$=await Ct(U.rhs,J,se,{context:F});else{var q=await Z(U.rhs,J,se);if(!j(q))throw{code:"T2006",stack:new Error().stack,position:U.position,value:q};if(j(F)){var me=await Z(vt,null,se);$=await lt(me,[F,q],null,se)}else $=await lt(q,[F],null,se)}return $}async function Ct(U,J,se,$){var F,q=await Z(U.procedure,J,se);if(typeof q>"u"&&U.procedure.type==="path"&&se.lookup(U.procedure.steps[0].value))throw{code:"T1005",stack:new Error().stack,position:U.position,token:U.procedure.steps[0].value};var me=[];typeof $<"u"&&me.push($.context);for(var fe=0;fe<U.arguments.length;fe++){const rt=await Z(U.arguments[fe],J,se);if(j(rt)){const Tt=async function(...$t){return await lt(rt,$t,null,se)};Tt.arity=V(rt),me.push(Tt)}else me.push(rt)}var Ie=U.procedure.type==="path"?U.procedure.steps[0].value:U.procedure.value;try{typeof q=="object"&&(q.token=Ie,q.position=U.position),F=await lt(q,me,J,se)}catch(rt){throw rt.position||(rt.position=U.position),rt.token||(rt.token=Ie),rt}return F}async function lt(U,J,se,$){var F;for(F=await sn(U,J,se,$);G(F)&&F.thunk===!0;){var q=await Z(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 me=[],fe=0;fe<F.body.arguments.length;fe++)me.push(await Z(F.body.arguments[fe],F.input,F.environment));F=await sn(q,me,se,$)}return F}async function sn(U,J,se,$){var F;try{var q=J;if(U&&(q=un(U.signature,J,se)),G(U))F=await Tn(U,q);else if(U&&U._jsonata_function===!0){var me={environment:$,input:se};F=U.implementation.apply(me,q),W(F)&&(F=F.next().value),k(F)&&(F=await F)}else if(typeof U=="function")F=U.apply(se,q),k(F)&&(F=await F);else throw{code:"T1006",stack:new Error().stack}}catch(fe){throw U&&(typeof fe.token>"u"&&typeof U.token<"u"&&(fe.token=U.token),fe.position=U.position||fe.position),fe}return F}function mn(U,J,se){var $={_jsonata_lambda:!0,input:J,environment:se,arguments:U.arguments,signature:U.signature,body:U.body};return U.thunk===!0&&($.thunk=!0),$.apply=async function(F,q){return await lt($,q,J,F?F.environment:se)},$}async function dn(U,J,se){for(var $,F=[],q=0;q<U.arguments.length;q++){var me=U.arguments[q];me.type==="operator"&&me.value==="?"?F.push(me):F.push(await Z(me,J,se))}var fe=await Z(U.procedure,J,se);if(typeof fe>"u"&&U.procedure.type==="path"&&se.lookup(U.procedure.steps[0].value))throw{code:"T1007",stack:new Error().stack,position:U.position,token:U.procedure.steps[0].value};if(G(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:U.position,token:U.procedure.type==="path"?U.procedure.steps[0].value:U.procedure.value};return $}function un(U,J,se){if(typeof U>"u")return J;var $=U.validate(J,se);return $}async function Tn(U,J){var se,$=Dn(U.environment);return U.arguments.forEach(function(F,q){$.bind(F.value,J[q])}),typeof U.body=="function"?se=await it(U.body,$):se=await Z(U.body,U.input,$),se}function rr(U,J){var se=Dn(U.environment),$=[];U.arguments.forEach(function(q,me){var fe=J[me];fe&&fe.type==="operator"&&fe.value==="?"?$.push(q):se.bind(q.value,fe)});var F={_jsonata_lambda:!0,input:U.input,environment:se,arguments:$,body:U.body};return F}function or(U,J){var se=ot(U);se=se.map(function(me){return"$"+me.trim()});var $="function("+se.join(", ")+"){ _ }",F=b($);F.body=U;var q=rr(F,J);return q}async function it(U,J){var se=ot(U),$=se.map(function(me){return J.lookup(me.trim())}),F={environment:J},q=U.apply(F,$);return k(q)&&(q=await q),q}function ot(U){var J=U.toString(),se=/\(([^)]*)\)/.exec(J)[1],$=se.split(",");return $}function He(U,J){var se={_jsonata_function:!0,implementation:U};return typeof J<"u"&&(se.signature=S(J)),se}async function cn(U,J){if(!(typeof U>"u")){var se=this.input;typeof J<"u"&&(se=J,Array.isArray(se)&&!P(se)&&(se=L(se),se.outerWrapper=!0));try{var $=b(U,!1)}catch(q){throw Ln(q),{stack:new Error().stack,code:"D3120",value:q.message,error:q}}try{var F=await Z($,se,this.environment)}catch(q){throw Ln(q),{stack:new Error().stack,code:"D3121",value:q.message,error:q}}return F}}function Rn(U){if(!(typeof U>"u"))return JSON.parse(f.string(U))}function Dn(U){var J={};const se={bind:function(F,q){J[F]=q},lookup:function(F){var q;return J.hasOwnProperty(F)?q=J[F]:U&&(q=U.lookup(F)),q},timestamp:U?U.timestamp:null,async:U?U.async:!1,isParallelCall:U?U.isParallelCall:!1,global:U?U.global:{ancestry:[null]}};if(U){var $=U.lookup(Symbol.for("jsonata.__createFrame_push"));$&&$(U,se)}return se}z.bind("sum",He(f.sum,"<a<n>:n>")),z.bind("count",He(f.count,"<a:n>")),z.bind("max",He(f.max,"<a<n>:n>")),z.bind("min",He(f.min,"<a<n>:n>")),z.bind("average",He(f.average,"<a<n>:n>")),z.bind("string",He(f.string,"<x-b?:s>")),z.bind("substring",He(f.substring,"<s-nn?:s>")),z.bind("substringBefore",He(f.substringBefore,"<s-s:s>")),z.bind("substringAfter",He(f.substringAfter,"<s-s:s>")),z.bind("lowercase",He(f.lowercase,"<s-:s>")),z.bind("uppercase",He(f.uppercase,"<s-:s>")),z.bind("length",He(f.length,"<s-:n>")),z.bind("trim",He(f.trim,"<s-:s>")),z.bind("pad",He(f.pad,"<s-ns?:s>")),z.bind("match",He(f.match,"<s-f<s:o>n?:a<o>>")),z.bind("contains",He(f.contains,"<s-(sf):b>")),z.bind("replace",He(f.replace,"<s-(sf)(sf)n?:s>")),z.bind("split",He(f.split,"<s-(sf)n?:a<s>>")),z.bind("join",He(f.join,"<a<s>s?:s>")),z.bind("formatNumber",He(f.formatNumber,"<n-so?:s>")),z.bind("formatBase",He(f.formatBase,"<n-n?:s>")),z.bind("formatInteger",He(p.formatInteger,"<n-s:s>")),z.bind("parseInteger",He(p.parseInteger,"<s-s:n>")),z.bind("number",He(f.number,"<(nsb)-:n>")),z.bind("floor",He(f.floor,"<n-:n>")),z.bind("ceil",He(f.ceil,"<n-:n>")),z.bind("round",He(f.round,"<n-n?:n>")),z.bind("abs",He(f.abs,"<n-:n>")),z.bind("sqrt",He(f.sqrt,"<n-:n>")),z.bind("power",He(f.power,"<n-n:n>")),z.bind("random",He(f.random,"<:n>")),z.bind("boolean",He(f.boolean,"<x-:b>")),z.bind("not",He(f.not,"<x-:b>")),z.bind("map",He(f.map,"<af>")),z.bind("zip",He(f.zip,"<a+>")),z.bind("filter",He(f.filter,"<af>")),z.bind("single",He(f.single,"<af?>")),z.bind("reduce",He(f.foldLeft,"<afj?:j>")),z.bind("sift",He(f.sift,"<o-f?:o>")),z.bind("keys",He(f.keys,"<x-:a<s>>")),z.bind("lookup",He(f.lookup,"<x-s:x>")),z.bind("append",He(f.append,"<xx:a>")),z.bind("exists",He(f.exists,"<x:b>")),z.bind("spread",He(f.spread,"<x-:a<o>>")),z.bind("merge",He(f.merge,"<a<o>:o>")),z.bind("reverse",He(f.reverse,"<a:a>")),z.bind("each",He(f.each,"<o-f:a>")),z.bind("error",He(f.error,"<s?:x>")),z.bind("assert",He(f.assert,"<bs?:x>")),z.bind("type",He(f.type,"<x:s>")),z.bind("sort",He(f.sort,"<af?:a>")),z.bind("shuffle",He(f.shuffle,"<a:a>")),z.bind("distinct",He(f.distinct,"<x:x>")),z.bind("base64encode",He(f.base64encode,"<s-:s>")),z.bind("base64decode",He(f.base64decode,"<s-:s>")),z.bind("encodeUrlComponent",He(f.encodeUrlComponent,"<s-:s>")),z.bind("encodeUrl",He(f.encodeUrl,"<s-:s>")),z.bind("decodeUrlComponent",He(f.decodeUrlComponent,"<s-:s>")),z.bind("decodeUrl",He(f.decodeUrl,"<s-:s>")),z.bind("eval",He(cn,"<sx?:x>")),z.bind("toMillis",He(p.toMillis,"<s-s?:n>")),z.bind("fromMillis",He(p.fromMillis,"<n-s?s?:s>")),z.bind("clone",He(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 Ln(U){var J=On[U.code];if(typeof J<"u"){var se=J.replace(/\{\{\{([^}]+)}}}/g,function(){return U[arguments[1]]});se=se.replace(/\{\{([^}]+)}}/g,function(){return JSON.stringify(U[arguments[1]])}),U.message=se}}function Qe(U,J){var se,$;try{se=b(U,J&&J.recover),$=se.errors,delete se.errors}catch(me){throw Ln(me),me}var F=Dn(z),q=new Date;return F.bind("now",He(function(me,fe){return p.fromMillis(q.getTime(),me,fe)},"<s?s?:s>")),F.bind("millis",He(function(){return q.getTime()},"<:n>")),J&&J.RegexEngine?Qe.RegexEngine=J.RegexEngine:Qe.RegexEngine=RegExp,{evaluate:async function(me,fe,Ie){if(typeof $<"u"){var rt={code:"S0500",position:0};throw Ln(rt),rt}if(typeof fe<"u"){var Tt;Tt=Dn(F);for(var $t in fe)Tt.bind($t,fe[$t])}else Tt=F;Tt.bind("$",me),q=new Date,Tt.timestamp=q,Array.isArray(me)&&!P(me)&&(me=L(me),me.outerWrapper=!0);var fn;try{return fn=await Z(se,me,Tt),typeof Ie=="function"&&Ie(null,fn),fn}catch(zt){throw Ln(zt),zt}},assign:function(me,fe){F.bind(me,fe)},registerFunction:function(me,fe,Ie){var rt=He(fe,Ie);F.bind(me,rt)},ast:function(){return se},errors:function(){return $}}}return Qe.parser=b,Qe}();s.exports=T},{"./datetime":1,"./functions":2,"./parser":4,"./signature":5,"./utils":6}],4:[function(i,s,c){var p=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,L=function(G,W){var k={type:G,value:W,position:R};return k},P=function(){for(var G=R,W=0,k,V,N=function(Z){if(w.charAt(Z)==="/"&&W===0){for(var ie=0;w.charAt(Z-(ie+1))==="\\";)ie++;if(ie%2===0)return!0}return!1};R<A;){var z=w.charAt(R);if(N(R)){if(k=w.substring(G,R),k==="")throw{code:"S0301",stack:new Error().stack,position:R};for(R++,z=w.charAt(R),G=R;z==="i"||z==="m";)R++,z=w.charAt(R);return V=w.substring(G,R)+"g",new RegExp(k,V)}(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}},j=function(G){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),j(G)}if(G!==!0&&W==="/")return R++,L("regex",P());if(W==="."&&w.charAt(R+1)===".")return R+=2,L("operator","..");if(W===":"&&w.charAt(R+1)==="=")return R+=2,L("operator",":=");if(W==="!"&&w.charAt(R+1)==="=")return R+=2,L("operator","!=");if(W===">"&&w.charAt(R+1)==="=")return R+=2,L("operator",">=");if(W==="<"&&w.charAt(R+1)==="=")return R+=2,L("operator","<=");if(W==="*"&&w.charAt(R+1)==="*")return R+=2,L("operator","**");if(W==="~"&&w.charAt(R+1)===">")return R+=2,L("operator","~>");if(W==="?"&&w.charAt(R+1)===":")return R+=2,L("operator","?:");if(W==="?"&&w.charAt(R+1)==="?")return R+=2,L("operator","??");if(Object.prototype.hasOwnProperty.call(v,W))return R++,L("operator",W);if(W==='"'||W==="'"){var V=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 Z=parseInt(z,16);N+=String.fromCharCode(Z),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===V)return R++,L("string",N);N+=W}R++}throw{code:"S0101",stack:new Error().stack,position:R}}var ie=/^-?(0|([1-9][0-9]*))(\.[0-9]+)?([Ee][-+]?[0-9]+)?/,ye=ie.exec(w.substring(R));if(ye!==null){var M=parseFloat(ye[0]);if(!isNaN(M)&&isFinite(M))return R+=ye[0].length,L("number",M);throw{code:"S0102",stack:new Error().stack,position:R,token:ye[0]}}var ue;if(W==="`"){R++;var Re=w.indexOf("`",R);if(Re!==-1)return ue=w.substring(R,Re),R=Re+1,L("name",ue);throw R=A,{code:"S0105",stack:new Error().stack,position:R}}for(var he=R,ve;;)if(ve=w.charAt(he),he===A||`
3357
- \r\v`.indexOf(ve)>-1||Object.prototype.hasOwnProperty.call(v,ve)){if(w.charAt(R)==="$")return ue=w.substring(R+1,he),R=he,L("variable",ue);switch(ue=w.substring(R,he),R=he,ue){case"or":case"in":case"and":return L("operator",ue);case"true":return L("value",!0);case"false":return L("value",!1);case"null":return L("value",null);default:return R===A&&ue===""?null:L("name",ue)}}else he++};return j},T=function(w,R){var A,L,P={},j=[],G=function(){var B=[];A.id!=="(end)"&&B.push({type:A.type,value:A.value,position:A.position});for(var Y=L();Y!==null;)B.push(Y),Y=L();return B},W={nud:function(){var B={code:"S0211",token:this.value,position:this.position};if(R)return B.remaining=G(),B.type="error",j.push(B),B;throw B.stack=new Error().stack,B}},k=function(B,Y){var $e=P[B];return Y=Y||0,$e?Y>=$e.lbp&&($e.lbp=Y):($e=Object.create(W),$e.id=$e.value=B,$e.lbp=Y,P[B]=$e),$e},V=function(B){if(R){B.remaining=G(),j.push(B);var Y=P["(error)"];return A=Object.create(Y),A.error=B,A.type="(error)",A}else throw B.stack=new Error().stack,B},N=function(B,Y){if(B&&A.id!==B){var $e;A.id==="(end)"?$e="S0203":$e="S0202";var ze={code:$e,position:A.position,token:A.value,value:B};return V(ze)}var qe=L(Y);if(qe===null)return A=P["(end)"],A.position=w.length,A;var We=qe.value,X=qe.type,oe;switch(X){case"name":case"variable":oe=P["(name)"];break;case"operator":if(oe=P[We],!oe)return V({code:"S0204",stack:new Error().stack,position:qe.position,token:We});break;case"string":case"number":case"value":oe=P["(literal)"];break;case"regex":X="regex",oe=P["(regex)"];break;default:return V({code:"S0205",stack:new Error().stack,position:qe.position,token:We})}return A=Object.create(oe),A.value=We,A.type=X,A.position=qe.position,A},z=function(B){var Y,$e=A;for(N(null,!0),Y=$e.nud();B<A.lbp;)$e=A,N(),Y=$e.led(Y);return Y},Z=function(B){var Y=k(B,0);Y.nud=function(){return this}},ie=function(B,Y,$e){var ze=Y||v[B],qe=k(B,ze);return qe.led=$e||function(We){return this.lhs=We,this.rhs=z(ze),this.type="binary",this},qe},ye=function(B,Y,$e){var ze=k(B,Y);return ze.led=$e,ze},M=function(B,Y){var $e=k(B);return $e.nud=Y||function(){return this.expression=z(70),this.type="unary",this},$e};Z("(end)"),Z("(name)"),Z("(literal)"),Z("(regex)"),k(":"),k(";"),k(","),k(")"),k("]"),k("}"),k(".."),ie("."),ie("+"),ie("-"),ie("*"),ie("/"),ie("%"),ie("="),ie("<"),ie(">"),ie("!="),ie("<="),ie(">="),ie("&"),ie("and"),ie("or"),ie("in"),Z("and"),Z("or"),Z("in"),M("-"),ie("~>"),ie("??",v["??"],function(B){return this.type="condition",this.condition={type:"function",value:"(",procedure:{type:"variable",value:"exists"},arguments:[B]},this.then=B,this.else=z(0),this}),ye("(error)",10,function(B){return this.lhs=B,this.error=A.error,this.remaining=G(),this.type="error",this}),M("*",function(){return this.type="wildcard",this}),M("**",function(){return this.type="descendant",this}),M("%",function(){return this.type="parent",this}),ie("(",v["("],function(B){if(this.procedure=B,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),B.type==="name"&&(B.value==="function"||B.value==="λ")){if(this.arguments.forEach(function(We,X){if(We.type!=="variable")return V({code:"S0208",stack:new Error().stack,position:We.position,token:We.value,value:X+1})}),this.type="lambda",A.id==="<"){for(var Y=A.position,$e=1,ze="<";$e>0&&A.id!=="{"&&A.id!=="(end)";){var qe=N();qe.id===">"?$e--:qe.id==="<"&&$e++,ze+=qe.value}N(">");try{this.signature=p(ze)}catch(We){return We.position=Y+We.offset,V(We)}}N("{"),this.body=z(0),N("}")}return this}),M("(",function(){for(var B=[];A.id!==")"&&(B.push(z(0)),A.id===";");)N(";");return N(")",!0),this.type="block",this.expressions=B,this}),M("[",function(){var B=[];if(A.id!=="]")for(;;){var Y=z(0);if(A.id===".."){var $e={type:"binary",value:"..",position:A.position,lhs:Y};N(".."),$e.rhs=z(0),Y=$e}if(B.push(Y),A.id!==",")break;N(",")}return N("]",!0),this.expressions=B,this.type="unary",this}),ie("[",v["["],function(B){if(A.id==="]"){for(var Y=B;Y&&Y.type==="binary"&&Y.value==="[";)Y=Y.lhs;return Y.keepArray=!0,N("]"),B}else return this.lhs=B,this.rhs=z(v["]"]),this.type="binary",N("]",!0),this}),ie("^",v["^"],function(B){N("(");for(var Y=[];;){var $e={descending:!1};if(A.id==="<"?N("<"):A.id===">"&&($e.descending=!0,N(">")),$e.expression=z(0),Y.push($e),A.id!==",")break;N(",")}return N(")"),this.lhs=B,this.rhs=Y,this.type="binary",this});var ue=function(B){var Y=[];if(A.id!=="}")for(;;){var $e=z(0);N(":");var ze=z(0);if(Y.push([$e,ze]),A.id!==",")break;N(",")}return N("}",!0),typeof B>"u"?(this.lhs=Y,this.type="unary"):(this.lhs=B,this.rhs=Y,this.type="binary"),this};M("{",ue),ie("{",v["{"],ue),ye(":=",v[":="],function(B){return B.type!=="variable"?V({code:"S0212",stack:new Error().stack,position:B.position,token:B.value}):(this.lhs=B,this.rhs=z(v[":="]-1),this.type="binary",this)}),ie("@",v["@"],function(B){return this.lhs=B,this.rhs=z(v["@"]),this.rhs.type!=="variable"?V({code:"S0214",stack:new Error().stack,position:this.rhs.position,token:"@"}):(this.type="binary",this)}),ie("#",v["#"],function(B){return this.lhs=B,this.rhs=z(v["#"]),this.rhs.type!=="variable"?V({code:"S0214",stack:new Error().stack,position:this.rhs.position,token:"#"}):(this.type="binary",this)}),ie("?",v["?"],function(B){return this.type="condition",this.condition=B,this.then=z(0),A.id===":"&&(N(":"),this.else=z(0)),this}),ie("?:",v["?:"],function(B){return this.type="condition",this.condition=B,this.then=B,this.else=z(0),this}),M("|",function(){return this.type="transform",this.pattern=z(0),N("|"),this.update=z(0),A.id===","&&(N(","),this.delete=z(0)),N("|"),this});var Re=function(B){var Y;if(B.type==="function"&&!B.predicate){var $e={type:"lambda",thunk:!0,arguments:[],position:B.position};$e.body=B,Y=$e}else if(B.type==="condition")B.then=Re(B.then),typeof B.else<"u"&&(B.else=Re(B.else)),Y=B;else if(B.type==="block"){var ze=B.expressions.length;ze>0&&(B.expressions[ze-1]=Re(B.expressions[ze-1])),Y=B}else Y=B;return Y},he=0,ve=0,ne=[],ce=function(B,Y){switch(B.type){case"name":case"wildcard":Y.level--,Y.level===0&&(typeof B.ancestor>"u"||(ne[Y.index].slot.label=B.ancestor.label),B.ancestor=Y,B.tuple=!0);break;case"parent":Y.level++;break;case"block":B.expressions.length>0&&(B.tuple=!0,Y=ce(B.expressions[B.expressions.length-1],Y));break;case"path":B.tuple=!0;var $e=B.steps.length-1;for(Y=ce(B.steps[$e--],Y);Y.level>0&&$e>=0;)Y=ce(B.steps[$e--],Y);break;default:throw{code:"S0217",token:B.type,position:B.position}}return Y},ge=function(B,Y){if(typeof Y.seekingParent<"u"||Y.type==="parent"){var $e=typeof Y.seekingParent<"u"?Y.seekingParent:[];Y.type==="parent"&&$e.push(Y.slot),typeof B.seekingParent>"u"?B.seekingParent=$e:Array.prototype.push.apply(B.seekingParent,$e)}},pe=function(B){var Y=B.steps.length-1,$e=B.steps[Y],ze=typeof $e.seekingParent<"u"?$e.seekingParent:[];$e.type==="parent"&&ze.push($e.slot);for(var qe=0;qe<ze.length;qe++){var We=ze[qe];for(Y=B.steps.length-2;We.level>0;){if(Y<0){typeof B.seekingParent>"u"?B.seekingParent=[We]:B.seekingParent.push(We);break}for(var X=B.steps[Y--];Y>=0&&X.focus&&B.steps[Y].focus;)X=B.steps[Y--];We=ce(X,We)}}},le=function(B){var Y;switch(B.type){case"binary":switch(B.value){case".":var $e=le(B.lhs);$e.type==="path"?Y=$e:Y={type:"path",steps:[$e]},$e.type==="parent"&&(Y.seekingParent=[$e.slot]);var ze=le(B.rhs);ze.type==="function"&&ze.procedure.type==="path"&&ze.procedure.steps.length===1&&ze.procedure.steps[0].type==="name"&&Y.steps[Y.steps.length-1].type==="function"&&(Y.steps[Y.steps.length-1].nextFunction=ze.procedure.steps[0].value),ze.type==="path"?Array.prototype.push.apply(Y.steps,ze.steps):(typeof ze.predicate<"u"&&(ze.stages=ze.predicate,delete ze.predicate),Y.steps.push(ze)),Y.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"}),Y.steps.filter(function(Fe){return Fe.keepArray===!0}).length>0&&(Y.keepSingletonArray=!0);var qe=Y.steps[0];qe.type==="unary"&&qe.value==="["&&(qe.consarray=!0);var We=Y.steps[Y.steps.length-1];We.type==="unary"&&We.value==="["&&(We.consarray=!0),pe(Y);break;case"[":Y=le(B.lhs);var X=Y,oe="predicate";if(Y.type==="path"&&(X=Y.steps[Y.steps.length-1],oe="stages"),typeof X.group<"u")throw{code:"S0209",stack:new Error().stack,position:B.position};typeof X[oe]>"u"&&(X[oe]=[]);var K=le(B.rhs);typeof K.seekingParent<"u"&&(K.seekingParent.forEach(Fe=>{Fe.level===1?ce(X,Fe):Fe.level--}),ge(X,K)),X[oe].push({type:"filter",expr:K,position:B.position});break;case"{":if(Y=le(B.lhs),typeof Y.group<"u")throw{code:"S0210",stack:new Error().stack,position:B.position};Y.group={lhs:B.rhs.map(function(Fe){return[le(Fe[0]),le(Fe[1])]}),position:B.position};break;case"^":Y=le(B.lhs),Y.type!=="path"&&(Y={type:"path",steps:[Y]});var Ee={type:"sort",position:B.position};Ee.terms=B.rhs.map(function(Fe){var et=le(Fe.expression);return ge(Ee,et),{descending:Fe.descending,expression:et}}),Y.steps.push(Ee),pe(Y);break;case":=":Y={type:"bind",value:B.value,position:B.position},Y.lhs=le(B.lhs),Y.rhs=le(B.rhs),ge(Y,Y.rhs);break;case"@":if(Y=le(B.lhs),X=Y,Y.type==="path"&&(X=Y.steps[Y.steps.length-1]),typeof X.stages<"u"||typeof X.predicate<"u")throw{code:"S0215",stack:new Error().stack,position:B.position};if(X.type==="sort")throw{code:"S0216",stack:new Error().stack,position:B.position};B.keepArray&&(X.keepArray=!0),X.focus=B.rhs.value,X.tuple=!0;break;case"#":Y=le(B.lhs),X=Y,Y.type==="path"?X=Y.steps[Y.steps.length-1]:(Y={type:"path",steps:[Y]},typeof X.predicate<"u"&&(X.stages=X.predicate,delete X.predicate)),typeof X.stages>"u"?X.index=B.rhs.value:X.stages.push({type:"index",value:B.rhs.value,position:B.position}),X.tuple=!0;break;case"~>":Y={type:"apply",value:B.value,position:B.position},Y.lhs=le(B.lhs),Y.rhs=le(B.rhs),Y.keepArray=Y.lhs.keepArray||Y.rhs.keepArray;break;default:Y={type:B.type,value:B.value,position:B.position},Y.lhs=le(B.lhs),Y.rhs=le(B.rhs),ge(Y,Y.lhs),ge(Y,Y.rhs)}break;case"unary":Y={type:B.type,value:B.value,position:B.position},B.value==="["?Y.expressions=B.expressions.map(function(Fe){var et=le(Fe);return ge(Y,et),et}):B.value==="{"?Y.lhs=B.lhs.map(function(Fe){var et=le(Fe[0]);ge(Y,et);var It=le(Fe[1]);return ge(Y,It),[et,It]}):(Y.expression=le(B.expression),B.value==="-"&&Y.expression.type==="number"?(Y=Y.expression,Y.value=-Y.value):ge(Y,Y.expression));break;case"function":case"partial":Y={type:B.type,name:B.name,value:B.value,position:B.position},Y.arguments=B.arguments.map(function(Fe){var et=le(Fe);return ge(Y,et),et}),Y.procedure=le(B.procedure);break;case"lambda":Y={type:B.type,arguments:B.arguments,signature:B.signature,position:B.position};var ee=le(B.body);Y.body=Re(ee);break;case"condition":Y={type:B.type,position:B.position},Y.condition=le(B.condition),ge(Y,Y.condition),Y.then=le(B.then),ge(Y,Y.then),typeof B.else<"u"&&(Y.else=le(B.else),ge(Y,Y.else));break;case"transform":Y={type:B.type,position:B.position},Y.pattern=le(B.pattern),Y.update=le(B.update),typeof B.delete<"u"&&(Y.delete=le(B.delete));break;case"block":Y={type:B.type,position:B.position},Y.expressions=B.expressions.map(function(Fe){var et=le(Fe);return ge(Y,et),(et.consarray||et.type==="path"&&et.steps[0].consarray)&&(Y.consarray=!0),et});break;case"name":Y={type:"path",steps:[B]},B.keepArray&&(Y.keepSingletonArray=!0);break;case"parent":Y={type:"parent",slot:{label:"!"+he++,level:1,index:ve++}},ne.push(Y);break;case"string":case"number":case"value":case"wildcard":case"descendant":case"variable":case"regex":Y=B;break;case"operator":if(B.value==="and"||B.value==="or"||B.value==="in")B.type="name",Y=le(B);else if(B.value==="?")Y=B;else throw{code:"S0201",stack:new Error().stack,position:B.position,token:B.value};break;case"error":Y=B,B.lhs&&(Y=le(B.lhs));break;default:var De="S0206";B.id==="(end)"&&(De="S0207");var we={code:De,position:B.position,token:B.value};if(R)return j.push(we),{type:"error",error:we};throw we.stack=new Error().stack,we}return B.keepArray&&(Y.keepArray=!0),Y};L=S(w),N();var te=z(0);if(A.id!=="(end)"){var Te={code:"S0201",position:A.position,token:A.value};V(Te)}if(te=le(te),te.type==="parent"||typeof te.seekingParent<"u")throw{code:"S0217",token:te.type,position:te.position};return j.length>0&&(te.errors=j),te};return T})();s.exports=f},{"./signature":5}],5:[function(i,s,c){var p=i("./utils");const f=(()=>{var v={a:"arrays",b:"booleans",f:"functions",n:"numbers",o:"objects",s:"strings"};function b(S){for(var T=1,w=[],R={},A=R;T<S.length;){var L=S.charAt(T);if(L===":")break;var P=function(){w.push(R),A=R,R={}},j=function(ie,ye,M,ue){for(var Re=1,he=ye;he<ie.length;)if(he++,L=ie.charAt(he),L===ue){if(Re--,Re===0)break}else L===M&&Re++;return he};switch(L){case"s":case"n":case"b":case"l":case"o":R.regex="["+L+"m]",R.type=L,P();break;case"a":R.regex="[asnblfom]",R.type=L,R.array=!0,P();break;case"f":R.regex="f",R.type=L,P();break;case"j":R.regex="[asnblom]",R.type=L,P();break;case"x":R.regex="[asnblfom]",R.type=L,P();break;case"-":A.context=!0,A.contextRegex=new RegExp(A.regex),A.regex+="?";break;case"?":case"+":A.regex+=L;break;case"(":var G=j(S,T,"(",")"),W=S.substring(T+1,G);if(W.indexOf("<")===-1)R.regex="["+W+"m]";else throw{code:"S0402",stack:new Error().stack,value:W,offset:T};R.type="("+W+")",T=G,P();break;case"<":if(A.type==="a"||A.type==="f"){var k=j(S,T,"<",">");A.subtype=S.substring(T+1,k),T=k}else throw{code:"S0401",stack:new Error().stack,value:A.type,offset:T};break}T++}var V="^"+w.map(function(ie){return"("+ie.regex+")"}).join("")+"$",N=new RegExp(V),z=function(ie){var ye;if(p.isFunction(ie))ye="f";else{var M=typeof ie;switch(M){case"string":ye="s";break;case"number":ye="n";break;case"boolean":ye="b";break;case"object":ie===null?ye="l":Array.isArray(ie)?ye="a":ye="o";break;case"undefined":default:ye="m"}}return ye},Z=function(ie,ye){for(var M="^",ue=0,Re=0;Re<w.length;Re++){M+=w[Re].regex;var he=ye.match(M);if(he===null)throw{code:"T0410",stack:new Error().stack,value:ie[ue],index:ue+1};ue=he[0].length}throw{code:"T0410",stack:new Error().stack,value:ie[ue],index:ue+1}};return{definition:S,validate:function(ie,ye){var M="";ie.forEach(function(ve){M+=z(ve)});var ue=N.exec(M);if(ue){var Re=[],he=0;return w.forEach(function(ve,ne){var ce=ie[he],ge=ue[ne+1];if(ge==="")if(ve.context&&ve.contextRegex){var pe=z(ye);if(ve.contextRegex.test(pe))Re.push(ye);else throw{code:"T0411",stack:new Error().stack,value:ye,index:he+1}}else Re.push(ce),he++;else ge.split("").forEach(function(le){if(ve.type==="a"){if(le==="m")ce=void 0;else{ce=ie[he];var te=!0;if(typeof ve.subtype<"u"){if(le!=="a"&&ge!==ve.subtype)te=!1;else if(le==="a"&&ce.length>0){var Te=z(ce[0]);if(Te!==ve.subtype.charAt(0))te=!1;else{var B=ce.filter(function(Y){return z(Y)!==Te});te=B.length===0}}}if(!te)throw{code:"T0412",stack:new Error().stack,value:ce,index:he+1,type:v[ve.subtype]};le!=="a"&&(ce=[ce])}Re.push(ce),he++}else Re.push(ce),he++})}),Re}Z(ie,M)}}}return b})();s.exports=f},{"./utils":6}],6:[function(i,s,c){const p=(()=>{function f(k){var V=!1;if(typeof k=="number"&&(V=!isNaN(k),V&&!isFinite(k)))throw{code:"D1001",value:k,stack:new Error().stack};return V}function v(k){var V=!1;return Array.isArray(k)&&(V=k.filter(function(N){return typeof N!="string"}).length===0),V}function b(k){var V=!1;return Array.isArray(k)&&(V=k.filter(function(N){return!f(N)}).length===0),V}function S(){var k=[];return k.sequence=!0,arguments.length===1&&k.push(arguments[0]),k}function T(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 V=typeof k.arity=="number"?k.arity:typeof k.implementation=="function"?k.implementation.length:typeof k.length=="number"?k.length:k.arguments.length;return V}function A(k){return k&&k._jsonata_lambda===!0}var L=(typeof Symbol=="function"?Symbol:{}).iterator||"@@iterator";function P(k){return typeof k=="object"&&k!==null&&L in k&&"next"in k&&typeof k.next=="function"}function j(k,V){if(k===V)return!0;if(typeof k=="object"&&typeof V=="object"&&k!==null&&V!==null){if(Array.isArray(k)&&Array.isArray(V)){if(k.length!==V.length)return!1;for(var N=0;N<k.length;N++)if(!j(k[N],V[N]))return!1;return!0}var z=Object.getOwnPropertyNames(k),Z=Object.getOwnPropertyNames(V);if(z.length!==Z.length)return!1;for(z=z.sort(),Z=Z.sort(),N=0;N<z.length;N++)if(z[N]!==Z[N])return!1;for(N=0;N<z.length;N++){var ie=z[N];if(!j(k[ie],V[ie]))return!1}return!0}return!1}function G(k){return typeof k=="object"&&k!==null&&"then"in k&&typeof k.then=="function"}function W(k){var V=[];for(let N of k)V.push(N);return V}return{isNumeric:f,isArrayOfStrings:v,isArrayOfNumbers:b,createSequence:S,isSequence:T,isFunction:w,isLambda:A,isIterable:P,getFunctionArity:R,isDeepEqual:j,stringToArray:W,isPromise:G}})();s.exports=p},{}]},{},[3])(3)})}(bC)),bC.exports}var tU=eU();const GA=WC(tU),nU=async(e,r,i)=>{const{operand:s,operator:c,value:p}=e;if(c==="jsonata")try{const S=p.toString(),T=i();return await GA(S).evaluate(T)}catch(S){return console.log("JSONata evaluation error:",S),!1}const f=r(s),v=String(f||"").toLowerCase().trim(),b=String(p||"").toLowerCase().trim();switch(c){case"==":case"===":return v===b;case"!=":case"!==":return v!==b;case">":const S=parseFloat(v),T=parseFloat(b);return!isNaN(S)&&!isNaN(T)&&S>T;case">=":const w=parseFloat(v),R=parseFloat(b);return!isNaN(w)&&!isNaN(R)&&w>=R;case"<":const A=parseFloat(v),L=parseFloat(b);return!isNaN(A)&&!isNaN(L)&&A<L;case"<=":const P=parseFloat(v),j=parseFloat(b);return!isNaN(P)&&!isNaN(j)&&P<=j;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(p)?p.some(k=>String(k).toLowerCase().trim()===v):String(p).split(",").map(k=>k.toLowerCase().trim()).includes(v);case"not_in":return Array.isArray(p)?!p.some(k=>String(k).toLowerCase().trim()===v):!String(p).split(",").map(k=>k.toLowerCase().trim()).includes(v);case"regex":case"matches":try{return new RegExp(String(p),"i").test(v)}catch{return console.warn("Invalid regex pattern:",p),!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 p of s)if(!await nU(p,r,i)){c=!1;break}if(c)return!0}return!1},rU=()=>{const{getPatientValue:e,getFullPatient:r}=Nr();return{evaluateCondition:Ve.useMemo(()=>async s=>await WA(s,e,r),[e,r])}},oU=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,p;const s=e.filter(f=>f.shouldRender);for(const f of s){if(oU(f)&&!aU(f,r))return console.warn(`Required field is missing: ${f.name||((c=f.props)==null?void 0:c.propertyId)||f.id}`),!1;if((p=f.props)!=null&&p.propertyId&&i(f.props.propertyId))return!1}return!0},aU=(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||typeof s=="string"&&s.trim()===""||Array.isArray(s)&&s.length===0)},YA=({flow:e,isPreview:r,$bgColor:i,onSubmit:s,onNextStep:c,onPrevStep:p,shouldRedirect:f=!0,formidavimHost:v})=>{const[b,S]=Ve.useState(0),[T,w]=Ve.useState([]),[R,A]=Ve.useState(!0),{evaluateCondition:L}=rU(),{getFlowValue:P,getAllFlowData:j,setDisableSubmitValue:G,getDisableSubmitValue:W,getFlowError:k,setCurrentFormValue:V}=Nr(),N=Nr().getAllFlowData(),z=async ne=>{if(!ne)return[];const ce=[];for(const ge of ne){const pe=!ge.condition||await L(ge.condition),le=pe;ce.push({...ge,isVisible:pe,shouldRender:le,hasCondition:!!ge.condition})}return ce};Ve.useEffect(()=>{S(0)},[e.slug]),Ve.useEffect(()=>{const ne=async()=>{var ge;if(!e.flowForms){w([]),A(!1);return}const ce=[];for(const pe of e.flowForms)if(!pe.condition||await L(pe.condition)){const te=(ge=pe.form)!=null&&ge.formComponents?await z(pe.form.formComponents):[];ce.push({...pe,evaluatedFormComponents:te})}w(ce),A(!1)};A(!0),ne()},[e.flowForms,L]),Ve.useEffect(()=>{if(!R&&T.length>0&&b<T.length){const ne=T[b],ce=(ne==null?void 0:ne.evaluatedFormComponents)||[],ge=q$(ce,P,k);G(!ge)}},[T,b,R,N,P,G]);const Z=T.length,ie=T[b],ye=W();if(Ve.useEffect(()=>{ie&&V(ie)},[ie,V]),R)return I.jsx("div",{children:"Loading..."});if(!ie)return null;const M=T[0]===ie,ue=b===Z-1,Re=(ie==null?void 0:ie.evaluatedFormComponents)||[],he=()=>{if(q$(Re,P,k)){if(ie.submit){s(j(),e,f);return}c&&c(e,ie),b<Z-1&&(S(ce=>ce+1),setTimeout(()=>{window.scrollTo({top:0,behavior:"smooth"})},0))}},ve=()=>{b>0&&(p&&p(e,ie),S(ne=>ne-1)),window.scrollTo({top:0,behavior:"smooth"})};return I.jsxs(iM,{children:[I.jsxs(dM,{$tracker:!0,id:"FormHeaderMobile",children:[I.jsx(uO,{src:"https://media-s3-cdn.ivimhealth.com/assets/images/logos/ivim-black.svg"}),I.jsx(fM,{id:"FlowStepTrackerContainerMobile"}),!M&&I.jsx(lM,{onClick:ve})]}),I.jsx(J$,{currentStep:b+1,totalSteps:Z,showOnDesktop:!0,showOnMobile:!1}),I.jsx(bp,{$xSmall:!0,$bgColor:"white",$bRad:"10px 10px 0px 0px",children:I.jsxs(cM,{id:"FormHeaderDesktop",children:[!M&&I.jsx(K$,{onClick:ve}),I.jsx(uO,{src:"https://media-s3-cdn.ivimhealth.com/assets/images/logos/ivim-black.svg"})]})}),I.jsx(KA,{$bgColor:ie.bgColor,children:I.jsx(qA,{flowForm:ie,isPreview:r,evaluatedFormComponents:Re,formidavimHost:v})}),I.jsx(bp,{$xSmall:!0,$bgColor:"white",$bRad:"0px 0px 10px 10px",children:I.jsx(sM,{$borderOff:!!ie.bgColor,children:I.jsx(sO,{type:"submit",onClick:he,$isLastStep:ue,$radius:"41px",$margin:"0 0 15px 0",$btnStyle:"black",$disable:ye,children:ie.navButtonText?ie.navButtonText:"Next"})})}),I.jsx(pM,{id:"BtnFlowBtnWrapperMobile",children:I.jsx(sO,{type:"submit",onClick:he,$isLastStep:ue,$radius:"41px",$margin:"0 0 15px 0",$btnStyle:"black",$disable:ye,$allowDisableClick:!0,children:ie.navButtonText?ie.navButtonText:"Next"})})]})},iU=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 p=c[0],f=c[1].trim();try{const v=await GA(f).evaluate(r),b=v??"";typeof b!="object"?s=s.replace(p,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 iU(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},lU=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 p of c.form.formComponents)p.props&&(p.props=await HC(p.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:p,onFlowInit:f,shouldRedirect:v,formidavimHost:b})=>{const{setFlowValues:S,resetAndSetFlowValues:T,generateFormDataFromFlow:w,setPatientValues:R,getFullPatient:A,setCurrentFlowValue:L}=Nr(),[P,j]=Ve.useState(null),[G,W]=Ve.useState(!0),[k,V]=Ve.useState(!1),N=async(Z,ie=!1,ye=!1)=>{try{const M=await lU(r,Z);if(j(M),L(M),ye&&f&&(r!=null&&r.id)&&(r!=null&&r.slug)&&(console.log("Renderer calling onFlowInit for flow:",r.slug,r.id),f(r)),ie){const ue=w(M);T(ue)}}catch(M){if(console.error("Error processing config:",M),j(r),L(r),ye&&f&&(r!=null&&r.id)&&(r!=null&&r.slug)&&(console.log("Renderer calling onFlowInit for flow (error case):",r.slug,r.id),f(r)),ie){const ue=w(r);T(ue)}}};Ve.useEffect(()=>{console.log("Renderer initial useEffect triggered - data/config changed"),(async()=>{W(!0),e&&R(e),await N(e,!0,!0),V(!0),W(!1)})()},[e,r]);const z=A();return Ve.useEffect(()=>{console.log("Renderer patient data useEffect triggered:",{hasInitialized:k,hasPatientProfile:!!z}),k&&z&&(console.log("Renderer calling processConfigWithPatientData from patient data effect"),N(z,!1,!1))},[z,r,k]),G||!P?I.jsx("div",{children:"Processing form..."}):I.jsx(YA,{flow:P,isPreview:i,onSubmit:s,onNextStep:c,onPrevStep:p,shouldRedirect:v,formidavimHost:b})},sU={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"},uU={playfair:'"Playfair Display", serif',poppins:"Poppins, sans-serif",karmina:"Karmina, serif"},cU={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)"},fU={colors:sU,fonts:uU,mediaQuery:cU},dU=s5({reducer:{[V0.name]:V0.reducer,[F0.name]:F0.reducer}}),pU=xe.div`
3357
+ \r\v`.indexOf(ve)>-1||Object.prototype.hasOwnProperty.call(v,ve)){if(w.charAt(R)==="$")return ue=w.substring(R+1,he),R=he,L("variable",ue);switch(ue=w.substring(R,he),R=he,ue){case"or":case"in":case"and":return L("operator",ue);case"true":return L("value",!0);case"false":return L("value",!1);case"null":return L("value",null);default:return R===A&&ue===""?null:L("name",ue)}}else he++};return j},T=function(w,R){var A,L,P={},j=[],G=function(){var B=[];A.id!=="(end)"&&B.push({type:A.type,value:A.value,position:A.position});for(var Y=L();Y!==null;)B.push(Y),Y=L();return B},W={nud:function(){var B={code:"S0211",token:this.value,position:this.position};if(R)return B.remaining=G(),B.type="error",j.push(B),B;throw B.stack=new Error().stack,B}},k=function(B,Y){var $e=P[B];return Y=Y||0,$e?Y>=$e.lbp&&($e.lbp=Y):($e=Object.create(W),$e.id=$e.value=B,$e.lbp=Y,P[B]=$e),$e},V=function(B){if(R){B.remaining=G(),j.push(B);var Y=P["(error)"];return A=Object.create(Y),A.error=B,A.type="(error)",A}else throw B.stack=new Error().stack,B},N=function(B,Y){if(B&&A.id!==B){var $e;A.id==="(end)"?$e="S0203":$e="S0202";var ze={code:$e,position:A.position,token:A.value,value:B};return V(ze)}var qe=L(Y);if(qe===null)return A=P["(end)"],A.position=w.length,A;var We=qe.value,X=qe.type,oe;switch(X){case"name":case"variable":oe=P["(name)"];break;case"operator":if(oe=P[We],!oe)return V({code:"S0204",stack:new Error().stack,position:qe.position,token:We});break;case"string":case"number":case"value":oe=P["(literal)"];break;case"regex":X="regex",oe=P["(regex)"];break;default:return V({code:"S0205",stack:new Error().stack,position:qe.position,token:We})}return A=Object.create(oe),A.value=We,A.type=X,A.position=qe.position,A},z=function(B){var Y,$e=A;for(N(null,!0),Y=$e.nud();B<A.lbp;)$e=A,N(),Y=$e.led(Y);return Y},Z=function(B){var Y=k(B,0);Y.nud=function(){return this}},ie=function(B,Y,$e){var ze=Y||v[B],qe=k(B,ze);return qe.led=$e||function(We){return this.lhs=We,this.rhs=z(ze),this.type="binary",this},qe},ye=function(B,Y,$e){var ze=k(B,Y);return ze.led=$e,ze},M=function(B,Y){var $e=k(B);return $e.nud=Y||function(){return this.expression=z(70),this.type="unary",this},$e};Z("(end)"),Z("(name)"),Z("(literal)"),Z("(regex)"),k(":"),k(";"),k(","),k(")"),k("]"),k("}"),k(".."),ie("."),ie("+"),ie("-"),ie("*"),ie("/"),ie("%"),ie("="),ie("<"),ie(">"),ie("!="),ie("<="),ie(">="),ie("&"),ie("and"),ie("or"),ie("in"),Z("and"),Z("or"),Z("in"),M("-"),ie("~>"),ie("??",v["??"],function(B){return this.type="condition",this.condition={type:"function",value:"(",procedure:{type:"variable",value:"exists"},arguments:[B]},this.then=B,this.else=z(0),this}),ye("(error)",10,function(B){return this.lhs=B,this.error=A.error,this.remaining=G(),this.type="error",this}),M("*",function(){return this.type="wildcard",this}),M("**",function(){return this.type="descendant",this}),M("%",function(){return this.type="parent",this}),ie("(",v["("],function(B){if(this.procedure=B,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),B.type==="name"&&(B.value==="function"||B.value==="λ")){if(this.arguments.forEach(function(We,X){if(We.type!=="variable")return V({code:"S0208",stack:new Error().stack,position:We.position,token:We.value,value:X+1})}),this.type="lambda",A.id==="<"){for(var Y=A.position,$e=1,ze="<";$e>0&&A.id!=="{"&&A.id!=="(end)";){var qe=N();qe.id===">"?$e--:qe.id==="<"&&$e++,ze+=qe.value}N(">");try{this.signature=p(ze)}catch(We){return We.position=Y+We.offset,V(We)}}N("{"),this.body=z(0),N("}")}return this}),M("(",function(){for(var B=[];A.id!==")"&&(B.push(z(0)),A.id===";");)N(";");return N(")",!0),this.type="block",this.expressions=B,this}),M("[",function(){var B=[];if(A.id!=="]")for(;;){var Y=z(0);if(A.id===".."){var $e={type:"binary",value:"..",position:A.position,lhs:Y};N(".."),$e.rhs=z(0),Y=$e}if(B.push(Y),A.id!==",")break;N(",")}return N("]",!0),this.expressions=B,this.type="unary",this}),ie("[",v["["],function(B){if(A.id==="]"){for(var Y=B;Y&&Y.type==="binary"&&Y.value==="[";)Y=Y.lhs;return Y.keepArray=!0,N("]"),B}else return this.lhs=B,this.rhs=z(v["]"]),this.type="binary",N("]",!0),this}),ie("^",v["^"],function(B){N("(");for(var Y=[];;){var $e={descending:!1};if(A.id==="<"?N("<"):A.id===">"&&($e.descending=!0,N(">")),$e.expression=z(0),Y.push($e),A.id!==",")break;N(",")}return N(")"),this.lhs=B,this.rhs=Y,this.type="binary",this});var ue=function(B){var Y=[];if(A.id!=="}")for(;;){var $e=z(0);N(":");var ze=z(0);if(Y.push([$e,ze]),A.id!==",")break;N(",")}return N("}",!0),typeof B>"u"?(this.lhs=Y,this.type="unary"):(this.lhs=B,this.rhs=Y,this.type="binary"),this};M("{",ue),ie("{",v["{"],ue),ye(":=",v[":="],function(B){return B.type!=="variable"?V({code:"S0212",stack:new Error().stack,position:B.position,token:B.value}):(this.lhs=B,this.rhs=z(v[":="]-1),this.type="binary",this)}),ie("@",v["@"],function(B){return this.lhs=B,this.rhs=z(v["@"]),this.rhs.type!=="variable"?V({code:"S0214",stack:new Error().stack,position:this.rhs.position,token:"@"}):(this.type="binary",this)}),ie("#",v["#"],function(B){return this.lhs=B,this.rhs=z(v["#"]),this.rhs.type!=="variable"?V({code:"S0214",stack:new Error().stack,position:this.rhs.position,token:"#"}):(this.type="binary",this)}),ie("?",v["?"],function(B){return this.type="condition",this.condition=B,this.then=z(0),A.id===":"&&(N(":"),this.else=z(0)),this}),ie("?:",v["?:"],function(B){return this.type="condition",this.condition=B,this.then=B,this.else=z(0),this}),M("|",function(){return this.type="transform",this.pattern=z(0),N("|"),this.update=z(0),A.id===","&&(N(","),this.delete=z(0)),N("|"),this});var Re=function(B){var Y;if(B.type==="function"&&!B.predicate){var $e={type:"lambda",thunk:!0,arguments:[],position:B.position};$e.body=B,Y=$e}else if(B.type==="condition")B.then=Re(B.then),typeof B.else<"u"&&(B.else=Re(B.else)),Y=B;else if(B.type==="block"){var ze=B.expressions.length;ze>0&&(B.expressions[ze-1]=Re(B.expressions[ze-1])),Y=B}else Y=B;return Y},he=0,ve=0,ne=[],ce=function(B,Y){switch(B.type){case"name":case"wildcard":Y.level--,Y.level===0&&(typeof B.ancestor>"u"||(ne[Y.index].slot.label=B.ancestor.label),B.ancestor=Y,B.tuple=!0);break;case"parent":Y.level++;break;case"block":B.expressions.length>0&&(B.tuple=!0,Y=ce(B.expressions[B.expressions.length-1],Y));break;case"path":B.tuple=!0;var $e=B.steps.length-1;for(Y=ce(B.steps[$e--],Y);Y.level>0&&$e>=0;)Y=ce(B.steps[$e--],Y);break;default:throw{code:"S0217",token:B.type,position:B.position}}return Y},ge=function(B,Y){if(typeof Y.seekingParent<"u"||Y.type==="parent"){var $e=typeof Y.seekingParent<"u"?Y.seekingParent:[];Y.type==="parent"&&$e.push(Y.slot),typeof B.seekingParent>"u"?B.seekingParent=$e:Array.prototype.push.apply(B.seekingParent,$e)}},pe=function(B){var Y=B.steps.length-1,$e=B.steps[Y],ze=typeof $e.seekingParent<"u"?$e.seekingParent:[];$e.type==="parent"&&ze.push($e.slot);for(var qe=0;qe<ze.length;qe++){var We=ze[qe];for(Y=B.steps.length-2;We.level>0;){if(Y<0){typeof B.seekingParent>"u"?B.seekingParent=[We]:B.seekingParent.push(We);break}for(var X=B.steps[Y--];Y>=0&&X.focus&&B.steps[Y].focus;)X=B.steps[Y--];We=ce(X,We)}}},le=function(B){var Y;switch(B.type){case"binary":switch(B.value){case".":var $e=le(B.lhs);$e.type==="path"?Y=$e:Y={type:"path",steps:[$e]},$e.type==="parent"&&(Y.seekingParent=[$e.slot]);var ze=le(B.rhs);ze.type==="function"&&ze.procedure.type==="path"&&ze.procedure.steps.length===1&&ze.procedure.steps[0].type==="name"&&Y.steps[Y.steps.length-1].type==="function"&&(Y.steps[Y.steps.length-1].nextFunction=ze.procedure.steps[0].value),ze.type==="path"?Array.prototype.push.apply(Y.steps,ze.steps):(typeof ze.predicate<"u"&&(ze.stages=ze.predicate,delete ze.predicate),Y.steps.push(ze)),Y.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"}),Y.steps.filter(function(Fe){return Fe.keepArray===!0}).length>0&&(Y.keepSingletonArray=!0);var qe=Y.steps[0];qe.type==="unary"&&qe.value==="["&&(qe.consarray=!0);var We=Y.steps[Y.steps.length-1];We.type==="unary"&&We.value==="["&&(We.consarray=!0),pe(Y);break;case"[":Y=le(B.lhs);var X=Y,oe="predicate";if(Y.type==="path"&&(X=Y.steps[Y.steps.length-1],oe="stages"),typeof X.group<"u")throw{code:"S0209",stack:new Error().stack,position:B.position};typeof X[oe]>"u"&&(X[oe]=[]);var K=le(B.rhs);typeof K.seekingParent<"u"&&(K.seekingParent.forEach(Fe=>{Fe.level===1?ce(X,Fe):Fe.level--}),ge(X,K)),X[oe].push({type:"filter",expr:K,position:B.position});break;case"{":if(Y=le(B.lhs),typeof Y.group<"u")throw{code:"S0210",stack:new Error().stack,position:B.position};Y.group={lhs:B.rhs.map(function(Fe){return[le(Fe[0]),le(Fe[1])]}),position:B.position};break;case"^":Y=le(B.lhs),Y.type!=="path"&&(Y={type:"path",steps:[Y]});var Ee={type:"sort",position:B.position};Ee.terms=B.rhs.map(function(Fe){var et=le(Fe.expression);return ge(Ee,et),{descending:Fe.descending,expression:et}}),Y.steps.push(Ee),pe(Y);break;case":=":Y={type:"bind",value:B.value,position:B.position},Y.lhs=le(B.lhs),Y.rhs=le(B.rhs),ge(Y,Y.rhs);break;case"@":if(Y=le(B.lhs),X=Y,Y.type==="path"&&(X=Y.steps[Y.steps.length-1]),typeof X.stages<"u"||typeof X.predicate<"u")throw{code:"S0215",stack:new Error().stack,position:B.position};if(X.type==="sort")throw{code:"S0216",stack:new Error().stack,position:B.position};B.keepArray&&(X.keepArray=!0),X.focus=B.rhs.value,X.tuple=!0;break;case"#":Y=le(B.lhs),X=Y,Y.type==="path"?X=Y.steps[Y.steps.length-1]:(Y={type:"path",steps:[Y]},typeof X.predicate<"u"&&(X.stages=X.predicate,delete X.predicate)),typeof X.stages>"u"?X.index=B.rhs.value:X.stages.push({type:"index",value:B.rhs.value,position:B.position}),X.tuple=!0;break;case"~>":Y={type:"apply",value:B.value,position:B.position},Y.lhs=le(B.lhs),Y.rhs=le(B.rhs),Y.keepArray=Y.lhs.keepArray||Y.rhs.keepArray;break;default:Y={type:B.type,value:B.value,position:B.position},Y.lhs=le(B.lhs),Y.rhs=le(B.rhs),ge(Y,Y.lhs),ge(Y,Y.rhs)}break;case"unary":Y={type:B.type,value:B.value,position:B.position},B.value==="["?Y.expressions=B.expressions.map(function(Fe){var et=le(Fe);return ge(Y,et),et}):B.value==="{"?Y.lhs=B.lhs.map(function(Fe){var et=le(Fe[0]);ge(Y,et);var It=le(Fe[1]);return ge(Y,It),[et,It]}):(Y.expression=le(B.expression),B.value==="-"&&Y.expression.type==="number"?(Y=Y.expression,Y.value=-Y.value):ge(Y,Y.expression));break;case"function":case"partial":Y={type:B.type,name:B.name,value:B.value,position:B.position},Y.arguments=B.arguments.map(function(Fe){var et=le(Fe);return ge(Y,et),et}),Y.procedure=le(B.procedure);break;case"lambda":Y={type:B.type,arguments:B.arguments,signature:B.signature,position:B.position};var ee=le(B.body);Y.body=Re(ee);break;case"condition":Y={type:B.type,position:B.position},Y.condition=le(B.condition),ge(Y,Y.condition),Y.then=le(B.then),ge(Y,Y.then),typeof B.else<"u"&&(Y.else=le(B.else),ge(Y,Y.else));break;case"transform":Y={type:B.type,position:B.position},Y.pattern=le(B.pattern),Y.update=le(B.update),typeof B.delete<"u"&&(Y.delete=le(B.delete));break;case"block":Y={type:B.type,position:B.position},Y.expressions=B.expressions.map(function(Fe){var et=le(Fe);return ge(Y,et),(et.consarray||et.type==="path"&&et.steps[0].consarray)&&(Y.consarray=!0),et});break;case"name":Y={type:"path",steps:[B]},B.keepArray&&(Y.keepSingletonArray=!0);break;case"parent":Y={type:"parent",slot:{label:"!"+he++,level:1,index:ve++}},ne.push(Y);break;case"string":case"number":case"value":case"wildcard":case"descendant":case"variable":case"regex":Y=B;break;case"operator":if(B.value==="and"||B.value==="or"||B.value==="in")B.type="name",Y=le(B);else if(B.value==="?")Y=B;else throw{code:"S0201",stack:new Error().stack,position:B.position,token:B.value};break;case"error":Y=B,B.lhs&&(Y=le(B.lhs));break;default:var De="S0206";B.id==="(end)"&&(De="S0207");var we={code:De,position:B.position,token:B.value};if(R)return j.push(we),{type:"error",error:we};throw we.stack=new Error().stack,we}return B.keepArray&&(Y.keepArray=!0),Y};L=S(w),N();var te=z(0);if(A.id!=="(end)"){var Te={code:"S0201",position:A.position,token:A.value};V(Te)}if(te=le(te),te.type==="parent"||typeof te.seekingParent<"u")throw{code:"S0217",token:te.type,position:te.position};return j.length>0&&(te.errors=j),te};return T})();s.exports=f},{"./signature":5}],5:[function(i,s,c){var p=i("./utils");const f=(()=>{var v={a:"arrays",b:"booleans",f:"functions",n:"numbers",o:"objects",s:"strings"};function b(S){for(var T=1,w=[],R={},A=R;T<S.length;){var L=S.charAt(T);if(L===":")break;var P=function(){w.push(R),A=R,R={}},j=function(ie,ye,M,ue){for(var Re=1,he=ye;he<ie.length;)if(he++,L=ie.charAt(he),L===ue){if(Re--,Re===0)break}else L===M&&Re++;return he};switch(L){case"s":case"n":case"b":case"l":case"o":R.regex="["+L+"m]",R.type=L,P();break;case"a":R.regex="[asnblfom]",R.type=L,R.array=!0,P();break;case"f":R.regex="f",R.type=L,P();break;case"j":R.regex="[asnblom]",R.type=L,P();break;case"x":R.regex="[asnblfom]",R.type=L,P();break;case"-":A.context=!0,A.contextRegex=new RegExp(A.regex),A.regex+="?";break;case"?":case"+":A.regex+=L;break;case"(":var G=j(S,T,"(",")"),W=S.substring(T+1,G);if(W.indexOf("<")===-1)R.regex="["+W+"m]";else throw{code:"S0402",stack:new Error().stack,value:W,offset:T};R.type="("+W+")",T=G,P();break;case"<":if(A.type==="a"||A.type==="f"){var k=j(S,T,"<",">");A.subtype=S.substring(T+1,k),T=k}else throw{code:"S0401",stack:new Error().stack,value:A.type,offset:T};break}T++}var V="^"+w.map(function(ie){return"("+ie.regex+")"}).join("")+"$",N=new RegExp(V),z=function(ie){var ye;if(p.isFunction(ie))ye="f";else{var M=typeof ie;switch(M){case"string":ye="s";break;case"number":ye="n";break;case"boolean":ye="b";break;case"object":ie===null?ye="l":Array.isArray(ie)?ye="a":ye="o";break;case"undefined":default:ye="m"}}return ye},Z=function(ie,ye){for(var M="^",ue=0,Re=0;Re<w.length;Re++){M+=w[Re].regex;var he=ye.match(M);if(he===null)throw{code:"T0410",stack:new Error().stack,value:ie[ue],index:ue+1};ue=he[0].length}throw{code:"T0410",stack:new Error().stack,value:ie[ue],index:ue+1}};return{definition:S,validate:function(ie,ye){var M="";ie.forEach(function(ve){M+=z(ve)});var ue=N.exec(M);if(ue){var Re=[],he=0;return w.forEach(function(ve,ne){var ce=ie[he],ge=ue[ne+1];if(ge==="")if(ve.context&&ve.contextRegex){var pe=z(ye);if(ve.contextRegex.test(pe))Re.push(ye);else throw{code:"T0411",stack:new Error().stack,value:ye,index:he+1}}else Re.push(ce),he++;else ge.split("").forEach(function(le){if(ve.type==="a"){if(le==="m")ce=void 0;else{ce=ie[he];var te=!0;if(typeof ve.subtype<"u"){if(le!=="a"&&ge!==ve.subtype)te=!1;else if(le==="a"&&ce.length>0){var Te=z(ce[0]);if(Te!==ve.subtype.charAt(0))te=!1;else{var B=ce.filter(function(Y){return z(Y)!==Te});te=B.length===0}}}if(!te)throw{code:"T0412",stack:new Error().stack,value:ce,index:he+1,type:v[ve.subtype]};le!=="a"&&(ce=[ce])}Re.push(ce),he++}else Re.push(ce),he++})}),Re}Z(ie,M)}}}return b})();s.exports=f},{"./utils":6}],6:[function(i,s,c){const p=(()=>{function f(k){var V=!1;if(typeof k=="number"&&(V=!isNaN(k),V&&!isFinite(k)))throw{code:"D1001",value:k,stack:new Error().stack};return V}function v(k){var V=!1;return Array.isArray(k)&&(V=k.filter(function(N){return typeof N!="string"}).length===0),V}function b(k){var V=!1;return Array.isArray(k)&&(V=k.filter(function(N){return!f(N)}).length===0),V}function S(){var k=[];return k.sequence=!0,arguments.length===1&&k.push(arguments[0]),k}function T(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 V=typeof k.arity=="number"?k.arity:typeof k.implementation=="function"?k.implementation.length:typeof k.length=="number"?k.length:k.arguments.length;return V}function A(k){return k&&k._jsonata_lambda===!0}var L=(typeof Symbol=="function"?Symbol:{}).iterator||"@@iterator";function P(k){return typeof k=="object"&&k!==null&&L in k&&"next"in k&&typeof k.next=="function"}function j(k,V){if(k===V)return!0;if(typeof k=="object"&&typeof V=="object"&&k!==null&&V!==null){if(Array.isArray(k)&&Array.isArray(V)){if(k.length!==V.length)return!1;for(var N=0;N<k.length;N++)if(!j(k[N],V[N]))return!1;return!0}var z=Object.getOwnPropertyNames(k),Z=Object.getOwnPropertyNames(V);if(z.length!==Z.length)return!1;for(z=z.sort(),Z=Z.sort(),N=0;N<z.length;N++)if(z[N]!==Z[N])return!1;for(N=0;N<z.length;N++){var ie=z[N];if(!j(k[ie],V[ie]))return!1}return!0}return!1}function G(k){return typeof k=="object"&&k!==null&&"then"in k&&typeof k.then=="function"}function W(k){var V=[];for(let N of k)V.push(N);return V}return{isNumeric:f,isArrayOfStrings:v,isArrayOfNumbers:b,createSequence:S,isSequence:T,isFunction:w,isLambda:A,isIterable:P,getFunctionArity:R,isDeepEqual:j,stringToArray:W,isPromise:G}})();s.exports=p},{}]},{},[3])(3)})}(bC)),bC.exports}var tU=eU();const GA=WC(tU),nU=async(e,r,i)=>{const{operand:s,operator:c,value:p}=e;if(c==="jsonata")try{const S=p.toString(),T=i();return await GA(S).evaluate(T)}catch(S){return console.log("JSONata evaluation error:",S),!1}const f=r(s),v=String(f||"").toLowerCase().trim(),b=String(p||"").toLowerCase().trim();switch(c){case"==":case"===":return v===b;case"!=":case"!==":return v!==b;case">":const S=parseFloat(v),T=parseFloat(b);return!isNaN(S)&&!isNaN(T)&&S>T;case">=":const w=parseFloat(v),R=parseFloat(b);return!isNaN(w)&&!isNaN(R)&&w>=R;case"<":const A=parseFloat(v),L=parseFloat(b);return!isNaN(A)&&!isNaN(L)&&A<L;case"<=":const P=parseFloat(v),j=parseFloat(b);return!isNaN(P)&&!isNaN(j)&&P<=j;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(p)?p.some(k=>String(k).toLowerCase().trim()===v):String(p).split(",").map(k=>k.toLowerCase().trim()).includes(v);case"not_in":return Array.isArray(p)?!p.some(k=>String(k).toLowerCase().trim()===v):!String(p).split(",").map(k=>k.toLowerCase().trim()).includes(v);case"regex":case"matches":try{return new RegExp(String(p),"i").test(v)}catch{return console.warn("Invalid regex pattern:",p),!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 p of s)if(!await nU(p,r,i)){c=!1;break}if(c)return!0}return!1},rU=()=>{const{getPatientValue:e,getFullPatient:r}=Nr();return{evaluateCondition:Ve.useMemo(()=>async s=>await WA(s,e,r),[e,r])}},oU=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,p;const s=e.filter(f=>f.shouldRender);for(const f of s){if(oU(f)&&!aU(f,r))return console.warn(`Required field is missing: ${f.name||((c=f.props)==null?void 0:c.propertyId)||f.id}`),!1;if((p=f.props)!=null&&p.propertyId&&i(f.props.propertyId))return!1}return!0},aU=(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||typeof s=="string"&&s.trim()===""||Array.isArray(s)&&s.length===0)},YA=({flow:e,isPreview:r,$bgColor:i,onSubmit:s,onNextStep:c,onPrevStep:p,shouldRedirect:f=!0,formidavimHost:v})=>{const[b,S]=Ve.useState(0),[T,w]=Ve.useState([]),[R,A]=Ve.useState(!0),{evaluateCondition:L}=rU(),{getFlowValue:P,getAllFlowData:j,setDisableSubmitValue:G,getDisableSubmitValue:W,getFlowError:k,setCurrentFormValue:V}=Nr(),N=Nr().getAllFlowData(),z=async ne=>{if(!ne)return[];const ce=[];for(const ge of ne){const pe=!ge.condition||await L(ge.condition),le=pe;ce.push({...ge,isVisible:pe,shouldRender:le,hasCondition:!!ge.condition})}return ce};Ve.useEffect(()=>{S(0)},[e.slug]),Ve.useEffect(()=>{const ne=async()=>{var ge;if(!e.flowForms){w([]),A(!1);return}const ce=[];for(const pe of e.flowForms)if(!pe.condition||await L(pe.condition)){const te=(ge=pe.form)!=null&&ge.formComponents?await z(pe.form.formComponents):[];ce.push({...pe,evaluatedFormComponents:te})}w(ce),A(!1)};A(!0),ne()},[e.flowForms,L]),Ve.useEffect(()=>{if(!R&&T.length>0&&b<T.length){const ne=T[b],ce=(ne==null?void 0:ne.evaluatedFormComponents)||[],ge=q$(ce,P,k);G(!ge)}},[T,b,R,N,P,G]);const Z=T.length,ie=T[b],ye=W();if(Ve.useEffect(()=>{ie&&V(ie)},[ie,V]),R)return I.jsx("div",{children:"Loading..."});if(!ie)return null;const M=T[0]===ie,ue=b===Z-1,Re=(ie==null?void 0:ie.evaluatedFormComponents)||[],he=()=>{if(q$(Re,P,k)){if(ie.submit){s(j(),e,f);return}c&&c(e,ie),b<Z-1&&(S(ce=>ce+1),setTimeout(()=>{window.scrollTo({top:0,behavior:"smooth"})},0))}},ve=()=>{b>0&&(p&&p(e,ie),S(ne=>ne-1)),window.scrollTo({top:0,behavior:"smooth"})};return I.jsxs(iM,{children:[I.jsxs(dM,{$tracker:!0,id:"FormHeaderMobile",children:[I.jsx(uO,{src:"https://media-s3-cdn.ivimhealth.com/assets/images/logos/ivim-black.svg"}),I.jsx(fM,{id:"FlowStepTrackerContainerMobile"}),!M&&I.jsx(lM,{onClick:ve})]}),I.jsx(J$,{currentStep:b+1,totalSteps:Z,showOnDesktop:!0,showOnMobile:!1}),I.jsx(bp,{$xSmall:!0,$bgColor:"white",$bRad:"10px 10px 0px 0px",children:I.jsxs(cM,{id:"FormHeaderDesktop",children:[!M&&I.jsx(K$,{onClick:ve}),I.jsx(uO,{src:"https://media-s3-cdn.ivimhealth.com/assets/images/logos/ivim-black.svg"})]})}),I.jsx(KA,{$bgColor:ie.bgColor,children:I.jsx(qA,{flowForm:ie,isPreview:r,evaluatedFormComponents:Re,formidavimHost:v})}),I.jsx(bp,{$xSmall:!0,$bgColor:"white",$bRad:"0px 0px 10px 10px",children:I.jsx(sM,{$borderOff:!!ie.bgColor,children:I.jsx(sO,{type:"submit",onClick:he,$isLastStep:ue,$radius:"41px",$margin:"0 0 15px 0",$btnStyle:"black",$disable:ye,children:ie.navButtonText?ie.navButtonText:"Next"})})}),I.jsx(pM,{id:"BtnFlowBtnWrapperMobile",children:I.jsx(sO,{type:"submit",onClick:he,$isLastStep:ue,$radius:"41px",$margin:"0 0 15px 0",$btnStyle:"black",$disable:ye,$allowDisableClick:!0,children:ie.navButtonText?ie.navButtonText:"Next"})})]})},iU=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 p=c[0],f=c[1].trim();try{const v=await GA(f).evaluate(r),b=v??"";typeof b!="object"?s=s.replace(p,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 iU(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},lU=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 p of c.form.formComponents)p.props&&(p.props=await HC(p.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:p,onFlowInit:f,shouldRedirect:v,formidavimHost:b})=>{const{setFlowValues:S,resetAndSetFlowValues:T,generateFormDataFromFlow:w,setPatientValues:R,getFullPatient:A,setCurrentFlowValue:L}=Nr(),[P,j]=Ve.useState(null),[G,W]=Ve.useState(!0),[k,V]=Ve.useState(!1),N=async(Z,ie=!1,ye=!1)=>{try{const M=await lU(r,Z);if(j(M),L(M),ye&&f&&(r!=null&&r.id)&&(r!=null&&r.slug)&&(console.log("Renderer calling onFlowInit for flow:",r.slug,r.id),f(r)),ie){const ue=w(M);T(ue)}}catch(M){if(console.error("Error processing config:",M),j(r),L(r),ye&&f&&(r!=null&&r.id)&&(r!=null&&r.slug)&&(console.log("Renderer calling onFlowInit for flow (error case):",r.slug,r.id),f(r)),ie){const ue=w(r);T(ue)}}};Ve.useEffect(()=>{console.log("Renderer initial useEffect triggered - data/config changed"),(async()=>{W(!0),e&&R(e),await N(e,!0,!0),V(!0),W(!1)})()},[e,r]);const z=A();return Ve.useEffect(()=>{console.log("Renderer patient data useEffect triggered:",{hasInitialized:k,hasPatientProfile:!!z}),k&&z&&(console.log("Renderer calling processConfigWithPatientData from patient data effect"),N(z,!1,!1))},[z,k]),G||!P?I.jsx("div",{children:"Processing form..."}):I.jsx(YA,{flow:P,isPreview:i,onSubmit:s,onNextStep:c,onPrevStep:p,shouldRedirect:v,formidavimHost:b})},sU={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"},uU={playfair:'"Playfair Display", serif',poppins:"Poppins, sans-serif",karmina:"Karmina, serif"},cU={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)"},fU={colors:sU,fonts:uU,mediaQuery:cU},dU=s5({reducer:{[V0.name]:V0.reducer,[F0.name]:F0.reducer}}),pU=xe.div`
3358
3358
  &&{
3359
3359
  width: 100%;
3360
3360
  min-height: calc(100vh - 100px);
package/index.mjs CHANGED
@@ -48051,7 +48051,7 @@ const WA = /* @__PURE__ */ KC(oU), aU = async (e, r, i) => {
48051
48051
  const z = A();
48052
48052
  return Tn(() => {
48053
48053
  console.log("Renderer patient data useEffect triggered:", { hasInitialized: k, hasPatientProfile: !!z }), k && z && (console.log("Renderer calling processConfigWithPatientData from patient data effect"), N(z, !1, !1));
48054
- }, [z, r, k]), G || !P ? /* @__PURE__ */ I.jsx("div", { children: "Processing form..." }) : /* @__PURE__ */ I.jsx(
48054
+ }, [z, k]), G || !P ? /* @__PURE__ */ I.jsx("div", { children: "Processing form..." }) : /* @__PURE__ */ I.jsx(
48055
48055
  uU,
48056
48056
  {
48057
48057
  flow: P,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hievilmath/browser-formidavim",
3
- "version": "1.4.23",
3
+ "version": "1.4.24",
4
4
  "main": "./index.js",
5
5
  "module": "./index.mjs",
6
6
  "typings": "./index.d.ts",