@inploi/plugin-chatbot 10.0.0 → 11.0.0

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.
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index-da8d6977.cjs");require("@inploi/sdk");var nt=({condition:e,context:t,submissions:r,ifBlock:s})=>{let[o,...a]=e.compareKey.split(".");if(!o)return!1;let l=n.$({context:t,key:o,path:a,submissions:r});if(!l)return!1;switch(l.type){case"address":{let i=n.v(l.value,a);switch(e.compare){case"equals":return i===e.compareValue;case"contains":return typeof i!="string"?!1:i.includes(e.compareValue);case"notEquals":return i!==e.compareValue;case"notContains":return typeof i!="string"?!0:!i.includes(e.compareValue)}break}case"integration":{if(typeof l.value!="object"||Array.isArray(l.value))return!1;let i=n.v(l.value,a),f={...s,data:{compareKey:"_temp",compare:e.compare,compareValue:e.compareValue}};switch(typeof i){case"boolean":return xe(f,{submissions:{_temp:{value:i,type:"boolean"}},context:t});case"string":return xe(f,{submissions:{_temp:{value:i,type:"string"}},context:t});case"number":return xe(f,{submissions:{_temp:{value:i,type:"number"}},context:t});case"object":return Array.isArray(i)&&i.every(p=>typeof p=="string")?xe(f,{submissions:{_temp:{value:i,type:"enum"}},context:t}):!1}break}case"boolean":{let i=e.compareValue==="true";switch(e.compare){case"equals":return l.value===i;case"notEquals":return l.value!==i}break}case"phone":case"string":{let i=l.type==="phone"?n.C(l.value):l.value;switch(e.compare){case"equals":return i===e.compareValue;case"contains":return i?i.includes(e.compareValue):!1;case"notEquals":return i!==e.compareValue;case"notContains":return i?!i.includes(e.compareValue):!0}break}case"number":{try{let i=Number(e.compareValue);switch(e.compare){case"equals":return l.value===i;case"notEquals":return l.value!==i;case"greaterThan":return l.value>i;case"greaterThanOrEqualTo":return l.value>=i;case"lessThan":return l.value<i;case"lessThanOrEqualTo":return l.value<=i}}catch{return console.error(`Failed to parse number in if-block ${s.id}`,l.value),!1}break}case"enum":switch(e.compare){case"equals":return l.value.length===1&&l.value[0]===e.compareValue;case"notEquals":return l.value.length===1&&l.value[0]!==e.compareValue;case"contains":return l.value.includes(e.compareValue);case"notContains":return!l.value.includes(e.compareValue)}break}},xe=(e,{context:t,submissions:r})=>{let s="combinator"in e.data?e.data.conditions:[e.data];if(("combinator"in e.data?e.data.combinator:"and")==="or"){for(let o of s)if(nt({condition:o,context:t,submissions:r,ifBlock:e}))return!0;return!1}else{for(let o of s)if(!nt({condition:o,context:t,submissions:r,ifBlock:e}))return!1;return!0}},rr=/{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g,nr=(e,{context:t,submissions:r})=>e.replace(rr,(s,o,a="")=>{let[l,...i]=o.trim().split("."),f=n.$({key:l,path:i,submissions:r,context:t});if(!f)return a;switch(f.type){case"boolean":return f.value===!0?"true":"false";case"file":return f.value.map(p=>`${p.name} (${n.A(p.sizeKb)})`).join(", ");case"enum":return f.value.join(", ");case"address":return Object.values(f.value).filter(p=>p&&p.trim().length>0).join(", ");case"number":case"string":return f.value?f.value.toString():a;case"phone":return n.C(f.value);case"integration":{if(typeof f.value!="object"||Array.isArray(f.value))break;let p=n.v(f.value,i);switch(typeof p){case"boolean":return p===!0?"true":"false";case"string":return p;case"number":return p.toString();case"object":if(Array.isArray(p)&&p.every(C=>typeof C=="string"))return p.join(", ")}break}}return a});const Ft=({context:e,submissions:t})=>({context:e,submissions:t??{}}),Y=(e,t)=>nr(e,Ft(t)),sr=(e,t)=>xe(e,Ft(t)),At=({node:e,nodes:t,stopWhen:r})=>{if((r==null?void 0:r(e))===!0)return e;const s=e.nextId?t.find(o=>o.id===e.nextId):void 0;if(s)return At({node:s,nodes:t,stopWhen:r})},ar=({childNode:e,nodes:t})=>{const s=t.filter(o=>o.type==="if-block").find(o=>{if(!o.branchId)return!1;const a=t.find(i=>i.id===o.branchId);if(!a)return!1;const l=At({node:a,nodes:t,stopWhen:i=>i.id===e.id});return!(!l||l.id!==e.id)});if(s!=null&&s.nextId)return t.find(o=>o.id===s.nextId)},ir=({flow:e,analytics:t,logger:r,talentBankClient:s,context:o,apiClient:a,getSubmissions:l,chatService:i,onFlowEnd:f,onInterpret:p,t:C})=>{let v=new AbortController;const h={...t.service,log:b=>t.service.log({...b,customProperties:{...b.customProperties,...t.customProperties}})},y=async(b,E)=>{if(v.signal.aborted)return;const V=l();p==null||p(b,E);try{await or({flow:e,analytics:h,logger:r,talentBankClient:s,apiClient:a,context:o,node:b,submissions:V,t:C,chat:{sendMessage:async x=>i.send({groupId:b.id,message:x,signal:v.signal}),userInput:async x=>i.input({input:x,signal:v.signal}),addToSubmissions:(x,_)=>{v.signal.aborted||i.addToSubmissions(x,_)}},next:x=>{const _=x?e.nodes.find(A=>A.id===x):ar({childNode:b,nodes:e.nodes});return _?y(_,b):f==null?void 0:f(b)},end:()=>f==null?void 0:f(b)})}catch(x){if(x instanceof n.AbortedError)return;throw x}};return{interpret:async b=>{const E=e.nodes.find(V=>V.id===b)??n.getHeadOrThrow(e.nodes);return y(E)},undo:b=>{let E=1;const V=e.nodes.find(_=>_.id===b[b.length-1]);for(let _=b.length-2;_>0;_--){const A=b[_],D=e.nodes.find(I=>I.id===A);if(!D||(E++,D.type.startsWith("question-")))break}v.abort(),v=new AbortController;const x=e.nodes.find(_=>_.id===b[b.length-E]);return n.invariant(x,"Undo failed: new start node not found"),y(x,V),{removed:E}},abort:()=>{v.abort()}}},It=e=>`+${e.countryCode} ${e.phoneNumber}`;async function or(e){const t=e.node;switch(t.type){case"text":return gr({...e,node:t});case"image":return yr({...e,node:t});case"question-text":return br({...e,node:t});case"question-enum":return wr({...e,node:t});case"question-number":return vr({...e,node:t});case"question-phone":return xr({...e,node:t});case"question-boolean":return kr({...e,node:t});case"question-file":return Cr({...e,node:t});case"question-address":return _r({...e,node:t});case"end-flow":return Sr({...e,node:t});case"if-block":return mr({...e,node:t});case"jump":return dr({...e,node:t});case"link":return pr({...e,node:t});case"integration-application-submit":return hr({...e,node:t});case"add-submission":return fr({...e,node:t});case"integration-workflow-get":throw Error("Workflow should be unreachable");case"identify":return cr({...e,node:t});case"check-duplicate":return ur({...e,node:t});case"feedback":return lr({...e,node:t});default:throw new Error(`Unknown node: ${JSON.stringify(t)}`)}}const fe=(e,t)=>{var s;const r=(s=e[t])==null?void 0:s.value;if(typeof r!="string"&&typeof r!="number")throw new Error(`Submission at “${t}” is not a string or number`);return r};async function lr({next:e,node:t}){e(t.nextId)}async function cr({next:e,node:t,analytics:r,submissions:s,logger:o}){if(!s)return e(t.nextId);try{r.log({event:"IDENTIFY",properties:{identifier:fe(s,t.data.key).toString(),first_name:t.data.firstName?fe(s,t.data.firstName).toString():void 0,last_name:t.data.lastName?fe(s,t.data.lastName).toString():void 0,email:t.data.email?fe(s,t.data.email).toString():void 0,phone_number:t.data.phoneNumber?fe(s,t.data.phoneNumber).toString():void 0,custom_traits:t.data.customTraits?Object.fromEntries(t.data.customTraits.map(({key:a,value:l})=>{var i;return[a,(i=s[l])==null?void 0:i.value]})):void 0}})}catch(a){o.error(a)}finally{e(t.nextId)}}async function ur({next:e,node:t,talentBankClient:r,submissions:s,flow:o,logger:a,chat:l}){var f;let i={isDuplicate:!1};if(s&&r){const p=t.data.scope==="job"?(f=o.job)==null?void 0:f.id:void 0;if(t.data.scope==="company"||p!=null)try{i=await r.checkDuplicate({email:fe(s,t.data.email).toString(),jobId:p,scope:t.data.scope})}catch(C){a.error("[check-duplicate]",C)}}l.addToSubmissions(t.data.key,{type:"integration",value:i}),e(t.nextId)}async function dr({next:e,node:t}){e(t.data.targetId)}async function fr({next:e,node:t,logger:r,submissions:s,context:o}){if(!s){r.error("Submissions not found");return}s[t.data.key]={type:"string",value:Y(t.data.value,{submissions:s,context:o})},e(t.nextId)}async function hr({chat:e,next:t,node:r,logger:s,apiClient:o,submissions:a,analytics:l,flow:i,t:f}){const p=async C=>{C!==!0&&await e.userInput({type:"submit",key:void 0,config:{label:r.data.submitLabel}}),await e.sendMessage({type:"loading"});const{anonymous_id:v,session_id:h}=l.getSessionInfo(),y=await o.fetch("/flow/submit",{method:"POST",body:JSON.stringify({log_submit:!1,integration_id:r.data.integrationId,anonymous_id:v,session_id:h,job:i.job,submissions:n.T(a||{})})}).catch(b=>b);r.data.key&&e.addToSubmissions(r.data.key,{type:"integration",value:y}),n.M(y).with({integration_response:n.z.select(n.z.union({service:n.z.optional(n.z.string),status:n.z.number,data:n.z.any},{service:n.z.optional(n.z.string),status:n.z.number,error:{message:n.z.string,data:n.z.any}}))},b=>{l.log({event:"FLOW_SUBMIT",properties:{flow_id:i.id,flow_version:i.version,flow_session_id:i.data.flowSessionId,flow_build:i.build,service:b.service??"INVALID_SERVICE",response:{status:b.status,payload:"data"in b?b.data:b.error.data??null},job:i.job}})}).otherwise(()=>{}),await n.M(y).with({integration_response:{data:n.z.select("redirect",{redirect_url:n.z.string,message:n.z.optional(n.z.union(n.z.string,n.z.nullish)),button_text:n.z.optional(n.z.union(n.z.string,n.z.nullish))})}},async b=>{await e.sendMessage({type:"text",author:"bot",text:b.redirect.message??f("submission_redirect_message")});try{const E=new URL(b.redirect.redirect_url);v&&!E.searchParams.has("anonymous_id")&&E.searchParams.set("anonymous_id",v),await e.sendMessage({type:"link",href:E.toString(),text:b.redirect.button_text??f("complete_submission"),onClick:()=>{if(!h){s.error("session_id not set, cannot log FLOW_REDIRECT event");return}l.log({event:"FLOW_REDIRECT",properties:{flow_build:i.build,flow_id:i.id,flow_session_id:h,flow_version:i.version,href:E.toString(),job:i.job}})}})}catch(E){s.error(`Invalid redirect URL: ${b.redirect.redirect_url}`,E),e.sendMessage({type:"system",variant:"error",text:f("redirect_url_error")})}t(r.nextId)}).with({success:!0},async()=>{r.data.skipConfirmation!==!0&&await e.sendMessage({type:"system",variant:"success",text:f("submission_completed")}),t(r.nextId)}).with({integration_response:{error:n.z.select("error",{message:n.z.string})}},async b=>{s.error(b.error),await e.sendMessage({type:"system",variant:"error",text:b.error.message||f("submission_failed")}),await p(!1)}).otherwise(async b=>{s.error(b),await e.sendMessage({type:"system",variant:"error",text:f("submission_failed")}),await p(!1)})};await p(r.data.skipConfirmation)}async function pr({chat:e,next:t,node:r,submissions:s,context:o}){await e.sendMessage({type:"link",href:Y(r.data.href,{submissions:s,context:o}),text:Y(r.data.cta,{submissions:s,context:o})}),t(r.nextId)}async function mr({submissions:e,next:t,node:r,context:s}){t(sr(r,{submissions:e,context:s})?r.branchId:r.nextId)}async function gr({chat:e,next:t,node:r,submissions:s,context:o}){await e.sendMessage({author:"bot",type:"text",text:Y(r.data.text,{submissions:s,context:o})}),t(r.nextId)}async function yr({chat:e,next:t,node:r}){await e.sendMessage({author:"bot",type:"image",url:r.data.url,height:r.data.height,width:r.data.width}),t(r.nextId)}async function br({chat:e,next:t,node:r,submissions:s,context:o,t:a}){await e.sendMessage({author:"bot",type:"text",text:Y(r.data.question,{submissions:s,context:o})});const l=r.data.format==="phone"?await e.userInput({key:r.data.key,type:"phone",config:{optional:r.data.optional,placeholder:r.data.placeholder,minChars:r.data.minChars,maxChars:r.data.maxChars,submissionFormat:"text",defaultValue:{}}}):await e.userInput({key:r.data.key,type:"text",config:{optional:r.data.optional,placeholder:r.data.placeholder,format:r.data.format,maxChars:r.data.maxChars,minChars:r.data.minChars}});l===null?await e.sendMessage({type:"system",variant:"info",text:a("skipped")}):await e.sendMessage({author:"user",type:"text",text:l.type==="phone"?It(l.value):l.value}),t(r.nextId)}async function vr({chat:e,next:t,node:r,submissions:s,context:o,t:a}){await e.sendMessage({author:"bot",type:"text",text:Y(r.data.question,{submissions:s,context:o})});const l=await e.userInput({key:r.data.key,type:"number",config:{max:r.data.max,min:r.data.min,optional:r.data.optional,placeholder:r.data.placeholder,decimalCases:r.data.decimalCases}});l===null?await e.sendMessage({type:"system",variant:"info",text:a("skipped")}):await e.sendMessage({author:"user",type:"text",text:l.value.toString()}),t(r.nextId)}async function xr({chat:e,next:t,node:r,submissions:s,context:o}){await e.sendMessage({author:"bot",type:"text",text:Y(r.data.question,{submissions:s,context:o})});const a=await e.userInput({key:r.data.key,type:"phone",config:{minChars:r.data.minChars,defaultValue:{countryCode:r.data.defaultCountryCode},placeholder:r.data.placeholder,submissionFormat:"phone",optional:r.data.optional}});a===null?await e.sendMessage({type:"system",variant:"info",text:"Skipped"}):await e.sendMessage({author:"user",type:"text",text:a.type==="phone"?It(a.value):a.value}),t(r.nextId)}async function wr({chat:e,next:t,node:r,submissions:s,context:o,t:a}){await e.sendMessage({author:"bot",type:"text",text:Y(r.data.question,{submissions:s,context:o})});const l=await e.userInput({key:r.data.key,type:"multiple-choice",config:r.data});l.value.length===0?await e.sendMessage({type:"system",variant:"info",text:a("skipped")}):await e.sendMessage({author:"user",type:"text",text:r.data.options.filter(i=>l.value.includes(i.value)).map(i=>i.label).join(", ")}),t(r.nextId)}async function kr({chat:e,next:t,node:r,submissions:s,context:o,t:a}){await e.sendMessage({author:"bot",type:"text",text:Y(r.data.question,{submissions:s,context:o})});const l=await e.userInput({key:r.data.key,type:"boolean",config:{optional:r.data.optional,labels:{true:r.data.trueLabel,false:r.data.falseLabel}}});l===null?await e.sendMessage({type:"system",variant:"info",text:a("skipped")}):await e.sendMessage({author:"user",type:"text",text:l.value===!0?r.data.trueLabel:r.data.falseLabel}),t(r.nextId)}async function _r({chat:e,next:t,node:r,t:s}){await e.sendMessage({author:"bot",type:"text",text:r.data.question});const o=await e.userInput({type:"address",key:r.data.key,config:{optional:r.data.optional,keys:r.data.keys,placeholder:r.data.placeholder}});if(o===null)await e.sendMessage({type:"system",variant:"info",text:s("skipped")});else{const a=Object.values(o.value).filter(l=>l&&l.trim().length>0).join(", ");await e.sendMessage({author:"user",type:"text",text:a})}return t(r.nextId)}async function Cr({node:e,chat:t,next:r,submissions:s,context:o,t:a}){await t.sendMessage({author:"bot",type:"text",text:Y(e.data.question,{submissions:s,context:o})});const l=await t.userInput({key:e.data.key,type:"file",config:{optional:e.data.optional,extensions:e.data.extensions,fileSizeLimitKib:e.data.maxSizeKb??10*1024,allowMultiple:e.data.multiple===!0}});if(l===null)await t.sendMessage({type:"system",variant:"info",text:a("skipped")});else for(const i of l.value)await t.sendMessage({author:"user",type:"file",fileName:i.name,fileSizeKb:i.sizeKb});r(e.nextId)}async function Sr({chat:e,end:t,node:r}){await e.sendMessage({type:"system",variant:"info",text:r.data.systemMessage}),t()}function st(e,t){let r;return(...s)=>{window.clearTimeout(r),r=window.setTimeout(()=>e(...s),t)}}function Vr({debounce:e,scroll:t,polyfill:r,offsetSize:s}={debounce:0,scroll:!1,offsetSize:!1}){const o=r||(typeof window>"u"?class{}:window.ResizeObserver);if(!o)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[a,l]=n.h({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),i=n._({element:null,scrollContainers:null,resizeObserver:null,lastBounds:a,orientationHandler:null}),f=e?typeof e=="number"?e:e.scroll:null,p=e?typeof e=="number"?e:e.resize:null,C=n._(!1);n.p(()=>(C.current=!0,()=>void(C.current=!1)));const[v,h,y]=n.F(()=>{const x=()=>{if(!i.current.element)return;const{left:_,top:A,width:D,height:I,bottom:ae,right:ue,x:Q,y:re}=i.current.element.getBoundingClientRect(),j={left:_,top:A,width:D,height:I,bottom:ae,right:ue,x:Q,y:re};i.current.element instanceof HTMLElement&&s&&(j.height=i.current.element.offsetHeight,j.width=i.current.element.offsetWidth),Object.freeze(j),C.current&&!Ir(i.current.lastBounds,j)&&l(i.current.lastBounds=j)};return[x,p?st(x,p):x,f?st(x,f):x]},[l,s,f,p]);function b(){i.current.scrollContainers&&(i.current.scrollContainers.forEach(x=>x.removeEventListener("scroll",y,!0)),i.current.scrollContainers=null),i.current.resizeObserver&&(i.current.resizeObserver.disconnect(),i.current.resizeObserver=null),i.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",i.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",i.current.orientationHandler))}function E(){i.current.element&&(i.current.resizeObserver=new o(y),i.current.resizeObserver.observe(i.current.element),t&&i.current.scrollContainers&&i.current.scrollContainers.forEach(x=>x.addEventListener("scroll",y,{capture:!0,passive:!0})),i.current.orientationHandler=()=>{y()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",i.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",i.current.orientationHandler))}const V=x=>{!x||x===i.current.element||(b(),i.current.element=x,i.current.scrollContainers=Lt(x),E())};return Fr(y,!!t),Er(h),n.p(()=>{b(),E()},[t,y,h]),n.p(()=>b,[]),[V,a,v]}function Er(e){n.p(()=>{const t=e;return window.addEventListener("resize",t),()=>void window.removeEventListener("resize",t)},[e])}function Fr(e,t){n.p(()=>{if(t){const r=e;return window.addEventListener("scroll",r,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",r,!0)}},[e,t])}function Lt(e){const t=[];if(!e||e===document.body)return t;const{overflow:r,overflowX:s,overflowY:o}=window.getComputedStyle(e);return[r,s,o].some(a=>a==="auto"||a==="scroll")&&t.push(e),[...t,...Lt(e.parentElement)]}const Ar=["x","y","top","bottom","left","right","width","height"],Ir=(e,t)=>Ar.every(r=>e[r]===t[r]),le=({class:e,...t})=>{const{t:r}=n.useTranslation();return n.o("button",{class:n.clsx("bg-accent-9 active:bg-accent-10 pointer-coarse:touch-hitbox fr flex-shrink-0 rounded-full p-2 text-white transition-all disabled:cursor-not-allowed disabled:opacity-50",e),type:"submit",...t,children:n.o("svg",{class:"block",width:"16",height:"16",viewBox:"0 0 16 16",fill:"transparent",stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",children:[n.o("title",{children:r("send")}),n.o("path",{d:"M3.5 7.5L8 3L12.5 7.5"}),n.o("path",{d:"M8 4V13"})]})})},pe=({error:e})=>!e||!e.message?null:n.o("div",{role:"alert",class:"text-error-11 flex max-w-full items-center gap-1 overflow-hidden rounded-full px-2 py-2",children:[n.o("svg",{class:"text-error-9 h-4 w-4",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.o("circle",{cx:"8",cy:"8",r:"6.3",stroke:"currentColor","stroke-width":"1.4"}),n.o("rect",{x:"7",y:"4",width:"2",height:"5",fill:"currentColor"}),n.o("rect",{x:"7",y:"10",width:"2",height:"2",fill:"currentColor"})]}),n.o("p",{class:"truncate pr-1 text-sm",children:e.message})]}),ce=({class:e,...t})=>{const{t:r}=n.useTranslation();return n.o("button",{type:"button",class:n.clsx("fr touch-hitbox text-neutral-10 bg-neutral-1 ring-divider hover:ring-divider active:ring-interactive-bg-hover hover:text-neutral-12 active:text-neutral-12 hover:bg-divider active:bg-interactive-bg-hover flex flex-shrink-0 items-center justify-center gap-1 self-center rounded-full py-1 pl-2 pr-2.5 text-sm ring-1 transition-all",e),...t,children:[n.o("svg",{"aria-hidden":!0,class:"block",width:"16",height:"16",viewBox:"0 0 16 16",fill:"transparent",stroke:"currentColor","stroke-linecap":"round","stroke-width":"1.5",children:[n.o("title",{children:r("skip")}),n.o("path",{d:"M3.25 11.25A5 5 0 0 1 12 7"}),n.o("path",{d:"M13.25 4.5V8.25H9.5"})]}),r("skip")]})};var ze={Afghanistan:"93",Albania:"355",Algeria:"213","American Samoa":"1 684",Andorra:"376",Angola:"244",Anguilla:"1 264",Antarctica:"672","Antigua and Barbuda":"1 268",Argentina:"54",Armenia:"374",Aruba:"297",Australia:"61",Austria:"43",Azerbaijan:"994",Bahrain:"973",Bangladesh:"880",Barbados:"1 246",Belarus:"375",Belgium:"32",Belize:"501",Benin:"229",Bermuda:"1 441",Bhutan:"975",Bolivia:"591","Bosnia and Herzegovina":"387",Botswana:"267","Bouvet Island":"47",Brazil:"55","British Indian Ocean Territory":"246","British Virgin Islands":"1 284",Brunei:"673",Bulgaria:"359","Burkina Faso":"226",Burundi:"257","Cabo Verde":"238",Cambodia:"855",Cameroon:"237",Canada:"1","Caribbean Netherlands":"599","Cayman Islands":"1 345","Central African Republic":"236",Chad:"235",Chile:"56",China:"86","Christmas Island":"61","Cocos (Keeling) Islands":"61",Colombia:"57",Comoros:"269","Cook Islands":"682","Costa Rica":"506",Croatia:"385",Cuba:"53",Curaçao:"599",Cyprus:"357",Czechia:"420","Côte d'Ivoire":"225","Democratic Republic of the Congo":"243",Denmark:"45",Djibouti:"253","Dominican Republic":"1 809",Ecuador:"593",Egypt:"20","El Salvador":"503","Equatorial Guinea":"240",Eritrea:"291",Estonia:"372",Eswatini:"268",Ethiopia:"251","Falkland Islands (Islas Malvinas)":"500","Faroe Islands":"298",Fiji:"679",Finland:"358",France:"33","French Guiana":"594","French Polynesia":"689","French Southern and Antarctic Lands":"262",Gabon:"241",Georgia:"995",Germany:"49",Ghana:"233",Gibraltar:"350",Greece:"30",Greenland:"299",Grenada:"1 473",Guadeloupe:"590",Guam:"1 671",Guatemala:"502",Guernsey:"44",Guinea:"224","Guinea-Bissau":"245",Guyana:"592",Haiti:"509",Honduras:"504","Hong Kong":"852",Hungary:"36",Iceland:"354",India:"91",Indonesia:"62",Iran:"98",Iraq:"964",Ireland:"353","Isle of Man":"44",Israel:"972",Italy:"39",Jamaica:"1 876",Japan:"81",Jersey:"44",Jordan:"962",Kazakhstan:"7",Kenya:"254",Kiribati:"686",Kosovo:"383",Kuwait:"965",Kyrgyzstan:"996",Laos:"856",Latvia:"371",Lebanon:"961",Lesotho:"266",Liberia:"231",Libya:"218",Liechtenstein:"423",Lithuania:"370",Luxembourg:"352",Macao:"853",Madagascar:"261",Malawi:"265",Malaysia:"60",Maldives:"960",Mali:"223",Malta:"356","Marshall Islands":"692",Martinique:"596",Mauritania:"222",Mauritius:"230",Mayotte:"262",Mexico:"52",Micronesia:"691",Moldova:"373",Monaco:"377",Mongolia:"976",Montenegro:"382",Montserrat:"1 664",Morocco:"212",Mozambique:"258","Myanmar (Burma)":"95",Namibia:"264",Nauru:"674",Nepal:"977",Netherlands:"31","New Caledonia":"687","New Zealand":"64",Nicaragua:"505",Niger:"227",Nigeria:"234",Niue:"683","Norfolk Island":"672","North Korea":"850","North Macedonia":"389","Northern Mariana Islands":"1 670",Norway:"47",Oman:"968",Pakistan:"92",Palau:"680",Palestine:"970",Panama:"507","Papua New Guinea":"675",Paraguay:"595",Peru:"51",Philippines:"63","Pitcairn Islands":"64",Poland:"48",Portugal:"351","Puerto Rico":"1 787",Qatar:"974",Romania:"40",Russia:"7",Rwanda:"250",Réunion:"262","Saint Barthélemy":"590","Saint Helena, Ascension and Tristan da Cunha":"290","Saint Kitts and Nevis":"1 869","Saint Lucia":"1 758","Saint Martin":"590","Saint Pierre and Miquelon":"508","Saint Vincent and the Grenadines":"1 784",Samoa:"685","San Marino":"378","Saudi Arabia":"966",Senegal:"221",Serbia:"381",Seychelles:"248","Sierra Leone":"232",Singapore:"65","Sint Maarten":"1 721",Slovakia:"421",Slovenia:"386","Solomon Islands":"677",Somalia:"252","South Africa":"27","South Georgia and the South Sandwich Islands":"500","South Korea":"82","South Sudan":"211",Spain:"34","Sri Lanka":"94",Sudan:"249",Suriname:"597","Svalbard and Jan Mayen":"47",Sweden:"46",Switzerland:"41",Syria:"963","São Tomé and Príncipe":"239",Taiwan:"886",Tajikistan:"992",Tanzania:"255",Thailand:"66","The Bahamas":"1 242","The Gambia":"220","Timor-Leste":"670",Togo:"228",Tokelau:"690",Tonga:"676","Trinidad and Tobago":"1 868",Tunisia:"216",Turkmenistan:"993","Turks and Caicos Islands":"1 649",Tuvalu:"688",Türkiye:"90","U.S. Virgin Islands":"1 340",Uganda:"256",Ukraine:"380","United Arab Emirates":"971","United Kingdom":"44","United States":"1","United States Minor Outlying Islands":"1",Uruguay:"598",Uzbekistan:"998",Vanuatu:"678","Vatican City":"379",Venezuela:"58",Vietnam:"84","Wallis and Futuna":"681","Western Sahara":"212",Yemen:"967",Zambia:"260",Zimbabwe:"263","Åland Islands":"358"};const _e=n.cva("outline-divider ease-expo-out placeholder:text-neutral-10 text-neutral-12 focus-visible:outline-accent-7 caret-accent-9 bg-lowest py-1 text-base outline outline-2 transition-all",{variants:{optional:{true:"pr-16 pl-3",false:"pl-3 pr-3"}},defaultVariants:{optional:!1}}),Lr="https://api.mapbox.com/search/searchbox/v1/suggest",Mr="ZzRDWFU0dTZ3SF9aWk9RNGl6QzZaWS5RZmlFak13a0hPbGxXZXlNSGN5RUhObUJ6TXpSV08yUW5OdE5tSTZJU1lpd2lJb1JYYXRObmJ2Tm5iaGhHZWx4V1lpb2pJMUp5ZS5rcA==",Tr=e=>atob(e).split("").reverse().join(""),ee=n.object({name:n.string()}),Nr=n.object({suggestions:n.array(n.object({full_address:n.optional(n.string()),place_formatted:n.optional(n.string()),name:n.optional(n.string()),mapbox_id:n.string(),context:n.partial(n.object({address:ee,street:ee,neighborhood:ee,locality:ee,district:ee,place:ee,region:ee,postcode:ee,country:ee}))}))}),Dr=({logger:e,t})=>n.F(()=>{var s;const r=(s=n.store.current$.peek().flow)==null?void 0:s.data.flowSessionId;return r?{enabled:!0,getPredictions:async o=>{var v;const a=new URL(Lr);a.searchParams.set("q",o),a.searchParams.set("session_token",r);const l=(v=n.store.current$.peek().flow)==null?void 0:v.locationOrigin;l&&l.lat!==void 0&&l.lng!==void 0&&l.lat>=-90&&l.lat<=90&&l.lng>=-180&&l.lng<=180&&a.searchParams.set("proximity",`${l.lng},${l.lat}`),a.searchParams.set("access_token",Tr(Mr));const f=await fetch(a);if(!f.ok)return e.error("Failed to get address details",f),{ok:!1,error:t("address_error")};const p=n.safeParse(Nr,await f.json());if(p.success===!1)return e.error("Failed to parse address details",p.issues),{ok:!1,error:t("address_error")};const{suggestions:C}=p.output;return{ok:!0,data:C.map(h=>{var y,b,E,V,x,_,A,D,I;return{label:h.full_address??h.place_formatted??h.name??h.mapbox_id,id:h.mapbox_id,address:{line1:((y=h.context.address)==null?void 0:y.name)??((b=h.context.street)==null?void 0:b.name),line2:void 0,line3:((E=h.context.neighborhood)==null?void 0:E.name)??((V=h.context.locality)==null?void 0:V.name),city:((x=h.context.place)==null?void 0:x.name)??((_=h.context.district)==null?void 0:_.name),state:(A=h.context.region)==null?void 0:A.name,postcode:(D=h.context.postcode)==null?void 0:D.name,country:(I=h.context.country)==null?void 0:I.name}}})}}}:{enabled:!1}},[e,t]),at=e=>{const{t}=n.useTranslation();return n.o("button",{type:"button",class:"text-neutral-10 hover:bg-neutral-4 hover:text-neutral-12 hover:border-neutral-5 flex items-center gap-1 rounded-[18px] border border-solid border-transparent px-3 py-1 pl-1.5 text-sm transition-colors",...e,children:[n.o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",stroke:"currentColor","stroke-width":"1.5",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:n.o("path",{d:"M10 3L5 8L10 13"})}),n.o("span",{children:t("back")})]})},Or=({input:e,onSubmitSuccess:t,logger:r})=>{const{t:s}=n.useTranslation(),[o,a]=n.h(),[l,i]=n.h([]),{enabled:f,getPredictions:p}=Dr({logger:r,t:s}),[C,v]=n.h(f?"query":"manual"),[h,y]=n.h(""),[b,E]=n.h(),V=x=>{n.invariant(f,"Query state should not be enabled"),x=x.trim(),x!==(h==null?void 0:h.trim())&&(y(x),x===""&&i([]),E(void 0),p(x).then(_=>{if(_.ok===!1){i([]),E(_.error);return}i(_.data)}))};switch(C){case"query":return n.invariant(f,"Query state should not be enabled"),n.o(Rr,{input:e,onSkip:()=>t(null),onAddressSelect:x=>{if(x===""){a(void 0),v("manual");return}const _=l.find(A=>A.id===x);_&&(a(_.address),v("details"))},onAddressSearch:x=>{V(x)},suggestions:l,query:h,error:b});case"details":return n.invariant(o!==void 0),n.o(ot,{input:e,logger:r,onSubmitSuccess:t,addressFields:o,actions:n.o(at,{onClick:()=>{v("query")}})});case"manual":return n.o(ot,{logger:r,input:e,onSubmitSuccess:t,addressFields:{},actions:f?n.o(at,{onClick:()=>{v("query")}}):void 0})}},Rr=({input:e,onSkip:t,suggestions:r,onAddressSelect:s,query:o,onAddressSearch:a,error:l})=>{const{t:i}=n.useTranslation(),f=n._(null);return n.y(()=>{f.current&&(f.current.focus(),f.current.select())},[]),n.o(n.k,{children:[n.o("form",{noValidate:!0,onSubmit:p=>{p.preventDefault();const v=new FormData(p.currentTarget).get("address");typeof v=="string"&&a(v)},class:"flex gap-2 p-2.5",children:[n.o("div",{class:"group relative flex-1",children:[n.o("input",{ref:f,name:"address",id:"chat-address",autocomplete:"address-line1 country-name postal-code",autoFocus:!0,placeholder:e.config.placeholder||i("address_search"),defaultValue:o,class:_e({optional:!!e.config.optional,className:"w-full rounded-full"})}),n.o("button",{type:"submit",class:"touch-hitbox text-neutral-12 hover:bg-neutral-3 fr absolute bottom-0 right-0 top-0 flex cursor-pointer items-center gap-1 rounded-full px-3 transition-all",children:n.o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.o("g",{id:"inploi",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round",strokeWidth:"1.5",children:[n.o("circle",{cx:"7",cy:"7",r:"4"}),n.o("path",{d:"M10 10L13 13"})]}),n.o("span",{class:"sr-only",children:i("search")})]})})]}),e.config.optional&&n.o(ce,{class:"relative",onClick:t})]}),l?n.o(pe,{error:{message:l}}):null,n.o("ul",{children:[r.map(p=>n.o("li",{children:n.o("button",{class:"text-neutral-11 fr hover:bg-neutral-3 focus-visible:bg-neutral-3 hover:text-neutral-12 border-b-neutral-3 flex w-full items-center border border-b border-solid border-transparent px-4 py-3 text-sm transition-colors duration-100",onClick:()=>{s(p.id)},children:[n.o("span",{class:"flex-grow",children:p.label}),n.o("svg",{class:"flex-none",width:"16",height:"16",viewBox:"0 0 16 16",stroke:"currentColor","stroke-width":"1.5",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:n.o("path",{d:"M6 3L11 8L6 13"})})]})},p.id)),n.o("li",{children:n.o("button",{class:"text-neutral-11 fr hover:bg-neutral-3 focus-visible:bg-neutral-3 hover:text-neutral-12 border-b-neutral-3 flex w-full items-center border border-b border-solid border-transparent px-4 py-3 text-sm transition-colors duration-100",onClick:()=>{s("")},children:n.o("span",{class:"flex-grow",children:i("address_manual")})})},"")]})]})},it=["line1","line2","line3","city","state","postcode","country"],ot=({addressFields:e,onSubmitSuccess:t,actions:r,input:s})=>{const o=n._(null);n.y(()=>{if(o.current){const i=o.current.querySelector("input");i&&(i.focus(),i.select())}},[]);const a=Object.keys(ze),{t:l}=n.useTranslation();return n.o("form",{class:"bg-neutral-1/90 flex flex-col justify-end gap-2 p-2",onSubmit:i=>{const f=new FormData(i.currentTarget),p=Object.fromEntries(f.entries());t({type:"address",value:p})},children:[n.o("div",{class:"bg-neutral-3 border-neutral-5 grid items-center gap-1.5 rounded-2xl border pb-2 pl-4 pr-3 pt-3 [grid-template-columns:min-content_1fr]",ref:o,children:it.map((i,f)=>{const p=`isdk_${i}`,C=s.config.keys[i];return C?n.o(n.k,{children:[n.o("label",{for:p,class:"text-neutral-9 [&:has(+*>input:focus)]:text-neutral-11 w-24 pb-2 text-xs uppercase leading-3 tracking-widest transition-colors",children:l(i)}),n.o("div",{class:"flex flex-col items-stretch gap-1.5",children:[i==="country"?n.o("div",{class:"relative",children:[n.o("select",{class:"text-neutral-12 hover:bg-neutral-4 placeholder:text-neutral-8 focus:bg-neutral-5 w-full flex-1 appearance-none rounded-lg border-solid bg-transparent bg-none px-3 py-1.5 text-base transition-colors focus:outline-none",name:C,id:p,defaultValue:e[i],required:!0,children:[e.country&&!a.includes(e.country)?n.o("option",{value:e[i],children:e[i]}):n.o("option",{value:"",children:l("select_country")}),a.map(v=>n.o("option",{value:v,children:v},v))]}),n.o("svg",{class:"text-neutral-12 absolute bottom-2.5 right-2 flex items-center justify-center",width:"16",height:"16",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:n.o("path",{d:"M4 6.5L8 10.5L12 6.5"})})]}):n.o("input",{autoFocus:f===0?!0:void 0,class:"text-neutral-12 hover:bg-neutral-4 placeholder:text-neutral-8 focus:bg-neutral-5 flex-1 rounded-lg border-solid bg-transparent px-3 py-1.5 text-base transition-colors autofill:shadow-[inset_0_0_0_1000px_hsl(210_16.7%_97.6%)] focus:outline-none",name:C,id:p,defaultValue:e[i],required:!0}),f===it.length-1?n.o("hr",{class:"m-0 w-full border-b border-b-transparent"}):n.o("hr",{class:"border-b-neutral-5 m-0 w-full border-b border-solid"})]})]}):null})}),n.o("div",{class:"flex w-full flex-1 ",children:[n.o("div",{class:"flex-grow",children:r}),n.o(le,{class:"flex items-center justify-center"})]})]})},Pe=()=>{const e=n._(null);return n.p(()=>{var t;(t=e.current)==null||t.focus()},[]),e},Mt=["true","false"],Br=n.picklist(Mt),zr="answer",Tt="flex items-center flex-wrap gap-2 p-2.5",Nt="min-w-0 max-w-full flex-auto",Dt=n.k$1(({label:e,...t},r)=>n.o("button",{class:"bg-lowest ease-expo-out ring-divider text-neutral-12 active:ring-accent-7 active:bg-accent-2 active:text-accent-11 fr block w-full overflow-hidden rounded-2xl px-2 py-2.5 ring-2 transition-all selection:bg-transparent",...t,ref:r,children:n.o("p",{class:"text-center text-base",children:e})})),Pr=({input:e,onSubmitSuccess:t})=>{const r=Pe();return n.o("form",{noValidate:!0,class:"",onSubmit:s=>{s.preventDefault();const o=n.getFormSubmitter(s).value,a=n.parse(Br,o);t({type:"boolean",value:a==="true"})},children:[n.o("ul",{class:Tt,children:Mt.map((s,o)=>n.o("li",{class:Nt,children:n.o(Dt,{ref:o===0?r:null,type:"submit",name:zr,value:s,label:e.config.labels[s]},s)}))}),e.config.optional&&n.o("div",{class:"px-2 pb-2",children:n.o(ce,{class:"relative w-full",type:"button",onClick:()=>t(null)})})]})},jr=e=>new Promise((t,r)=>{const s=new FileReader;s.readAsDataURL(e),s.onload=()=>s.result?t(s.result.toString()):r("No result from reader"),s.onerror=r}),$r=e=>e.reduce((t,r)=>t+r.sizeKb,0),Ur=n.isSubmissionOfType("file"),lt=3,qr=({file:e,class:t,...r})=>{const s=e.name.split(".").pop(),o=e.name.replace(new RegExp(`.${s}$`),"");return n.o("div",{class:n.clsx("bg-accent-1 outline-accent-4 flex max-w-full gap-2 overflow-hidden rounded-lg px-3 py-2 text-sm outline",t),...r,children:[n.o("p",{"aria-label":"File name",class:"text-accent-12 flex flex-grow overflow-hidden",children:[n.o("span",{class:"block truncate",children:o}),n.o("span",{children:[".",s]})]}),n.o("p",{"aria-label":"File size",class:"text-accent-11",children:n.A(e.sizeKb)})]})},ct=({class:e,...t})=>n.o("li",{class:n.clsx("outline-neutral-6 text-neutral-11 bg-neutral-1 block rounded-md px-1 py-0.5 text-xs outline outline-1",e),...t}),Ot=e=>{const t=e.split(".").pop();if(!t)throw new Error("No file extension found");return t?"."+t:""},Hr=({allowedExtensions:e,files:t})=>{const r=e.map(s=>s.toLowerCase());return t.every(s=>r.includes(Ot(s.name).toLowerCase()))},Kr=(e,t)=>{const r=Ot(e);return`${e.replace(new RegExp(`${r}$`),"").slice(0,t)}${r}`},Gr=({input:e,onSubmitSuccess:t})=>{var v;const r=(v=n.store.current$.value.flow)==null?void 0:v.data.submissions[e.key],[s,o]=n.h(Ur(r)?r.value:[]),[a,l]=n.h(),i=s.length-lt,f=$r(s),p=Pe(),{t:C}=n.useTranslation();return n.o("form",{class:"flex flex-col gap-1 p-2.5",onSubmit:h=>(h.preventDefault(),l(void 0),s.length===0?l({type:"required",message:C("validation_file")}):e.config.extensions.length>0&&!Hr({allowedExtensions:e.config.extensions,files:s})?l({type:"validate",message:`${C("validation_file_ext",{ext:e.config.extensions.join(", ")})}`}):e.config.fileSizeLimitKib&&f>e.config.fileSizeLimitKib?l({type:"max",message:`File size exceeds limit of ${n.A(e.config.fileSizeLimitKib)}`}):e.config.allowMultiple===!1&&s.length>1?l({type:"invalid",message:C("validation_file_max",{count:1})}):t({type:"file",value:s})),children:[n.o("div",{class:"flex items-center gap-2",children:[n.o("label",{ref:p,for:"dropzone-file",class:"border-neutral-8 bg-neutral-2 flex h-48 w-full cursor-pointer flex-col items-center justify-center overflow-hidden rounded-2xl border border-dashed p-4",children:[s.length>0?n.o(n.k,{children:[n.o("ul",{class:"flex max-w-full flex-wrap justify-center gap-1 overflow-hidden p-1",children:[s.slice(0,lt).map(h=>{const y=h.name.split(".").pop(),b=h.name.replace(new RegExp(`.${y}$`),"");return n.o(ct,{class:"flex overflow-hidden",children:[n.o("span",{class:"block truncate",children:b}),n.o("span",{children:[".",y]})]})}),i>0?n.o(ct,{children:["+",i," file",i!==1?"s":""]}):null]}),n.o("p",{class:"text-neutral-11 text-xs",children:[n.A(f)," ",s.length>1?"total":""]})]}):n.o("div",{class:"flex flex-col justify-center gap-4 pb-6 pt-5",children:[n.o("header",{class:"flex flex-col items-center gap-0",children:[n.o("svg",{class:"text-neutral-11 mb-1 h-8 w-8","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 16",children:n.o("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2"})}),n.o("p",{class:"text-neutral-12 tracking-[-0.01em]",children:C("upload_file",{count:e.config.allowMultiple?2:1})}),e.config.fileSizeLimitKib?n.o("p",{class:"text-neutral-10 text-xs",children:["(",C("file_max_size",{size:n.A(e.config.fileSizeLimitKib)}),")"]}):null]}),n.o("aside",{class:"flex flex-col items-center gap-2",children:[n.o("p",{id:"accepted-filetypes",class:"sr-only",children:C("file_extensions")}),n.o("ul",{"aria-describedby":"accepted-filetypes",class:"flex flex-wrap justify-center gap-2",children:e.config.extensions.map(h=>n.o("li",{class:"ring-lowest outline-neutral-6 text-neutral-9 bg-neutral-1 rounded-md px-1 py-0.5 text-[11px] uppercase tracking-wide outline outline-1 ring-2",children:h.replace(".","")}))})]})]}),n.o("input",{id:"dropzone-file",onInput:async h=>{n.invariant(h.target instanceof HTMLInputElement);const y=h.target.files?Array.from(h.target.files):[],b=await Promise.allSettled(y.map(async V=>{const x=await jr(V);return{name:Kr(V.name,42),data:x,sizeKb:V.size/1e3}}));if(b.some(({status:V})=>V==="rejected"))return l({type:"invalid",message:"Invalid file"});const E=b.map(V=>V.status==="fulfilled"?V.value:null).filter(Boolean);o(E)},multiple:e.config.allowMultiple,type:"file",class:"sr-only"})]}),n.o("div",{class:"flex h-full flex-col items-center gap-2",children:[n.o(le,{disabled:s.length===0}),e.config.optional&&n.o(ce,{class:"relative",onClick:()=>t(null)})]})]}),n.o(pe,{error:a})]})};var Ce=e=>e.type==="checkbox",oe=e=>e instanceof Date,H=e=>e==null;const Rt=e=>typeof e=="object";var B=e=>!H(e)&&!Array.isArray(e)&&Rt(e)&&!oe(e),Wr=e=>B(e)&&e.target?Ce(e.target)?e.target.checked:e.target.value:e,Jr=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Zr=(e,t)=>e.has(Jr(t)),Xr=e=>{const t=e.constructor&&e.constructor.prototype;return B(t)&&t.hasOwnProperty("isPrototypeOf")},je=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function P(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(je&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(B(e)&&Xr(e)))return e;const s=r?[]:Object.create(Object.getPrototypeOf(e));for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(s[o]=P(e[o]));return s}var Fe=e=>/^\w*$/.test(e),O=e=>e===void 0,$e=e=>Array.isArray(e)?e.filter(Boolean):[],Ue=e=>$e(e.replace(/["|']|\]/g,"").split(/\.|\[/)),k=(e,t,r)=>{if(!t||!B(e))return r;const s=(Fe(t)?[t]:Ue(t)).reduce((o,a)=>H(o)?o:o[a],e);return O(s)||s===e?O(e[t])?r:e[t]:s},X=e=>typeof e=="boolean",J=e=>typeof e=="function",N=(e,t,r)=>{let s=-1;const o=Fe(t)?[t]:Ue(t),a=o.length,l=a-1;for(;++s<a;){const i=o[s];let f=r;if(s!==l){const p=e[i];f=B(p)||Array.isArray(p)?p:isNaN(+o[s+1])?{}:[]}if(i==="__proto__"||i==="constructor"||i==="prototype")return;e[i]=f,e=e[i]}};const ut={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Z={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},te={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Yr=n.Cn.createContext(null);Yr.displayName="HookFormControlContext";var Qr=(e,t,r,s=!0)=>{const o={defaultValues:t._defaultValues};for(const a in e)Object.defineProperty(o,a,{get:()=>{const l=a;return t._proxyFormState[l]!==Z.all&&(t._proxyFormState[l]=!s||Z.all),r&&(r[l]=!0),e[l]}});return o};const en=typeof window<"u"?n.Cn.useLayoutEffect:n.Cn.useEffect;var G=e=>typeof e=="string",tn=(e,t,r,s,o)=>G(e)?(s&&t.watch.add(e),k(r,e,o)):Array.isArray(e)?e.map(a=>(s&&t.watch.add(a),k(r,a))):(s&&(t.watchAll=!0),r),Re=e=>H(e)||!Rt(e);function se(e,t,r=new WeakSet){if(Re(e)||Re(t))return Object.is(e,t);if(oe(e)&&oe(t))return Object.is(e.getTime(),t.getTime());const s=Object.keys(e),o=Object.keys(t);if(s.length!==o.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const a of s){const l=e[a];if(!o.includes(a))return!1;if(a!=="ref"){const i=t[a];if(oe(l)&&oe(i)||B(l)&&B(i)||Array.isArray(l)&&Array.isArray(i)?!se(l,i,r):!Object.is(l,i))return!1}}return!0}const rn=n.Cn.createContext(null);rn.displayName="HookFormContext";var Bt=(e,t,r,s,o)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[s]:o||!0}}:{},we=e=>Array.isArray(e)?e:[e],dt=()=>{let e=[];return{get observers(){return e},next:o=>{for(const a of e)a.next&&a.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(a=>a!==o)}}),unsubscribe:()=>{e=[]}}};function zt(e,t){const r={};for(const s in e)if(e.hasOwnProperty(s)){const o=e[s],a=t[s];if(o&&B(o)&&a){const l=zt(o,a);B(l)&&(r[s]=l)}else e[s]&&(r[s]=a)}return r}var q=e=>B(e)&&!Object.keys(e).length,qe=e=>e.type==="file",Ve=e=>{if(!je)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Pt=e=>e.type==="select-multiple",He=e=>e.type==="radio",nn=e=>He(e)||Ce(e),Oe=e=>Ve(e)&&e.isConnected;function sn(e,t){const r=t.slice(0,-1).length;let s=0;for(;s<r;)e=O(e)?s++:e[t[s++]];return e}function an(e){for(const t in e)if(e.hasOwnProperty(t)&&!O(e[t]))return!1;return!0}function R(e,t){const r=Array.isArray(t)?t:Fe(t)?[t]:Ue(t),s=r.length===1?e:sn(e,r),o=r.length-1,a=r[o];return s&&delete s[a],o!==0&&(B(s)&&q(s)||Array.isArray(s)&&an(s))&&R(e,r.slice(0,-1)),e}var on=e=>{for(const t in e)if(J(e[t]))return!0;return!1};function jt(e){return Array.isArray(e)||B(e)&&!on(e)}function Be(e,t={}){for(const r in e){const s=e[r];jt(s)?(t[r]=Array.isArray(s)?[]:{},Be(s,t[r])):O(s)||(t[r]=!0)}return t}function he(e,t,r){r||(r=Be(t));for(const s in e){const o=e[s];if(jt(o))O(t)||Re(r[s])?r[s]=Be(o,Array.isArray(o)?[]:{}):he(o,H(t)?{}:t[s],r[s]);else{const a=t[s];r[s]=!se(o,a)}}return r}const ft={value:!1,isValid:!1},ht={value:!0,isValid:!0};var $t=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!O(e[0].attributes.value)?O(e[0].value)||e[0].value===""?ht:{value:e[0].value,isValid:!0}:ht:ft}return ft},Ut=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:s})=>O(e)?e:t?e===""?NaN:e&&+e:r&&G(e)?new Date(e):s?s(e):e;const pt={isValid:!1,value:null};var qt=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,pt):pt;function mt(e){const t=e.ref;return qe(t)?t.files:He(t)?qt(e.refs).value:Pt(t)?[...t.selectedOptions].map(({value:r})=>r):Ce(t)?$t(e.refs).value:Ut(O(t.value)?e.ref.value:t.value,e)}var ln=(e,t,r,s)=>{const o={};for(const a of e){const l=k(t,a);l&&N(o,a,l._f)}return{criteriaMode:r,names:[...e],fields:o,shouldUseNativeValidation:s}},Ee=e=>e instanceof RegExp,be=e=>O(e)?e:Ee(e)?e.source:B(e)?Ee(e.value)?e.value.source:e.value:e,gt=e=>({isOnSubmit:!e||e===Z.onSubmit,isOnBlur:e===Z.onBlur,isOnChange:e===Z.onChange,isOnAll:e===Z.all,isOnTouch:e===Z.onTouched});const yt="AsyncFunction";var cn=e=>!!e&&!!e.validate&&!!(J(e.validate)&&e.validate.constructor.name===yt||B(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===yt)),un=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),bt=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(s=>e.startsWith(s)&&/^\.\w+/.test(e.slice(s.length))));const ke=(e,t,r,s)=>{for(const o of r||Object.keys(e)){const a=k(e,o);if(a){const{_f:l,...i}=a;if(l){if(l.refs&&l.refs[0]&&t(l.refs[0],o)&&!s)return!0;if(l.ref&&t(l.ref,l.name)&&!s)return!0;if(ke(i,t))break}else if(B(i)&&ke(i,t))break}}};function vt(e,t,r){const s=k(e,r);if(s||Fe(r))return{error:s,name:r};const o=r.split(".");for(;o.length;){const a=o.join("."),l=k(t,a),i=k(e,a);if(l&&!Array.isArray(l)&&r!==a)return{name:r};if(i&&i.type)return{name:a,error:i};if(i&&i.root&&i.root.type)return{name:`${a}.root`,error:i.root};o.pop()}return{name:r}}var dn=(e,t,r,s)=>{r(e);const{name:o,...a}=e;return q(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(l=>t[l]===(!s||Z.all))},fn=(e,t,r)=>!e||!t||e===t||we(e).some(s=>s&&(r?s===t:s.startsWith(t)||t.startsWith(s))),hn=(e,t,r,s,o)=>o.isOnAll?!1:!r&&o.isOnTouch?!(t||e):(r?s.isOnBlur:o.isOnBlur)?!e:(r?s.isOnChange:o.isOnChange)?e:!0,pn=(e,t)=>!$e(k(e,t)).length&&R(e,t),mn=(e,t,r)=>{const s=we(k(e,r));return N(s,"root",t[r]),N(e,r,s),e};function xt(e,t,r="validate"){if(G(e)||Array.isArray(e)&&e.every(G)||X(e)&&!e)return{type:r,message:G(e)?e:"",ref:t}}var de=e=>B(e)&&!Ee(e)?e:{value:e,message:""},wt=async(e,t,r,s,o,a)=>{const{ref:l,refs:i,required:f,maxLength:p,minLength:C,min:v,max:h,pattern:y,validate:b,name:E,valueAsNumber:V,mount:x}=e._f,_=k(r,E);if(!x||t.has(E))return{};const A=i?i[0]:l,D=F=>{o&&A.reportValidity&&(A.setCustomValidity(X(F)?"":F||""),A.reportValidity())},I={},ae=He(l),ue=Ce(l),Q=ae||ue,re=(V||qe(l))&&O(l.value)&&O(_)||Ve(l)&&l.value===""||_===""||Array.isArray(_)&&!_.length,j=Bt.bind(null,E,s,I),Se=(F,L,z,$=te.maxLength,W=te.minLength)=>{const K=F?L:z;I[E]={type:F?$:W,message:K,ref:l,...j(F?$:W,K)}};if(a?!Array.isArray(_)||!_.length:f&&(!Q&&(re||H(_))||X(_)&&!_||ue&&!$t(i).isValid||ae&&!qt(i).isValid)){const{value:F,message:L}=G(f)?{value:!!f,message:f}:de(f);if(F&&(I[E]={type:te.required,message:L,ref:A,...j(te.required,L)},!s))return D(L),I}if(!re&&(!H(v)||!H(h))){let F,L;const z=de(h),$=de(v);if(!H(_)&&!isNaN(_)){const W=l.valueAsNumber||_&&+_;H(z.value)||(F=W>z.value),H($.value)||(L=W<$.value)}else{const W=l.valueAsDate||new Date(_),K=ye=>new Date(new Date().toDateString()+" "+ye),me=l.type=="time",ge=l.type=="week";G(z.value)&&_&&(F=me?K(_)>K(z.value):ge?_>z.value:W>new Date(z.value)),G($.value)&&_&&(L=me?K(_)<K($.value):ge?_<$.value:W<new Date($.value))}if((F||L)&&(Se(!!F,z.message,$.message,te.max,te.min),!s))return D(I[E].message),I}if((p||C)&&!re&&(G(_)||a&&Array.isArray(_))){const F=de(p),L=de(C),z=!H(F.value)&&_.length>+F.value,$=!H(L.value)&&_.length<+L.value;if((z||$)&&(Se(z,F.message,L.message),!s))return D(I[E].message),I}if(y&&!re&&G(_)){const{value:F,message:L}=de(y);if(Ee(F)&&!_.match(F)&&(I[E]={type:te.pattern,message:L,ref:l,...j(te.pattern,L)},!s))return D(L),I}if(b){if(J(b)){const F=await b(_,r),L=xt(F,A);if(L&&(I[E]={...L,...j(te.validate,L.message)},!s))return D(L.message),I}else if(B(b)){let F={};for(const L in b){if(!q(F)&&!s)break;const z=xt(await b[L](_,r),A,L);z&&(F={...z,...j(L,z.message)},D(z.message),s&&(I[E]=F))}if(!q(F)&&(I[E]={ref:A,...F},!s))return I}}return D(!0),I};const gn={mode:Z.onSubmit,reValidateMode:Z.onChange,shouldFocusError:!0};function yn(e={}){let t={...gn,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:J(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},s={},o=B(t.defaultValues)||B(t.values)?P(t.defaultValues||t.values)||{}:{},a=t.shouldUnregister?{}:P(o),l={action:!1,mount:!1,watch:!1,keepIsValid:!1},i={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},f,p=0;const C={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},v={...C};let h={...v};const y={array:dt(),state:dt()},b=t.criteriaMode===Z.all,E=c=>u=>{clearTimeout(p),p=setTimeout(c,u)},V=async c=>{if(!l.keepIsValid&&!t.disabled&&(v.isValid||h.isValid||c)){let u;t.resolver?(u=q((await Q()).errors),x()):u=await j(s,!0),u!==r.isValid&&y.state.next({isValid:u})}},x=(c,u)=>{!t.disabled&&(v.isValidating||v.validatingFields||h.isValidating||h.validatingFields)&&((c||Array.from(i.mount)).forEach(d=>{d&&(u?N(r.validatingFields,d,u):R(r.validatingFields,d))}),y.state.next({validatingFields:r.validatingFields,isValidating:!q(r.validatingFields)}))},_=(c,u=[],d,w,g=!0,m=!0)=>{if(w&&d&&!t.disabled){if(l.action=!0,m&&Array.isArray(k(s,c))){const S=d(k(s,c),w.argA,w.argB);g&&N(s,c,S)}if(m&&Array.isArray(k(r.errors,c))){const S=d(k(r.errors,c),w.argA,w.argB);g&&N(r.errors,c,S),pn(r.errors,c)}if((v.touchedFields||h.touchedFields)&&m&&Array.isArray(k(r.touchedFields,c))){const S=d(k(r.touchedFields,c),w.argA,w.argB);g&&N(r.touchedFields,c,S)}(v.dirtyFields||h.dirtyFields)&&(r.dirtyFields=he(o,a)),y.state.next({name:c,isDirty:F(c,u),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else N(a,c,u)},A=(c,u)=>{N(r.errors,c,u),y.state.next({errors:r.errors})},D=c=>{r.errors=c,y.state.next({errors:r.errors,isValid:!1})},I=(c,u,d,w)=>{const g=k(s,c);if(g){const m=k(a,c,O(d)?k(o,c):d);O(m)||w&&w.defaultChecked||u?N(a,c,u?m:mt(g._f)):$(c,m),l.mount&&!l.action&&V()}},ae=(c,u,d,w,g)=>{let m=!1,S=!1;const M={name:c};if(!t.disabled){if(!d||w){(v.isDirty||h.isDirty)&&(S=r.isDirty,r.isDirty=M.isDirty=F(),m=S!==M.isDirty);const T=se(k(o,c),u);S=!!k(r.dirtyFields,c),T?R(r.dirtyFields,c):N(r.dirtyFields,c,!0),M.dirtyFields=r.dirtyFields,m=m||(v.dirtyFields||h.dirtyFields)&&S!==!T}if(d){const T=k(r.touchedFields,c);T||(N(r.touchedFields,c,d),M.touchedFields=r.touchedFields,m=m||(v.touchedFields||h.touchedFields)&&T!==d)}m&&g&&y.state.next(M)}return m?M:{}},ue=(c,u,d,w)=>{const g=k(r.errors,c),m=(v.isValid||h.isValid)&&X(u)&&r.isValid!==u;if(t.delayError&&d?(f=E(()=>A(c,d)),f(t.delayError)):(clearTimeout(p),f=null,d?N(r.errors,c,d):R(r.errors,c)),(d?!se(g,d):g)||!q(w)||m){const S={...w,...m&&X(u)?{isValid:u}:{},errors:r.errors,name:c};r={...r,...S},y.state.next(S)}},Q=async c=>(x(c,!0),await t.resolver(a,t.context,ln(c||i.mount,s,t.criteriaMode,t.shouldUseNativeValidation))),re=async c=>{const{errors:u}=await Q(c);if(x(c),c)for(const d of c){const w=k(u,d);w?N(r.errors,d,w):R(r.errors,d)}else r.errors=u;return u},j=async(c,u,d={valid:!0})=>{for(const w in c){const g=c[w];if(g){const{_f:m,...S}=g;if(m){const M=i.array.has(m.name),T=g._f&&cn(g._f);T&&v.validatingFields&&x([m.name],!0);const U=await wt(g,i.disabled,a,b,t.shouldUseNativeValidation&&!u,M);if(T&&v.validatingFields&&x([m.name]),U[m.name]&&(d.valid=!1,u||e.shouldUseNativeValidation))break;!u&&(k(U,m.name)?M?mn(r.errors,U,m.name):N(r.errors,m.name,U[m.name]):R(r.errors,m.name))}!q(S)&&await j(S,u,d)}}return d.valid},Se=()=>{for(const c of i.unMount){const u=k(s,c);u&&(u._f.refs?u._f.refs.every(d=>!Oe(d)):!Oe(u._f.ref))&&Le(c)}i.unMount=new Set},F=(c,u)=>!t.disabled&&(c&&u&&N(a,c,u),!se(Ke(),o)),L=(c,u,d)=>tn(c,i,{...l.mount?a:O(u)?o:G(c)?{[c]:u}:u},d,u),z=c=>$e(k(l.mount?a:o,c,t.shouldUnregister?k(o,c,[]):[])),$=(c,u,d={})=>{const w=k(s,c);let g=u;if(w){const m=w._f;m&&(!m.disabled&&N(a,c,Ut(u,m)),g=Ve(m.ref)&&H(u)?"":u,Pt(m.ref)?[...m.ref.options].forEach(S=>S.selected=g.includes(S.value)):m.refs?Ce(m.ref)?m.refs.forEach(S=>{(!S.defaultChecked||!S.disabled)&&(Array.isArray(g)?S.checked=!!g.find(M=>M===S.value):S.checked=g===S.value||!!g)}):m.refs.forEach(S=>S.checked=S.value===g):qe(m.ref)?m.ref.value="":(m.ref.value=g,m.ref.type||y.state.next({name:c,values:P(a)})))}(d.shouldDirty||d.shouldTouch)&&ae(c,g,d.shouldTouch,d.shouldDirty,!0),d.shouldValidate&&ye(c)},W=(c,u,d)=>{for(const w in u){if(!u.hasOwnProperty(w))return;const g=u[w],m=c+"."+w,S=k(s,m);(i.array.has(c)||B(g)||S&&!S._f)&&!oe(g)?W(m,g,d):$(m,g,d)}},K=(c,u,d={})=>{const w=k(s,c),g=i.array.has(c),m=P(u);N(a,c,m),g?(y.array.next({name:c,values:P(a)}),(v.isDirty||v.dirtyFields||h.isDirty||h.dirtyFields)&&d.shouldDirty&&y.state.next({name:c,dirtyFields:he(o,a),isDirty:F(c,m)})):w&&!w._f&&!H(m)?W(c,m,d):$(c,m,d),bt(c,i)?y.state.next({...r,name:c,values:P(a)}):y.state.next({name:l.mount?c:void 0,values:P(a)})},me=async c=>{l.mount=!0;const u=c.target;let d=u.name,w=!0;const g=k(s,d),m=T=>{w=Number.isNaN(T)||oe(T)&&isNaN(T.getTime())||se(T,k(a,d,T))},S=gt(t.mode),M=gt(t.reValidateMode);if(g){let T,U;const ie=u.type?mt(g._f):Wr(c),ne=c.type===ut.BLUR||c.type===ut.FOCUS_OUT,Qt=!un(g._f)&&!t.resolver&&!k(r.errors,d)&&!g._f.deps||hn(ne,k(r.touchedFields,d),r.isSubmitted,M,S),Ne=bt(d,i,ne);N(a,d,ie),ne?(!u||!u.readOnly)&&(g._f.onBlur&&g._f.onBlur(c),f&&f(0)):g._f.onChange&&g._f.onChange(c);const De=ae(d,ie,ne),er=!q(De)||Ne;if(!ne&&y.state.next({name:d,type:c.type,values:P(a)}),Qt)return(v.isValid||h.isValid)&&(t.mode==="onBlur"?ne&&V():ne||V()),er&&y.state.next({name:d,...Ne?{}:De});if(!ne&&Ne&&y.state.next({...r}),t.resolver){const{errors:tt}=await Q([d]);if(x([d]),m(ie),w){const tr=vt(r.errors,s,d),rt=vt(tt,s,tr.name||d);T=rt.error,d=rt.name,U=q(tt)}}else x([d],!0),T=(await wt(g,i.disabled,a,b,t.shouldUseNativeValidation))[d],x([d]),m(ie),w&&(T?U=!1:(v.isValid||h.isValid)&&(U=await j(s,!0)));w&&(g._f.deps&&(!Array.isArray(g._f.deps)||g._f.deps.length>0)&&ye(g._f.deps),ue(d,U,T,De))}},ge=(c,u)=>{if(k(r.errors,u)&&c.focus)return c.focus(),1},ye=async(c,u={})=>{let d,w;const g=we(c);if(t.resolver){const m=await re(O(c)?c:g);d=q(m),w=c?!g.some(S=>k(m,S)):d}else c?(w=(await Promise.all(g.map(async m=>{const S=k(s,m);return await j(S&&S._f?{[m]:S}:S)}))).every(Boolean),!(!w&&!r.isValid)&&V()):w=d=await j(s);return y.state.next({...!G(c)||(v.isValid||h.isValid)&&d!==r.isValid?{}:{name:c},...t.resolver||!c?{isValid:d}:{},errors:r.errors}),u.shouldFocus&&!w&&ke(s,ge,c?g:i.mount),w},Ke=(c,u)=>{let d={...l.mount?a:o};return u&&(d=zt(u.dirtyFields?r.dirtyFields:r.touchedFields,d)),O(c)?d:G(c)?k(d,c):c.map(w=>k(d,w))},Ge=(c,u)=>({invalid:!!k((u||r).errors,c),isDirty:!!k((u||r).dirtyFields,c),error:k((u||r).errors,c),isValidating:!!k(r.validatingFields,c),isTouched:!!k((u||r).touchedFields,c)}),Kt=c=>{const u=c?we(c):void 0;u==null||u.forEach(d=>R(r.errors,d)),u?u.forEach(d=>{y.state.next({name:d,errors:r.errors})}):y.state.next({errors:{}})},We=(c,u,d)=>{const w=(k(s,c,{_f:{}})._f||{}).ref,g=k(r.errors,c)||{},{ref:m,message:S,type:M,...T}=g;N(r.errors,c,{...T,...u,ref:w}),y.state.next({name:c,errors:r.errors,isValid:!1}),d&&d.shouldFocus&&w&&w.focus&&w.focus()},Gt=(c,u)=>J(c)?y.state.subscribe({next:d=>"values"in d&&c(L(void 0,u),d)}):L(c,u,!0),Je=c=>y.state.subscribe({next:u=>{fn(c.name,u.name,c.exact)&&dn(u,c.formState||v,Yt,c.reRenderRoot)&&c.callback({values:{...a},...r,...u,defaultValues:o})}}).unsubscribe,Wt=c=>(l.mount=!0,h={...h,...c.formState},Je({...c,formState:{...C,...c.formState}})),Le=(c,u={})=>{for(const d of c?we(c):i.mount)i.mount.delete(d),i.array.delete(d),u.keepValue||(R(s,d),R(a,d)),!u.keepError&&R(r.errors,d),!u.keepDirty&&R(r.dirtyFields,d),!u.keepTouched&&R(r.touchedFields,d),!u.keepIsValidating&&R(r.validatingFields,d),!t.shouldUnregister&&!u.keepDefaultValue&&R(o,d);y.state.next({values:P(a)}),y.state.next({...r,...u.keepDirty?{isDirty:F()}:{}}),!u.keepIsValid&&V()},Ze=({disabled:c,name:u})=>{if(X(c)&&l.mount||c||i.disabled.has(u)){const g=i.disabled.has(u)!==!!c;c?i.disabled.add(u):i.disabled.delete(u),g&&l.mount&&!l.action&&V()}},Me=(c,u={})=>{let d=k(s,c);const w=X(u.disabled)||X(t.disabled);return N(s,c,{...d||{},_f:{...d&&d._f?d._f:{ref:{name:c}},name:c,mount:!0,...u}}),i.mount.add(c),d?Ze({disabled:X(u.disabled)?u.disabled:t.disabled,name:c}):I(c,!0,u.value),{...w?{disabled:u.disabled||t.disabled}:{},...t.progressive?{required:!!u.required,min:be(u.min),max:be(u.max),minLength:be(u.minLength),maxLength:be(u.maxLength),pattern:be(u.pattern)}:{},name:c,onChange:me,onBlur:me,ref:g=>{if(g){Me(c,u),d=k(s,c);const m=O(g.value)&&g.querySelectorAll&&g.querySelectorAll("input,select,textarea")[0]||g,S=nn(m),M=d._f.refs||[];if(S?M.find(T=>T===m):m===d._f.ref)return;N(s,c,{_f:{...d._f,...S?{refs:[...M.filter(Oe),m,...Array.isArray(k(o,c))?[{}]:[]],ref:{type:m.type,name:c}}:{ref:m}}}),I(c,!1,void 0,m)}else d=k(s,c,{}),d._f&&(d._f.mount=!1),(t.shouldUnregister||u.shouldUnregister)&&!(Zr(i.array,c)&&l.action)&&i.unMount.add(c)}}},Te=()=>t.shouldFocusError&&ke(s,ge,i.mount),Jt=c=>{X(c)&&(y.state.next({disabled:c}),ke(s,(u,d)=>{const w=k(s,d);w&&(u.disabled=w._f.disabled||c,Array.isArray(w._f.refs)&&w._f.refs.forEach(g=>{g.disabled=w._f.disabled||c}))},0,!1))},Xe=(c,u)=>async d=>{let w;d&&(d.preventDefault&&d.preventDefault(),d.persist&&d.persist());let g=P(a);if(y.state.next({isSubmitting:!0}),t.resolver){const{errors:m,values:S}=await Q();x(),r.errors=m,g=P(S)}else await j(s);if(i.disabled.size)for(const m of i.disabled)R(g,m);if(R(r.errors,"root"),q(r.errors)){y.state.next({errors:{}});try{await c(g,d)}catch(m){w=m}}else u&&await u({...r.errors},d),Te(),setTimeout(Te);if(y.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:q(r.errors)&&!w,submitCount:r.submitCount+1,errors:r.errors}),w)throw w},Zt=(c,u={})=>{k(s,c)&&(O(u.defaultValue)?K(c,P(k(o,c))):(K(c,u.defaultValue),N(o,c,P(u.defaultValue))),u.keepTouched||R(r.touchedFields,c),u.keepDirty||(R(r.dirtyFields,c),r.isDirty=u.defaultValue?F(c,P(k(o,c))):F()),u.keepError||(R(r.errors,c),v.isValid&&V()),y.state.next({...r}))},Ye=(c,u={})=>{const d=c?P(c):o,w=P(d),g=q(c),m=g?o:w;if(u.keepDefaultValues||(o=d),!u.keepValues){if(u.keepDirtyValues){const S=new Set([...i.mount,...Object.keys(he(o,a))]);for(const M of Array.from(S)){const T=k(r.dirtyFields,M),U=k(a,M),ie=k(m,M);T&&!O(U)?N(m,M,U):!T&&!O(ie)&&K(M,ie)}}else{if(je&&O(c))for(const S of i.mount){const M=k(s,S);if(M&&M._f){const T=Array.isArray(M._f.refs)?M._f.refs[0]:M._f.ref;if(Ve(T)){const U=T.closest("form");if(U){U.reset();break}}}}if(u.keepFieldsRef)for(const S of i.mount)K(S,k(m,S));else s={}}a=t.shouldUnregister?u.keepDefaultValues?P(o):{}:P(m),y.array.next({values:{...m}}),y.state.next({values:{...m}})}i={mount:u.keepDirtyValues?i.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!v.isValid||!!u.keepIsValid||!!u.keepDirtyValues||!t.shouldUnregister&&!q(m),l.watch=!!t.shouldUnregister,l.keepIsValid=!!u.keepIsValid,l.action=!1,u.keepErrors||(r.errors={}),y.state.next({submitCount:u.keepSubmitCount?r.submitCount:0,isDirty:g?!1:u.keepDirty?r.isDirty:!!(u.keepDefaultValues&&!se(c,o)),isSubmitted:u.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:g?{}:u.keepDirtyValues?u.keepDefaultValues&&a?he(o,a):r.dirtyFields:u.keepDefaultValues&&c?he(o,c):u.keepDirty?r.dirtyFields:{},touchedFields:u.keepTouched?r.touchedFields:{},errors:u.keepErrors?r.errors:{},isSubmitSuccessful:u.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},Qe=(c,u)=>Ye(J(c)?c(a):c,{...t.resetOptions,...u}),Xt=(c,u={})=>{const d=k(s,c),w=d&&d._f;if(w){const g=w.refs?w.refs[0]:w.ref;g.focus&&setTimeout(()=>{g.focus(),u.shouldSelect&&J(g.select)&&g.select()})}},Yt=c=>{r={...r,...c}},et={control:{register:Me,unregister:Le,getFieldState:Ge,handleSubmit:Xe,setError:We,_subscribe:Je,_runSchema:Q,_updateIsValidating:x,_focusError:Te,_getWatch:L,_getDirty:F,_setValid:V,_setFieldArray:_,_setDisabledField:Ze,_setErrors:D,_getFieldArray:z,_reset:Ye,_resetDefaultValues:()=>J(t.defaultValues)&&t.defaultValues().then(c=>{Qe(c,t.resetOptions),y.state.next({isLoading:!1})}),_removeUnmounted:Se,_disableForm:Jt,_subjects:y,_proxyFormState:v,get _fields(){return s},get _formValues(){return a},get _state(){return l},set _state(c){l=c},get _defaultValues(){return o},get _names(){return i},set _names(c){i=c},get _formState(){return r},get _options(){return t},set _options(c){t={...t,...c}}},subscribe:Wt,trigger:ye,register:Me,handleSubmit:Xe,watch:Gt,setValue:K,getValues:Ke,reset:Qe,resetField:Zt,clearErrors:Kt,unregister:Le,setError:We,setFocus:Xt,getFieldState:Ge};return{...et,formControl:et}}function Ae(e={}){const t=n.Cn.useRef(void 0),r=n.Cn.useRef(void 0),[s,o]=n.Cn.useState({isDirty:!1,isValidating:!1,isLoading:J(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:J(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:s},e.defaultValues&&!J(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:l,...i}=yn(e);t.current={...i,formState:s}}const a=t.current.control;return a._options=e,en(()=>{const l=a._subscribe({formState:a._proxyFormState,callback:()=>o({...a._formState}),reRenderRoot:!0});return o(i=>({...i,isReady:!0})),a._formState.isReady=!0,l},[a]),n.Cn.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),n.Cn.useEffect(()=>{e.mode&&(a._options.mode=e.mode),e.reValidateMode&&(a._options.reValidateMode=e.reValidateMode)},[a,e.mode,e.reValidateMode]),n.Cn.useEffect(()=>{e.errors&&(a._setErrors(e.errors),a._focusError())},[a,e.errors]),n.Cn.useEffect(()=>{e.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,e.shouldUnregister]),n.Cn.useEffect(()=>{if(a._proxyFormState.isDirty){const l=a._getDirty();l!==s.isDirty&&a._subjects.state.next({isDirty:l})}},[a,s.isDirty]),n.Cn.useEffect(()=>{var l;e.values&&!se(e.values,r.current)?(a._reset(e.values,{keepFieldsRef:!0,...a._options.resetOptions}),!((l=a._options.resetOptions)===null||l===void 0)&&l.keepIsValid||a._setValid(),r.current=e.values,o(i=>({...i}))):a._resetDefaultValues()},[a,e.values]),n.Cn.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),t.current.formState=n.Cn.useMemo(()=>Qr(s,a),[a,s]),t.current}const kt=(e,t,r)=>{if(e&&"reportValidity"in e){const s=k(r,t);e.setCustomValidity(s&&s.message||""),e.reportValidity()}},bn=(e,t)=>{for(const r in t.fields){const s=t.fields[r];s&&s.ref&&"reportValidity"in s.ref?kt(s.ref,r,e):s.refs&&s.refs.forEach(o=>kt(o,r,e))}},vn=(e,t)=>{t.shouldUseNativeValidation&&bn(e,t);const r={};for(const s in e){const o=k(t.fields,s),a=Object.assign(e[s]||{},{ref:o&&o.ref});if(xn(t.names||Object.keys(e),s)){const l=Object.assign({},k(r,s));N(l,"root",a),N(r,s,l)}else N(r,s,a)}return r},xn=(e,t)=>e.some(r=>r.startsWith(t+"."));var Ie=function(e,t,r){return r===void 0&&(r={}),function(s,o,a){try{var l=!a.shouldUseNativeValidation&&a.criteriaMode==="all";return Promise.resolve(n.safeParseAsync(e,s,Object.assign({},t,{abortPipeEarly:!l}))).then(function(i){if(i.issues){for(var f={};i.issues.length;){var p=i.issues[0],C=n.getDotPath(p);if(C&&(f[C]||(f[C]={message:p.message,type:p.type}),l)){var v=f[C].types,h=v&&v[p.type];f[C]=Bt(C,l,f,p.type,h?[].concat(h,p.message):p.message)}i.issues.shift()}return{values:{},errors:vn(f,a)}}return{values:r.raw?s:i.output,errors:{}}})}catch(i){return Promise.reject(i)}}};const _t=27,Ct=12,St=10,wn=n.isSubmissionOfType("enum"),kn=(e,t)=>{const r={min:e.minSelected??0,max:e.maxSelected??e.options.length};return Ie(n.object({checked:n.pipe(n.record(n.string(),n.boolean()),n.transform(s=>Object.entries(s).filter(([o,a])=>a).map(([o,a])=>o)),n.maxLength(r.max,t("validation_multiple_choice_max",{count:r.max})),n.minLength(r.min,t("validation_multiple_choice_min",{count:r.min})))}))},_n=n.k$1(({option:e,...t},r)=>n.o(n.k,{children:[n.o("input",{class:"peer sr-only h-full",type:"checkbox",...t,ref:r}),n.o("label",{class:"bg-lowest hover:bg-neutral-2 active:outline-neutral-8 ease-expo-out outline-divider text-neutral-11 peer-checked:outline-accent-7 peer-checked:bg-accent-2 peer-checked:text-accent-9 peer-focus-visible:ring-accent-9 peer-focus-visible:ring-offset-accent-7 block cursor-pointer select-none rounded-2xl px-3 py-1.5 outline outline-1 ring-0 ring-transparent transition-all selection:bg-transparent peer-focus-visible:ring-4",htmlFor:t.id,children:e.label})]})),Vt=n.cva("gutter-stable flex w-full flex-1 flex-wrap gap-2 overflow-y-auto rounded-xl p-2.5 pr-4",{variants:{variant:{singleOption:"justify-center",booleanLike:Tt}}}),Cn=({input:e,onSubmitSuccess:t})=>{var C,v;const r=e.key?(C=n.store.current$.value.flow)==null?void 0:C.data.submissions[e.key]:void 0,s=(e.config.minSelected===1||e.config.minSelected===void 0)&&e.config.maxSelected===1,o=s&&e.config.options.length===2,{t:a}=n.useTranslation(),{register:l,handleSubmit:i,formState:{errors:f}}=Ae({defaultValues:{checked:s?{}:wn(r)?Object.fromEntries(r.value.map(h=>[h,!0])):{}},resolver:kn(e.config,a)}),p=Pe();return o?n.o("ul",{style:{maxHeight:6.5*_t+5*Ct+2*St},class:Vt({variant:"booleanLike"}),children:e.config.options.map((h,y)=>n.o("li",{class:Nt,children:n.o(Dt,{type:"submit",ref:b=>{b&&y===0&&(p.current=b)},label:h.label,value:"true",onClick:()=>t({type:"enum",value:[h.value]})})},h.value))}):n.o("form",{noValidate:!0,onSubmit:h=>i(y=>{const b=y.checked;t({type:"enum",value:b})})(h),children:[n.o("div",{class:"flex items-center gap-1",children:[n.o("ul",{style:{maxHeight:6.5*_t+5*Ct+2*St},class:Vt({variant:e.config.options.length===1?"singleOption":void 0}),children:e.config.options.map((h,y)=>{const b=`checked.${h.value}`,{ref:E,...V}=l(b);return n.o("li",{class:"relative",children:n.o(_n,{option:h,autoFocus:y===0,ref:x=>{x&&y===0&&(p.current=x),E(x)},id:b,...V,onClick:s?()=>t({type:"enum",value:[h.value]}):void 0})},h.value)})}),n.o("div",{class:"flex flex-col items-center gap-2 pr-2.5 pt-2.5",children:[s?null:n.o(le,{}),e.config.minSelected===0&&n.o(ce,{class:"relative",type:"button",onClick:()=>t({type:"enum",value:[]})})]})]}),n.o("div",{class:"px-1",children:n.o(pe,{error:(v=f.checked)==null?void 0:v.root})})]})},Sn=n.isSubmissionOfType("number"),Vn=(e,t)=>{const r=e.min??Number.MIN_SAFE_INTEGER,s=e.max??Number.MAX_SAFE_INTEGER,o=e.decimalCases??0;return Ie(n.object({number:n.pipe(n.number(t("validation_number")),n.minValue(r,t("validation_number_min",{min:r})),n.maxValue(s,t("validation_number_max",{max:s})),n.check(a=>a===Number(a.toFixed(o)),t("validation_number_decimal_cases",{count:o})))}))},En=({input:e,onSubmitSuccess:t})=>{var v;const r=e.config.defaultValue,s=e.key?(v=n.store.current$.value.flow)==null?void 0:v.data.submissions[e.key]:void 0,{t:o}=n.useTranslation(),{register:a,handleSubmit:l,formState:{errors:i}}=Ae({defaultValues:{number:r?Number(r):Sn(s)?s.value:void 0},resolver:Vn(e.config,o)}),{ref:f,...p}=a("number",{required:!e.config.optional,valueAsNumber:!0}),C=n._();return n.y(()=>{C.current&&(C.current.focus(),C.current.select())},[]),n.o("form",{class:"flex flex-col gap-1 p-2.5",onSubmit:l(h=>{h.number!==void 0&&t({type:"number",value:h.number})}),children:[n.o("div",{class:"flex items-center gap-2",children:[n.o("div",{class:"relative min-w-0 flex-grow",children:[n.o("input",{...p,id:"chat-input",autocomplete:"off",autoCapitalize:"off",autoCorrect:"off",autoFocus:!0,ref:h=>{h&&(C.current=h),f(h)},type:"text",min:e.config.min,max:e.config.max,class:_e({optional:e.config.optional,className:"[type=number:-webkit-inner-spin-button] w-full rounded-full [-webkit-outer-spin-button:none]"}),placeholder:e.config.placeholder}),e.config.optional&&n.o(ce,{class:"absolute bottom-0 right-0.5 top-0",onClick:()=>t(null)})]}),n.o(le,{})]}),n.o(pe,{error:i.number})]})},Fn=e=>{if(e==="")return{countryCode:"",phoneNumber:""};const t=Object.entries(ze).find(o=>e.startsWith(o[1])),r=t?t[1]:"",s=e.replace(r,"");return/^\d+$/.test(s)?{countryCode:r,phoneNumber:s}:{countryCode:"",phoneNumber:""}},An="44",In=/^[0-9 ]+$/,Ln=n.isSubmissionOfType("string"),Mn=n.isSubmissionOfType("phone"),Tn=e=>{const t=n.pipe(n.string(e("validation_country_code")),n.regex(In,e("validation_country_code"))),r=n.pipe(n.string(e("validation_phone")),n.minLength(1,e("validation_phone")),n.transform(s=>s.replace(/[^0-9]/g,"")));return Ie(n.object({countryCode:t,phoneNumber:r}))},Nn=({input:e,onSubmitSuccess:t})=>{var E;const r=e.key?(E=n.store.current$.value.flow)==null?void 0:E.data.submissions[e.key]:void 0,{t:s}=n.useTranslation(),[o,a]=n.h(),l=Ln(r)?Fn(r.value):Mn(r)?r.value:void 0,{register:i,handleSubmit:f,formState:{errors:p},watch:C}=Ae({defaultValues:{countryCode:(l==null?void 0:l.countryCode)??e.config.defaultValue.countryCode??An,phoneNumber:(l==null?void 0:l.phoneNumber)??e.config.defaultValue.phoneNumber??""},resolver:Tn(s)}),{ref:v,...h}=i("phoneNumber",{required:!e.config.optional}),y=n._(),b=C("countryCode");return n.y(()=>{y.current&&(y.current.focus(),y.current.select())},[]),n.o("form",{noValidate:!0,class:"flex flex-col gap-1 p-2.5",onSubmit:f(V=>{const x=V.phoneNumber.replace(/[^0-9]/g,""),_=V.countryCode.replace(/[^0-9]/g,"");a(void 0);const A=e.config.minChars??7,D=x.length+_.length;if(D<A)return a(s("validation_phone_min_chars",{count:A}));const I=e.config.maxChars;if(I!=null&&D>I)return a(s("validation_max_chars",{count:I}));e.config.submissionFormat==="phone"?t({type:"phone",value:{countryCode:_,phoneNumber:x}}):t({type:"string",value:b+V.phoneNumber})}),children:[n.o("div",{class:"flex items-center gap-2",children:[n.o("div",{class:"relative flex min-w-0 flex-1 flex-grow gap-2",children:[n.o("label",{class:"text-neutral-12 bg-lowest hover:bg-neutral-5 placeholder:text-neutral-8 focus-visible:outline-accent-7 focus-within:bg-neutral-5 focus-within:outline-accent-7 outline-divider relative flex h-full cursor-pointer appearance-none items-center justify-center overflow-hidden text-ellipsis whitespace-nowrap rounded-l-full border-solid px-3 py-1.5 text-center text-base outline outline-2 transition-all focus-within:outline-none",htmlFor:`isdk_phone_${e.key}`,children:[n.o("span",{children:["+",b]}),n.o("select",{...i("countryCode",{}),id:`isdk_phone_${e.key}`,class:"absolute inset-0 opacity-0",children:Object.entries(ze).map(([V,x])=>n.o("option",{value:x,children:[V," (+",x,")"]},V))})]}),n.o("input",{...h,id:"chat-input",type:"tel",inputMode:"tel",autocomplete:"off",autoCapitalize:"off",autoCorrect:"off",autoFocus:!0,ref:V=>{V&&(y.current=V),v(V)},class:_e({optional:e.config.optional,className:"min-w-0 flex-1 rounded-r-full"}),placeholder:e.config.placeholder}),e.config.optional&&n.o(ce,{class:"absolute bottom-0 right-1 top-0",onClick:()=>t(null)})]}),n.o(le,{})]}),n.o(pe,{error:p.countryCode||p.phoneNumber||{message:o}})]})},Dn=({input:e,onSubmitSuccess:t})=>n.o("div",{class:"flex flex-col items-center py-3",children:n.o("button",{class:"bg-accent-9 hover:bg-accent-10 active:bg-submit-bg-active hover:border-accent-10 active:border-submit-bg-active border-accent-9 ring-accent-6 focus-visible:outline-accent-8 ring-offset-neutral-1 flex cursor-pointer rounded-full border border-solid px-5 py-3 pr-4 text-white outline-none ring-1 ring-offset-[1.5px] transition-all duration-300 focus-visible:outline-2 active:ring-2 active:ring-offset-2",name:e.key,onClick:()=>{t(null)},children:n.o("span",{class:"flex items-center gap-1.5",children:[n.o("span",{class:"inline-flex items-center text-sm font-medium",children:e.config.label||"Submit"}),n.o("svg",{stroke:"currentColor","stroke-width":"1.5",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.o("path",{d:"M4 8L8 4L12 8"}),n.o("path",{d:"M8 4V13"})]})]})})}),On={date:{type:"date",inputMode:"text"},email:{type:"email",inputMode:"email",formNoValidate:!0},text:{type:"text",inputMode:"text"},url:{type:"url",inputMode:"url",formNoValidate:!0}},Rn=n.isSubmissionOfType("string"),Bn=(e,t)=>{const r={maxLength:t("validation_max_chars",{count:e.maxChars??999}),minLength:t("validation_min_chars",{count:e.minChars??1})};return Ie(n.object({text:{date:n.pipe(n.string(t("validation_date")),n.regex(/^\d{4}-\d{2}-\d{2}$/,t("validation_date"))),email:n.pipe(n.string(t("validation_email")),n.email(t("validation_email")),n.minLength(e.minChars??1,r.minLength),n.maxLength(e.maxChars??1/0,r.maxLength)),text:n.pipe(n.string(),n.minLength(e.minChars??1,r.minLength),n.maxLength(e.maxChars??1/0,r.maxLength)),url:n.pipe(n.string(t("validation_url")),n.url(t("validation_url")),n.minLength(e.minChars??1,r.minLength),n.maxLength(e.maxChars??1/0,r.maxLength))}[e.format]}))},zn=({input:e,onSubmitSuccess:t})=>{var v;const{t:r}=n.useTranslation(),s=e.key?(v=n.store.current$.value.flow)==null?void 0:v.data.submissions[e.key]:void 0,o=e.config.defaultValue,{register:a,handleSubmit:l,formState:{errors:i}}=Ae({defaultValues:{text:o||(Rn(s)?s.value:"")},resolver:Bn(e.config,r)}),{ref:f,...p}=a("text",{required:!e.config.optional}),C=n._();return n.y(()=>{C.current&&(C.current.focus(),C.current.select())},[]),n.o("form",{noValidate:!0,class:"flex flex-col gap-1 p-2.5",onSubmit:l(h=>{t({type:"string",value:h.text})}),children:[n.o("div",{class:"flex items-center gap-2",children:[n.o("div",{class:"relative min-w-0 flex-1",children:[n.o("input",{id:"chat-input",...p,...On[e.config.format],autocomplete:"off",autoCapitalize:"off",autoCorrect:"off",autoFocus:!0,ref:h=>{h&&(C.current=h),f(h)},placeholder:e.config.placeholder,class:_e({optional:!!e.config.optional,className:"w-full rounded-full"})}),e.config.optional&&n.o(ce,{class:"absolute bottom-0 right-0.5 top-0",onClick:()=>t(null)})]}),n.o(le,{})]}),n.o(pe,{error:i.text})]})},Pn={text:zn,phone:Nn,"multiple-choice":Cn,boolean:Pr,file:Gr,submit:Dn,address:Or,number:En},jn=({logger:e})=>{var a;const t=(a=n.store.current$.value.flow)==null?void 0:a.data.currentInput,[r,s]=Vr(),o=n._(null);return n.store.inputHeight$.value=s.height,n.p(()=>{const l=o.current;if(l)return l.addEventListener("transitionstart",n.chatStore.scrollToEnd.smooth),l.addEventListener("transitioncancel",n.chatStore.scrollToEnd.smooth),l.addEventListener("transitionend",n.chatStore.scrollToEnd.smooth),()=>{l.removeEventListener("transitionstart",n.chatStore.scrollToEnd.smooth),l.removeEventListener("transitioncancel",n.chatStore.scrollToEnd.smooth),l.removeEventListener("transitionend",n.chatStore.scrollToEnd.smooth)}},[]),n.o("div",{ref:o,class:"ease-expo-out absolute bottom-0 w-full overflow-hidden rounded-b-3xl backdrop-blur-xl transition-all duration-700 will-change-[height]",style:{height:s.height},children:n.o("div",{ref:r,class:"border-divider flex flex-col justify-end border-t",children:t?(()=>{const l=Pn[t.type];return n.o(l,{logger:e,onSubmitSuccess:n.chatStore.onSubmitSuccessFn$.value,input:t})})():n.o("div",{class:"flex items-center gap-2 p-2.5",children:[n.o("input",{"aria-hidden":"true",id:"chat-input",class:_e({optional:!1,className:"flex-grow rounded-full"}),disabled:!0}),n.o(le,{disabled:!0,"aria-hidden":"true",tabIndex:-1})]})})})};function $n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Un=function(e){return e instanceof RegExp},qn=function(t){var r=/[\\^$.*+?()[\]{}|]/g,s=RegExp(r.source);return t&&s.test(t)?t.replace(r,"\\$&"):t},Ht=function(e){return typeof e=="string"},Hn=function(e){var t=[];return e.forEach(function(r){Array.isArray(r)?t=t.concat(r):t.push(r)}),t};function Kn(e,t,r){var s=0,o=0;if(e==="")return e;if(!e||!Ht(e))throw new TypeError("First argument to react-string-replace#replaceString must be a string");var a=t;Un(a)||(a=new RegExp("("+qn(a)+")","gi"));for(var l=e.split(a),i=1,f=l.length;i<f;i+=2){if(l[i]===void 0||l[i-1]===void 0){console.warn("reactStringReplace: Encountered undefined value during string replacement. Your RegExp may not be working the way you expect.");continue}o=l[i].length,s+=l[i-1].length,l[i]=r(l[i],i,s),s+=o}return l}var Gn=function(t,r,s){return Array.isArray(t)||(t=[t]),Hn(t.map(function(o){return Ht(o)?Kn(o,r,s):o}))};const ve=$n(Gn),Wn=/(\[[^\]]+\]\([^)]+\))/g,Jn=/\[([^\]]+)\]\(([^)]+)\)/,Zn=/(https?:\/\/[^\s]+)/g,Xn=/_(.*?)_/g,Yn=/\*\*(.*?)\*\*/g,Qn=/\\n|\n/g,Et="text-accent-10 hover:text-accent-11 no-underline underline-offset-2 hover:underline",es=e=>{const t=ve(e,Wn,(l,i)=>{const[,f,p]=l.match(Jn)??[];return p?n.o("a",{class:Et,href:p,children:f??p},p+i):n.o("span",{children:"INVALID LINK"})}),r=ve(t,Zn,(l,i)=>n.o("a",{class:Et,href:l,children:l},l+i)),s=ve(r,Xn,(l,i)=>n.o("em",{children:l},l+i)),o=ve(s,Yn,(l,i)=>n.o("strong",{children:l},l+i));return ve(o,Qn,(l,i)=>n.o("br",{},`br-${i}`))},ts=n.cva("select-text max-w-[min(100%,24rem)] [text-wrap:pretty] leading-snug flex-shrink min-w-[2rem] py-2 px-3 rounded-[18px] min-h-[36px] break-words relative",{variants:{side:{left:"bg-bubble-weak-bg text-neutral-12 shadow-surface-sm outline outline-1 outline-bubble-weak rounded-bl-md",right:"ml-auto bg-accent-9 text-white rounded-br-md shadow-surface-sm shadow-bubble-strong-shadow"},animate:{true:"animate-bubble-in",false:""}},defaultVariants:{side:"left"}}),rs=({children:e,className:t,animate:r,side:s,...o})=>n.o("p",{style:{transformOrigin:s==="left"?"0% 50%":"100% 50%"},class:ts({className:t,side:s,animate:r}),...o,children:e}),ns=({message:e})=>n.o("div",{class:"bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl px-2 py-2",children:n.o("a",{onClick:e.onClick,class:"bg-lowest shadow-surface-sm ring-accent-6 hover:ring-accent-8 active:bg-accent-2 active:text-accent-10 text-accent-9 focus-visible:ring-accent-7/50 text-wrap-balance flex items-center gap-1.5 rounded-full py-2 pl-4 pr-2.5 text-center no-underline ring-1 transition-all focus:outline-none focus-visible:ring-4 focus-visible:ring-offset-2",target:"_blank",href:e.href,children:[e.text,n.o("svg",{class:"flex-none",width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:n.o("path",{d:"M3.64645 11.3536C3.45118 11.1583 3.45118 10.8417 3.64645 10.6465L10.2929 4L6 4C5.72386 4 5.5 3.77614 5.5 3.5C5.5 3.22386 5.72386 3 6 3L11.5 3C11.6326 3 11.7598 3.05268 11.8536 3.14645C11.9473 3.24022 12 3.36739 12 3.5L12 9.00001C12 9.27615 11.7761 9.50001 11.5 9.50001C11.2239 9.50001 11 9.27615 11 9.00001V4.70711L4.35355 11.3536C4.15829 11.5488 3.84171 11.5488 3.64645 11.3536Z",fill:"currentColor","fill-rule":"evenodd","clip-rule":"evenodd"})})]})}),ss=({className:e,...t})=>(n.p(()=>{n.chatStore.scrollToEnd.smooth()}),n.o("div",{"aria-hidden":!0,children:n.chatStore.isBotTyping$.value===!0?n.o("div",{"aria-label":"Typing…",class:n.clsx("flex gap-1 p-4",e),...t,children:Array.from({length:3},(r,s)=>n.o("div",{class:"bg-accent-9 h-1.5 w-1.5 animate-bounce rounded-full",style:{animationDelay:`${-s*200}ms`}}))}):void 0})),as={bot:"left",user:"right"},is=n.cva("w-full select-none py-2 text-wrap-balance text-center text-[10px] uppercase tracking-widest drop-shadow-[0_1.5px_var(--i-color-n-1)]",{variants:{variant:{info:"text-neutral-8",warning:"text-[#FFC107]",error:"text-error-9",success:"text-[#4CAF50]"}}}),os=({lastSentMessageFooter:e})=>{var r;const t=((r=n.store.current$.value.flow)==null?void 0:r.data.messages)??[];return n.p(()=>{n.chatStore.scrollToEnd.smooth()},[t.length]),n.o("ol",{"aria-label":"Chat messages",class:"mt-auto flex flex-col justify-end gap-2 p-2 pt-[calc(var(--header-height)+1rem)]",children:[t.map((s,o)=>n.o(n.k,{children:n.o("li",{class:"flex",children:n.M(s).with({type:"system"},a=>n.o("p",{class:is({variant:a.variant}),children:a.text})).with({type:"text",author:n.z.union("bot","user")},a=>{const l=a.author==="user"&&!t.slice(o+1).some(p=>p.type==="text"&&p.author==="user"),i=o===t.length-1,f=a.author==="bot"?es(a.text):a.text;return n.o(n.k,{children:[l?e:null,n.o(rs,{animate:i,side:as[a.author],children:f},o)]})}).with({type:"link"},a=>n.o(ns,{message:a})).with({type:"image"},a=>n.o("img",{class:"shadow-surface-md w-full max-w-[min(100%,24rem)] rounded-2xl",src:a.url,style:{aspectRatio:a.width/a.height}})).with({type:"file"},a=>n.o(qr,{class:a.author==="bot"?void 0:"ml-auto",file:{name:a.fileName,sizeKb:a.fileSizeKb}})).with({type:"loading"},a=>{const l=t[t.length-1];return!(a===l)||n.chatStore.isBotTyping$.value?null:n.o("div",{class:"flex flex-grow flex-col items-center justify-center",children:n.o(n.LoadingIndicator,{class:"text-neutral-6 h-8 w-8"})})}).exhaustive()})},o)),n.o(ss,{},"typing")]})},ls=({logger:e,apiClient:t,analytics:r,talentBankClient:s})=>{const{flow:o}=n.store.current$.value;n.invariant(o,"Flow is required to exist to show chatbot body");const a=n.store.viewState$.value,{chatRef:l,chatService:i}=n.useChatService(),{t:f}=n.useTranslation(),[p,C]=n.h();return n.y(()=>{a==="maximised"&&n.chatStore.scrollToEnd.instant()},[a]),n.y(()=>{var x,_;const{state:v,flow:h}=n.store.current$.peek();if(v!=="loaded")throw new Error(f("invalid_state"));let y=h.data.nodeHistory.at(-1);if(n.chatStore.scrollToEnd.instant(),n.store.setInput(void 0),h.data.isFinished)return;y===void 0?(y=n.getHeadOrThrow(o.nodes).id,n.store.setCurrentNodeId(y),r.log({event:"FLOW_START",properties:{flow_id:o.id,flow_version:o.version,flow_session_id:h.data.flowSessionId,flow_build:o.build,job:o.job},customProperties:(x=o.analytics)==null?void 0:x.customProperties})):n.store.removeMessagesSentByNodeIds([y]);const{interpret:b,abort:E,undo:V}=ir({context:o.context,analytics:{service:r,customProperties:(_=o.analytics)==null?void 0:_.customProperties},apiClient:t,logger:e,talentBankClient:s,flow:o,chatService:i,t:f,getSubmissions:()=>{var A;return(A=n.store.current$.peek().flow)==null?void 0:A.data.submissions},onInterpret:A=>n.store.setCurrentNodeId(A.id),onFlowEnd:async()=>{var D;n.store.markAsFinished();const A=n.store.current$.peek().flow;n.invariant(A),r.log({event:"FLOW_END",properties:{flow_id:o.id,flow_version:o.version,flow_session_id:A.data.flowSessionId,flow_build:o.build,job:o.job},customProperties:(D=o.analytics)==null?void 0:D.customProperties})}});return C(()=>V),b(y),E},[r,t,i,e,o,s,f]),n.o(n.k,{children:[n.o("div",{ref:l,className:"hide-scrollbars relative flex w-full max-w-full flex-grow flex-col overflow-y-scroll",style:{WebkitOverflowScrolling:"touch",paddingBottom:n.store.inputHeight$.value},children:n.o(os,{lastSentMessageFooter:o.data.isFinished||!p?null:n.o(us,{undoFn:p})})}),n.o(jn,{logger:e})]})},cs=e=>e.type==="identify"?[]:"key"in e.data&&e.data.key?[e.data.key]:"keys"in e.data?Object.values(e.data.keys).filter(t=>typeof t=="string"):[],us=({undoFn:e})=>{const{t}=n.useTranslation();return n.o(n.SvgIconButton,{onClick:async()=>{const{flow:r}=n.store.current$.peek();n.invariant(r);const{removed:s}=e(r.data.nodeHistory),o=r.data.nodeHistory.splice(-s);o.length!==0&&(n.store.removeMessagesSentByNodeIds(o),n.store.setInput(void 0),o.pop(),o.map(a=>r.nodes.find(l=>l.id===a)).filter(Boolean).flatMap(cs).forEach(a=>delete r.data.submissions[a]),n.store.current$.value={...n.store.current$.value})},children:[n.o("title",{children:t("undo")}),n.o("path",{d:"M3 13h2.67l6.66-6.67a1.9 1.9 0 0 0 0-2.66 1.91 1.91 0 0 0-2.66 0L3 10.33V13Zm4.6-7.25 2.67 2.67"})]})};exports.ChatbotBody=ls;
@@ -1,4 +1,4 @@
1
- import { o as Xt, p as Yt, H as st, c as Re, g as Qt, i as me, A as Mr, u as Nr, M as at, z as R, h as se, _ as ue, a as ce, F as er, b as Y, d as c, e as je, f as Ge, y as xe, k as we, s as D, j as Tr, l as ge, m as Dr, n as rt, q as Q, r as Rr, t as tr, v as Or, w as Br, x as Pr, B as Fe, C as H, D as jr, E as $r, G as pe, I as Oe, J as qe, K as rr, L as Ur, N as zr, O as qr, P as Kr, Q as Hr, R as Gr, S as nr, T as Wr, U as Jr, V as Z, W as Zr, X as Xr, Y as Yr } from "./index-8b83b99d.js";
1
+ import { $ as Xt, C as Qt, v as st, A as Re, g as Yt, i as me, a as Mr, T as Nr, M as at, z as R, h as se, _ as ue, p as ce, F as er, u as Q, o as c, c as je, b as Ge, y as xe, k as we, s as D, d as Tr, e as ge, f as Dr, j as rt, l as Y, m as Rr, n as tr, q as Or, r as Br, t as Pr, w as Fe, x as H, B as jr, D as $r, E as pe, G as Oe, H as qe, I as rr, J as Ur, K as zr, L as qr, N as Kr, O as Hr, P as Gr, Q as nr, R as Wr, S as Jr, U as Z, V as Zr, W as Xr, X as Qr } from "./index-523342dc.js";
2
2
  import "@inploi/sdk";
3
3
  var Vt = ({ condition: e, context: t, submissions: r, ifBlock: n }) => {
4
4
  let [i, ...s] = e.compareKey.split(".");
@@ -50,7 +50,7 @@ var Vt = ({ condition: e, context: t, submissions: r, ifBlock: n }) => {
50
50
  }
51
51
  case "phone":
52
52
  case "string": {
53
- let a = o.type === "phone" ? Yt(o.value) : o.value;
53
+ let a = o.type === "phone" ? Qt(o.value) : o.value;
54
54
  switch (e.compare) {
55
55
  case "equals":
56
56
  return a === e.compareValue;
@@ -111,7 +111,7 @@ var Vt = ({ condition: e, context: t, submissions: r, ifBlock: n }) => {
111
111
  return !1;
112
112
  return !0;
113
113
  }
114
- }, Qr = /{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g, en = (e, { context: t, submissions: r }) => e.replace(Qr, (n, i, s = "") => {
114
+ }, Yr = /{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g, en = (e, { context: t, submissions: r }) => e.replace(Yr, (n, i, s = "") => {
115
115
  let [o, ...a] = i.trim().split("."), f = Xt({ key: o, path: a, submissions: r, context: t });
116
116
  if (!f)
117
117
  return s;
@@ -128,7 +128,7 @@ var Vt = ({ condition: e, context: t, submissions: r, ifBlock: n }) => {
128
128
  case "string":
129
129
  return f.value ? f.value.toString() : s;
130
130
  case "phone":
131
- return Yt(f.value);
131
+ return Qt(f.value);
132
132
  case "integration": {
133
133
  if (typeof f.value != "object" || Array.isArray(f.value))
134
134
  break;
@@ -258,7 +258,7 @@ const sr = ({
258
258
  };
259
259
  return {
260
260
  interpret: async (b) => {
261
- const E = e.nodes.find((V) => V.id === b) ?? Qt(e.nodes);
261
+ const E = e.nodes.find((V) => V.id === b) ?? Yt(e.nodes);
262
262
  return y(E);
263
263
  },
264
264
  undo: (b) => {
@@ -1029,7 +1029,7 @@ const En = ["x", "y", "top", "bottom", "left", "right", "width", "height"], Fn =
1029
1029
  }) => {
1030
1030
  const {
1031
1031
  t: r
1032
- } = Y();
1032
+ } = Q();
1033
1033
  return c("button", {
1034
1034
  class: je("bg-accent-9 active:bg-accent-10 pointer-coarse:touch-hitbox fr flex-shrink-0 rounded-full p-2 text-white transition-all disabled:cursor-not-allowed disabled:opacity-50", e),
1035
1035
  type: "submit",
@@ -1091,7 +1091,7 @@ const En = ["x", "y", "top", "bottom", "left", "right", "width", "height"], Fn =
1091
1091
  }) => {
1092
1092
  const {
1093
1093
  t: r
1094
- } = Y();
1094
+ } = Q();
1095
1095
  return c("button", {
1096
1096
  type: "button",
1097
1097
  class: je("fr touch-hitbox text-neutral-10 bg-neutral-1 ring-divider hover:ring-divider active:ring-interactive-bg-hover hover:text-neutral-12 active:text-neutral-12 hover:bg-divider active:bg-interactive-bg-hover flex flex-shrink-0 items-center justify-center gap-1 self-center rounded-full py-1 pl-2 pr-2.5 text-sm ring-1 transition-all", e),
@@ -1128,13 +1128,13 @@ const $e = Ge("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
1128
1128
  optional: !1
1129
1129
  }
1130
1130
  }), In = "https://api.mapbox.com/search/searchbox/v1/suggest", An = "ZzRDWFU0dTZ3SF9aWk9RNGl6QzZaWS5RZmlFak13a0hPbGxXZXlNSGN5RUhObUJ6TXpSV08yUW5OdE5tSTZJU1lpd2lJb1JYYXRObmJ2Tm5iaGhHZWx4V1lpb2pJMUp5ZS5rcA==", Ln = (e) => atob(e).split("").reverse().join(""), oe = ge({
1131
- name: Q()
1131
+ name: Y()
1132
1132
  }), Mn = ge({
1133
1133
  suggestions: Dr(ge({
1134
- full_address: rt(Q()),
1135
- place_formatted: rt(Q()),
1136
- name: rt(Q()),
1137
- mapbox_id: Q(),
1134
+ full_address: rt(Y()),
1135
+ place_formatted: rt(Y()),
1136
+ name: rt(Y()),
1137
+ mapbox_id: Y(),
1138
1138
  context: Rr(ge({
1139
1139
  address: oe,
1140
1140
  street: oe,
@@ -1202,7 +1202,7 @@ const $e = Ge("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
1202
1202
  }, [e, t]), Ft = (e) => {
1203
1203
  const {
1204
1204
  t
1205
- } = Y();
1205
+ } = Q();
1206
1206
  return c("button", {
1207
1207
  type: "button",
1208
1208
  class: "text-neutral-10 hover:bg-neutral-4 hover:text-neutral-12 hover:border-neutral-5 flex items-center gap-1 rounded-[18px] border border-solid border-transparent px-3 py-1 pl-1.5 text-sm transition-colors",
@@ -1229,7 +1229,7 @@ const $e = Ge("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
1229
1229
  }) => {
1230
1230
  const {
1231
1231
  t: n
1232
- } = Y(), [i, s] = se(), [o, a] = se([]), {
1232
+ } = Q(), [i, s] = se(), [o, a] = se([]), {
1233
1233
  enabled: f,
1234
1234
  getPredictions: p
1235
1235
  } = Nn({
@@ -1300,7 +1300,7 @@ const $e = Ge("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
1300
1300
  }) => {
1301
1301
  const {
1302
1302
  t: a
1303
- } = Y(), f = ue(null);
1303
+ } = Q(), f = ue(null);
1304
1304
  return xe(() => {
1305
1305
  f.current && (f.current.focus(), f.current.select());
1306
1306
  }, []), c(we, {
@@ -1415,7 +1415,7 @@ const $e = Ge("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
1415
1415
  }, []);
1416
1416
  const s = Object.keys(lt), {
1417
1417
  t: o
1418
- } = Y();
1418
+ } = Q();
1419
1419
  return c("form", {
1420
1420
  class: "bg-neutral-1/90 flex flex-col justify-end gap-2 p-2",
1421
1421
  onSubmit: (a) => {
@@ -1603,7 +1603,7 @@ const $e = Ge("outline-divider ease-expo-out placeholder:text-neutral-10 text-ne
1603
1603
  var v;
1604
1604
  const r = (v = D.current$.value.flow) == null ? void 0 : v.data.submissions[e.key], [n, i] = se($n(r) ? r.value : []), [s, o] = se(), a = n.length - Lt, f = jn(n), p = ct(), {
1605
1605
  t: C
1606
- } = Y();
1606
+ } = Q();
1607
1607
  return c("form", {
1608
1608
  class: "flex flex-col gap-1 p-2.5",
1609
1609
  onSubmit: (h) => (h.preventDefault(), o(void 0), n.length === 0 ? o({
@@ -1812,8 +1812,8 @@ var Xn = (e, t, r, n = !0) => {
1812
1812
  });
1813
1813
  return i;
1814
1814
  };
1815
- const Yn = typeof window < "u" ? H.useLayoutEffect : H.useEffect;
1816
- var X = (e) => typeof e == "string", Qn = (e, t, r, n, i) => X(e) ? (n && t.watch.add(e), k(r, e, i)) : Array.isArray(e) ? e.map((s) => (n && t.watch.add(s), k(r, s))) : (n && (t.watchAll = !0), r), it = (e) => W(e) || !hr(e);
1815
+ const Qn = typeof window < "u" ? H.useLayoutEffect : H.useEffect;
1816
+ var X = (e) => typeof e == "string", Yn = (e, t, r, n, i) => X(e) ? (n && t.watch.add(e), k(r, e, i)) : Array.isArray(e) ? e.map((s) => (n && t.watch.add(s), k(r, s))) : (n && (t.watchAll = !0), r), it = (e) => W(e) || !hr(e);
1817
1817
  function he(e, t, r = /* @__PURE__ */ new WeakSet()) {
1818
1818
  if (it(e) || it(t))
1819
1819
  return Object.is(e, t);
@@ -2299,7 +2299,7 @@ function ps(e = {}) {
2299
2299
  u && (u._f.refs ? u._f.refs.every((d) => !nt(d)) : !nt(u._f.ref)) && Xe(l);
2300
2300
  }
2301
2301
  a.unMount = /* @__PURE__ */ new Set();
2302
- }, F = (l, u) => !t.disabled && (l && u && T(s, l, u), !he(mt(), i)), L = (l, u, d) => Qn(l, a, {
2302
+ }, F = (l, u) => !t.disabled && (l && u && T(s, l, u), !he(mt(), i)), L = (l, u, d) => Yn(l, a, {
2303
2303
  ...o.mount ? s : B(u) ? i : X(l) ? { [l]: u } : u
2304
2304
  }, d, u), $ = (l) => dt(k(o.mount ? s : i, l, t.shouldUnregister ? k(i, l, []) : [])), q = (l, u, d = {}) => {
2305
2305
  const w = k(n, l);
@@ -2451,7 +2451,7 @@ function ps(e = {}) {
2451
2451
  const g = a.disabled.has(u) !== !!l;
2452
2452
  l ? a.disabled.add(u) : a.disabled.delete(u), g && o.mount && !o.action && V();
2453
2453
  }
2454
- }, Ye = (l, u = {}) => {
2454
+ }, Qe = (l, u = {}) => {
2455
2455
  let d = k(n, l);
2456
2456
  const w = ne(u.disabled) || ne(t.disabled);
2457
2457
  return T(n, l, {
@@ -2480,7 +2480,7 @@ function ps(e = {}) {
2480
2480
  onBlur: Ae,
2481
2481
  ref: (g) => {
2482
2482
  if (g) {
2483
- Ye(l, u), d = k(n, l);
2483
+ Qe(l, u), d = k(n, l);
2484
2484
  const m = B(g.value) && g.querySelectorAll && g.querySelectorAll("input,select,textarea")[0] || g, S = ts(m), M = d._f.refs || [];
2485
2485
  if (S ? M.find((N) => N === m) : m === d._f.ref)
2486
2486
  return;
@@ -2501,7 +2501,7 @@ function ps(e = {}) {
2501
2501
  d = k(n, l, {}), d._f && (d._f.mount = !1), (t.shouldUnregister || u.shouldUnregister) && !(Wn(a.array, l) && o.action) && a.unMount.add(l);
2502
2502
  }
2503
2503
  };
2504
- }, Qe = () => t.shouldFocusError && Pe(n, Le, a.mount), Sr = (l) => {
2504
+ }, Ye = () => t.shouldFocusError && Pe(n, Le, a.mount), Sr = (l) => {
2505
2505
  ne(l) && (y.state.next({ disabled: l }), Pe(n, (u, d) => {
2506
2506
  const w = k(n, d);
2507
2507
  w && (u.disabled = w._f.disabled || l, Array.isArray(w._f.refs) && w._f.refs.forEach((g) => {
@@ -2532,7 +2532,7 @@ function ps(e = {}) {
2532
2532
  w = m;
2533
2533
  }
2534
2534
  } else
2535
- u && await u({ ...r.errors }, d), Qe(), setTimeout(Qe);
2535
+ u && await u({ ...r.errors }, d), Ye(), setTimeout(Ye);
2536
2536
  if (y.state.next({
2537
2537
  isSubmitted: !0,
2538
2538
  isSubmitting: !1,
@@ -2616,7 +2616,7 @@ function ps(e = {}) {
2616
2616
  };
2617
2617
  }, _t = {
2618
2618
  control: {
2619
- register: Ye,
2619
+ register: Qe,
2620
2620
  unregister: Xe,
2621
2621
  getFieldState: gt,
2622
2622
  handleSubmit: xt,
@@ -2624,7 +2624,7 @@ function ps(e = {}) {
2624
2624
  _subscribe: bt,
2625
2625
  _runSchema: ie,
2626
2626
  _updateIsValidating: x,
2627
- _focusError: Qe,
2627
+ _focusError: Ye,
2628
2628
  _getWatch: L,
2629
2629
  _getDirty: F,
2630
2630
  _setValid: V,
@@ -2678,7 +2678,7 @@ function ps(e = {}) {
2678
2678
  },
2679
2679
  subscribe: Cr,
2680
2680
  trigger: Me,
2681
- register: Ye,
2681
+ register: Qe,
2682
2682
  handleSubmit: xt,
2683
2683
  watch: _r,
2684
2684
  setValue: J,
@@ -2728,7 +2728,7 @@ function Je(e = {}) {
2728
2728
  };
2729
2729
  }
2730
2730
  const s = t.current.control;
2731
- return s._options = e, Yn(() => {
2731
+ return s._options = e, Qn(() => {
2732
2732
  const o = s._subscribe({
2733
2733
  formState: s._proxyFormState,
2734
2734
  callback: () => i({ ...s._formState }),
@@ -2815,7 +2815,7 @@ const Ht = 27, Gt = 12, Wt = 10, bs = Fe("enum"), vs = (e, t) => {
2815
2815
  max: e.maxSelected ?? e.options.length
2816
2816
  };
2817
2817
  return Ze(ge({
2818
- checked: pe(Ur(Q(), zr()), rr((n) => Object.entries(n).filter(([i, s]) => s).map(([i, s]) => i)), qe(r.max, t("validation_multiple_choice_max", {
2818
+ checked: pe(Ur(Y(), zr()), rr((n) => Object.entries(n).filter(([i, s]) => s).map(([i, s]) => i)), qe(r.max, t("validation_multiple_choice_max", {
2819
2819
  count: r.max
2820
2820
  })), Oe(r.min, t("validation_multiple_choice_min", {
2821
2821
  count: r.min
@@ -2851,7 +2851,7 @@ const Ht = 27, Gt = 12, Wt = 10, bs = Fe("enum"), vs = (e, t) => {
2851
2851
  var C, v;
2852
2852
  const r = e.key ? (C = D.current$.value.flow) == null ? void 0 : C.data.submissions[e.key] : void 0, n = (e.config.minSelected === 1 || e.config.minSelected === void 0) && e.config.maxSelected === 1, i = n && e.config.options.length === 2, {
2853
2853
  t: s
2854
- } = Y(), {
2854
+ } = Q(), {
2855
2855
  register: o,
2856
2856
  handleSubmit: a,
2857
2857
  formState: {
@@ -2961,7 +2961,7 @@ const Ht = 27, Gt = 12, Wt = 10, bs = Fe("enum"), vs = (e, t) => {
2961
2961
  var v;
2962
2962
  const r = e.config.defaultValue, n = e.key ? (v = D.current$.value.flow) == null ? void 0 : v.data.submissions[e.key] : void 0, {
2963
2963
  t: i
2964
- } = Y(), {
2964
+ } = Q(), {
2965
2965
  register: s,
2966
2966
  handleSubmit: o,
2967
2967
  formState: {
@@ -3035,7 +3035,7 @@ const Ht = 27, Gt = 12, Wt = 10, bs = Fe("enum"), vs = (e, t) => {
3035
3035
  phoneNumber: ""
3036
3036
  };
3037
3037
  }, Vs = "44", Es = /^[0-9 ]+$/, Fs = Fe("string"), Is = Fe("phone"), As = (e) => {
3038
- const t = pe(Q(e("validation_country_code")), nr(Es, e("validation_country_code"))), r = pe(Q(e("validation_phone")), Oe(1, e("validation_phone")), rr((n) => n.replace(/[^0-9]/g, "")));
3038
+ const t = pe(Y(e("validation_country_code")), nr(Es, e("validation_country_code"))), r = pe(Y(e("validation_phone")), Oe(1, e("validation_phone")), rr((n) => n.replace(/[^0-9]/g, "")));
3039
3039
  return Ze(ge({
3040
3040
  countryCode: t,
3041
3041
  phoneNumber: r
@@ -3047,7 +3047,7 @@ const Ht = 27, Gt = 12, Wt = 10, bs = Fe("enum"), vs = (e, t) => {
3047
3047
  var E;
3048
3048
  const r = e.key ? (E = D.current$.value.flow) == null ? void 0 : E.data.submissions[e.key] : void 0, {
3049
3049
  t: n
3050
- } = Y(), [i, s] = se(), o = Fs(r) ? Ss(r.value) : Is(r) ? r.value : void 0, {
3050
+ } = Q(), [i, s] = se(), o = Fs(r) ? Ss(r.value) : Is(r) ? r.value : void 0, {
3051
3051
  register: a,
3052
3052
  handleSubmit: f,
3053
3053
  formState: {
@@ -3203,10 +3203,10 @@ const Ht = 27, Gt = 12, Wt = 10, bs = Fe("enum"), vs = (e, t) => {
3203
3203
  };
3204
3204
  return Ze(ge({
3205
3205
  text: {
3206
- date: pe(Q(t("validation_date")), nr(/^\d{4}-\d{2}-\d{2}$/, t("validation_date"))),
3207
- email: pe(Q(t("validation_email")), Wr(t("validation_email")), Oe(e.minChars ?? 1, r.minLength), qe(e.maxChars ?? 1 / 0, r.maxLength)),
3208
- text: pe(Q(), Oe(e.minChars ?? 1, r.minLength), qe(e.maxChars ?? 1 / 0, r.maxLength)),
3209
- url: pe(Q(t("validation_url")), Jr(t("validation_url")), Oe(e.minChars ?? 1, r.minLength), qe(e.maxChars ?? 1 / 0, r.maxLength))
3206
+ date: pe(Y(t("validation_date")), nr(/^\d{4}-\d{2}-\d{2}$/, t("validation_date"))),
3207
+ email: pe(Y(t("validation_email")), Wr(t("validation_email")), Oe(e.minChars ?? 1, r.minLength), qe(e.maxChars ?? 1 / 0, r.maxLength)),
3208
+ text: pe(Y(), Oe(e.minChars ?? 1, r.minLength), qe(e.maxChars ?? 1 / 0, r.maxLength)),
3209
+ url: pe(Y(t("validation_url")), Jr(t("validation_url")), Oe(e.minChars ?? 1, r.minLength), qe(e.maxChars ?? 1 / 0, r.maxLength))
3210
3210
  }[e.format]
3211
3211
  }));
3212
3212
  }, Rs = ({
@@ -3216,7 +3216,7 @@ const Ht = 27, Gt = 12, Wt = 10, bs = Fe("enum"), vs = (e, t) => {
3216
3216
  var v;
3217
3217
  const {
3218
3218
  t: r
3219
- } = Y(), n = e.key ? (v = D.current$.value.flow) == null ? void 0 : v.data.submissions[e.key] : void 0, i = e.config.defaultValue, {
3219
+ } = Q(), n = e.key ? (v = D.current$.value.flow) == null ? void 0 : v.data.submissions[e.key] : void 0, i = e.config.defaultValue, {
3220
3220
  register: s,
3221
3221
  handleSubmit: o,
3222
3222
  formState: {
@@ -3386,7 +3386,7 @@ const Te = /* @__PURE__ */ Ps(qs), Ks = /(\[[^\]]+\]\([^)]+\))/g, Hs = /\[([^\]]
3386
3386
  children: o
3387
3387
  }, o + a));
3388
3388
  return Te(i, Zs, (o, a) => c("br", {}, `br-${a}`));
3389
- }, Ys = Ge("select-text max-w-[min(100%,24rem)] [text-wrap:pretty] leading-snug flex-shrink min-w-[2rem] py-2 px-3 rounded-[18px] min-h-[36px] break-words relative", {
3389
+ }, Qs = Ge("select-text max-w-[min(100%,24rem)] [text-wrap:pretty] leading-snug flex-shrink min-w-[2rem] py-2 px-3 rounded-[18px] min-h-[36px] break-words relative", {
3390
3390
  variants: {
3391
3391
  side: {
3392
3392
  left: "bg-bubble-weak-bg text-neutral-12 shadow-surface-sm outline outline-1 outline-bubble-weak rounded-bl-md",
@@ -3400,7 +3400,7 @@ const Te = /* @__PURE__ */ Ps(qs), Ks = /(\[[^\]]+\]\([^)]+\))/g, Hs = /\[([^\]]
3400
3400
  defaultVariants: {
3401
3401
  side: "left"
3402
3402
  }
3403
- }), Qs = ({
3403
+ }), Ys = ({
3404
3404
  children: e,
3405
3405
  className: t,
3406
3406
  animate: r,
@@ -3410,7 +3410,7 @@ const Te = /* @__PURE__ */ Ps(qs), Ks = /(\[[^\]]+\]\([^)]+\))/g, Hs = /\[([^\]]
3410
3410
  style: {
3411
3411
  transformOrigin: n === "left" ? "0% 50%" : "100% 50%"
3412
3412
  },
3413
- class: Ys({
3413
+ class: Qs({
3414
3414
  className: t,
3415
3415
  side: n,
3416
3416
  animate: r
@@ -3499,7 +3499,7 @@ const Te = /* @__PURE__ */ Ps(qs), Ks = /(\[[^\]]+\]\([^)]+\))/g, Hs = /\[([^\]]
3499
3499
  }, (s) => {
3500
3500
  const o = s.author === "user" && !t.slice(i + 1).some((p) => p.type === "text" && p.author === "user"), a = i === t.length - 1, f = s.author === "bot" ? Xs(s.text) : s.text;
3501
3501
  return c(we, {
3502
- children: [o ? e : null, c(Qs, {
3502
+ children: [o ? e : null, c(Ys, {
3503
3503
  animate: a,
3504
3504
  side: ra[s.author],
3505
3505
  children: f
@@ -3554,7 +3554,7 @@ const Te = /* @__PURE__ */ Ps(qs), Ks = /(\[[^\]]+\]\([^)]+\))/g, Hs = /\[([^\]]
3554
3554
  chatService: a
3555
3555
  } = Xr(), {
3556
3556
  t: f
3557
- } = Y(), [p, C] = se();
3557
+ } = Q(), [p, C] = se();
3558
3558
  return xe(() => {
3559
3559
  s === "maximised" && Z.scrollToEnd.instant();
3560
3560
  }, [s]), xe(() => {
@@ -3568,7 +3568,7 @@ const Te = /* @__PURE__ */ Ps(qs), Ks = /(\[[^\]]+\]\([^)]+\))/g, Hs = /\[([^\]]
3568
3568
  let y = h.data.nodeHistory.at(-1);
3569
3569
  if (Z.scrollToEnd.instant(), D.setInput(void 0), h.data.isFinished)
3570
3570
  return;
3571
- y === void 0 ? (y = Qt(i.nodes).id, D.setCurrentNodeId(y), r.log({
3571
+ y === void 0 ? (y = Yt(i.nodes).id, D.setCurrentNodeId(y), r.log({
3572
3572
  event: "FLOW_START",
3573
3573
  properties: {
3574
3574
  flow_id: i.id,
@@ -3641,8 +3641,8 @@ const Te = /* @__PURE__ */ Ps(qs), Ks = /(\[[^\]]+\]\([^)]+\))/g, Hs = /\[([^\]]
3641
3641
  }) => {
3642
3642
  const {
3643
3643
  t
3644
- } = Y();
3645
- return c(Yr, {
3644
+ } = Q();
3645
+ return c(Qr, {
3646
3646
  onClick: async () => {
3647
3647
  const {
3648
3648
  flow: r