@hievilmath/browser-formidavim 1.4.38 → 1.4.39

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.
Files changed (3) hide show
  1. package/index.js +1 -1
  2. package/index.mjs +9 -2
  3. package/package.json +1 -1
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:d}=r||{};return I.jsx(Xj,{href:s,target:c,$btnStyle:p,$margin:d,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:dj,hidden:fj,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)),d=Fu.useSelector(M=>I5(M)),v=Ue.useCallback((M,se)=>{e(S5({field:M,value:se}))},[e]),b=Ue.useCallback(M=>r[M],[r]),S=Ue.useCallback(()=>r,[r]),T=Ue.useCallback(M=>{e(C5(M))},[e]),w=Ue.useCallback(M=>{e(w5(M))},[e]),R=Ue.useCallback((M,se)=>{e(E5({field:M,error:se}))},[e]),A=Ue.useCallback(M=>i[M],[i]),L=Ue.useCallback(M=>{e(T5(M))},[e]),P=Ue.useCallback(()=>s,[s]),j=Ue.useCallback((M,se)=>{e(L5({[M]:se}))},[e]),G=Ue.useCallback(M=>{const se={id:M.customerId??null,profile:M.data};e(M5(se))},[e]),Y=Ue.useCallback(M=>d==null?void 0:d[M],[d]),k=Ue.useCallback(()=>d,[d]),V=Ue.useCallback(M=>{e(R5(M))},[e]),N=Ue.useCallback(()=>c,[c]),z=Ue.useCallback(M=>{e(O5(M))},[e]),Z=Ue.useCallback(()=>p,[p]),ie=Ue.useCallback((M,se)=>{v(M,se),j(M,se)},[v,j]),pe=Ue.useCallback(M=>{const se={};return M.flowForms&&M.flowForms.forEach(we=>{var he;(he=we.form)!=null&&he.formComponents&&we.form.formComponents.forEach(Ce=>{const ue=Ce.componentId||"";if(Zj[ue]){const ye=Ce.props,me=ye==null?void 0:ye.propertyId;me&&(se[me]=null)}})}),se},[]);return{setFlowValue:v,setFlowValues:T,resetAndSetFlowValues:w,getFlowValue:b,getAllFlowData:S,setFlowError:R,getFlowError:A,setDisableSubmitValue:L,getDisableSubmitValue:P,setPatientValue:j,setPatientValues:G,getPatientValue:Y,getFullPatient:k,setCurrentFlowValue:V,getCurrentFlowValue:N,setCurrentFormValue:z,getCurrentFormValue:Z,setFlowAndPatientValue:ie,generateFormDataFromFlow:pe}};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 d(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 d(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++)d(p[b]);return d}return i}()({1:[function(i,s,c){const p=i("./utils"),d=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(te,De,Ee){var Fe="";if(te<=19)Fe=(De?" and ":"")+(Ee?S[te]:b[te]);else if(te<100){const Lt=Math.floor(te/10),Dt=te%10;Fe=(De?" and ":"")+T[Lt-2],Dt>0?Fe+="-"+K(Dt,!1,Ee):Ee&&(Fe=Fe.substring(0,Fe.length-1)+"ieth")}else if(te<1e3){const Lt=Math.floor(te/100),Dt=te%100;Fe=(De?", ":"")+b[Lt]+" Hundred",Dt>0?Fe+=K(Dt,!0,Ee):Ee&&(Fe+="th")}else{var rt=Math.floor(Math.log10(te)/3);rt>w.length&&(rt=w.length);const Lt=Math.pow(10,rt*3),Dt=Math.floor(te/Lt),vt=te-Dt*Lt;Fe=(De?", ":"")+K(Dt,!1,!1)+" "+w[rt-1],vt>0?Fe+=K(vt,!0,Ee):Ee&&(Fe+="th")}return Fe},Te=K(X,!1,oe);return Te}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(),Te=Math.pow(10,(oe+1)*3);A[K]=Te,A[K+"th"]=Te});function L(X){const K=X.split(/,\s|\sand\s|[\s\\-]/).map(De=>A[De]);let Te=[0];return K.forEach(De=>{if(De<100){let Ee=Te.pop();Ee>=1e3&&(Te.push(Ee),Ee=0),Te.push(Ee+De)}else Te.push(Te.pop()*De)}),Te.reduce((De,Ee)=>De+Ee,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 Y(X){for(var oe=0,K=1,Te=X.length-1;Te>=0;Te--){const te=X[Te],De=j[te];De<K?oe-=De:(K=De,oe+=De)}return oe}function k(X,oe){for(var K=[],Te=oe.charCodeAt(0);X>0;)K.unshift(String.fromCharCode((X-1)%26+Te)),X=Math.floor((X-1)/26);return K.join("")}function V(X,oe){for(var K=oe.charCodeAt(0),Te=0,te=0;te<X.length;te++)Te+=(X.charCodeAt(X.length-te-1)-K+1)*Math.pow(26,te);return Te}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 Te=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 te=oe.mandatoryDigits-K.length;if(te>0){var De=new Array(te+1).join("0");K=De+K}if(oe.zeroCode!==48&&(K=v(K).map(Lt=>String.fromCodePoint(Lt.codePointAt(0)+oe.zeroCode-48)).join("")),oe.regular){const Lt=Math.floor((K.length-1)/oe.groupingSeparators.position);for(let Dt=Lt;Dt>0;Dt--){const vt=K.length-Dt*oe.groupingSeparators.position;K=K.substr(0,vt)+oe.groupingSeparators.character+K.substr(vt)}}else oe.groupingSeparators.reverse().forEach(Lt=>{const Dt=K.length-Lt.position;K=K.substr(0,Dt)+Lt.character+K.substr(Dt)});if(oe.ordinal){var Ee={1:"st",2:"nd",3:"rd"},Fe=K[K.length-1],rt=Ee[Fe];(!rt||K.length>1&&K[K.length-2]==="1")&&(rt="th"),K=K+rt}break;case z.SEQUENCE:throw{code:"D3130",value:oe.token}}return Te&&(K="-"+K),K}const pe=[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,Te;const te=X.lastIndexOf(";");switch(te===-1?K=X:(K=X.substring(0,te),Te=X.substring(te+1),Te[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,Ee=0,Fe=0,rt=[],Lt=0;if(v(K).map(vt=>vt.codePointAt(0)).reverse().forEach(vt=>{let yt=!1;for(let St=0;St<pe.length;St++){const lt=pe[St];if(vt>=lt&&vt<=lt+9){if(yt=!0,Ee++,Lt++,De===null)De=lt;else if(lt!==De)throw{code:"D3131"};break}}yt||(vt===35?(Lt++,Fe++):rt.push({position:Lt,character:String.fromCodePoint(vt)}))}),Ee>0){oe.primary=z.DECIMAL,oe.zeroCode=De,oe.mandatoryDigits=Ee,oe.optionalDigits=Fe;const yt=function(St){if(St.length===0)return 0;const lt=St[0].character;for(let un=1;un<St.length;un++)if(St[un].character!==lt)return 0;const sn=St.map(un=>un.position),mn=function(un,Tn){return Tn===0?un:mn(Tn,un%Tn)},fn=sn.reduce(mn);for(let un=1;un<=sn.length;un++)if(sn.indexOf(un*fn)===-1)return 0;return fn}(rt);yt>0?(oe.regular=!0,oe.groupingSeparators={position:yt,character:rt[0].character}):(oe.regular=!1,oe.groupingSeparators=rt)}else oe.primary=z.SEQUENCE,oe.token=K}}return oe}const se={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 we(X){var oe=[];const K={type:"datetime",parts:oe},Te=function(yt,St){if(St>yt){let lt=X.substring(yt,St);lt=lt.split("]]").join("]"),oe.push({type:"literal",value:lt})}};for(var te=0,De=0;De<X.length;){if(X.charAt(De)==="["){if(X.charAt(De+1)==="["){Te(te,De),oe.push({type:"literal",value:"["}),De+=2,te=De;continue}if(Te(te,De),te=De,De=X.indexOf("]",te),De===-1)throw{code:"D3135"};let yt=X.substring(te+1,De);yt=yt.split(/\s+/).join("");var Ee={type:"marker",component:yt.charAt(0)},Fe=yt.lastIndexOf(","),rt;if(Fe!==-1){const St=yt.substring(Fe+1),lt=St.indexOf("-");let sn,mn;const fn=function(Tn){if(!(typeof Tn>"u"||Tn==="*"))return parseInt(Tn)};lt===-1?sn=St:(sn=St.substring(0,lt),mn=St.substring(lt+1));const un={min:fn(sn),max:fn(mn)};Ee.width=un,rt=yt.substring(1,Fe)}else rt=yt.substring(1);if(rt.length===1)Ee.presentation1=rt;else if(rt.length>1){var Lt=rt.charAt(rt.length-1);"atco".indexOf(Lt)!==-1?(Ee.presentation2=Lt,Lt==="o"&&(Ee.ordinal=!0),Ee.presentation1=rt.substring(0,rt.length-1)):Ee.presentation1=rt}else Ee.presentation1=se[Ee.component];if(typeof Ee.presentation1>"u")throw{code:"D3132",value:Ee.component};if(Ee.presentation1[0]==="n")Ee.names=Z.LOWER;else if(Ee.presentation1[0]==="N")Ee.presentation1[1]==="n"?Ee.names=Z.TITLE:Ee.names=Z.UPPER;else if("YMDdFWwXxHhmsf".indexOf(Ee.component)!==-1){var Dt=Ee.presentation1;if(Ee.presentation2&&(Dt+=";"+Ee.presentation2),Ee.integerFormat=M(Dt),Ee.width&&Ee.width.min!==void 0&&Ee.integerFormat.mandatoryDigits<Ee.width.min&&(Ee.integerFormat.mandatoryDigits=Ee.width.min),Ee.component==="Y")if(Ee.n=-1,Ee.width&&Ee.width.max!==void 0)Ee.n=Ee.width.max,Ee.integerFormat.mandatoryDigits=Ee.n;else{var vt=Ee.integerFormat.mandatoryDigits+Ee.integerFormat.optionalDigits;vt>=2&&(Ee.n=vt)}const St=oe[oe.length-1];St&&St.integerFormat&&(St.integerFormat.parseWidth=St.integerFormat.mandatoryDigits)}(Ee.component==="Z"||Ee.component==="z")&&(Ee.integerFormat=M(Ee.presentation1)),oe.push(Ee),te=De+1}De++}return Te(te,De),K}const he=["","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Ce=["January","February","March","April","May","June","July","August","September","October","November","December"],ue=1e3*60*60*24,fe=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)*ue:oe-(K-1)*ue},ye=function(X,oe){return{year:X,month:oe,nextMonth:function(){return oe===11?ye(X+1,0):ye(X,oe+1)},previousMonth:function(){return oe===0?ye(X-1,11):ye(X,oe-1)},nextYear:function(){return ye(X+1,oe)},previousYear:function(){return ye(X-1,oe)}}},me=function(X,oe){return(oe-X)/(ue*7)+1},ne=(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 Te=Date.UTC(X.getUTCFullYear(),X.getUTCMonth(),X.getUTCDate()),te=Date.UTC(X.getUTCFullYear(),0);K=(Te-te)/ue+1;break}case"F":K=X.getUTCDay(),K===0&&(K=7);break;case"W":{const Te=ye(X.getUTCFullYear(),0),te=fe(Te),De=Date.UTC(Te.year,X.getUTCMonth(),X.getUTCDate());let Ee=me(te,De);if(Ee>52){const Fe=fe(Te.nextYear());De>=Fe&&(Ee=1)}else if(Ee<1){const Fe=fe(Te.previousYear());Ee=me(Fe,De)}K=Math.floor(Ee);break}case"w":{const Te=ye(X.getUTCFullYear(),X.getUTCMonth()),te=fe(Te),De=Date.UTC(Te.year,Te.month,X.getUTCDate());let Ee=me(te,De);if(Ee>4){const Fe=fe(Te.nextMonth());De>=Fe&&(Ee=1)}else if(Ee<1){const Fe=fe(Te.previousMonth());Ee=me(Fe,De)}K=Math.floor(Ee);break}case"X":{const Te=ye(X.getUTCFullYear(),0),te=fe(Te),De=fe(Te.nextYear()),Ee=X.getTime();Ee<te?K=Te.year-1:Ee>=De?K=Te.year+1:K=Te.year;break}case"x":{const Te=ye(X.getUTCFullYear(),X.getUTCMonth()),te=fe(Te),De=Te.nextMonth(),Ee=fe(De),Fe=X.getTime();Fe<te?K=Te.previousMonth().month+1:Fe>=Ee?K=De.month+1:K=Te.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 ee=null;function Re(X,oe,K){var Te=0,te=0;if(typeof K<"u"){const Dt=parseInt(K);Te=Math.floor(Dt/100),te=Dt%100}var De=function(Dt,vt){var yt=ne(Dt,vt.component);if("YMDdFWwXxHhms".indexOf(vt.component)!==-1)if(vt.component==="Y"&&vt.n!==-1&&(yt=yt%Math.pow(10,vt.n)),vt.names){if(vt.component==="M"||vt.component==="x")yt=Ce[yt-1];else if(vt.component==="F")yt=he[yt];else throw{code:"D3133",value:vt.component};vt.names===Z.UPPER?yt=yt.toUpperCase():vt.names===Z.LOWER&&(yt=yt.toLowerCase()),vt.width&&yt.length>vt.width.max&&(yt=yt.substring(0,vt.width.max))}else yt=ie(yt,vt.integerFormat);else if(vt.component==="f")yt=ie(yt,vt.integerFormat);else if(vt.component==="Z"||vt.component==="z"){const St=Te*100+te;if(vt.integerFormat.regular)yt=ie(St,vt.integerFormat);else{const lt=vt.integerFormat.mandatoryDigits;if(lt===1||lt===2)yt=ie(Te,vt.integerFormat),te!==0&&(yt+=":"+N(te,"00"));else if(lt===3||lt===4)yt=ie(St,vt.integerFormat);else throw{code:"D3134",value:lt}}St>=0&&(yt="+"+yt),vt.component==="z"&&(yt="GMT"+yt),St===0&&vt.presentation2==="t"&&(yt="Z")}else vt.component==="P"&&vt.names===Z.UPPER&&(yt=yt.toUpperCase());return yt};let Ee;typeof oe>"u"?(ee===null&&(ee=we("[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01].[f001][Z01:01t]")),Ee=ee):Ee=we(oe);const Fe=(60*Te+te)*60*1e3,rt=new Date(X+Fe);let Lt="";return Ee.parts.forEach(function(Dt){Dt.type==="literal"?Lt+=Dt.value:Lt+=De(rt,Dt)}),Lt}function B(X){var oe={};if(X.type==="datetime")oe.type="datetime",oe.parts=X.parts.map(function(K){var Te={};if(K.type==="literal")Te.regex=K.value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");else if(K.component==="Z"||K.component==="z"){let De;Array.isArray(K.integerFormat.groupingSeparators)||(De=K.integerFormat.groupingSeparators),Te.regex="",K.component==="z"&&(Te.regex="GMT"),Te.regex+="[-+][0-9]+",De&&(Te.regex+=De.character+"[0-9]+"),Te.parse=function(Ee){K.component==="z"&&(Ee=Ee.substring(3));let Fe=0,rt=0;return De?(Fe=Number.parseInt(Ee.substring(0,Ee.indexOf(De.character))),rt=Number.parseInt(Ee.substring(Ee.indexOf(De.character)+1))):Ee.length-1<=2?Fe=Number.parseInt(Ee):(Fe=Number.parseInt(Ee.substring(0,3)),rt=Number.parseInt(Ee.substring(3))),Fe*60+rt}}else if(K.integerFormat)Te=B(K.integerFormat);else{Te.regex="[a-zA-Z]+";var te={};if(K.component==="M"||K.component==="x")Ce.forEach(function(De,Ee){K.width&&K.width.max?te[De.substring(0,K.width.max)]=Ee+1:te[De]=Ee+1});else if(K.component==="F")he.forEach(function(De,Ee){Ee>0&&(K.width&&K.width.max?te[De.substring(0,K.width.max)]=Ee:te[De]=Ee)});else if(K.component==="P")te={am:0,AM:0,pm:1,PM:1};else throw{code:"D3133",value:K.component};Te.parse=function(De){return te[De]}}return Te.component=K.component,Te});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(Te){return V(Te,K?"A":"a")};break;case z.ROMAN:oe.regex=K?"[MDCLXVI]+":"[mdclxvi]+",oe.parse=function(Te){return Y(K?Te:Te.toUpperCase())};break;case z.WORDS:oe.regex="(?:"+Object.keys(A).concat("and","[\\-, ]").join("|")+")+",oe.parse=function(Te){return L(Te.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(Te){let te=Te;return X.ordinal&&(te=Te.substring(0,Te.length-2)),X.regular?te=te.split(",").join(""):X.groupingSeparators.forEach(De=>{te=te.split(De.character).join("")}),X.zeroCode!==48&&(te=te.split("").map(De=>String.fromCodePoint(De.codePointAt(0)-X.zeroCode+48)).join("")),parseInt(te)};break;case z.SEQUENCE:throw{code:"D3130",value:X.token}}}return oe}function W(X,oe){if(typeof X>"u")return;const K=M(oe);return B(K).parse(X)}function $e(X,oe){const K=we(oe),Te=B(K),te="^"+Te.parts.map(rt=>"("+rt.regex+")").join("")+"$";var Ee=new RegExp(te,"i").exec(X);if(Ee!==null){const lt={};for(let qe=1;qe<Ee.length;qe++){const U=Te.parts[qe-1];U.parse&&(lt[U.component]=U.parse(Ee[qe]))}if(Object.getOwnPropertyNames(lt).length===0)return;let sn=0;const mn=qe=>{sn<<=1,sn+=qe?1:0},fn=qe=>!(~qe&sn)&&!!(qe&sn);"YXMxWwdD".split("").forEach(qe=>mn(lt[qe]));const Tn=!fn(161)&&fn(130),rr=fn(84),or=!rr&&fn(72);sn=0,"PHhmsf".split("").forEach(qe=>mn(lt[qe]));const ot=!fn(23)&&fn(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]=ne(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 Be=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(!Be.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 Re.call(this,X,oe,K)}return{formatInteger:N,parseInteger:W,fromMillis:We,toMillis:Qe}}();s.exports=d},{"./utils":6}],2:[function(i,s,c){(function(p){(function(){var d=i("./utils");const v=(()=>{var b=d.isNumeric,S=d.isArrayOfStrings,T=d.isArrayOfNumbers,w=d.createSequence,R=d.isSequence,A=d.isFunction,L=d.isLambda,P=d.isPromise,j=d.getFunctionArity,G=d.isDeepEqual,Y=d.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 ve=F?2:0;Array.isArray($)&&$.outerWrapper&&($=$[0]),q=JSON.stringify($,function(ce,Ie){return typeof Ie<"u"&&Ie!==null&&Ie.toPrecision&&b(Ie)?Number(Ie.toPrecision(15)):Ie&&A(Ie)?"":Ie},ve)}return q}}function pe($,F,q){if(!(typeof $>"u")){var ve=Y($),ce=ve.length;if(ce+F<0&&(F=0),typeof q<"u"){if(q<=0)return"";var Ie=F>=0?F+q:ce+F+q;return ve.slice(F,Ie).join("")}return ve.slice(F).join("")}}function M($,F){if(!(typeof $>"u")){var q=$.indexOf(F);return q>-1?$.substr(0,q):$}}function se($,F){if(!(typeof $>"u")){var q=$.indexOf(F);return q>-1?$.substr(q+F.length):$}}function we($){if(!(typeof $>"u"))return $.toLowerCase()}function he($){if(!(typeof $>"u"))return $.toUpperCase()}function Ce($){if(!(typeof $>"u"))return Y($).length}function ue($){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 fe($,F,q){if(!(typeof $>"u")){(typeof q>"u"||q.length===0)&&(q=" ");var ve;F=Math.trunc(F);var ce=Math.abs(F)-Ce($);if(ce>0){var Ie=new Array(ce+1).join(q);q.length>1&&(Ie=pe(Ie,0,ce)),F>0?ve=$+Ie:ve=Ie+$}else ve=$;return ve}}async function ye($,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 me($,F){if(!(typeof $>"u")){var q;if(typeof F=="string")q=$.indexOf(F)!==-1;else{var ve=await ye(F,$);q=typeof ve<"u"}return q}}async function ne($,F,q){if(!(typeof $>"u")){if(q<0)throw{stack:new Error().stack,value:q,code:"D3040",index:3};var ve=w();if(typeof q>"u"||q>0){var ce=0,Ie=await ye(F,$);if(typeof Ie<"u")for(;typeof Ie<"u"&&(typeof q>"u"||ce<q);)ve.push({match:Ie.match,index:Ie.start,groups:Ie.groups}),Ie=await ye(Ie.next),ce++}return ve}}async function ee($,F,q,ve){if(!(typeof $>"u")){var ce=this;if(F==="")throw{code:"D3010",stack:new Error().stack,value:F,index:2};if(ve<0)throw{code:"D3011",stack:new Error().stack,value:ve,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 nt="",Tt=0;if(typeof ve>"u"||ve>0){var $t=0;if(typeof F=="string"){for(var dn=$.indexOf(F,Tt);dn!==-1&&(typeof ve>"u"||$t<ve);)nt+=$.substring(Tt,dn),nt+=q,Tt=dn+F.length,$t++,dn=$.indexOf(F,Tt);nt+=$.substring(Tt)}else{var zt=await ye(F,$);if(typeof zt<"u"){for(;typeof zt<"u"&&(typeof ve>"u"||$t<ve);){nt+=$.substring(Tt,zt.start);var bn=Ie.apply(ce,[zt]);if(P(bn)&&(bn=await bn),typeof bn=="string")nt+=bn;else throw{code:"D3012",stack:new Error().stack,value:bn};Tt=zt.start+zt.match.length,$t++,zt=await ye(zt.next)}nt+=$.substring(Tt)}else nt=$}}else nt=$;return nt}}function Re($){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 W($){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 Be($){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 ve=[];if(typeof q>"u"||q>0)if(typeof F=="string")ve=$.split(F,q);else{var ce=0,Ie=await ye(F,$);if(typeof Ie<"u"){for(var nt=0;typeof Ie<"u"&&(typeof q>"u"||ce<q);)ve.push($.substring(nt,Ie.start)),nt=Ie.end,Ie=await ye(Ie.next),ce++;(typeof q>"u"||ce<q)&&ve.push($.substring(nt))}else ve.push($)}return ve}}function X($,F){if(!(typeof $>"u"))return typeof F>"u"&&(F=""),$.join(F)}function oe($,F,q){if(!(typeof $>"u")){var ve={"decimal-separator":".","grouping-separator":",","exponent-separator":"e",infinity:"Infinity","minus-sign":"-",NaN:"NaN",percent:"%","per-mille":"‰","zero-digit":"0",digit:"#","pattern-separator":";"},ce=ve;typeof q<"u"&&Object.keys(q).forEach(function(Ht){ce[Ht]=q[Ht]});for(var Ie=[],nt=ce["zero-digit"].charCodeAt(0),Tt=nt;Tt<nt+10;Tt++)Ie.push(String.fromCharCode(Tt));var $t=Ie.concat([ce["decimal-separator"],ce["exponent-separator"],ce["grouping-separator"],ce.digit,ce["pattern-separator"]]),dn=F.split(ce["pattern-separator"]);if(dn.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!==ce["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!==ce["exponent-separator"])return Ht.substring(Tr+1)}(),yn=Ht.substring(Bn.length,Ht.length-gr.length),so,Er,To,_i,uo=Ht.indexOf(ce["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(ce["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(ce["decimal-separator"]);so!==yn.lastIndexOf(ce["decimal-separator"])&&(Bn="D3081"),yn.indexOf(ce.percent)!==yn.lastIndexOf(ce.percent)&&(Bn="D3082"),yn.indexOf(ce["per-mille"])!==yn.lastIndexOf(ce["per-mille"])&&(Bn="D3083"),yn.indexOf(ce.percent)!==-1&&yn.indexOf(ce["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===ce.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)===ce["grouping-separator"]||yn.charAt(so+1)===ce["grouping-separator"])&&(Bn="D3087"):Ht.integerPart.charAt(Ht.integerPart.length-1)===ce["grouping-separator"]&&(Bn="D3088"),yn.indexOf(ce["grouping-separator"]+ce["grouping-separator"])!==-1&&(Bn="D3089");var uo=Ht.integerPart.indexOf(ce.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(ce.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(ce.percent)!==-1||yn.indexOf(ce["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(ce["grouping-separator"]);Qo!==-1;){var hl=(pl?Hr.substring(0,Qo):Hr.substring(Qo)).split("").filter(function(Xo){return Ie.indexOf(Xo)!==-1||Xo===ce.digit}).length;Fi.push(hl),Qo=Ht.integerPart.indexOf(ce["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===ce.digit}).length,Tr=typeof Ht.exponentPart=="string";To===0&&Mn===0&&(Tr?(Zr=1,Mn=1):To=1),Tr&&To===0&&Ht.integerPart.indexOf(ce.digit)!==-1&&(To=1),To===0&&Zr===0&&(Zr=1);var fi=0;return Tr&&(fi=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:fi,suffix:Ht.suffix,picture:Ht.subpicture}},Xn=dn.map(zt);Xn.forEach(bn);var an=Xn.map(pn),ae=ce["minus-sign"],Ye=ce["zero-digit"],at=ce["decimal-separator"],_t=ce["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(ce.percent)!==-1?Wt=$*100:At.picture.indexOf(ce["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 di=Kr(en,0);Xt=At.minimumExponentSize-di.length,Xt>0&&(di=new Array(Xt+1).join(Ye)+di),Yt=Yt+ce["exponent-separator"]+(en<0?ae:"")+di}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 Te($){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 te($){var F;if(!(typeof $>"u"))return F=Math.abs($),F}function De($){var F;if(!(typeof $>"u"))return F=Math.floor($),F}function Ee($){var F;if(!(typeof $>"u"))return F=Math.ceil($),F}function Fe($,F){var q;if(!(typeof $>"u")){if(F){var ve=$.toString().split("e");$=+(ve[0]+"e"+(ve[1]?+ve[1]+F:F))}q=Math.round($);var ce=q-$;return Math.abs(ce)===.5&&Math.abs(q%2)===1&&(q=q-1),F&&(ve=q.toString().split("e"),q=+(ve[0]+"e"+(ve[1]?+ve[1]-F:-F))),Object.is(q,-0)&&(q=0),q}}function rt($){var F;if(!(typeof $>"u")){if($<0)throw{stack:new Error().stack,code:"D3060",index:1,value:$};return F=Math.sqrt($),F}}function Lt($,F){var q;if(!(typeof $>"u")){if(q=Math.pow($,F),!isFinite(q))throw{stack:new Error().stack,code:"D3061",index:1,value:$,exp:F};return q}}function Dt(){return Math.random()}function vt($){if(!(typeof $>"u")){var F=!1;if(Array.isArray($)){if($.length===1)F=vt($[0]);else if($.length>1){var q=$.filter(function(ve){return vt(ve)});F=q.length>0}}else typeof $=="string"?$.length>0&&(F=!0):b($)?$!==0&&(F=!0):$!==null&&typeof $=="object"&&!A($)?Object.keys($).length>0&&(F=!0):typeof $=="boolean"&&$===!0&&(F=!0);return F}}function yt($){if(!(typeof $>"u"))return!vt($)}function St($,F,q,ve){var ce=[F],Ie=j($);return Ie>=2&&ce.push(q),Ie>=3&&ce.push(ve),ce}async function lt($,F){if(!(typeof $>"u")){for(var q=w(),ve=0;ve<$.length;ve++){var ce=St(F,$[ve],ve,$),Ie=await F.apply(this,ce);typeof Ie<"u"&&q.push(Ie)}return q}}async function sn($,F){if(!(typeof $>"u")){for(var q=w(),ve=0;ve<$.length;ve++){var ce=$[ve],Ie=St(F,ce,ve,$),nt=await F.apply(this,Ie);vt(nt)&&q.push(ce)}return q}}async function mn($,F){if(!(typeof $>"u")){for(var q=!1,ve,ce=0;ce<$.length;ce++){var Ie=$[ce],nt=!0;if(typeof F<"u"){var Tt=St(F,Ie,ce,$),$t=await F.apply(this,Tt);nt=vt($t)}if(nt)if(!q)ve=Ie,q=!0;else throw{stack:new Error().stack,code:"D3138",index:ce}}if(!q)throw{stack:new Error().stack,code:"D3139"};return ve}}function fn(){for(var $=[],F=Array.prototype.slice.call(arguments),q=Math.min.apply(Math,F.map(function(Ie){return Array.isArray(Ie)?Ie.length:0})),ve=0;ve<q;ve++){var ce=F.map(Ie=>Ie[ve]);$.push(ce)}return $}async function un($,F,q){if(!(typeof $>"u")){var ve,ce=j(F);if(ce<2)throw{stack:new Error().stack,code:"D3050",index:1};var Ie;for(typeof q>"u"&&$.length>0?(ve=$[0],Ie=1):(ve=q,Ie=0);Ie<$.length;){var nt=[ve,$[Ie]];ce>=3&&nt.push(Ie),ce>=4&&nt.push($),ve=await F.apply(this,nt),Ie++}return ve}}function Tn($){var F=w();if(Array.isArray($)){var q={};$.forEach(function(ve){var ce=Tn(ve);ce.forEach(function(Ie){q[Ie]=!0})}),F=Tn(q)}else $!==null&&typeof $=="object"&&!A($)&&Object.keys($).forEach(ve=>F.push(ve));return F}function rr($,F){var q;if(Array.isArray($)){q=w();for(var ve=0;ve<$.length;ve++){var ce=rr($[ve],F);typeof ce<"u"&&(Array.isArray(ce)?ce.forEach(Ie=>q.push(Ie)):q.push(ce))}}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(ce){F=or(F,ot(ce))});else if($!==null&&typeof $=="object"&&!L($))for(var q in $){var ve={};ve[q]=$[q],F.push(ve)}else F=$;return F}function He($){if(!(typeof $>"u")){var F={};return $.forEach(function(q){for(var ve in q)F[ve]=q[ve]}),F}}function cn($){if(!(typeof $>"u")){if($.length<=1)return $;for(var F=$.length,q=new Array(F),ve=0;ve<F;ve++)q[F-ve-1]=$[ve];return q}}async function Rn($,F){var q=w();for(var ve in $){var ce=St(F,$[ve],ve,$),Ie=await F.apply(this,ce);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(nt,Tt){return nt>Tt}}else q=F;var ve=async function(nt,Tt){var $t=async function(zt,bn,pn){bn.length===0?Array.prototype.push.apply(zt,pn):pn.length===0?Array.prototype.push.apply(zt,bn):await q(bn[0],pn[0])?(zt.push(pn[0]),await $t(zt,bn,pn.slice(1))):(zt.push(bn[0]),await $t(zt,bn.slice(1),pn))},dn=[];return await $t(dn,nt,Tt),dn},ce=async function(nt){if(!Array.isArray(nt)||nt.length<=1)return nt;var Tt=Math.floor(nt.length/2),$t=nt.slice(0,Tt),dn=nt.slice(Tt);return $t=await ce($t),dn=await ce(dn),await ve($t,dn)},Ie=await ce($);return Ie}}function U($){if(!(typeof $>"u")){if($.length<=1)return $;for(var F=new Array($.length),q=0;q<$.length;q++){var ve=Math.floor(Math.random()*(q+1));q!==ve&&(F[q]=F[ve]),F[ve]=$[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 ve=$[q],ce=!1,Ie=0;Ie<F.length;Ie++)if(G(ve,F[Ie])){ce=!0;break}ce||F.push(ve)}return F}}async function le($,F){var q={};for(var ve in $){var ce=$[ve],Ie=St(F,ce,ve,$),nt=await F.apply(this,Ie);vt(nt)&&(q[ve]=ce)}return Object.keys(q).length===0&&(q=void 0),q}return{sum:k,count:V,max:N,min:z,average:Z,string:ie,substring:pe,substringBefore:M,substringAfter:se,lowercase:we,uppercase:he,length:Ce,trim:ue,pad:fe,match:ne,contains:me,replace:ee,split:We,join:X,formatNumber:oe,formatBase:K,number:Te,floor:De,ceil:Ee,round:Fe,abs:te,sqrt:rt,power:Lt,random:Dt,boolean:vt,not:yt,map:lt,zip:fn,filter:sn,single:mn,foldLeft:un,sift:le,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:Re,base64decode:B,encodeUrlComponent:W,encodeUrl:$e,decodeUrlComponent:Be,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"),d=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,Y=v.isIterable,k=v.isPromise,V=v.getFunctionArity,N=v.isDeepEqual,z=Dn(null);async function Z(U,J,le){var $,F=le.lookup(Symbol.for("jsonata.__evaluate_entry"));switch(F&&await F(U,J,le),U.type){case"path":$=await ie(U,J,le);break;case"binary":$=await Ce(U,J,le);break;case"unary":$=await ue(U,J,le);break;case"name":$=fe(U,J);break;case"string":case"number":case"value":$=ye(U);break;case"wildcard":$=me(U,J);break;case"descendant":$=ee(U,J);break;case"parent":$=le.lookup(U.slot.label);break;case"condition":$=await De(U,J,le);break;case"block":$=await Ee(U,J,le);break;case"bind":$=await te(U,J,le);break;case"regex":$=Fe(U);break;case"function":$=await St(U,J,le);break;case"variable":$=rt(U,J,le);break;case"lambda":$=mn(U,J,le);break;case"partial":$=await fn(U,J,le);break;case"apply":$=await yt(U,J,le);break;case"transform":$=Dt(U,J,le);break}if(Object.prototype.hasOwnProperty.call(U,"predicate"))for(var q=0;q<U.predicate.length;q++)$=await he(U.predicate[q].expr,$,le);U.type!=="path"&&Object.prototype.hasOwnProperty.call(U,"group")&&($=await oe(U.group,$,le));var ve=le.lookup(Symbol.for("jsonata.__evaluate_exit"));return ve&&await ve(U,J,le,$),$&&P($)&&!$.tupleStream&&(U.keepArray&&($.keepSingleton=!0),$.length===0?$=void 0:$.length===1&&($=$.keepSingleton?$:$[0])),$}async function ie(U,J,le){var $;Array.isArray(J)&&U.steps[0].type!=="variable"?$=J:$=L(J);for(var F,q=!1,ve=void 0,ce=0;ce<U.steps.length;ce++){var Ie=U.steps[ce];if(Ie.tuple&&(q=!0),ce===0&&Ie.consarray?F=await Z(Ie,$,le):q?ve=await we(Ie,$,ve,le):F=await M(Ie,$,le,ce===U.steps.length-1),!q&&(typeof F>"u"||F.length===0))break;typeof Ie.focus>"u"&&($=F)}if(q)if(U.tuple)F=ve;else for(F=L(),ce=0;ce<ve.length;ce++)F.push(ve[ce]["@"]);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?ve:F,le)),F}function pe(U,J){var le=Dn(U);for(const $ in J)le.bind($,J[$]);return le}async function M(U,J,le,$){var F;if(U.type==="sort")return F=await Lt(U,J,le),U.stages&&(F=await se(U.stages,F,le)),F;F=L();for(var q=0;q<J.length;q++){var ve=await Z(U,J[q],le);if(U.stages)for(var ce=0;ce<U.stages.length;ce++)ve=await he(U.stages[ce].expr,ve,le);typeof ve<"u"&&F.push(ve)}var Ie=L();return $&&F.length===1&&Array.isArray(F[0])&&!P(F[0])?Ie=F[0]:F.forEach(function(nt){!Array.isArray(nt)||nt.cons?Ie.push(nt):nt.forEach(Tt=>Ie.push(Tt))}),Ie}async function se(U,J,le){for(var $=J,F=0;F<U.length;F++){var q=U[F];switch(q.type){case"filter":$=await he(q.expr,$,le);break;case"index":for(var ve=0;ve<$.length;ve++){var ce=$[ve];ce[q.value]=ve}break}}return $}async function we(U,J,le,$){var F;if(U.type==="sort"){if(le)F=await Lt(U,le,$);else{var q=await Lt(U,J,$);F=L(),F.tupleStream=!0;for(var ve=0;ve<q.length;ve++){var ce={"@":q[ve]};ce[U.index]=ve,F.push(ce)}}return U.stages&&(F=await se(U.stages,F,$)),F}F=L(),F.tupleStream=!0;var Ie=$;le===void 0&&(le=J.map(dn=>({"@":dn})));for(var nt=0;nt<le.length;nt++){Ie=pe($,le[nt]);var Tt=await Z(U,le[nt]["@"],Ie);if(typeof Tt<"u"){Array.isArray(Tt)||(Tt=[Tt]);for(var $t=0;$t<Tt.length;$t++)ce={},Object.assign(ce,le[nt]),Tt.tupleStream?Object.assign(ce,Tt[$t]):(U.focus?(ce[U.focus]=Tt[$t],ce["@"]=le[nt]["@"]):ce["@"]=Tt[$t],U.index&&(ce[U.index]=$t),U.ancestor&&(ce[U.ancestor.label]=le[nt]["@"])),F.push(ce)}}return U.stages&&(F=await se(U.stages,F,$)),F}async function he(U,J,le){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],ve=q,ce=le;J.tupleStream&&(ve=q["@"],ce=pe(le,q));var Ie=await Z(U,ve,ce);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)}):d.boolean(Ie)&&$.push(q)}return $}async function Ce(U,J,le){var $,F=await Z(U.lhs,J,le),q=U.value,ve=async()=>await Z(U.rhs,J,le);if(q==="and"||q==="or")try{return await Qe(F,ve,q)}catch(Ie){throw Ie.position=U.position,Ie.token=q,Ie}var ce=await ve();try{switch(q){case"+":case"-":case"*":case"/":case"%":$=B(F,ce,q);break;case"=":case"!=":$=W(F,ce,q);break;case"<":case"<=":case">":case">=":$=$e(F,ce,q);break;case"&":$=X(F,ce);break;case"..":$=Te(F,ce);break;case"in":$=Be(F,ce);break}}catch(Ie){throw Ie.position=U.position,Ie.token=q,Ie}return $}async function ue(U,J,le){var $;switch(U.value){case"-":if($=await Z(U.expression,J,le),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 ve=await Promise.all(U.expressions.map(async(ce,Ie)=>(le.isParallelCall=Ie>0,[ce,await Z(ce,J,le)])));for(let ce of ve){var[F,q]=ce;typeof q<"u"&&(F.value==="["?$.push(q):$=d.append($,q))}U.consarray&&Object.defineProperty($,"cons",{enumerable:!1,configurable:!1,value:!0});break;case"{":$=await oe(U,J,le);break}return $}function fe(U,J,le){return d.lookup(J,U.value)}function ye(U){return U.value}function me(U,J){var le=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=ne(F),le=d.append(le,F)):le.push(F)}),le}function ne(U,J){return typeof J>"u"&&(J=[]),Array.isArray(U)?U.forEach(function(le){ne(le,J)}):J.push(U),J}function ee(U,J){var le,$=L();return typeof J<"u"&&(Re(J,$),$.length===1?le=$[0]:le=$),le}function Re(U,J){Array.isArray(U)||J.push(U),Array.isArray(U)?U.forEach(function(le){Re(le,J)}):U!==null&&typeof U=="object"&&Object.keys(U).forEach(function(le){Re(U[le],J)})}function B(U,J,le){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(le){case"+":$=U+J;break;case"-":$=U-J;break;case"*":$=U*J;break;case"/":$=U/J;break;case"%":$=U%J;break}return $}function W(U,J,le){var $,F=typeof U,q=typeof J;if(F==="undefined"||q==="undefined")return!1;switch(le){case"=":$=N(U,J);break;case"!=":$=!N(U,J);break}return $}function $e(U,J,le){var $,F=typeof U,q=typeof J,ve=F==="undefined"||F==="string"||F==="number",ce=q==="undefined"||q==="string"||q==="number";if(!ve||!ce)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(le){case"<":$=U<J;break;case"<=":$=U<=J;break;case">":$=U>J;break;case">=":$=U>=J;break}return $}}function Be(U,J){var le=!1;if(typeof U>"u"||typeof J>"u")return!1;Array.isArray(J)||(J=[J]);for(var $=0;$<J.length;$++)if(J[$]===U){le=!0;break}return le}async function Qe(U,J,le){var $,F=We(U);switch(le){case"and":$=F&&We(await J());break;case"or":$=F||We(await J());break}return $}function We(U){var J=d.boolean(U);return typeof J>"u"?!1:J}function X(U,J){var le,$="",F="";return typeof U<"u"&&($=d.string(U)),typeof J<"u"&&(F=d.string(J)),le=$.concat(F),le}async function oe(U,J,le){var $={},F={},q=!!(J&&J.tupleStream);Array.isArray(J)||(J=L(J)),J.length===0&&J.push(void 0);for(var ve=0;ve<J.length;ve++)for(var ce=J[ve],Ie=q?pe(le,ce):le,nt=0;nt<U.lhs.length;nt++){var Tt=U.lhs[nt],$t=await Z(Tt[0],q?ce["@"]:ce,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 dn={data:ce,exprIndex:nt};if(F.hasOwnProperty($t)){if(F[$t].exprIndex!==nt)throw{code:"D1009",stack:new Error().stack,position:U.position,value:$t};F[$t].data=d.append(F[$t].data,ce)}else F[$t]=dn}}let zt=await Promise.all(Object.keys(F).map(async(pn,Xn)=>{let an=F[pn];var ae=an.data,Ye=le;if(q){var at=K(an.data);ae=at["@"],delete at["@"],Ye=pe(le,at)}return le.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 le=1;le<U.length;le++)for(const $ in U[le])J[$]=d.append(J[$],U[le][$]);return J}function Te(U,J){var le;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 le;var $=J-U+1;if($>1e7)throw{code:"D2014",stack:new Error().stack,value:$};le=new Array($);for(var F=U,q=0;F<=J;F++,q++)le[q]=F;return le.sequence=!0,le}async function te(U,J,le){var $=await Z(U.rhs,J,le);return le.bind(U.lhs.value,$),$}async function De(U,J,le){var $,F=await Z(U.condition,J,le);return d.boolean(F)?$=await Z(U.then,J,le):typeof U.else<"u"&&($=await Z(U.else,J,le)),$}async function Ee(U,J,le){for(var $,F=Dn(le),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),le=function($,F){var q;J.lastIndex=F||0;var ve=J.exec($);if(ve!==null){if(q={match:ve[0],start:ve.index,end:ve.index+ve[0].length,groups:[]},ve.length>1)for(var ce=1;ce<ve.length;ce++)q.groups.push(ve[ce]);q.next=function(){if(!(J.lastIndex>=$.length)){var Ie=le($,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 le}function rt(U,J,le){var $;return U.value===""?$=J&&J.outerWrapper?J[0]:J:$=le.lookup(U.value),$}async function Lt(U,J,le){var $,F=J,q=!!J.tupleStream,ve=async function(Ie,nt){for(var Tt=0,$t=0;Tt===0&&$t<U.terms.length;$t++){var dn=U.terms[$t],zt=Ie,bn=le;q&&(zt=Ie["@"],bn=pe(le,Ie));var pn=await Z(dn.expression,zt,bn);zt=nt,bn=le,q&&(zt=nt["@"],bn=pe(le,nt));var Xn=await Z(dn.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,dn.descending===!0&&(Tt=-Tt))}return Tt===1},ce={environment:le,input:J};return $=await d.sort.apply(ce,[F,ve]),$}function Dt(U,J,le){var $=async function(F){if(!(typeof F>"u")){var q=le.lookup("clone");if(!j(q))throw{code:"T2013",stack:new Error().stack,position:U.position};var ve=await lt(q,[F],null,le),ce=await Z(U.pattern,ve,le);if(typeof ce<"u"){Array.isArray(ce)||(ce=[ce]);for(var Ie=0;Ie<ce.length;Ie++){var nt=ce[Ie];if(nt&&(nt.isPrototypeOf(ve)||nt instanceof Object.constructor))throw{code:"D1010",stack:new Error().stack,position:U.position};var Tt=await Z(U.update,nt,le),$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 dn in Tt)nt[dn]=Tt[dn]}if(typeof U.delete<"u"){var zt=await Z(U.delete,nt,le);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 nt=="object"&&nt!==null&&delete nt[zt[pn]]}}}}return ve}};return He($,"<(oa):o>")}var vt=b("function($f, $g) { function($x){ $g($f($x)) } }");async function yt(U,J,le){var $,F=await Z(U.lhs,J,le);if(U.rhs.type==="function")$=await St(U.rhs,J,le,{context:F});else{var q=await Z(U.rhs,J,le);if(!j(q))throw{code:"T2006",stack:new Error().stack,position:U.position,value:q};if(j(F)){var ve=await Z(vt,null,le);$=await lt(ve,[F,q],null,le)}else $=await lt(q,[F],null,le)}return $}async function St(U,J,le,$){var F,q=await Z(U.procedure,J,le);if(typeof q>"u"&&U.procedure.type==="path"&&le.lookup(U.procedure.steps[0].value))throw{code:"T1005",stack:new Error().stack,position:U.position,token:U.procedure.steps[0].value};var ve=[];typeof $<"u"&&ve.push($.context);for(var ce=0;ce<U.arguments.length;ce++){const nt=await Z(U.arguments[ce],J,le);if(j(nt)){const Tt=async function(...$t){return await lt(nt,$t,null,le)};Tt.arity=V(nt),ve.push(Tt)}else ve.push(nt)}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,ve,J,le)}catch(nt){throw nt.position||(nt.position=U.position),nt.token||(nt.token=Ie),nt}return F}async function lt(U,J,le,$){var F;for(F=await sn(U,J,le,$);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 ve=[],ce=0;ce<F.body.arguments.length;ce++)ve.push(await Z(F.body.arguments[ce],F.input,F.environment));F=await sn(q,ve,le,$)}return F}async function sn(U,J,le,$){var F;try{var q=J;if(U&&(q=un(U.signature,J,le)),G(U))F=await Tn(U,q);else if(U&&U._jsonata_function===!0){var ve={environment:$,input:le};F=U.implementation.apply(ve,q),Y(F)&&(F=F.next().value),k(F)&&(F=await F)}else if(typeof U=="function")F=U.apply(le,q),k(F)&&(F=await F);else throw{code:"T1006",stack:new Error().stack}}catch(ce){throw U&&(typeof ce.token>"u"&&typeof U.token<"u"&&(ce.token=U.token),ce.position=U.position||ce.position),ce}return F}function mn(U,J,le){var $={_jsonata_lambda:!0,input:J,environment:le,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:le)},$}async function fn(U,J,le){for(var $,F=[],q=0;q<U.arguments.length;q++){var ve=U.arguments[q];ve.type==="operator"&&ve.value==="?"?F.push(ve):F.push(await Z(ve,J,le))}var ce=await Z(U.procedure,J,le);if(typeof ce>"u"&&U.procedure.type==="path"&&le.lookup(U.procedure.steps[0].value))throw{code:"T1007",stack:new Error().stack,position:U.position,token:U.procedure.steps[0].value};if(G(ce))$=rr(ce,F);else if(ce&&ce._jsonata_function===!0)$=or(ce.implementation,F);else if(typeof ce=="function")$=or(ce,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,le){if(typeof U>"u")return J;var $=U.validate(J,le);return $}async function Tn(U,J){var le,$=Dn(U.environment);return U.arguments.forEach(function(F,q){$.bind(F.value,J[q])}),typeof U.body=="function"?le=await it(U.body,$):le=await Z(U.body,U.input,$),le}function rr(U,J){var le=Dn(U.environment),$=[];U.arguments.forEach(function(q,ve){var ce=J[ve];ce&&ce.type==="operator"&&ce.value==="?"?$.push(q):le.bind(q.value,ce)});var F={_jsonata_lambda:!0,input:U.input,environment:le,arguments:$,body:U.body};return F}function or(U,J){var le=ot(U);le=le.map(function(ve){return"$"+ve.trim()});var $="function("+le.join(", ")+"){ _ }",F=b($);F.body=U;var q=rr(F,J);return q}async function it(U,J){var le=ot(U),$=le.map(function(ve){return J.lookup(ve.trim())}),F={environment:J},q=U.apply(F,$);return k(q)&&(q=await q),q}function ot(U){var J=U.toString(),le=/\(([^)]*)\)/.exec(J)[1],$=le.split(",");return $}function He(U,J){var le={_jsonata_function:!0,implementation:U};return typeof J<"u"&&(le.signature=S(J)),le}async function cn(U,J){if(!(typeof U>"u")){var le=this.input;typeof J<"u"&&(le=J,Array.isArray(le)&&!P(le)&&(le=L(le),le.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($,le,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(d.string(U))}function Dn(U){var J={};const le={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,le)}return le}z.bind("sum",He(d.sum,"<a<n>:n>")),z.bind("count",He(d.count,"<a:n>")),z.bind("max",He(d.max,"<a<n>:n>")),z.bind("min",He(d.min,"<a<n>:n>")),z.bind("average",He(d.average,"<a<n>:n>")),z.bind("string",He(d.string,"<x-b?:s>")),z.bind("substring",He(d.substring,"<s-nn?:s>")),z.bind("substringBefore",He(d.substringBefore,"<s-s:s>")),z.bind("substringAfter",He(d.substringAfter,"<s-s:s>")),z.bind("lowercase",He(d.lowercase,"<s-:s>")),z.bind("uppercase",He(d.uppercase,"<s-:s>")),z.bind("length",He(d.length,"<s-:n>")),z.bind("trim",He(d.trim,"<s-:s>")),z.bind("pad",He(d.pad,"<s-ns?:s>")),z.bind("match",He(d.match,"<s-f<s:o>n?:a<o>>")),z.bind("contains",He(d.contains,"<s-(sf):b>")),z.bind("replace",He(d.replace,"<s-(sf)(sf)n?:s>")),z.bind("split",He(d.split,"<s-(sf)n?:a<s>>")),z.bind("join",He(d.join,"<a<s>s?:s>")),z.bind("formatNumber",He(d.formatNumber,"<n-so?:s>")),z.bind("formatBase",He(d.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(d.number,"<(nsb)-:n>")),z.bind("floor",He(d.floor,"<n-:n>")),z.bind("ceil",He(d.ceil,"<n-:n>")),z.bind("round",He(d.round,"<n-n?:n>")),z.bind("abs",He(d.abs,"<n-:n>")),z.bind("sqrt",He(d.sqrt,"<n-:n>")),z.bind("power",He(d.power,"<n-n:n>")),z.bind("random",He(d.random,"<:n>")),z.bind("boolean",He(d.boolean,"<x-:b>")),z.bind("not",He(d.not,"<x-:b>")),z.bind("map",He(d.map,"<af>")),z.bind("zip",He(d.zip,"<a+>")),z.bind("filter",He(d.filter,"<af>")),z.bind("single",He(d.single,"<af?>")),z.bind("reduce",He(d.foldLeft,"<afj?:j>")),z.bind("sift",He(d.sift,"<o-f?:o>")),z.bind("keys",He(d.keys,"<x-:a<s>>")),z.bind("lookup",He(d.lookup,"<x-s:x>")),z.bind("append",He(d.append,"<xx:a>")),z.bind("exists",He(d.exists,"<x:b>")),z.bind("spread",He(d.spread,"<x-:a<o>>")),z.bind("merge",He(d.merge,"<a<o>:o>")),z.bind("reverse",He(d.reverse,"<a:a>")),z.bind("each",He(d.each,"<o-f:a>")),z.bind("error",He(d.error,"<s?:x>")),z.bind("assert",He(d.assert,"<bs?:x>")),z.bind("type",He(d.type,"<x:s>")),z.bind("sort",He(d.sort,"<af?:a>")),z.bind("shuffle",He(d.shuffle,"<a:a>")),z.bind("distinct",He(d.distinct,"<x:x>")),z.bind("base64encode",He(d.base64encode,"<s-:s>")),z.bind("base64decode",He(d.base64decode,"<s-:s>")),z.bind("encodeUrlComponent",He(d.encodeUrlComponent,"<s-:s>")),z.bind("encodeUrl",He(d.encodeUrl,"<s-:s>")),z.bind("decodeUrlComponent",He(d.decodeUrlComponent,"<s-:s>")),z.bind("decodeUrl",He(d.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 le=J.replace(/\{\{\{([^}]+)}}}/g,function(){return U[arguments[1]]});le=le.replace(/\{\{([^}]+)}}/g,function(){return JSON.stringify(U[arguments[1]])}),U.message=le}}function qe(U,J){var le,$;try{le=b(U,J&&J.recover),$=le.errors,delete le.errors}catch(ve){throw Ln(ve),ve}var F=Dn(z),q=new Date;return F.bind("now",He(function(ve,ce){return p.fromMillis(q.getTime(),ve,ce)},"<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(ve,ce,Ie){if(typeof $<"u"){var nt={code:"S0500",position:0};throw Ln(nt),nt}if(typeof ce<"u"){var Tt;Tt=Dn(F);for(var $t in ce)Tt.bind($t,ce[$t])}else Tt=F;Tt.bind("$",ve),q=new Date,Tt.timestamp=q,Array.isArray(ve)&&!P(ve)&&(ve=L(ve),ve.outerWrapper=!0);var dn;try{return dn=await Z(le,ve,Tt),typeof Ie=="function"&&Ie(null,dn),dn}catch(zt){throw Ln(zt),zt}},assign:function(ve,ce){F.bind(ve,ce)},registerFunction:function(ve,ce,Ie){var nt=He(ce,Ie);F.bind(ve,nt)},ast:function(){return le},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 d=(()=>{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,Y){var k={type:G,value:Y,position:R};return k},P=function(){for(var G=R,Y=0,k,V,N=function(Z){if(w.charAt(Z)==="/"&&Y===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)!=="\\"&&Y++,(z===")"||z==="]"||z==="}")&&w.charAt(R-1)!=="\\"&&Y--,R++}throw{code:"S0302",stack:new Error().stack,position:R}},j=function(G){if(R>=A)return null;for(var Y=w.charAt(R);R<A&&`
3356
3356
  \r\v`.indexOf(Y)>-1;)R++,Y=w.charAt(R);if(Y==="/"&&w.charAt(R+1)==="*"){var k=R;for(R+=2,Y=w.charAt(R);!(Y==="*"&&w.charAt(R+1)==="/");)if(Y=w.charAt(++R),R>=A)throw{code:"S0106",stack:new Error().stack,position:k};return R+=2,Y=w.charAt(R),j(G)}if(G!==!0&&Y==="/")return R++,L("regex",P());if(Y==="."&&w.charAt(R+1)===".")return R+=2,L("operator","..");if(Y===":"&&w.charAt(R+1)==="=")return R+=2,L("operator",":=");if(Y==="!"&&w.charAt(R+1)==="=")return R+=2,L("operator","!=");if(Y===">"&&w.charAt(R+1)==="=")return R+=2,L("operator",">=");if(Y==="<"&&w.charAt(R+1)==="=")return R+=2,L("operator","<=");if(Y==="*"&&w.charAt(R+1)==="*")return R+=2,L("operator","**");if(Y==="~"&&w.charAt(R+1)===">")return R+=2,L("operator","~>");if(Y==="?"&&w.charAt(R+1)===":")return R+=2,L("operator","?:");if(Y==="?"&&w.charAt(R+1)==="?")return R+=2,L("operator","??");if(Object.prototype.hasOwnProperty.call(v,Y))return R++,L("operator",Y);if(Y==='"'||Y==="'"){var V=Y;R++;for(var N="";R<A;){if(Y=w.charAt(R),Y==="\\")if(R++,Y=w.charAt(R),Object.prototype.hasOwnProperty.call(b,Y))N+=b[Y];else if(Y==="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:Y};else{if(Y===V)return R++,L("string",N);N+=Y}R++}throw{code:"S0101",stack:new Error().stack,position:R}}var ie=/^-?(0|([1-9][0-9]*))(\.[0-9]+)?([Ee][-+]?[0-9]+)?/,pe=ie.exec(w.substring(R));if(pe!==null){var M=parseFloat(pe[0]);if(!isNaN(M)&&isFinite(M))return R+=pe[0].length,L("number",M);throw{code:"S0102",stack:new Error().stack,position:R,token:pe[0]}}var se;if(Y==="`"){R++;var we=w.indexOf("`",R);if(we!==-1)return se=w.substring(R,we),R=we+1,L("name",se);throw R=A,{code:"S0105",stack:new Error().stack,position:R}}for(var he=R,Ce;;)if(Ce=w.charAt(he),he===A||`
3357
- \r\v`.indexOf(Ce)>-1||Object.prototype.hasOwnProperty.call(v,Ce)){if(w.charAt(R)==="$")return se=w.substring(R+1,he),R=he,L("variable",se);switch(se=w.substring(R,he),R=he,se){case"or":case"in":case"and":return L("operator",se);case"true":return L("value",!0);case"false":return L("value",!1);case"null":return L("value",null);default:return R===A&&se===""?null:L("name",se)}}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 W=L();W!==null;)B.push(W),W=L();return B},Y={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,W){var $e=P[B];return W=W||0,$e?W>=$e.lbp&&($e.lbp=W):($e=Object.create(Y),$e.id=$e.value=B,$e.lbp=W,P[B]=$e),$e},V=function(B){if(R){B.remaining=G(),j.push(B);var W=P["(error)"];return A=Object.create(W),A.error=B,A.type="(error)",A}else throw B.stack=new Error().stack,B},N=function(B,W){if(B&&A.id!==B){var $e;A.id==="(end)"?$e="S0203":$e="S0202";var Be={code:$e,position:A.position,token:A.value,value:B};return V(Be)}var Qe=L(W);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 W,$e=A;for(N(null,!0),W=$e.nud();B<A.lbp;)$e=A,N(),W=$e.led(W);return W},Z=function(B){var W=k(B,0);W.nud=function(){return this}},ie=function(B,W,$e){var Be=W||v[B],Qe=k(B,Be);return Qe.led=$e||function(We){return this.lhs=We,this.rhs=z(Be),this.type="binary",this},Qe},pe=function(B,W,$e){var Be=k(B,W);return Be.led=$e,Be},M=function(B,W){var $e=k(B);return $e.nud=W||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}),pe("(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 W=A.position,$e=1,Be="<";$e>0&&A.id!=="{"&&A.id!=="(end)";){var Qe=N();Qe.id===">"?$e--:Qe.id==="<"&&$e++,Be+=Qe.value}N(">");try{this.signature=p(Be)}catch(We){return We.position=W+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 W=z(0);if(A.id===".."){var $e={type:"binary",value:"..",position:A.position,lhs:W};N(".."),$e.rhs=z(0),W=$e}if(B.push(W),A.id!==",")break;N(",")}return N("]",!0),this.expressions=B,this.type="unary",this}),ie("[",v["["],function(B){if(A.id==="]"){for(var W=B;W&&W.type==="binary"&&W.value==="[";)W=W.lhs;return W.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 W=[];;){var $e={descending:!1};if(A.id==="<"?N("<"):A.id===">"&&($e.descending=!0,N(">")),$e.expression=z(0),W.push($e),A.id!==",")break;N(",")}return N(")"),this.lhs=B,this.rhs=W,this.type="binary",this});var se=function(B){var W=[];if(A.id!=="}")for(;;){var $e=z(0);N(":");var Be=z(0);if(W.push([$e,Be]),A.id!==",")break;N(",")}return N("}",!0),typeof B>"u"?(this.lhs=W,this.type="unary"):(this.lhs=B,this.rhs=W,this.type="binary"),this};M("{",se),ie("{",v["{"],se),pe(":=",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 we=function(B){var W;if(B.type==="function"&&!B.predicate){var $e={type:"lambda",thunk:!0,arguments:[],position:B.position};$e.body=B,W=$e}else if(B.type==="condition")B.then=we(B.then),typeof B.else<"u"&&(B.else=we(B.else)),W=B;else if(B.type==="block"){var Be=B.expressions.length;Be>0&&(B.expressions[Be-1]=we(B.expressions[Be-1])),W=B}else W=B;return W},he=0,Ce=0,ue=[],fe=function(B,W){switch(B.type){case"name":case"wildcard":W.level--,W.level===0&&(typeof B.ancestor>"u"||(ue[W.index].slot.label=B.ancestor.label),B.ancestor=W,B.tuple=!0);break;case"parent":W.level++;break;case"block":B.expressions.length>0&&(B.tuple=!0,W=fe(B.expressions[B.expressions.length-1],W));break;case"path":B.tuple=!0;var $e=B.steps.length-1;for(W=fe(B.steps[$e--],W);W.level>0&&$e>=0;)W=fe(B.steps[$e--],W);break;default:throw{code:"S0217",token:B.type,position:B.position}}return W},ye=function(B,W){if(typeof W.seekingParent<"u"||W.type==="parent"){var $e=typeof W.seekingParent<"u"?W.seekingParent:[];W.type==="parent"&&$e.push(W.slot),typeof B.seekingParent>"u"?B.seekingParent=$e:Array.prototype.push.apply(B.seekingParent,$e)}},me=function(B){var W=B.steps.length-1,$e=B.steps[W],Be=typeof $e.seekingParent<"u"?$e.seekingParent:[];$e.type==="parent"&&Be.push($e.slot);for(var Qe=0;Qe<Be.length;Qe++){var We=Be[Qe];for(W=B.steps.length-2;We.level>0;){if(W<0){typeof B.seekingParent>"u"?B.seekingParent=[We]:B.seekingParent.push(We);break}for(var X=B.steps[W--];W>=0&&X.focus&&B.steps[W].focus;)X=B.steps[W--];We=fe(X,We)}}},ne=function(B){var W;switch(B.type){case"binary":switch(B.value){case".":var $e=ne(B.lhs);$e.type==="path"?W=$e:W={type:"path",steps:[$e]},$e.type==="parent"&&(W.seekingParent=[$e.slot]);var Be=ne(B.rhs);Be.type==="function"&&Be.procedure.type==="path"&&Be.procedure.steps.length===1&&Be.procedure.steps[0].type==="name"&&W.steps[W.steps.length-1].type==="function"&&(W.steps[W.steps.length-1].nextFunction=Be.procedure.steps[0].value),Be.type==="path"?Array.prototype.push.apply(W.steps,Be.steps):(typeof Be.predicate<"u"&&(Be.stages=Be.predicate,delete Be.predicate),W.steps.push(Be)),W.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"}),W.steps.filter(function(Fe){return Fe.keepArray===!0}).length>0&&(W.keepSingletonArray=!0);var Qe=W.steps[0];Qe.type==="unary"&&Qe.value==="["&&(Qe.consarray=!0);var We=W.steps[W.steps.length-1];We.type==="unary"&&We.value==="["&&(We.consarray=!0),me(W);break;case"[":W=ne(B.lhs);var X=W,oe="predicate";if(W.type==="path"&&(X=W.steps[W.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=ne(B.rhs);typeof K.seekingParent<"u"&&(K.seekingParent.forEach(Fe=>{Fe.level===1?fe(X,Fe):Fe.level--}),ye(X,K)),X[oe].push({type:"filter",expr:K,position:B.position});break;case"{":if(W=ne(B.lhs),typeof W.group<"u")throw{code:"S0210",stack:new Error().stack,position:B.position};W.group={lhs:B.rhs.map(function(Fe){return[ne(Fe[0]),ne(Fe[1])]}),position:B.position};break;case"^":W=ne(B.lhs),W.type!=="path"&&(W={type:"path",steps:[W]});var Te={type:"sort",position:B.position};Te.terms=B.rhs.map(function(Fe){var rt=ne(Fe.expression);return ye(Te,rt),{descending:Fe.descending,expression:rt}}),W.steps.push(Te),me(W);break;case":=":W={type:"bind",value:B.value,position:B.position},W.lhs=ne(B.lhs),W.rhs=ne(B.rhs),ye(W,W.rhs);break;case"@":if(W=ne(B.lhs),X=W,W.type==="path"&&(X=W.steps[W.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"#":W=ne(B.lhs),X=W,W.type==="path"?X=W.steps[W.steps.length-1]:(W={type:"path",steps:[W]},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"~>":W={type:"apply",value:B.value,position:B.position},W.lhs=ne(B.lhs),W.rhs=ne(B.rhs),W.keepArray=W.lhs.keepArray||W.rhs.keepArray;break;default:W={type:B.type,value:B.value,position:B.position},W.lhs=ne(B.lhs),W.rhs=ne(B.rhs),ye(W,W.lhs),ye(W,W.rhs)}break;case"unary":W={type:B.type,value:B.value,position:B.position},B.value==="["?W.expressions=B.expressions.map(function(Fe){var rt=ne(Fe);return ye(W,rt),rt}):B.value==="{"?W.lhs=B.lhs.map(function(Fe){var rt=ne(Fe[0]);ye(W,rt);var Lt=ne(Fe[1]);return ye(W,Lt),[rt,Lt]}):(W.expression=ne(B.expression),B.value==="-"&&W.expression.type==="number"?(W=W.expression,W.value=-W.value):ye(W,W.expression));break;case"function":case"partial":W={type:B.type,name:B.name,value:B.value,position:B.position},W.arguments=B.arguments.map(function(Fe){var rt=ne(Fe);return ye(W,rt),rt}),W.procedure=ne(B.procedure);break;case"lambda":W={type:B.type,arguments:B.arguments,signature:B.signature,position:B.position};var te=ne(B.body);W.body=we(te);break;case"condition":W={type:B.type,position:B.position},W.condition=ne(B.condition),ye(W,W.condition),W.then=ne(B.then),ye(W,W.then),typeof B.else<"u"&&(W.else=ne(B.else),ye(W,W.else));break;case"transform":W={type:B.type,position:B.position},W.pattern=ne(B.pattern),W.update=ne(B.update),typeof B.delete<"u"&&(W.delete=ne(B.delete));break;case"block":W={type:B.type,position:B.position},W.expressions=B.expressions.map(function(Fe){var rt=ne(Fe);return ye(W,rt),(rt.consarray||rt.type==="path"&&rt.steps[0].consarray)&&(W.consarray=!0),rt});break;case"name":W={type:"path",steps:[B]},B.keepArray&&(W.keepSingletonArray=!0);break;case"parent":W={type:"parent",slot:{label:"!"+he++,level:1,index:Ce++}},ue.push(W);break;case"string":case"number":case"value":case"wildcard":case"descendant":case"variable":case"regex":W=B;break;case"operator":if(B.value==="and"||B.value==="or"||B.value==="in")B.type="name",W=ne(B);else if(B.value==="?")W=B;else throw{code:"S0201",stack:new Error().stack,position:B.position,token:B.value};break;case"error":W=B,B.lhs&&(W=ne(B.lhs));break;default:var De="S0206";B.id==="(end)"&&(De="S0207");var Ee={code:De,position:B.position,token:B.value};if(R)return j.push(Ee),{type:"error",error:Ee};throw Ee.stack=new Error().stack,Ee}return B.keepArray&&(W.keepArray=!0),W};L=S(w),N();var ee=z(0);if(A.id!=="(end)"){var Re={code:"S0201",position:A.position,token:A.value};V(Re)}if(ee=ne(ee),ee.type==="parent"||typeof ee.seekingParent<"u")throw{code:"S0217",token:ee.type,position:ee.position};return j.length>0&&(ee.errors=j),ee};return T})();s.exports=d},{"./signature":5}],5:[function(i,s,c){var p=i("./utils");const d=(()=>{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,pe,M,se){for(var we=1,he=pe;he<ie.length;)if(he++,L=ie.charAt(he),L===se){if(we--,we===0)break}else L===M&&we++;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,"(",")"),Y=S.substring(T+1,G);if(Y.indexOf("<")===-1)R.regex="["+Y+"m]";else throw{code:"S0402",stack:new Error().stack,value:Y,offset:T};R.type="("+Y+")",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 pe;if(p.isFunction(ie))pe="f";else{var M=typeof ie;switch(M){case"string":pe="s";break;case"number":pe="n";break;case"boolean":pe="b";break;case"object":ie===null?pe="l":Array.isArray(ie)?pe="a":pe="o";break;case"undefined":default:pe="m"}}return pe},Z=function(ie,pe){for(var M="^",se=0,we=0;we<w.length;we++){M+=w[we].regex;var he=pe.match(M);if(he===null)throw{code:"T0410",stack:new Error().stack,value:ie[se],index:se+1};se=he[0].length}throw{code:"T0410",stack:new Error().stack,value:ie[se],index:se+1}};return{definition:S,validate:function(ie,pe){var M="";ie.forEach(function(Ce){M+=z(Ce)});var se=N.exec(M);if(se){var we=[],he=0;return w.forEach(function(Ce,ue){var fe=ie[he],ye=se[ue+1];if(ye==="")if(Ce.context&&Ce.contextRegex){var me=z(pe);if(Ce.contextRegex.test(me))we.push(pe);else throw{code:"T0411",stack:new Error().stack,value:pe,index:he+1}}else we.push(fe),he++;else ye.split("").forEach(function(ne){if(Ce.type==="a"){if(ne==="m")fe=void 0;else{fe=ie[he];var ee=!0;if(typeof Ce.subtype<"u"){if(ne!=="a"&&ye!==Ce.subtype)ee=!1;else if(ne==="a"&&fe.length>0){var Re=z(fe[0]);if(Re!==Ce.subtype.charAt(0))ee=!1;else{var B=fe.filter(function(W){return z(W)!==Re});ee=B.length===0}}}if(!ee)throw{code:"T0412",stack:new Error().stack,value:fe,index:he+1,type:v[Ce.subtype]};ne!=="a"&&(fe=[fe])}we.push(fe),he++}else we.push(fe),he++})}),we}Z(ie,M)}}}return b})();s.exports=d},{"./utils":6}],6:[function(i,s,c){const p=(()=>{function d(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!d(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 Y(k){var V=[];for(let N of k)V.push(N);return V}return{isNumeric:d,isArrayOfStrings:v,isArrayOfNumbers:b,createSequence:S,isSequence:T,isFunction:w,isLambda:A,isIterable:P,getFunctionArity:R,isDeepEqual:j,stringToArray:Y,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 d=r(s),v=String(d||"").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(d)?d.some(k=>String(k).toLowerCase().trim().includes(b)):v.includes(b);case"not_contains":case"not_includes":return Array.isArray(d)?!d.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 d!=null&&v!=="";case"not_exists":case"is_empty":return d==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:Ue.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(d=>d.shouldRender);for(const d of s){if(oU(d)&&!aU(d,r))return console.warn(`Required field is missing: ${d.name||((c=d.props)==null?void 0:c.propertyId)||d.id}`),!1;if((p=d.props)!=null&&p.propertyId&&i(d.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:d=!0,formidavimHost:v})=>{const[b,S]=Ue.useState(0),[T,w]=Ue.useState([]),[R,A]=Ue.useState(!0),{evaluateCondition:L}=rU(),{getFlowValue:P,getAllFlowData:j,setDisableSubmitValue:G,getDisableSubmitValue:Y,getFlowError:k,setCurrentFormValue:V}=Nr(),N=Nr().getAllFlowData(),z=async ue=>{if(!ue)return[];const fe=[];for(const ye of ue){const me=!ye.condition||await L(ye.condition),ne=me;fe.push({...ye,isVisible:me,shouldRender:ne,hasCondition:!!ye.condition})}return fe};Ue.useEffect(()=>{S(0)},[e.slug]),Ue.useEffect(()=>{const ue=async()=>{var ye;if(!e.flowForms){w([]),A(!1);return}const fe=[];for(const me of e.flowForms)if(!me.condition||await L(me.condition)){const ee=(ye=me.form)!=null&&ye.formComponents?await z(me.form.formComponents):[];fe.push({...me,evaluatedFormComponents:ee})}w(fe),A(!1)};A(!0),ue()},[e.flowForms,L]),Ue.useEffect(()=>{if(!R&&T.length>0&&b<T.length){const ue=T[b],fe=(ue==null?void 0:ue.evaluatedFormComponents)||[],ye=q$(fe,P,k);G(!ye)}},[T,b,R,N,P,G]);const Z=T.length,ie=T[b],pe=Y();if(Ue.useEffect(()=>{ie&&V(ie)},[ie,V]),R)return I.jsx("div",{children:"Loading..."});if(!ie)return null;const M=T[0]===ie,se=b===Z-1,we=(ie==null?void 0:ie.evaluatedFormComponents)||[],he=()=>{if(q$(we,P,k)){if(ie.submit){s(j(),e,d);return}c&&c(e,ie),b<Z-1&&(S(fe=>fe+1),setTimeout(()=>{window.scrollTo({top:0,behavior:"smooth"})},0))}},Ce=()=>{b>0&&(p&&p(e,ie),S(ue=>ue-1)),window.scrollTo({top:0,behavior:"smooth"})};return I.jsxs(iM,{children:[I.jsxs(fM,{$tracker:!0,id:"FormHeaderMobile",children:[I.jsx(uO,{src:"https://media-s3-cdn.ivimhealth.com/assets/images/logos/ivim-black.svg"}),I.jsx(dM,{id:"FlowStepTrackerContainerMobile"}),!M&&I.jsx(lM,{onClick:Ce})]}),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:Ce}),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:we,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:se,$radius:"41px",$margin:"0 0 15px 0",$btnStyle:"black",$disable:pe,children:ie.navButtonText?ie.navButtonText:"Next"})})}),I.jsx(pM,{id:"BtnFlowBtnWrapperMobile",children:I.jsx(sO,{type:"submit",onClick:he,$isLastStep:se,$radius:"41px",$margin:"0 0 15px 0",$btnStyle:"black",$disable:pe,$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],d=c[1].trim();try{const v=await GA(d).evaluate(r),b=v??"";typeof b!="object"?s=s.replace(p,String(b)):s=b}catch(v){console.warn(`Failed to process template expression: "${d}"`,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:d,shouldRedirect:v,formidavimHost:b})=>{const{setFlowValues:S,resetAndSetFlowValues:T,generateFormDataFromFlow:w,setPatientValues:R,getFullPatient:A,setCurrentFlowValue:L}=Nr(),[P,j]=Ue.useState(null),[G,Y]=Ue.useState(!0),[k,V]=Ue.useState(!1),N=async(ie,pe=!1,M=!1)=>{try{const se=await lU(r,ie);if(j(se),L(se),M&&d&&(r!=null&&r.id)&&(r!=null&&r.slug)&&d(r),pe){const we=w(se);T(we)}}catch(se){if(console.error("Error processing config:",se),j(r),L(r),M&&d&&(r!=null&&r.id)&&(r!=null&&r.slug)&&d(r),pe){const we=w(r);T(we)}}},z=ie=>{const pe={};return ie.flowForms&&(ie.flowForms.forEach(M=>{var se;(se=M.form)!=null&&se.formComponents&&M.form.formComponents.forEach(we=>{if(we.componentId==="hidden"&&we.props){const he=we.props,{propertyId:Ce,jsonataExpression:ue}=he;Ce&&ue!=null&&(pe[Ce]=String(ue),console.log("Renderer - extracted hidden value:",Ce,"=",String(ue)))}})}),Object.keys(pe).length>0&&console.log("Renderer - total hidden values extracted:",pe)),pe};Ue.useEffect(()=>{(async()=>{Y(!0);const pe=z(r),M=e?{...e,...pe}:Object.keys(pe).length>0?pe:e;M&&R(M),await N(M,!0,!0),V(!0),Y(!1)})()},[e,r]);const Z=A();return Ue.useEffect(()=>{k&&Z&&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)"},dU={colors:sU,fonts:uU,mediaQuery:cU},fU=s5({reducer:{[V0.name]:V0.reducer,[F0.name]:F0.reducer}}),pU=be.div`
3357
+ \r\v`.indexOf(Ce)>-1||Object.prototype.hasOwnProperty.call(v,Ce)){if(w.charAt(R)==="$")return se=w.substring(R+1,he),R=he,L("variable",se);switch(se=w.substring(R,he),R=he,se){case"or":case"in":case"and":return L("operator",se);case"true":return L("value",!0);case"false":return L("value",!1);case"null":return L("value",null);default:return R===A&&se===""?null:L("name",se)}}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 W=L();W!==null;)B.push(W),W=L();return B},Y={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,W){var $e=P[B];return W=W||0,$e?W>=$e.lbp&&($e.lbp=W):($e=Object.create(Y),$e.id=$e.value=B,$e.lbp=W,P[B]=$e),$e},V=function(B){if(R){B.remaining=G(),j.push(B);var W=P["(error)"];return A=Object.create(W),A.error=B,A.type="(error)",A}else throw B.stack=new Error().stack,B},N=function(B,W){if(B&&A.id!==B){var $e;A.id==="(end)"?$e="S0203":$e="S0202";var Be={code:$e,position:A.position,token:A.value,value:B};return V(Be)}var Qe=L(W);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 W,$e=A;for(N(null,!0),W=$e.nud();B<A.lbp;)$e=A,N(),W=$e.led(W);return W},Z=function(B){var W=k(B,0);W.nud=function(){return this}},ie=function(B,W,$e){var Be=W||v[B],Qe=k(B,Be);return Qe.led=$e||function(We){return this.lhs=We,this.rhs=z(Be),this.type="binary",this},Qe},pe=function(B,W,$e){var Be=k(B,W);return Be.led=$e,Be},M=function(B,W){var $e=k(B);return $e.nud=W||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}),pe("(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 W=A.position,$e=1,Be="<";$e>0&&A.id!=="{"&&A.id!=="(end)";){var Qe=N();Qe.id===">"?$e--:Qe.id==="<"&&$e++,Be+=Qe.value}N(">");try{this.signature=p(Be)}catch(We){return We.position=W+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 W=z(0);if(A.id===".."){var $e={type:"binary",value:"..",position:A.position,lhs:W};N(".."),$e.rhs=z(0),W=$e}if(B.push(W),A.id!==",")break;N(",")}return N("]",!0),this.expressions=B,this.type="unary",this}),ie("[",v["["],function(B){if(A.id==="]"){for(var W=B;W&&W.type==="binary"&&W.value==="[";)W=W.lhs;return W.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 W=[];;){var $e={descending:!1};if(A.id==="<"?N("<"):A.id===">"&&($e.descending=!0,N(">")),$e.expression=z(0),W.push($e),A.id!==",")break;N(",")}return N(")"),this.lhs=B,this.rhs=W,this.type="binary",this});var se=function(B){var W=[];if(A.id!=="}")for(;;){var $e=z(0);N(":");var Be=z(0);if(W.push([$e,Be]),A.id!==",")break;N(",")}return N("}",!0),typeof B>"u"?(this.lhs=W,this.type="unary"):(this.lhs=B,this.rhs=W,this.type="binary"),this};M("{",se),ie("{",v["{"],se),pe(":=",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 we=function(B){var W;if(B.type==="function"&&!B.predicate){var $e={type:"lambda",thunk:!0,arguments:[],position:B.position};$e.body=B,W=$e}else if(B.type==="condition")B.then=we(B.then),typeof B.else<"u"&&(B.else=we(B.else)),W=B;else if(B.type==="block"){var Be=B.expressions.length;Be>0&&(B.expressions[Be-1]=we(B.expressions[Be-1])),W=B}else W=B;return W},he=0,Ce=0,ue=[],fe=function(B,W){switch(B.type){case"name":case"wildcard":W.level--,W.level===0&&(typeof B.ancestor>"u"||(ue[W.index].slot.label=B.ancestor.label),B.ancestor=W,B.tuple=!0);break;case"parent":W.level++;break;case"block":B.expressions.length>0&&(B.tuple=!0,W=fe(B.expressions[B.expressions.length-1],W));break;case"path":B.tuple=!0;var $e=B.steps.length-1;for(W=fe(B.steps[$e--],W);W.level>0&&$e>=0;)W=fe(B.steps[$e--],W);break;default:throw{code:"S0217",token:B.type,position:B.position}}return W},ye=function(B,W){if(typeof W.seekingParent<"u"||W.type==="parent"){var $e=typeof W.seekingParent<"u"?W.seekingParent:[];W.type==="parent"&&$e.push(W.slot),typeof B.seekingParent>"u"?B.seekingParent=$e:Array.prototype.push.apply(B.seekingParent,$e)}},me=function(B){var W=B.steps.length-1,$e=B.steps[W],Be=typeof $e.seekingParent<"u"?$e.seekingParent:[];$e.type==="parent"&&Be.push($e.slot);for(var Qe=0;Qe<Be.length;Qe++){var We=Be[Qe];for(W=B.steps.length-2;We.level>0;){if(W<0){typeof B.seekingParent>"u"?B.seekingParent=[We]:B.seekingParent.push(We);break}for(var X=B.steps[W--];W>=0&&X.focus&&B.steps[W].focus;)X=B.steps[W--];We=fe(X,We)}}},ne=function(B){var W;switch(B.type){case"binary":switch(B.value){case".":var $e=ne(B.lhs);$e.type==="path"?W=$e:W={type:"path",steps:[$e]},$e.type==="parent"&&(W.seekingParent=[$e.slot]);var Be=ne(B.rhs);Be.type==="function"&&Be.procedure.type==="path"&&Be.procedure.steps.length===1&&Be.procedure.steps[0].type==="name"&&W.steps[W.steps.length-1].type==="function"&&(W.steps[W.steps.length-1].nextFunction=Be.procedure.steps[0].value),Be.type==="path"?Array.prototype.push.apply(W.steps,Be.steps):(typeof Be.predicate<"u"&&(Be.stages=Be.predicate,delete Be.predicate),W.steps.push(Be)),W.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"}),W.steps.filter(function(Fe){return Fe.keepArray===!0}).length>0&&(W.keepSingletonArray=!0);var Qe=W.steps[0];Qe.type==="unary"&&Qe.value==="["&&(Qe.consarray=!0);var We=W.steps[W.steps.length-1];We.type==="unary"&&We.value==="["&&(We.consarray=!0),me(W);break;case"[":W=ne(B.lhs);var X=W,oe="predicate";if(W.type==="path"&&(X=W.steps[W.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=ne(B.rhs);typeof K.seekingParent<"u"&&(K.seekingParent.forEach(Fe=>{Fe.level===1?fe(X,Fe):Fe.level--}),ye(X,K)),X[oe].push({type:"filter",expr:K,position:B.position});break;case"{":if(W=ne(B.lhs),typeof W.group<"u")throw{code:"S0210",stack:new Error().stack,position:B.position};W.group={lhs:B.rhs.map(function(Fe){return[ne(Fe[0]),ne(Fe[1])]}),position:B.position};break;case"^":W=ne(B.lhs),W.type!=="path"&&(W={type:"path",steps:[W]});var Te={type:"sort",position:B.position};Te.terms=B.rhs.map(function(Fe){var rt=ne(Fe.expression);return ye(Te,rt),{descending:Fe.descending,expression:rt}}),W.steps.push(Te),me(W);break;case":=":W={type:"bind",value:B.value,position:B.position},W.lhs=ne(B.lhs),W.rhs=ne(B.rhs),ye(W,W.rhs);break;case"@":if(W=ne(B.lhs),X=W,W.type==="path"&&(X=W.steps[W.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"#":W=ne(B.lhs),X=W,W.type==="path"?X=W.steps[W.steps.length-1]:(W={type:"path",steps:[W]},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"~>":W={type:"apply",value:B.value,position:B.position},W.lhs=ne(B.lhs),W.rhs=ne(B.rhs),W.keepArray=W.lhs.keepArray||W.rhs.keepArray;break;default:W={type:B.type,value:B.value,position:B.position},W.lhs=ne(B.lhs),W.rhs=ne(B.rhs),ye(W,W.lhs),ye(W,W.rhs)}break;case"unary":W={type:B.type,value:B.value,position:B.position},B.value==="["?W.expressions=B.expressions.map(function(Fe){var rt=ne(Fe);return ye(W,rt),rt}):B.value==="{"?W.lhs=B.lhs.map(function(Fe){var rt=ne(Fe[0]);ye(W,rt);var Lt=ne(Fe[1]);return ye(W,Lt),[rt,Lt]}):(W.expression=ne(B.expression),B.value==="-"&&W.expression.type==="number"?(W=W.expression,W.value=-W.value):ye(W,W.expression));break;case"function":case"partial":W={type:B.type,name:B.name,value:B.value,position:B.position},W.arguments=B.arguments.map(function(Fe){var rt=ne(Fe);return ye(W,rt),rt}),W.procedure=ne(B.procedure);break;case"lambda":W={type:B.type,arguments:B.arguments,signature:B.signature,position:B.position};var te=ne(B.body);W.body=we(te);break;case"condition":W={type:B.type,position:B.position},W.condition=ne(B.condition),ye(W,W.condition),W.then=ne(B.then),ye(W,W.then),typeof B.else<"u"&&(W.else=ne(B.else),ye(W,W.else));break;case"transform":W={type:B.type,position:B.position},W.pattern=ne(B.pattern),W.update=ne(B.update),typeof B.delete<"u"&&(W.delete=ne(B.delete));break;case"block":W={type:B.type,position:B.position},W.expressions=B.expressions.map(function(Fe){var rt=ne(Fe);return ye(W,rt),(rt.consarray||rt.type==="path"&&rt.steps[0].consarray)&&(W.consarray=!0),rt});break;case"name":W={type:"path",steps:[B]},B.keepArray&&(W.keepSingletonArray=!0);break;case"parent":W={type:"parent",slot:{label:"!"+he++,level:1,index:Ce++}},ue.push(W);break;case"string":case"number":case"value":case"wildcard":case"descendant":case"variable":case"regex":W=B;break;case"operator":if(B.value==="and"||B.value==="or"||B.value==="in")B.type="name",W=ne(B);else if(B.value==="?")W=B;else throw{code:"S0201",stack:new Error().stack,position:B.position,token:B.value};break;case"error":W=B,B.lhs&&(W=ne(B.lhs));break;default:var De="S0206";B.id==="(end)"&&(De="S0207");var Ee={code:De,position:B.position,token:B.value};if(R)return j.push(Ee),{type:"error",error:Ee};throw Ee.stack=new Error().stack,Ee}return B.keepArray&&(W.keepArray=!0),W};L=S(w),N();var ee=z(0);if(A.id!=="(end)"){var Re={code:"S0201",position:A.position,token:A.value};V(Re)}if(ee=ne(ee),ee.type==="parent"||typeof ee.seekingParent<"u")throw{code:"S0217",token:ee.type,position:ee.position};return j.length>0&&(ee.errors=j),ee};return T})();s.exports=d},{"./signature":5}],5:[function(i,s,c){var p=i("./utils");const d=(()=>{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,pe,M,se){for(var we=1,he=pe;he<ie.length;)if(he++,L=ie.charAt(he),L===se){if(we--,we===0)break}else L===M&&we++;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,"(",")"),Y=S.substring(T+1,G);if(Y.indexOf("<")===-1)R.regex="["+Y+"m]";else throw{code:"S0402",stack:new Error().stack,value:Y,offset:T};R.type="("+Y+")",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 pe;if(p.isFunction(ie))pe="f";else{var M=typeof ie;switch(M){case"string":pe="s";break;case"number":pe="n";break;case"boolean":pe="b";break;case"object":ie===null?pe="l":Array.isArray(ie)?pe="a":pe="o";break;case"undefined":default:pe="m"}}return pe},Z=function(ie,pe){for(var M="^",se=0,we=0;we<w.length;we++){M+=w[we].regex;var he=pe.match(M);if(he===null)throw{code:"T0410",stack:new Error().stack,value:ie[se],index:se+1};se=he[0].length}throw{code:"T0410",stack:new Error().stack,value:ie[se],index:se+1}};return{definition:S,validate:function(ie,pe){var M="";ie.forEach(function(Ce){M+=z(Ce)});var se=N.exec(M);if(se){var we=[],he=0;return w.forEach(function(Ce,ue){var fe=ie[he],ye=se[ue+1];if(ye==="")if(Ce.context&&Ce.contextRegex){var me=z(pe);if(Ce.contextRegex.test(me))we.push(pe);else throw{code:"T0411",stack:new Error().stack,value:pe,index:he+1}}else we.push(fe),he++;else ye.split("").forEach(function(ne){if(Ce.type==="a"){if(ne==="m")fe=void 0;else{fe=ie[he];var ee=!0;if(typeof Ce.subtype<"u"){if(ne!=="a"&&ye!==Ce.subtype)ee=!1;else if(ne==="a"&&fe.length>0){var Re=z(fe[0]);if(Re!==Ce.subtype.charAt(0))ee=!1;else{var B=fe.filter(function(W){return z(W)!==Re});ee=B.length===0}}}if(!ee)throw{code:"T0412",stack:new Error().stack,value:fe,index:he+1,type:v[Ce.subtype]};ne!=="a"&&(fe=[fe])}we.push(fe),he++}else we.push(fe),he++})}),we}Z(ie,M)}}}return b})();s.exports=d},{"./utils":6}],6:[function(i,s,c){const p=(()=>{function d(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!d(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 Y(k){var V=[];for(let N of k)V.push(N);return V}return{isNumeric:d,isArrayOfStrings:v,isArrayOfNumbers:b,createSequence:S,isSequence:T,isFunction:w,isLambda:A,isIterable:P,getFunctionArity:R,isDeepEqual:j,stringToArray:Y,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 d=r(s),v=String(d||"").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(d)?d.some(k=>String(k).toLowerCase().trim().includes(b)):v.includes(b);case"not_contains":case"not_includes":return Array.isArray(d)?!d.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 d!=null&&v!=="";case"not_exists":case"is_empty":return d==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:Ue.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(d=>d.shouldRender);for(const d of s){if(oU(d)&&!aU(d,r))return console.warn(`Required field is missing: ${d.name||((c=d.props)==null?void 0:c.propertyId)||d.id}`),!1;if((p=d.props)!=null&&p.propertyId&&i(d.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:d=!0,formidavimHost:v})=>{const[b,S]=Ue.useState(0),[T,w]=Ue.useState([]),[R,A]=Ue.useState(!0),{evaluateCondition:L}=rU(),{getFlowValue:P,getAllFlowData:j,setDisableSubmitValue:G,getDisableSubmitValue:Y,getFlowError:k,setCurrentFormValue:V}=Nr(),N=Nr().getAllFlowData(),z=async ue=>{if(!ue)return[];const fe=[];for(const ye of ue){const me=!ye.condition||await L(ye.condition),ne=me;fe.push({...ye,isVisible:me,shouldRender:ne,hasCondition:!!ye.condition})}return fe};Ue.useEffect(()=>{S(0)},[e.slug]),Ue.useEffect(()=>{const ue=async()=>{var ye;if(!e.flowForms){w([]),A(!1);return}const fe=[];for(const me of e.flowForms)if(!me.condition||await L(me.condition)){const ee=(ye=me.form)!=null&&ye.formComponents?await z(me.form.formComponents):[];fe.push({...me,evaluatedFormComponents:ee})}w(fe),A(!1)};A(!0),ue()},[e.flowForms,L]),Ue.useEffect(()=>{if(!R&&T.length>0&&b<T.length){const ue=T[b],fe=(ue==null?void 0:ue.evaluatedFormComponents)||[],ye=q$(fe,P,k);G(!ye)}},[T,b,R,N,P,G]);const Z=T.length,ie=T[b],pe=Y();if(Ue.useEffect(()=>{ie&&V(ie)},[ie,V]),R)return I.jsx("div",{children:"Loading..."});if(!ie)return null;const M=T[0]===ie,se=b===Z-1,we=(ie==null?void 0:ie.evaluatedFormComponents)||[],he=()=>{if(q$(we,P,k)){if(ie.submit){s(j(),e,d);return}c&&c(e,ie),b<Z-1&&(S(fe=>fe+1),setTimeout(()=>{window.scrollTo({top:0,behavior:"smooth"})},0))}},Ce=()=>{b>0&&(p&&p(e,ie),S(ue=>ue-1)),window.scrollTo({top:0,behavior:"smooth"})};return I.jsxs(iM,{children:[I.jsxs(fM,{$tracker:!0,id:"FormHeaderMobile",children:[I.jsx(uO,{src:"https://media-s3-cdn.ivimhealth.com/assets/images/logos/ivim-black.svg"}),I.jsx(dM,{id:"FlowStepTrackerContainerMobile"}),!M&&I.jsx(lM,{onClick:Ce})]}),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:Ce}),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:we,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:se,$radius:"41px",$margin:"0 0 15px 0",$btnStyle:"black",$disable:pe,children:ie.navButtonText?ie.navButtonText:"Next"})})}),I.jsx(pM,{id:"BtnFlowBtnWrapperMobile",children:I.jsx(sO,{type:"submit",onClick:he,$isLastStep:se,$radius:"41px",$margin:"0 0 15px 0",$btnStyle:"black",$disable:pe,$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],d=c[1].trim();try{const v=await GA(d).evaluate(r),b=v??"";typeof b!="object"?s=s.replace(p,String(b)):s=b}catch(v){console.warn(`Failed to process template expression: "${d}"`,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:d,shouldRedirect:v,formidavimHost:b})=>{const{setFlowValues:S,resetAndSetFlowValues:T,generateFormDataFromFlow:w,setPatientValues:R,getFullPatient:A,setCurrentFlowValue:L}=Nr(),[P,j]=Ue.useState(null),[G,Y]=Ue.useState(!0),[k,V]=Ue.useState(!1),N=async(ie,pe=!1,M=!1)=>{try{const se=await lU(r,ie);if(j(se),L(se),M&&d&&(r!=null&&r.id)&&(r!=null&&r.slug)&&d(r),pe){const we=w(se);T(we)}}catch(se){if(console.error("Error processing config:",se),j(r),L(r),M&&d&&(r!=null&&r.id)&&(r!=null&&r.slug)&&d(r),pe){const we=w(r);T(we)}}},z=ie=>{const pe={};return ie.flowForms&&(ie.flowForms.forEach(M=>{var se;(se=M.form)!=null&&se.formComponents&&M.form.formComponents.forEach(we=>{if(we.componentId==="hidden"&&we.props){const he=we.props,{propertyId:Ce,jsonataExpression:ue}=he;Ce&&ue!=null&&(pe[Ce]=String(ue),console.log("Renderer - extracted hidden value:",Ce,"=",String(ue)))}})}),Object.keys(pe).length>0&&console.log("Renderer - total hidden values extracted:",pe)),pe};Ue.useEffect(()=>{(async()=>{Y(!0);const pe=z(r);let M=e;Object.keys(pe).length>0&&(e&&typeof e=="object"&&"data"in e&&typeof e.data=="object"?M={...e,data:{...e.data,...pe}}:e?M={...e,...pe}:M=pe),M&&R(M),await N(M,!0,!0),V(!0),Y(!1)})()},[e,r]);const Z=A();return Ue.useEffect(()=>{k&&Z&&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)"},dU={colors:sU,fonts:uU,mediaQuery:cU},fU=s5({reducer:{[V0.name]:V0.reducer,[F0.name]:F0.reducer}}),pU=be.div`
3358
3358
  &&{
3359
3359
  width: 100%;
3360
3360
  min-height: calc(100vh - 100px);
package/index.mjs CHANGED
@@ -48056,8 +48056,15 @@ const WA = /* @__PURE__ */ KC(oU), aU = async (e, r, i) => {
48056
48056
  Rn(() => {
48057
48057
  (async () => {
48058
48058
  Y(!0);
48059
- const pe = z(r), M = e ? { ...e, ...pe } : Object.keys(pe).length > 0 ? pe : e;
48060
- M && R(M), await N(M, !0, !0), V(!0), Y(!1);
48059
+ const pe = z(r);
48060
+ let M = e;
48061
+ Object.keys(pe).length > 0 && (e && typeof e == "object" && "data" in e && typeof e.data == "object" ? M = {
48062
+ ...e,
48063
+ data: {
48064
+ ...e.data,
48065
+ ...pe
48066
+ }
48067
+ } : e ? M = { ...e, ...pe } : M = pe), M && R(M), await N(M, !0, !0), V(!0), Y(!1);
48061
48068
  })();
48062
48069
  }, [e, r]);
48063
48070
  const Z = A();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hievilmath/browser-formidavim",
3
- "version": "1.4.38",
3
+ "version": "1.4.39",
4
4
  "main": "./index.js",
5
5
  "module": "./index.mjs",
6
6
  "typings": "./index.d.ts",