@inploi/plugin-chatbot 3.13.0 → 3.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cdn/index.js CHANGED
@@ -42,4 +42,4 @@ var Wd=Object.defineProperty;var Kd=(Ze,he,S)=>he in Ze?Wd(Ze,he,{enumerable:!0,
42
42
  `,ql=()=>({getOrCreateChatbotElement:()=>{const e=document.getElementById(jo);if(e)return e;const t=document.createElement("div");return document.body.appendChild(t),t.id=jo,t}});var Yl=["1","2","3","4","5","6","7","8","9","10","11","12"],Gl={light:{1:[98.8,.015],2:[97.8,.018],3:[95.8,.025],4:[92,.04],5:[89,.05],6:[85,.07],7:[80.5,.08],8:[74,.11],9:[60,.22],10:[56,.23],11:[50,.19],12:[25,.18]},dark:{1:[19,.015],2:[21,.018],3:[25.5,.055],4:[29.3,.084],5:[33.5,.098],6:[39.05,.107],7:[45,.11],8:[55,.13],9:[60,.22],10:[67,.18],11:[79.3,.12],12:[95,.04]}},Zl=(e,t=1,r)=>n=>{const[i,o]=Gl[r][n];return"oklch("+i+"% "+o*t+" "+e+")"},$n=e=>{const t=Zl(e.hue,e.chroma,e.mode);return Object.fromEntries(Yl.map(r=>[e.prefix+r,e.transform(t(r))]))},Sn=e=>e,Ql=e=>{const t=Object.keys(e).flatMap(r=>{const n=e[r];return typeof n=="object"&&n!==null?Object.keys(n).map(i=>{const o=n[i];return[`${String(r)}.${i}`,o]}):[[r,n]]});return Object.fromEntries(t)},wr=e=>!!e&&typeof e=="object"&&!Array.isArray(e),En=(e,...t)=>{if(!t.length)return e;const r=t.shift();if(wr(e)&&wr(r))for(const n in r){const i=r[n];if(wr(i)){e[n]||Object.assign(e,{[n]:{}});const o=e[n];wr(o)&&En(o,i)}else Object.assign(e,{[n]:r[n]})}return En(e,...t)},Xl=e=>{function t(r,n){const i=[e.prefix,n.toString().replace(/\./g,"-")].join("");return r==="declaration"?`--${i}`:`var(--${i})`}return t},Jl=()=>({core:e=>({semantic:t=>({component:r=>({from:n=>{const{theme:i,getToken:o}=n,s=v=>o("reference",v.toString()),a=e({theme:i}),l=t({theme:i,core:s,raw:{core:a}}),u=r({theme:i,core:s,semantic:s,raw:{core:a,semantic:l}}),p=Ql(En(a,l,u)),c=([v,b],m)=>{const h=[m,v].filter(Boolean).join(".");return typeof b=="object"?Object.entries(b).flatMap(_=>c(_,h)):[[n.getToken("declaration",h),b]]};return{values:p,declarations:Object.fromEntries(Object.entries(p).flatMap(v=>c(v))),ref:v=>o("reference",v.toString())}}})})})});const[Cn,On,as]=["oklch(0% 0 0)","oklch(100% 0 0)","transparent"],eu=Jl().core(({theme:e})=>({color:{black:Cn,white:On,lowest:e.mode==="light"?On:Cn,highest:e.mode==="light"?Cn:On,...$n({prefix:"a-",hue:e.hue,chroma:e.chroma,mode:e.mode,transform:Sn}),...$n({prefix:"n-",hue:e.hue,chroma:.05,mode:e.mode,transform:Sn}),...$n({prefix:"e-",hue:20,chroma:e.chroma,mode:e.mode,transform:Sn})},typography:{}})).semantic(({core:e,raw:t,theme:r})=>{const n=(i,o)=>t.core.color[i].replace(")",` / ${o})`);return{"font-family":{body:"inherit",headings:"inherit"},"font-style":{body:"normal",headings:"normal"},"font-weight-body":"normal","font-weight-headings":"normal","radius-app":"1.5rem","radius-interactive":"1.5rem",color:{divider:n("n-8",r.mode==="dark"?.4:.2)},"copy-body":e("color.n-12"),"copy-headings":e("color.n-12"),interactive:{copy:e("color.n-11"),"copy-hover":e("color.n-12"),"copy-active":e("color.n-12"),bg:as,"bg-hover":n("n-10",.4),"bg-active":n("n-10",.5)}}}).component(({raw:e,theme:t,semantic:r,core:n})=>{const i=(o,s)=>e.core.color[o].replace(")",` / ${s})`);return{app:{bg:n(t.mode==="dark"?"color.n-1":"color.n-2")},overlay:{bg:i("black",.4)},bubble:{"weak-bg":n(t.mode==="dark"?"color.n-3":"color.lowest"),"weak-outline":r("color.divider"),"strong-shadow":i("a-9",.05)},"status-bar":{bg:i("n-2",.8),"bg-button":as,"bg-button-hover":i("n-10",.4),"bg-button-active":i("n-10",.5)},"submit-button":{"bg-active":n(t.mode==="dark"?"color.a-8":"color.a-11")}}}),tu=Xl({prefix:"i-"}),ru=e=>{const t=eu.from({theme:e,getToken:tu}),r=Object.entries(t.declarations).map(([n,i])=>`${n}: ${i};`);return`#isdk {
43
43
  ${r.concat(r).join(`
44
44
  `)}
45
- }`},nu=({_internal_domManager:e=ql(),theme:t})=>Ze(({apiClient:r,logger:n,analytics:i})=>{let o=!1;const s=()=>{if(typeof window>"u")return;const a=[T("style",{id:"inploi-chatbot-styles"},Kl),T("style",{id:"inploi-chatbot-theme"},ru(t))],l=e.getOrCreateChatbotElement();lt(T(q,{},[a,T(Ul,{apiClient:r,logger:n,analytics:i})]),l),o=!0};return{prepare:async()=>{if(!(typeof window>"u"))try{if(o)return;s(),n.info("Chatbot plugin prepared")}catch(a){n.error("Error preparing chatbot plugin",a)}},fetchFlowByJobId:async a=>r.fetch(`/flow/job/${a}`).then(l=>{const u=Pt(Hl,l);return{context:{job_id:u.job.id,flow_id:u.flow.id,flow_version:u.flow.version},flow:u.flow,title:`Applying for “${u.job.title}”`,flowKeys:[u.job.id]}}),fetchFlowById:async a=>r.fetch(`/flow/id/${a}`).then(l=>{const u=Pt(zl,l);return{flow:u.flow,context:{flow_id:u.flow.id,flow_version:u.flow.version},title:"Chatbot",flowKeys:[]}}),open:async a=>{if(!(typeof window>"u"))try{D.cancelCurrentFlow(),D.viewState$.value="maximised",o||s(),a instanceof Promise?(D.current$.value={state:"loading"},a.then(async l=>{const u=Pt(Wl,l);D.startFlow(u)}).catch(l=>{const u=l instanceof Error?l.message:"An error occurred";D.current$.value={state:"error",error:u}})):D.startFlow(a)}catch(l){n.error("Error starting flow",l)}},startApplication:void 0,closeApplication:void 0,close:async()=>{typeof window>"u"||(D.cancelCurrentFlow(),n.info("Closed flow from an external source"))}}});if(!window.inploi)throw new Error("Please insert the SDK script tag above the plugins.");window.inploi.chatbotPlugin=nu;const cs=({node:e,nodes:t,stopWhen:r})=>{if((r==null?void 0:r(e))===!0)return e;const n=e.nextId?t.find(i=>i.id===e.nextId):void 0;if(n)return cs({node:n,nodes:t,stopWhen:r})},iu=({childNode:e,nodes:t})=>{const n=t.filter(i=>i.type==="if-block").find(i=>{if(!i.branchId)return!1;const o=t.find(a=>a.id===i.branchId);if(!o)return!1;const s=cs({node:o,nodes:t,stopWhen:a=>a.id===e.id});return!(!s||s.id!==e.id)});if(n!=null&&n.nextId)return t.find(i=>i.id===n.nextId)},ou=({flow:e,analytics:t,logger:r,context:n,apiClient:i,getSubmissions:o,chatService:s,onFlowEnd:a,onInterpret:l})=>{let u=new AbortController;const p=async(c,v)=>{const b=o();l==null||l(c,v);try{await su({analytics:t,logger:r,apiClient:i,context:n,node:c,submissions:b,chat:{sendMessage:async m=>s.send({groupId:c.id,message:m,signal:u.signal}),userInput:async m=>s.input({input:m,signal:u.signal})},next:m=>{const h=m?e.find(_=>_.id===m):iu({childNode:c,nodes:e});return h?p(h,c):a==null?void 0:a(c)},end:()=>a==null?void 0:a(c)})}catch(m){if(m instanceof Rt)return;throw m}};return{interpret:async c=>{const v=e.find(b=>b.id===c)??ts(e);return p(v)},undo:c=>{let v=1;const b=e.find(h=>h.id===c[c.length-1]);for(let h=c.length-2;h>0;h--){const _=c[h],k=e.find(w=>w.id===_);if(!k||(v++,k.type.startsWith("question-")))break}u.abort(),u=new AbortController;const m=e.find(h=>h.id===c[c.length-v]);return ke(m,"Undo failed: new start node not found"),p(m,b),{removed:v}},abort:()=>{u.abort()}}};async function su(e){return await Ne(e).with({node:{type:"text"}},uu).with({node:{type:"image"}},du).with({node:{type:"question-text"}},fu).with({node:{type:"question-enum"}},hu).with({node:{type:"question-number"}},pu).with({node:{type:"question-boolean"}},vu).with({node:{type:"question-file"}},gu).with({node:{type:"question-address"}},mu).with({node:{type:"end-flow"}},bu).with({node:{type:"if-block"}},lu).with({node:{type:"jump"}},({node:t,next:r})=>r(t.data.targetId)).with({node:{type:"link"}},cu).with({node:{type:"integration-application-submit"}},au).with({node:{type:"integration-workflow-get"}},()=>Error("Unreachable")).exhaustive()}async function au({chat:e,next:t,node:r,logger:n,apiClient:i,submissions:o,context:s,analytics:a}){r.data.skipConfirmation!==!0&&await e.userInput({type:"submit",key:void 0,config:{label:r.data.submitLabel}}),await e.sendMessage({type:"system",variant:"info",text:"Submitting…"});const{anonymous_id:l,session_id:u}=a.getSessionInfo(),p=await i.fetch("/flow/apply",{method:"POST",body:JSON.stringify({...s,integration_id:r.data.integrationId,anonymous_id:l,session_id:u,submissions:Il(o||{})})}).catch(c=>c);await Ne(p).with({ats_data:{redirect_url:fe.string}},async c=>{await e.sendMessage({type:"text",author:"bot",text:"Almost there! Please complete your submission here:"});const v=new URL(c.ats_data.redirect_url);l&&!v.searchParams.has("anonymous_id")&&v.searchParams.set("anonymous_id",l),await e.sendMessage({type:"link",href:v.toString(),text:"Complete submission"}),t(r.nextId)}).with({success:!0},async()=>{await e.sendMessage({type:"system",variant:"success",text:"Submission completed!"}),t(r.nextId)}).otherwise(async c=>{n.error(c),await e.sendMessage({type:"system",variant:"error",text:"Failed to submit"}),t(r.id)})}async function cu({chat:e,next:t,node:r,submissions:n}){await e.sendMessage({type:"link",href:r.data.href,text:ot(r.data.cta,n)}),t(r.nextId)}async function lu({submissions:e,next:t,node:r}){const n=yu(r,e)?r.branchId:r.nextId;t(n)}async function uu({chat:e,next:t,node:r,submissions:n}){await e.sendMessage({author:"bot",type:"text",text:ot(r.data.text,n)}),t(r.nextId)}async function du({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 fu({chat:e,next:t,node:r,submissions:n}){await e.sendMessage({author:"bot",type:"text",text:ot(r.data.question,n)});const i=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}});i.value===null?await e.sendMessage({type:"system",variant:"info",text:"Skipped"}):await e.sendMessage({author:"user",type:"text",text:i.value}),t(r.nextId)}async function pu({chat:e,next:t,node:r,submissions:n}){await e.sendMessage({author:"bot",type:"text",text:ot(r.data.question,n)});const i=await e.userInput({key:r.data.key,type:"text",config:{optional:r.data.optional,placeholder:r.data.placeholder,format:"text"}});i.value===null?await e.sendMessage({type:"system",variant:"info",text:"Skipped"}):await e.sendMessage({author:"user",type:"text",text:i.value}),t(r.nextId)}async function hu({chat:e,next:t,node:r,submissions:n}){await e.sendMessage({author:"bot",type:"text",text:ot(r.data.question,n)});const i=await e.userInput({key:r.data.key,type:"multiple-choice",config:r.data});i.value.length===0?await e.sendMessage({type:"system",variant:"info",text:"Skipped"}):await e.sendMessage({author:"user",type:"text",text:r.data.options.filter(o=>i.value.includes(o.value)).map(o=>o.label).join(", ")}),t(r.nextId)}async function vu({chat:e,next:t,node:r,submissions:n}){await e.sendMessage({author:"bot",type:"text",text:ot(r.data.question,n)});const o=(await e.userInput({key:r.data.key,type:"boolean",config:{optional:r.data.optional,labels:{true:r.data.trueLabel,false:r.data.falseLabel}}})).value;o===null?await e.sendMessage({type:"system",variant:"info",text:"Skipped"}):await e.sendMessage({author:"user",type:"text",text:{true:r.data.trueLabel,false:r.data.falseLabel}[o]}),t(r.nextId)}async function mu({chat:e,next:t,node:r}){await e.sendMessage({author:"bot",type:"text",text:r.data.question});const n=await e.userInput({type:"address",key:r.data.key,config:{optional:r.data.optional,keys:r.data.keys,placeholder:r.data.placeholder}});if(n.value===null)await e.sendMessage({type:"system",variant:"info",text:"Skipped"});else{const i=Object.values(n.value).filter(o=>o&&o.trim().length>0).join(", ");await e.sendMessage({author:"user",type:"text",text:i})}return t(r.nextId)}async function gu({node:e,chat:t,next:r,submissions:n}){await t.sendMessage({author:"bot",type:"text",text:ot(e.data.question,n)});const i=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(i.value===null)await t.sendMessage({type:"system",variant:"info",text:"Skipped"});else for(const o of i.value)await t.sendMessage({author:"user",type:"file",fileName:o.name,fileSizeKb:o.sizeKb});r(e.nextId)}async function bu({chat:e,end:t,node:r}){await e.sendMessage({type:"system",variant:"info",text:r.data.systemMessage}),t()}const ls=fe.union(fe.string,fe.array(fe.string),null),yu=(e,t)=>{const r=t==null?void 0:t[e.data.compareKey];return r?Ne({...e.data,answer:r}).with({compare:"equals"},({compareValue:n})=>typeof r.value=="string"||typeof r.value=="boolean"?n===r.value.toString():!1).with({compare:"notEquals"},({compareValue:n})=>typeof r.value=="string"||typeof r.value=="boolean"?n!==r.value.toString():!1).with({compare:"contains",answer:{value:ls}},({compareValue:n,answer:i})=>i.value!==null&&i.value.includes(n)).with({compare:"notContains",answer:{value:ls}},({compareValue:n,answer:i})=>i.value===null||!i.value.includes(n)).with({answer:{type:"file"}},()=>!1).with({answer:{type:"address",value:fe.any}},()=>!1).exhaustive():!1},ot=(e,t)=>{const r=/{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g;return e.replace(r,(n,i,o="")=>{i=i.trim();const s=t==null?void 0:t[i];if(!s)return o;switch(s.type){case"boolean":return s.value==="true"?"true":"false";case"file":return s.value?s.value.map(a=>`${a.name} (${Lt(a.sizeKb)})`).join(", "):"no files";case"multiple-choice":return s.value.join(", ");default:return s.value||o}})};function wu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Pn(e,t,r){var n,i,o,s,a;t==null&&(t=100);function l(){var p=Date.now()-s;p<t&&p>=0?n=setTimeout(l,t-p):(n=null,r||(a=e.apply(o,i),o=i=null))}var u=function(){o=this,i=arguments,s=Date.now();var p=r&&!n;return n||(n=setTimeout(l,t)),p&&(a=e.apply(o,i),o=i=null),a};return u.clear=function(){n&&(clearTimeout(n),n=null)},u.flush=function(){n&&(a=e.apply(o,i),o=i=null,clearTimeout(n),n=null)},u}Pn.debounce=Pn;var _u=Pn;const us=wu(_u);function xu(e){let{debounce:t,scroll:r,polyfill:n,offsetSize:i}=e===void 0?{debounce:0,scroll:!1,offsetSize:!1}:e;const o=n||(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[s,a]=Y({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),l=L({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s}),u=t?typeof t=="number"?t:t.scroll:null,p=t?typeof t=="number"?t:t.resize:null,c=L(!1);V(()=>(c.current=!0,()=>void(c.current=!1)));const[v,b,m]=se(()=>{const w=()=>{if(!l.current.element)return;const{left:P,top:I,width:O,height:z,bottom:W,right:N,x:F,y:ie}=l.current.element.getBoundingClientRect(),ee={left:P,top:I,width:O,height:z,bottom:W,right:N,x:F,y:ie};l.current.element instanceof HTMLElement&&i&&(ee.height=l.current.element.offsetHeight,ee.width=l.current.element.offsetWidth),Object.freeze(ee),c.current&&!Eu(l.current.lastBounds,ee)&&a(l.current.lastBounds=ee)};return[w,p?us(w,p):w,u?us(w,u):w]},[a,i,u,p]);function h(){l.current.scrollContainers&&(l.current.scrollContainers.forEach(w=>w.removeEventListener("scroll",m,!0)),l.current.scrollContainers=null),l.current.resizeObserver&&(l.current.resizeObserver.disconnect(),l.current.resizeObserver=null)}function _(){l.current.element&&(l.current.resizeObserver=new o(m),l.current.resizeObserver.observe(l.current.element),r&&l.current.scrollContainers&&l.current.scrollContainers.forEach(w=>w.addEventListener("scroll",m,{capture:!0,passive:!0})))}const k=w=>{!w||w===l.current.element||(h(),l.current.element=w,l.current.scrollContainers=ds(w),_())};return $u(m,!!r),ku(b),V(()=>{h(),_()},[r,m,b]),V(()=>h,[]),[k,s,v]}function ku(e){V(()=>{const t=e;return window.addEventListener("resize",t),()=>void window.removeEventListener("resize",t)},[e])}function $u(e,t){V(()=>{if(t){const r=e;return window.addEventListener("scroll",r,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",r,!0)}},[e,t])}function ds(e){const t=[];if(!e||e===document.body)return t;const{overflow:r,overflowX:n,overflowY:i}=window.getComputedStyle(e);return[r,n,i].some(o=>o==="auto"||o==="scroll")&&t.push(e),[...t,...ds(e.parentElement)]}const Su=["x","y","top","bottom","left","right","width","height"],Eu=(e,t)=>Su.every(r=>e[r]===t[r]),jt=({class:e,...t})=>d("button",{class:Ue("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:d("svg",{class:"block",width:"16",height:"16",viewBox:"0 0 16 16",fill:"transparent",stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",children:[d("title",{children:"Send"}),d("path",{d:"M3.5 7.5L8 3L12.5 7.5"}),d("path",{d:"M8 4V13"})]})}),Cu=25,An=We({instant:()=>{},smooth:()=>{}}),ce={onSubmitSuccessFn$:We(()=>{}),isBotTyping$:We(!1),scrollToEnd:{instant:()=>An.value.instant(),smooth:()=>An.value.smooth()}},Ou=()=>{const e=L(null);ye(()=>{An.value={instant:()=>{var r;return(r=e.current)==null?void 0:r.scrollTo({top:e.current.scrollHeight,behavior:"instant"})},smooth:()=>{e.current&&e.current.scrollHeight-e.current.scrollTop<=e.current.clientHeight*1.5&&e.current.scrollTo({top:e.current.scrollHeight,behavior:"smooth"})}}},[e]);const t=se(()=>({send:async({message:r,signal:n,groupId:i})=>{if(await Ne(r).with({author:"bot",type:"text"},async o=>{if(n!=null&&n.aborted)throw new Rt;ce.isBotTyping$.value=!0;const s=Math.min(Math.max(20,o.text.length),100)*Cu;await new Promise(a=>setTimeout(a,s,{signal:n})),ce.isBotTyping$.value=!1}).otherwise(async()=>{}),n!=null&&n.aborted)throw new Rt;D.addMessage(r,i)},input:async({input:r,signal:n})=>{if(n!=null&&n.aborted)throw new Rt;return D.setInput(r),await new Promise(i=>{const o=s=>{if(n!=null&&n.aborted)throw new Rt;D.setInput(void 0),r.key&&D.setSubmission(r.key,s),i(s)};ce.onSubmitSuccessFn$.value=o})}}),[]);return{chatRef:e,chatService:t}},Ut=({class:e,...t})=>d("button",{type:"button",class:Ue("fr text-neutral-9 flex flex-shrink-0 items-center justify-center gap-1 rounded-full py-[6px] pl-2 pr-3 text-sm underline-offset-2 transition-all",e),...t,children:[d("svg",{class:"block",width:"16",height:"16",viewBox:"0 0 16 16",fill:"transparent",stroke:"currentColor","stroke-linecap":"round","stroke-width":"1.5",children:[d("title",{children:"Skip"}),d("path",{d:"M3.25 11.25A5 5 0 0 1 12 7"}),d("path",{d:"M13.25 4.5V8.25H9.5"})]}),"Skip"]}),fs={line1:["street_number","floor","room","premise"],line2:["subpremise","street_address","route"],line3:["sublocality","neighborhood"],city:["locality","postal_town"],state:["administrative_area_level_1"],postcode:["postal_code"],country:["country"]},_r=Object.keys(fs),Pu=e=>_r.reduce((t,r)=>{const n=fs[r],i=e.filter(o=>o.types.some(s=>n.includes(s))).map(o=>o.long_name).join(", ");return i&&(t[r]=i),t},{}),Au=document.createElement("div"),Iu=()=>se(()=>{const{google:e}=window;if(!("google"in window)||!("maps"in e)||!("places"in e.maps))return{enabled:!1};const t=new e.maps.places.AutocompleteService,r=new e.maps.places.PlacesService(Au);return{enabled:!0,getPredictions:async n=>{const{predictions:i}=await t.getPlacePredictions({input:n});return i.map(o=>({label:o.description,value:o.place_id}))},getPlaceDetails:async n=>await new Promise((o,s)=>r.getDetails({placeId:n,fields:["address_components"]},(a,l)=>l!==e.maps.places.PlacesServiceStatus.OK?s(l):a===null?s("ZERO_RESULTS"):o({ok:!0,place:a}))).catch(async o=>(console.error("Failed to get address details",o),{ok:!1}))}},[]),In=e=>d("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:[d("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:d("path",{d:"M10 3L5 8L10 13"})}),d("span",{children:"Back"})]}),Dn={label:"Fill in manually",value:""},Du=({input:e,onSubmitSuccess:t})=>{const[r,n]=Y(""),[i,o]=Y(),[s,a]=Y([]),[l,u]=Y(),{enabled:p,getPredictions:c,getPlaceDetails:v}=Iu(),[b,m]=Y(p?"query":"manual"),h=se(()=>rs(_=>{if(ke(p,"Query state should not be enabled if Google Places isn't available"),n(_),_===""){a([]);return}c(_).then(k=>{a(k)})},500),[p,c]);switch(V(()=>{if(p&&!(l===void 0||l===""))return v(l).then(_=>{if(!_.ok||!_.place.address_components){o({});return}const k=Pu(_.place.address_components);o(k),m("details")}),()=>{o(void 0)}},[l,v,p]),b){case"query":return ke(p,"Query state should not be enabled if Google Places isn't available"),d(Tu,{input:e,onSkip:()=>t(null),onAddressSelect:_=>{u(_),m("loading")},onInputChange:h,suggestions:s,query:r});case"loading":return d(Tn,{input:e,onSubmitSuccess:t,addressFields:{},actions:d(In,{onClick:()=>{u(void 0),m("query")}})});case"details":return ke(i!==void 0),d(Tn,{input:e,onSubmitSuccess:t,addressFields:i,actions:d(In,{onClick:()=>{u(void 0),m("query")}})});case"manual":return d(Tn,{input:e,onSubmitSuccess:t,addressFields:{},actions:p?d(In,{onClick:()=>{u(void 0),m("query")}}):void 0})}},Tu=({input:e,onSkip:t,suggestions:r,onAddressSelect:n,query:i,onInputChange:o})=>{const s=L(null);return ye(()=>{s.current&&(s.current.focus(),s.current.select())},[]),d(q,{children:[d("form",{noValidate:!0,onSubmit:a=>{a.preventDefault},class:"flex flex-col justify-end gap-1 p-2.5",children:[d("input",{onChange:a=>{o(a.currentTarget.value)},ref:s,name:"address",id:"chat-address",autocomplete:"on",autoFocus:!0,class:"outline-divider ease-expo-out placeholder:text-neutral-10 text-neutral-12 focus-visible:outline-accent-7 caret-accent-9 bg-lowest w-full rounded-full px-3 py-1 text-base outline outline-2 transition-all",placeholder:e.config.placeholder||"Search an address",defaultValue:i}),!e.config.optional&&d(Ut,{class:"absolute right-3",onClick:t})]}),d("ul",{children:[r.map(a=>d("li",{children:d("button",{class:"text-neutral-11 fr hover: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:()=>{n(a.value)},children:[d("span",{class:"flex-grow",children:a.label}),d("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:d("path",{d:"M6 3L11 8L6 13"})})]})},a.label)),d("li",{children:d("button",{class:"text-neutral-11 fr hover: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:()=>{n(Dn.value)},children:d("span",{class:"flex-grow",children:Dn.label})})},Dn.label)]})]})},Nu={line1:"Line 1",line2:"Line 2",line3:"Line 3",city:"City",state:"State",postcode:"Postcode",country:"Country"},Tn=({addressFields:e,onSubmitSuccess:t,actions:r})=>{const n=L(null);return ye(()=>{n.current&&(n.current.focus(),n.current.select())},[]),d("form",{class:"bg-neutral-1/90 flex flex-col justify-end gap-2 p-2",onSubmit:i=>{const o=new FormData(i.currentTarget),s=Object.fromEntries(o.entries());t(s)},children:[d("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:n,children:_r.map((i,o)=>{const s=`isdk_${i}`;return d(q,{children:[d("label",{for:s,class:"text-neutral-9 [&:has(+*>input:focus)]:text-neutral-11 w-24 pb-2 text-xs uppercase leading-3 tracking-widest transition-colors",children:Nu[i]}),d("div",{class:"flex flex-col items-stretch gap-1.5",children:[d("input",{autoFocus:o===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 focus:outline-none",name:i,id:s,defaultValue:e[i],required:!0}),o!==_r.length-1&&d("hr",{class:"border-b-neutral-5 m-0 w-full border-b border-solid"}),o===_r.length-1&&d("hr",{class:"m-0 w-full border-b border-b-transparent"})]})]})})}),d("div",{class:"flex w-full flex-1 ",children:[d("div",{class:"flex-grow",children:r}),d(jt,{class:"flex items-center justify-center"})]})]})},Nn=()=>{const e=L(null);return V(()=>{var t;(t=e.current)==null||t.focus()},[]),e},ps=["true","false"],Fu=sa(ps),Mu="answer",Lu=({input:e,onSubmitSuccess:t})=>{const r=Nn();return d("form",{noValidate:!0,class:"",onSubmit:n=>{n.preventDefault();const i=Ne(n).with({nativeEvent:{submitter:fe.select(fe.union(fe.instanceOf(HTMLButtonElement),fe.instanceOf(HTMLInputElement)))}},s=>s.value).otherwise(()=>{throw new Error("invalid form")}),o=Pt(Fu,i);t(o)},children:[d("div",{class:"flex items-center gap-2 p-2.5",children:ps.map((n,i)=>d("button",{ref:i===0?r:null,type:"submit",name:Mu,value:n,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 flex-1 overflow-hidden rounded-2xl px-2.5 py-2.5 ring-2 transition-all selection:bg-transparent",children:d("p",{class:"truncate text-center text-base",children:e.config.labels[n]})}))}),e.config.optional&&d("div",{class:"px-2 pb-2",children:d(Ut,{class:"w-full",type:"button",onClick:()=>t(null)})})]})},Fn=({error:e})=>e?d("div",{role:"alert",class:"text-error-11 flex max-w-full items-center gap-1 overflow-hidden rounded-full px-2 py-2",children:[d("svg",{class:"text-error-9 h-4 w-4",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[d("circle",{cx:"8",cy:"8",r:"6.3",stroke:"currentColor","stroke-width":"1.4"}),d("rect",{x:"7",y:"4",width:"2",height:"5",fill:"currentColor"}),d("rect",{x:"7",y:"10",width:"2",height:"2",fill:"currentColor"})]}),d("p",{class:"truncate pr-1 text-sm",children:e.message})]}):null,Ru=e=>new Promise((t,r)=>{const n=new FileReader;n.readAsDataURL(e),n.onload=()=>n.result?t(n.result.toString()):r("No result from reader"),n.onerror=r}),Vu=e=>e.reduce((t,r)=>t+r.sizeKb,0),Bu=xn("file"),hs=3,ju=({file:e,class:t,...r})=>{const n=e.name.split(".").pop(),i=e.name.replace(new RegExp(`.${n}$`),"");return d("div",{class:Ue("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:[d("p",{"aria-label":"File name",class:"text-accent-12 flex flex-grow overflow-hidden",children:[d("span",{class:"block truncate",children:i}),d("span",{children:[".",n]})]}),d("p",{"aria-label":"File size",class:"text-accent-11",children:Lt(e.sizeKb)})]})},vs=({class:e,...t})=>d("li",{class:Ue("outline-neutral-6 text-neutral-11 bg-neutral-1 block rounded-md px-1 py-0.5 text-xs outline outline-1",e),...t}),ms=e=>{const t=e.split(".").pop();if(!t)throw new Error("No file extension found");return t?"."+t:""},Uu=({allowedExtensions:e,files:t})=>{const r=e.map(n=>n.toLowerCase());return t.every(n=>r.includes(ms(n.name).toLowerCase()))},zu=(e,t)=>{const r=ms(e);return`${e.replace(new RegExp(`${r}$`),"").slice(0,t)}${r}`},Hu=({input:e,onSubmitSuccess:t})=>{var p;const r=(p=D.current$.value.flow)==null?void 0:p.data.submissions[e.key],[n,i]=Y(Bu(r)&&r.value!==null?r.value:[]),[o,s]=Y(),a=n.length-hs,l=Vu(n),u=Nn();return d("form",{class:"flex flex-col gap-1 p-2.5",onSubmit:c=>(c.preventDefault(),s(void 0),n.length===0?s({type:"required",message:"Please select a file"}):e.config.extensions.length>0&&!Uu({allowedExtensions:e.config.extensions,files:n})?s({type:"validate",message:`Please upload ${e.config.extensions.join(", ")} files only`}):e.config.fileSizeLimitKib&&l>e.config.fileSizeLimitKib?s({type:"max",message:`File size exceeds limit of ${Lt(e.config.fileSizeLimitKib)}`}):e.config.allowMultiple===!1&&n.length>1?s({type:"invalid",message:"Only one file is allowed"}):t(n)),children:[d("div",{class:"flex items-center gap-2",children:[d("label",{ref:u,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:[n.length>0?d(q,{children:[d("ul",{class:"flex max-w-full flex-wrap justify-center gap-1 overflow-hidden p-1",children:[n.slice(0,hs).map(c=>{const v=c.name.split(".").pop(),b=c.name.replace(new RegExp(`.${v}$`),"");return d(vs,{class:"flex overflow-hidden",children:[d("span",{class:"block truncate",children:b}),d("span",{children:[".",v]})]})}),a>0?d(vs,{children:["+",a," file",a!==1?"s":""]}):null]}),d("p",{class:"text-neutral-11 text-xs",children:[Lt(l)," ",n.length>1?"total":""]})]}):d("div",{class:"flex flex-col justify-center gap-4 pb-6 pt-5",children:[d("header",{class:"flex flex-col items-center gap-0",children:[d("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:d("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"})}),d("p",{class:"text-neutral-12 tracking-[-0.01em]",children:[e.config.allowMultiple?"Select files":"Select a file"," to upload"]}),e.config.fileSizeLimitKib?d("p",{class:"text-neutral-10 text-xs",children:["(max ",Lt(e.config.fileSizeLimitKib),")"]}):null]}),d("aside",{class:"flex flex-col items-center gap-2",children:[d("p",{id:"accepted-filetypes",class:"sr-only",children:"Accepted file extensions"}),d("ul",{"aria-describedby":"accepted-filetypes",class:"flex flex-wrap justify-center gap-2",children:e.config.extensions.map(c=>d("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:c.replace(".","")}))})]})]}),d("input",{id:"dropzone-file",onInput:async c=>{ke(c.target instanceof HTMLInputElement);const v=c.target.files?Array.from(c.target.files):[],b=await Promise.allSettled(v.map(async h=>{const _=await Ru(h);return{name:zu(h.name,42),data:_,sizeKb:h.size/1e3}}));if(b.some(({status:h})=>h==="rejected"))return s({type:"invalid",message:"Invalid file"});const m=b.map(h=>h.status==="fulfilled"?h.value:null).filter(Boolean);i(m)},multiple:e.config.allowMultiple,type:"file",class:"sr-only"})]}),d("div",{class:"flex h-full flex-col items-center gap-2",children:[d(jt,{disabled:n.length===0}),e.config.optional&&d(Ut,{onClick:()=>t(null)})]})]}),o&&d(Fn,{error:o})]})};var zt=e=>e.type==="checkbox",_t=e=>e instanceof Date,le=e=>e==null;const gs=e=>typeof e=="object";var J=e=>!le(e)&&!Array.isArray(e)&&gs(e)&&!_t(e),Wu=e=>J(e)&&e.target?zt(e.target)?e.target.checked:e.target.value:e,Ku=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,qu=(e,t)=>e.has(Ku(t)),Yu=e=>{const t=e.constructor&&e.constructor.prototype;return J(t)&&t.hasOwnProperty("isPrototypeOf")},Mn=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Fe(e){let t;const r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(Mn&&(e instanceof Blob||e instanceof FileList))&&(r||J(e)))if(t=r?[]:{},!r&&!Yu(e))t=e;else for(const n in e)e.hasOwnProperty(n)&&(t[n]=Fe(e[n]));else return e;return t}var Ht=e=>Array.isArray(e)?e.filter(Boolean):[],Z=e=>e===void 0,E=(e,t,r)=>{if(!t||!J(e))return r;const n=Ht(t.split(/[,[\].]+?/)).reduce((i,o)=>le(i)?i:i[o],e);return Z(n)||n===e?Z(e[t])?r:e[t]:n},Ye=e=>typeof e=="boolean";const bs={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},$e={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Me={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};xe.createContext(null);var Gu=(e,t,r,n=!0)=>{const i={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(i,o,{get:()=>{const s=o;return t._proxyFormState[s]!==$e.all&&(t._proxyFormState[s]=!n||$e.all),r&&(r[s]=!0),e[s]}});return i},we=e=>J(e)&&!Object.keys(e).length,Zu=(e,t,r,n)=>{r(e);const{name:i,...o}=e;return we(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(s=>t[s]===(!n||$e.all))},Ln=e=>Array.isArray(e)?e:[e];function Qu(e){const t=xe.useRef(e);t.current=e,xe.useEffect(()=>{const r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}},[e.disabled])}var Oe=e=>typeof e=="string",Xu=(e,t,r,n,i)=>Oe(e)?(n&&t.watch.add(e),E(r,e,i)):Array.isArray(e)?e.map(o=>(n&&t.watch.add(o),E(r,o))):(n&&(t.watchAll=!0),r),Rn=e=>/^\w*$/.test(e),ys=e=>Ht(e.replace(/["|']|\]/g,"").split(/\.|\[/));function U(e,t,r){let n=-1;const i=Rn(t)?[t]:ys(t),o=i.length,s=o-1;for(;++n<o;){const a=i[n];let l=r;if(n!==s){const u=e[a];l=J(u)||Array.isArray(u)?u:isNaN(+i[n+1])?{}:[]}e[a]=l,e=e[a]}return e}var ws=(e,t,r,n,i)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:i||!0}}:{},_s=e=>({isOnSubmit:!e||e===$e.onSubmit,isOnBlur:e===$e.onBlur,isOnChange:e===$e.onChange,isOnAll:e===$e.all,isOnTouch:e===$e.onTouched}),xs=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const xr=(e,t,r,n)=>{for(const i of r||Object.keys(e)){const o=E(e,i);if(o){const{_f:s,...a}=o;if(s){if(s.refs&&s.refs[0]&&t(s.refs[0],i)&&!n)break;if(s.ref&&t(s.ref,s.name)&&!n)break}else J(a)&&xr(a,t)}}};var Ju=(e,t,r)=>{const n=Ht(E(e,r));return U(n,"root",t[r]),U(e,r,n),e},Vn=e=>e.type==="file",Ge=e=>typeof e=="function",kr=e=>{if(!Mn)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},$r=e=>Oe(e),Bn=e=>e.type==="radio",Sr=e=>e instanceof RegExp;const ks={value:!1,isValid:!1},$s={value:!0,isValid:!0};var Ss=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&&!Z(e[0].attributes.value)?Z(e[0].value)||e[0].value===""?$s:{value:e[0].value,isValid:!0}:$s:ks}return ks};const Es={isValid:!1,value:null};var Cs=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,Es):Es;function Os(e,t,r="validate"){if($r(e)||Array.isArray(e)&&e.every($r)||Ye(e)&&!e)return{type:r,message:$r(e)?e:"",ref:t}}var xt=e=>J(e)&&!Sr(e)?e:{value:e,message:""},Ps=async(e,t,r,n,i)=>{const{ref:o,refs:s,required:a,maxLength:l,minLength:u,min:p,max:c,pattern:v,validate:b,name:m,valueAsNumber:h,mount:_,disabled:k}=e._f,w=E(t,m);if(!_||k)return{};const P=s?s[0]:o,I=B=>{n&&P.reportValidity&&(P.setCustomValidity(Ye(B)?"":B||""),P.reportValidity())},O={},z=Bn(o),W=zt(o),N=z||W,F=(h||Vn(o))&&Z(o.value)&&Z(w)||kr(o)&&o.value===""||w===""||Array.isArray(w)&&!w.length,ie=ws.bind(null,m,r,O),ee=(B,M,Q,pe=Me.maxLength,_e=Me.minLength)=>{const Pe=B?M:Q;O[m]={type:B?pe:_e,message:Pe,ref:o,...ie(B?pe:_e,Pe)}};if(i?!Array.isArray(w)||!w.length:a&&(!N&&(F||le(w))||Ye(w)&&!w||W&&!Ss(s).isValid||z&&!Cs(s).isValid)){const{value:B,message:M}=$r(a)?{value:!!a,message:a}:xt(a);if(B&&(O[m]={type:Me.required,message:M,ref:P,...ie(Me.required,M)},!r))return I(M),O}if(!F&&(!le(p)||!le(c))){let B,M;const Q=xt(c),pe=xt(p);if(!le(w)&&!isNaN(w)){const _e=o.valueAsNumber||w&&+w;le(Q.value)||(B=_e>Q.value),le(pe.value)||(M=_e<pe.value)}else{const _e=o.valueAsDate||new Date(w),Pe=Or=>new Date(new Date().toDateString()+" "+Or),at=o.type=="time",Kt=o.type=="week";Oe(Q.value)&&w&&(B=at?Pe(w)>Pe(Q.value):Kt?w>Q.value:_e>new Date(Q.value)),Oe(pe.value)&&w&&(M=at?Pe(w)<Pe(pe.value):Kt?w<pe.value:_e<new Date(pe.value))}if((B||M)&&(ee(!!B,Q.message,pe.message,Me.max,Me.min),!r))return I(O[m].message),O}if((l||u)&&!F&&(Oe(w)||i&&Array.isArray(w))){const B=xt(l),M=xt(u),Q=!le(B.value)&&w.length>+B.value,pe=!le(M.value)&&w.length<+M.value;if((Q||pe)&&(ee(Q,B.message,M.message),!r))return I(O[m].message),O}if(v&&!F&&Oe(w)){const{value:B,message:M}=xt(v);if(Sr(B)&&!w.match(B)&&(O[m]={type:Me.pattern,message:M,ref:o,...ie(Me.pattern,M)},!r))return I(M),O}if(b){if(Ge(b)){const B=await b(w,t),M=Os(B,P);if(M&&(O[m]={...M,...ie(Me.validate,M.message)},!r))return I(M.message),O}else if(J(b)){let B={};for(const M in b){if(!we(B)&&!r)break;const Q=Os(await b[M](w,t),P,M);Q&&(B={...Q,...ie(M,Q.message)},I(Q.message),r&&(O[m]=B))}if(!we(B)&&(O[m]={ref:P,...B},!r))return O}}return I(!0),O};function ed(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Z(e)?n++:e[t[n++]];return e}function td(e){for(const t in e)if(e.hasOwnProperty(t)&&!Z(e[t]))return!1;return!0}function ne(e,t){const r=Array.isArray(t)?t:Rn(t)?[t]:ys(t),n=r.length===1?e:ed(e,r),i=r.length-1,o=r[i];return n&&delete n[o],i!==0&&(J(n)&&we(n)||Array.isArray(n)&&td(n))&&ne(e,r.slice(0,-1)),e}function jn(){let e=[];return{get observers(){return e},next:i=>{for(const o of e)o.next&&o.next(i)},subscribe:i=>(e.push(i),{unsubscribe:()=>{e=e.filter(o=>o!==i)}}),unsubscribe:()=>{e=[]}}}var Er=e=>le(e)||!gs(e);function st(e,t){if(Er(e)||Er(t))return e===t;if(_t(e)&&_t(t))return e.getTime()===t.getTime();const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const i of r){const o=e[i];if(!n.includes(i))return!1;if(i!=="ref"){const s=t[i];if(_t(o)&&_t(s)||J(o)&&J(s)||Array.isArray(o)&&Array.isArray(s)?!st(o,s):o!==s)return!1}}return!0}var As=e=>e.type==="select-multiple",rd=e=>Bn(e)||zt(e),Un=e=>kr(e)&&e.isConnected,Is=e=>{for(const t in e)if(Ge(e[t]))return!0;return!1};function Cr(e,t={}){const r=Array.isArray(e);if(J(e)||r)for(const n in e)Array.isArray(e[n])||J(e[n])&&!Is(e[n])?(t[n]=Array.isArray(e[n])?[]:{},Cr(e[n],t[n])):le(e[n])||(t[n]=!0);return t}function Ds(e,t,r){const n=Array.isArray(e);if(J(e)||n)for(const i in e)Array.isArray(e[i])||J(e[i])&&!Is(e[i])?Z(t)||Er(r[i])?r[i]=Array.isArray(e[i])?Cr(e[i],[]):{...Cr(e[i])}:Ds(e[i],le(t)?{}:t[i],r[i]):r[i]=!st(e[i],t[i]);return r}var zn=(e,t)=>Ds(e,t,Cr(t)),Ts=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Z(e)?e:t?e===""?NaN:e&&+e:r&&Oe(e)?new Date(e):n?n(e):e;function Hn(e){const t=e.ref;if(!(e.refs?e.refs.every(r=>r.disabled):t.disabled))return Vn(t)?t.files:Bn(t)?Cs(e.refs).value:As(t)?[...t.selectedOptions].map(({value:r})=>r):zt(t)?Ss(e.refs).value:Ts(Z(t.value)?e.ref.value:t.value,e)}var nd=(e,t,r,n)=>{const i={};for(const o of e){const s=E(t,o);s&&U(i,o,s._f)}return{criteriaMode:r,names:[...e],fields:i,shouldUseNativeValidation:n}},Wt=e=>Z(e)?e:Sr(e)?e.source:J(e)?Sr(e.value)?e.value.source:e.value:e,id=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Ns(e,t,r){const n=E(e,r);if(n||Rn(r))return{error:n,name:r};const i=r.split(".");for(;i.length;){const o=i.join("."),s=E(t,o),a=E(e,o);if(s&&!Array.isArray(s)&&r!==o)return{name:r};if(a&&a.type)return{name:o,error:a};i.pop()}return{name:r}}var od=(e,t,r,n,i)=>i.isOnAll?!1:!r&&i.isOnTouch?!(t||e):(r?n.isOnBlur:i.isOnBlur)?!e:(r?n.isOnChange:i.isOnChange)?e:!0,sd=(e,t)=>!Ht(E(e,t)).length&&ne(e,t);const ad={mode:$e.onSubmit,reValidateMode:$e.onChange,shouldFocusError:!0};function cd(e={},t){let r={...ad,...e},n={submitCount:0,isDirty:!1,isLoading:Ge(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{},disabled:!1},i={},o=J(r.defaultValues)||J(r.values)?Fe(r.defaultValues||r.values)||{}:{},s=r.shouldUnregister?{}:Fe(o),a={action:!1,mount:!1,watch:!1},l={mount:new Set,unMount:new Set,array:new Set,watch:new Set},u,p=0;const c={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},v={values:jn(),array:jn(),state:jn()},b=e.resetOptions&&e.resetOptions.keepDirtyValues,m=_s(r.mode),h=_s(r.reValidateMode),_=r.criteriaMode===$e.all,k=f=>g=>{clearTimeout(p),p=setTimeout(f,g)},w=async f=>{if(c.isValid||f){const g=r.resolver?we((await F()).errors):await ee(i,!0);g!==n.isValid&&v.state.next({isValid:g})}},P=f=>c.isValidating&&v.state.next({isValidating:f}),I=(f,g=[],y,C,$=!0,x=!0)=>{if(C&&y){if(a.action=!0,x&&Array.isArray(E(i,f))){const A=y(E(i,f),C.argA,C.argB);$&&U(i,f,A)}if(x&&Array.isArray(E(n.errors,f))){const A=y(E(n.errors,f),C.argA,C.argB);$&&U(n.errors,f,A),sd(n.errors,f)}if(c.touchedFields&&x&&Array.isArray(E(n.touchedFields,f))){const A=y(E(n.touchedFields,f),C.argA,C.argB);$&&U(n.touchedFields,f,A)}c.dirtyFields&&(n.dirtyFields=zn(o,s)),v.state.next({name:f,isDirty:M(f,g),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else U(s,f,g)},O=(f,g)=>{U(n.errors,f,g),v.state.next({errors:n.errors})},z=(f,g,y,C)=>{const $=E(i,f);if($){const x=E(s,f,Z(y)?E(o,f):y);Z(x)||C&&C.defaultChecked||g?U(s,f,g?x:Hn($._f)):_e(f,x),a.mount&&w()}},W=(f,g,y,C,$)=>{let x=!1,A=!1;const H={name:f};if(!y||C){c.isDirty&&(A=n.isDirty,n.isDirty=H.isDirty=M(),x=A!==H.isDirty);const X=st(E(o,f),g);A=E(n.dirtyFields,f),X?ne(n.dirtyFields,f):U(n.dirtyFields,f,!0),H.dirtyFields=n.dirtyFields,x=x||c.dirtyFields&&A!==!X}if(y){const X=E(n.touchedFields,f);X||(U(n.touchedFields,f,y),H.touchedFields=n.touchedFields,x=x||c.touchedFields&&X!==y)}return x&&$&&v.state.next(H),x?H:{}},N=(f,g,y,C)=>{const $=E(n.errors,f),x=c.isValid&&Ye(g)&&n.isValid!==g;if(e.delayError&&y?(u=k(()=>O(f,y)),u(e.delayError)):(clearTimeout(p),u=null,y?U(n.errors,f,y):ne(n.errors,f)),(y?!st($,y):$)||!we(C)||x){const A={...C,...x&&Ye(g)?{isValid:g}:{},errors:n.errors,name:f};n={...n,...A},v.state.next(A)}P(!1)},F=async f=>r.resolver(s,r.context,nd(f||l.mount,i,r.criteriaMode,r.shouldUseNativeValidation)),ie=async f=>{const{errors:g}=await F(f);if(f)for(const y of f){const C=E(g,y);C?U(n.errors,y,C):ne(n.errors,y)}else n.errors=g;return g},ee=async(f,g,y={valid:!0})=>{for(const C in f){const $=f[C];if($){const{_f:x,...A}=$;if(x){const H=l.array.has(x.name),X=await Ps($,s,_,r.shouldUseNativeValidation&&!g,H);if(X[x.name]&&(y.valid=!1,g))break;!g&&(E(X,x.name)?H?Ju(n.errors,X,x.name):U(n.errors,x.name,X[x.name]):ne(n.errors,x.name))}A&&await ee(A,g,y)}}return y.valid},B=()=>{for(const f of l.unMount){const g=E(i,f);g&&(g._f.refs?g._f.refs.every(y=>!Un(y)):!Un(g._f.ref))&&Kn(f)}l.unMount=new Set},M=(f,g)=>(f&&g&&U(s,f,g),!st(Rs(),o)),Q=(f,g,y)=>Xu(f,l,{...a.mount?s:Z(g)?o:Oe(f)?{[f]:g}:g},y,g),pe=f=>Ht(E(a.mount?s:o,f,e.shouldUnregister?E(o,f,[]):[])),_e=(f,g,y={})=>{const C=E(i,f);let $=g;if(C){const x=C._f;x&&(!x.disabled&&U(s,f,Ts(g,x)),$=kr(x.ref)&&le(g)?"":g,As(x.ref)?[...x.ref.options].forEach(A=>A.selected=$.includes(A.value)):x.refs?zt(x.ref)?x.refs.length>1?x.refs.forEach(A=>(!A.defaultChecked||!A.disabled)&&(A.checked=Array.isArray($)?!!$.find(H=>H===A.value):$===A.value)):x.refs[0]&&(x.refs[0].checked=!!$):x.refs.forEach(A=>A.checked=A.value===$):Vn(x.ref)?x.ref.value="":(x.ref.value=$,x.ref.type||v.values.next({name:f,values:{...s}})))}(y.shouldDirty||y.shouldTouch)&&W(f,$,y.shouldTouch,y.shouldDirty,!0),y.shouldValidate&&Wn(f)},Pe=(f,g,y)=>{for(const C in g){const $=g[C],x=`${f}.${C}`,A=E(i,x);(l.array.has(f)||!Er($)||A&&!A._f)&&!_t($)?Pe(x,$,y):_e(x,$,y)}},at=(f,g,y={})=>{const C=E(i,f),$=l.array.has(f),x=Fe(g);U(s,f,x),$?(v.array.next({name:f,values:{...s}}),(c.isDirty||c.dirtyFields)&&y.shouldDirty&&v.state.next({name:f,dirtyFields:zn(o,s),isDirty:M(f,x)})):C&&!C._f&&!le(x)?Pe(f,x,y):_e(f,x,y),xs(f,l)&&v.state.next({...n}),v.values.next({name:f,values:{...s}}),!a.mount&&t()},Kt=async f=>{const g=f.target;let y=g.name,C=!0;const $=E(i,y),x=()=>g.type?Hn($._f):Wu(f),A=H=>{C=Number.isNaN(H)||H===E(s,y,H)};if($){let H,X;const Pr=x(),$t=f.type===bs.BLUR||f.type===bs.FOCUS_OUT,Ud=!id($._f)&&!r.resolver&&!E(n.errors,y)&&!$._f.deps||od($t,E(n.touchedFields,y),n.isSubmitted,h,m),Yn=xs(y,l,$t);U(s,y,Pr),$t?($._f.onBlur&&$._f.onBlur(f),u&&u(0)):$._f.onChange&&$._f.onChange(f);const Gn=W(y,Pr,$t,!1),zd=!we(Gn)||Yn;if(!$t&&v.values.next({name:y,type:f.type,values:{...s}}),Ud)return c.isValid&&w(),zd&&v.state.next({name:y,...Yn?{}:Gn});if(!$t&&Yn&&v.state.next({...n}),P(!0),r.resolver){const{errors:Ks}=await F([y]);if(A(Pr),C){const Hd=Ns(n.errors,i,y),qs=Ns(Ks,i,Hd.name||y);H=qs.error,y=qs.name,X=we(Ks)}}else H=(await Ps($,s,_,r.shouldUseNativeValidation))[y],A(Pr),C&&(H?X=!1:c.isValid&&(X=await ee(i,!0)));C&&($._f.deps&&Wn($._f.deps),N(y,X,H,Gn))}},Or=(f,g)=>{if(E(n.errors,g)&&f.focus)return f.focus(),1},Wn=async(f,g={})=>{let y,C;const $=Ln(f);if(P(!0),r.resolver){const x=await ie(Z(f)?f:$);y=we(x),C=f?!$.some(A=>E(x,A)):y}else f?(C=(await Promise.all($.map(async x=>{const A=E(i,x);return await ee(A&&A._f?{[x]:A}:A)}))).every(Boolean),!(!C&&!n.isValid)&&w()):C=y=await ee(i);return v.state.next({...!Oe(f)||c.isValid&&y!==n.isValid?{}:{name:f},...r.resolver||!f?{isValid:y}:{},errors:n.errors,isValidating:!1}),g.shouldFocus&&!C&&xr(i,Or,f?$:l.mount),C},Rs=f=>{const g={...o,...a.mount?s:{}};return Z(f)?g:Oe(f)?E(g,f):f.map(y=>E(g,y))},Vs=(f,g)=>({invalid:!!E((g||n).errors,f),isDirty:!!E((g||n).dirtyFields,f),isTouched:!!E((g||n).touchedFields,f),error:E((g||n).errors,f)}),Rd=f=>{f&&Ln(f).forEach(g=>ne(n.errors,g)),v.state.next({errors:f?n.errors:{}})},Bs=(f,g,y)=>{const C=(E(i,f,{_f:{}})._f||{}).ref;U(n.errors,f,{...g,ref:C}),v.state.next({name:f,errors:n.errors,isValid:!1}),y&&y.shouldFocus&&C&&C.focus&&C.focus()},Vd=(f,g)=>Ge(f)?v.values.subscribe({next:y=>f(Q(void 0,g),y)}):Q(f,g,!0),Kn=(f,g={})=>{for(const y of f?Ln(f):l.mount)l.mount.delete(y),l.array.delete(y),g.keepValue||(ne(i,y),ne(s,y)),!g.keepError&&ne(n.errors,y),!g.keepDirty&&ne(n.dirtyFields,y),!g.keepTouched&&ne(n.touchedFields,y),!r.shouldUnregister&&!g.keepDefaultValue&&ne(o,y);v.values.next({values:{...s}}),v.state.next({...n,...g.keepDirty?{isDirty:M()}:{}}),!g.keepIsValid&&w()},js=({disabled:f,name:g,field:y,fields:C,value:$})=>{if(Ye(f)){const x=f?void 0:Z($)?Hn(y?y._f:E(C,g)._f):$;U(s,g,x),W(g,x,!1,!1,!0)}},qn=(f,g={})=>{let y=E(i,f);const C=Ye(g.disabled);return U(i,f,{...y||{},_f:{...y&&y._f?y._f:{ref:{name:f}},name:f,mount:!0,...g}}),l.mount.add(f),y?js({field:y,disabled:g.disabled,name:f}):z(f,!0,g.value),{...C?{disabled:g.disabled}:{},...r.progressive?{required:!!g.required,min:Wt(g.min),max:Wt(g.max),minLength:Wt(g.minLength),maxLength:Wt(g.maxLength),pattern:Wt(g.pattern)}:{},name:f,onChange:Kt,onBlur:Kt,ref:$=>{if($){qn(f,g),y=E(i,f);const x=Z($.value)&&$.querySelectorAll&&$.querySelectorAll("input,select,textarea")[0]||$,A=rd(x),H=y._f.refs||[];if(A?H.find(X=>X===x):x===y._f.ref)return;U(i,f,{_f:{...y._f,...A?{refs:[...H.filter(Un),x,...Array.isArray(E(o,f))?[{}]:[]],ref:{type:x.type,name:f}}:{ref:x}}}),z(f,!1,void 0,x)}else y=E(i,f,{}),y._f&&(y._f.mount=!1),(r.shouldUnregister||g.shouldUnregister)&&!(qu(l.array,f)&&a.action)&&l.unMount.add(f)}}},Us=()=>r.shouldFocusError&&xr(i,Or,l.mount),Bd=f=>{Ye(f)&&(v.state.next({disabled:f}),xr(i,g=>{g.disabled=f},0,!1))},zs=(f,g)=>async y=>{y&&(y.preventDefault&&y.preventDefault(),y.persist&&y.persist());let C=Fe(s);if(v.state.next({isSubmitting:!0}),r.resolver){const{errors:$,values:x}=await F();n.errors=$,C=x}else await ee(i);ne(n.errors,"root"),we(n.errors)?(v.state.next({errors:{}}),await f(C,y)):(g&&await g({...n.errors},y),Us(),setTimeout(Us)),v.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:we(n.errors),submitCount:n.submitCount+1,errors:n.errors})},jd=(f,g={})=>{E(i,f)&&(Z(g.defaultValue)?at(f,E(o,f)):(at(f,g.defaultValue),U(o,f,g.defaultValue)),g.keepTouched||ne(n.touchedFields,f),g.keepDirty||(ne(n.dirtyFields,f),n.isDirty=g.defaultValue?M(f,E(o,f)):M()),g.keepError||(ne(n.errors,f),c.isValid&&w()),v.state.next({...n}))},Hs=(f,g={})=>{const y=f?Fe(f):o,C=Fe(y),$=f&&!we(f)?C:o;if(g.keepDefaultValues||(o=y),!g.keepValues){if(g.keepDirtyValues||b)for(const x of l.mount)E(n.dirtyFields,x)?U($,x,E(s,x)):at(x,E($,x));else{if(Mn&&Z(f))for(const x of l.mount){const A=E(i,x);if(A&&A._f){const H=Array.isArray(A._f.refs)?A._f.refs[0]:A._f.ref;if(kr(H)){const X=H.closest("form");if(X){X.reset();break}}}}i={}}s=e.shouldUnregister?g.keepDefaultValues?Fe(o):{}:Fe($),v.array.next({values:{...$}}),v.values.next({values:{...$}})}l={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!a.mount&&t(),a.mount=!c.isValid||!!g.keepIsValid,a.watch=!!e.shouldUnregister,v.state.next({submitCount:g.keepSubmitCount?n.submitCount:0,isDirty:g.keepDirty?n.isDirty:!!(g.keepDefaultValues&&!st(f,o)),isSubmitted:g.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:g.keepDirtyValues?n.dirtyFields:g.keepDefaultValues&&f?zn(o,f):{},touchedFields:g.keepTouched?n.touchedFields:{},errors:g.keepErrors?n.errors:{},isSubmitSuccessful:g.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},Ws=(f,g)=>Hs(Ge(f)?f(s):f,g);return{control:{register:qn,unregister:Kn,getFieldState:Vs,handleSubmit:zs,setError:Bs,_executeSchema:F,_getWatch:Q,_getDirty:M,_updateValid:w,_removeUnmounted:B,_updateFieldArray:I,_updateDisabledField:js,_getFieldArray:pe,_reset:Hs,_resetDefaultValues:()=>Ge(r.defaultValues)&&r.defaultValues().then(f=>{Ws(f,r.resetOptions),v.state.next({isLoading:!1})}),_updateFormState:f=>{n={...n,...f}},_disableForm:Bd,_subjects:v,_proxyFormState:c,get _fields(){return i},get _formValues(){return s},get _state(){return a},set _state(f){a=f},get _defaultValues(){return o},get _names(){return l},set _names(f){l=f},get _formState(){return n},set _formState(f){n=f},get _options(){return r},set _options(f){r={...r,...f}}},trigger:Wn,register:qn,handleSubmit:zs,watch:Vd,setValue:at,getValues:Rs,reset:Ws,resetField:jd,clearErrors:Rd,unregister:Kn,setError:Bs,setFocus:(f,g={})=>{const y=E(i,f),C=y&&y._f;if(C){const $=C.refs?C.refs[0]:C.ref;$.focus&&($.focus(),g.shouldSelect&&$.select())}},getFieldState:Vs}}function Fs(e={}){const t=xe.useRef(),r=xe.useRef(),[n,i]=xe.useState({isDirty:!1,isValidating:!1,isLoading:Ge(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},disabled:!1,defaultValues:Ge(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...cd(e,()=>i(s=>({...s}))),formState:n});const o=t.current.control;return o._options=e,Qu({subject:o._subjects.state,next:s=>{Zu(s,o._proxyFormState,o._updateFormState,!0)&&i({...o._formState})}}),xe.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),xe.useEffect(()=>{if(o._proxyFormState.isDirty){const s=o._getDirty();s!==n.isDirty&&o._subjects.state.next({isDirty:s})}},[o,n.isDirty]),xe.useEffect(()=>{e.values&&!st(e.values,r.current)?(o._reset(e.values,o._options.resetOptions),r.current=e.values):o._resetDefaultValues()},[e.values,o]),xe.useEffect(()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=Gu(n,o),t.current}var Ms=function(e,t,r){if(e&&"reportValidity"in e){var n=E(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},ld=function(e,t){var r=function(i){var o=t.fields[i];o&&o.ref&&"reportValidity"in o.ref?Ms(o.ref,i,e):o.refs&&o.refs.forEach(function(s){return Ms(s,i,e)})};for(var n in t.fields)r(n)},ud=function(e,t){t.shouldUseNativeValidation&&ld(e,t);var r={};for(var n in e){var i=E(t.fields,n),o=Object.assign(e[n]||{},{ref:i&&i.ref});if(fd(t.names||Object.keys(e),n)){var s=Object.assign({},dd(E(r,n)));U(s,"root",o),U(r,n,s)}else U(r,n,o)}return r},dd=function(e){return Array.isArray(e)?e.filter(Boolean):[]},fd=function(e,t){return e.some(function(r){return r.startsWith(t+".")})},pd=function(e,t){for(var r={};e.issues.length;){var n=e.issues[0];if(n.path){var i=n.path.map(function(a){return a.key}).join(".");if(r[i]||(r[i]={message:n.message,type:n.validation}),t){var o=r[i].types,s=o&&o[n.validation];r[i]=ws(i,t,r,n.validation,s?[].concat(s,n.message):n.message)}e.issues.shift()}}return r},Ls=function(e,t,r){return r===void 0&&(r={}),function(n,i,o){try{return Promise.resolve(function(s,a){try{var l=function(){function u(c){return{values:r.raw?n:c,errors:{}}}var p=Object.assign({},{abortEarly:!1,abortPipeEarly:!1},t);return r.mode==="sync"?u(Pt(e,n,p)):Promise.resolve(la(e,n,p)).then(u)}()}catch(u){return a(u)}return l&&l.then?l.then(void 0,a):l}(0,function(s){if(s instanceof Nr)return{values:{},errors:ud(pd(s,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw s}))}catch(s){return Promise.reject(s)}}};const hd=27,vd=12,md=10,gd=e=>{const t=Object.fromEntries(new FormData(e).entries());Object.keys(t).length&&e.dispatchEvent(new Event("submit",{bubbles:!0}))},bd=xn("multiple-choice"),yd=e=>{const t={min:e.minSelected??0,max:e.maxSelected??e.options.length};return Ls(Be({checked:yi(bi(ia()),r=>Object.entries(r).filter(([n,i])=>i).map(([n,i])=>n),[At(t.max,`Please select at most ${t.max} option${t.max!==1?"s":""}`),wi(t.min,`Please select at least ${t.min} option${t.min!==1?"s":""}`)])}))},wd=({input:e,onSubmitSuccess:t})=>{var l,u;const r=e.key?(l=D.current$.value.flow)==null?void 0:l.data.submissions[e.key]:void 0,n=(e.config.minSelected===1||e.config.minSelected===void 0)&&e.config.maxSelected===1,{register:i,handleSubmit:o,formState:{errors:s}}=Fs({defaultValues:{checked:n?{}:bd(r)?Object.fromEntries(r.value.map(p=>[p,!0])):{}},resolver:yd(e.config)}),a=Nn();return d("form",{noValidate:!0,class:"flex flex-col gap-1 pr-2.5",onChange:p=>{n&&gd(p.currentTarget)},onSubmit:o(p=>{const c=p.checked;t(c)}),children:[d("div",{class:"flex items-center gap-1",children:[d("ul",{style:{maxHeight:6.5*hd+5*vd+2*md},class:Ue("gutter-stable flex w-full flex-1 flex-wrap gap-3 overflow-y-auto rounded-xl p-2.5 pr-4",{"justify-center":e.config.options.length===1}),children:e.config.options.map((p,c)=>{const v=`checked.${p.value}`,{ref:b,...m}=i(v);return d("li",{class:"relative",children:[d("input",{autoFocus:c===0,ref:h=>{h&&c===0&&(a.current=h),b(h)},id:v,...m,class:"peer sr-only h-full",type:"checkbox"}),d("label",{class:"bg-lowest peer-focus-visible:ring-accent-7 active:outline-neutral-10 ease-expo-out outline-divider text-neutral-11 peer-checked:outline-accent-7 peer-checked:bg-accent-2 peer-checked:text-accent-9 block rounded-2xl px-2.5 py-1 outline outline-2 ring-0 ring-transparent transition-all selection:bg-transparent peer-focus-visible:ring-4 peer-focus-visible:ring-offset-2",htmlFor:v,children:p.label})]},p.value)})}),d("div",{class:"flex flex-col items-center gap-2",children:[!n&&d(jt,{}),e.config.minSelected===0&&d(Ut,{type:"button",onClick:()=>t([])})]})]}),d("div",{class:"px-1",children:d(Fn,{error:(u=s.checked)==null?void 0:u.root})})]})},_d=({input:e,onSubmitSuccess:t})=>d("div",{class:"flex flex-col items-center py-3",children:d("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:d("span",{class:"flex items-center gap-1.5",children:[d("span",{class:"inline-flex items-center text-sm font-medium",children:e.config.label}),d("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:[d("path",{d:"M4 8L8 4L12 8"}),d("path",{d:"M8 4V13"})]})]})})}),kt={empty:"Please enter some text",email:"That doesn’t look like a valid email address",phone:"That doesn’t look like a valid phone number",url:"That doesn’t look like a valid URL"},xd=be(kt.phone,[fa(/^\+?[0-9 -]+$/,kt.phone)]),kd={email:{type:"email",inputMode:"email",formNoValidate:!0},phone:{type:"tel",inputMode:"tel"},text:{type:"text",inputMode:"text"},url:{type:"url",inputMode:"url",formNoValidate:!0}},$d=xn("text"),Sd=e=>{const t=`Please enter no more than ${e.maxChars} characters`;return Ls(Be({text:{email:be(kt.email,[da(kt.email),At(e.maxChars??1/0,t)]),phone:yi(xd,r=>r.replace(/[^0-9]/g,""),[At(e.maxChars??1/0,t)]),text:be([wi(1,kt.empty),At(e.maxChars??1/0,t)]),url:be([pa(kt.url),At(e.maxChars??1/0,t)])}[e.format]}))},Ed=({input:e,onSubmitSuccess:t})=>{var p;const r=e.key?(p=D.current$.value.flow)==null?void 0:p.data.submissions[e.key]:void 0,n=e.config.defaultValue,{register:i,handleSubmit:o,formState:{errors:s}}=Fs({defaultValues:{text:n||($d(r)?r.value:"")},resolver:Sd(e.config)}),{ref:a,...l}=i("text",{required:!e.config.optional}),u=L();return ye(()=>{u.current&&(u.current.focus(),u.current.select())},[]),d(q,{children:d("form",{noValidate:!0,class:"flex flex-col gap-1 p-2.5",onSubmit:o(c=>{t(c.text)}),children:[d("div",{class:"flex items-center gap-2",children:[d("div",{class:"relative min-w-0 flex-grow",children:[d("input",{id:"chat-input",...l,...kd[e.config.format],autocomplete:"off",autoCapitalize:"off",autoCorrect:"off",autoFocus:!0,ref:c=>{c&&(u.current=c),a(c)},class:"outline-divider ease-expo-out placeholder:text-neutral-10 text-neutral-12 focus-visible:outline-accent-7 caret-accent-9 bg-lowest w-full rounded-full px-3 py-1 text-base outline outline-2 transition-all",placeholder:e.config.placeholder}),e.config.optional&&d(Ut,{class:"absolute right-0 top-0",onClick:()=>t(null)})]}),d(jt,{})]}),d(Fn,{error:s.text})]})})},Cd=()=>{var o;const e=(o=D.current$.value.flow)==null?void 0:o.data.currentInput,[t,r]=xu(),n=L(null);D.inputHeight$.value=r.height,V(()=>{const s=n.current;if(s)return s.addEventListener("transitionstart",ce.scrollToEnd.smooth),s.addEventListener("transitioncancel",ce.scrollToEnd.smooth),s.addEventListener("transitionend",ce.scrollToEnd.smooth),()=>{s.removeEventListener("transitionstart",ce.scrollToEnd.smooth),s.removeEventListener("transitioncancel",ce.scrollToEnd.smooth),s.removeEventListener("transitionend",ce.scrollToEnd.smooth)}},[]);const i=s=>a=>ce.onSubmitSuccessFn$.value({type:s,value:a});return d("div",{ref:n,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:r.height},children:d("div",{ref:t,class:"border-divider flex flex-col justify-end border-t",children:Ne({input:e}).with({input:fe.nullish},()=>d("div",{class:"flex items-center gap-2 p-2.5",children:[d("input",{"aria-hidden":"true",id:"chat-input",class:"outline-divider flex-grow rounded-full bg-transparent px-3 py-1 text-base outline outline-2",disabled:!0}),d(jt,{disabled:!0,"aria-hidden":"true",tabIndex:-1})]})).with({input:{type:"text"}},s=>d(Ed,{onSubmitSuccess:i(s.input.type),...s})).with({input:{type:"multiple-choice"}},s=>d(wd,{onSubmitSuccess:i(s.input.type),...s})).with({input:{type:"boolean"}},s=>d(Lu,{onSubmitSuccess:i(s.input.type),...s})).with({input:{type:"file"}},s=>d(Hu,{onSubmitSuccess:i(s.input.type),...s})).with({input:{type:"submit"}},s=>d(_d,{onSubmitSuccess:i(s.input.type),...s})).with({input:{type:"address"}},s=>d(Du,{onSubmitSuccess:i(s.input.type),...s})).exhaustive()})})},Od=on("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"}}),Pd=({children:e,className:t,animate:r,side:n,...i})=>d("p",{style:{transformOrigin:n==="left"?"0% 50%":"100% 50%"},class:Od({className:t,side:n,animate:r}),...i,children:e}),Ad=({className:e,...t})=>(V(()=>{ce.scrollToEnd.smooth()}),d("div",{"aria-hidden":!0,children:ce.isBotTyping$.value===!0?d("div",{"aria-label":"Typing…",class:Ue("flex gap-1 p-4",e),...t,children:Array.from({length:3},(r,n)=>d("div",{class:"bg-accent-9 h-1.5 w-1.5 animate-bounce rounded-full",style:{animationDelay:`${-n*200}ms`}}))}):void 0})),Id={bot:"left",user:"right"},Dd=on("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]"}}}),Td=({lastSentMessageFooter:e})=>{var r;const t=((r=D.current$.value.flow)==null?void 0:r.data.messages)??[];return V(()=>{ce.scrollToEnd.smooth()},[t.length]),d("ol",{"aria-label":"Chat messages",class:"flex flex-col justify-end gap-2 p-2 pt-[calc(var(--header-height)+1rem)]",children:[t.map((n,i)=>d(q,{children:d("li",{class:"flex",children:Ne(n).with({type:"system"},o=>d("p",{class:Dd({variant:o.variant}),children:o.text})).with({type:"text",author:fe.union("bot","user")},o=>{const s=o.author==="user"&&!t.slice(i+1).some(l=>l.type==="text"&&l.author==="user"),a=i===t.length-1;return d(Pd,{animate:a,side:Id[o.author],children:[o.text,s?e:null]},i)}).with({type:"link"},o=>d("div",{class:"bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl px-2 py-2",children:d("a",{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:o.href,children:[o.text,d("svg",{class:"flex-none",width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:d("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"})})]})})).with({type:"image"},o=>d("img",{class:"shadow-surface-md w-full max-w-[min(100%,24rem)] rounded-2xl",src:o.url,style:{aspectRatio:o.width/o.height}})).with({type:"file"},o=>d(ju,{class:o.author==="bot"?"":"ml-auto",file:{name:o.fileName,sizeKb:o.fileSizeKb}})).exhaustive()})},i)),d(Ad,{},"typing")]})},Nd=({logger:e,apiClient:t,analytics:r})=>{const{flow:n}=D.current$.value;ke(n,"Flow is required to exist to show chatbot body");const i=D.viewState$.value,{chatRef:o,chatService:s}=Ou(),[a,l]=Y();return ye(()=>{i==="maximised"&&ce.scrollToEnd.instant()},[i]),ye(()=>{const{state:u,flow:p}=D.current$.peek();if(u!=="loaded")throw new Error(pl.invalid_state);let c=p.data.nodeHistory.at(-1);if(ce.scrollToEnd.instant(),D.setInput(void 0),p.data.isFinished)return;c===void 0?(c=ts(n.nodes).id,D.setCurrentNodeId(c),r.log({event:"FLOW_START",properties:{flow_id:n.id,flow_version:n.version,flow_session_id:p.data.flowSessionId},customProperties:n.context})):D.removeMessagesSentByNodeIds([c]);const{interpret:v,abort:b,undo:m}=ou({context:n.context,analytics:r,apiClient:t,logger:e,flow:n.nodes,chatService:s,getSubmissions:()=>{var h;return(h=D.current$.peek().flow)==null?void 0:h.data.submissions},onInterpret:(h,_)=>{const k=D.current$.peek().flow;ke(k),_&&(k.data.sequence=k.data.sequence+1,r.log({event:"FLOW_NODE",properties:{flow_id:n.id,flow_version:n.version,from_node_id:_.id,to_node_id:h.id,sequence:k.data.sequence,flow_session_id:k.data.flowSessionId},customProperties:n.context})),D.setCurrentNodeId(h.id)},onFlowEnd:async()=>{D.markAsFinished();const h=D.current$.peek().flow;ke(h),r.log({event:"FLOW_END",properties:{flow_id:n.id,flow_version:n.version,flow_session_id:h.data.flowSessionId},customProperties:n.context})}});return l(()=>m),v(c),b},[r,t,s,e,n]),d(q,{children:[d("div",{ref:o,className:"hide-scrollbars relative flex w-full max-w-full flex-grow flex-col overflow-y-scroll",style:{WebkitOverflowScrolling:"touch",paddingBottom:D.inputHeight$.value},children:d(Td,{lastSentMessageFooter:n.data.isFinished||!a?null:d(Md,{undoFn:a})})}),d(Cd,{})]})},Fd=e=>"key"in e.data&&e.data.key?[e.data.key]:"keys"in e.data?Object.values(e.data.keys).filter(t=>typeof t=="string"):[],Md=({undoFn:e})=>d("div",{class:"absolute bottom-0 right-0 flex w-full translate-y-full justify-end",children:d("button",{class:"fr touch-hitbox text-neutral-9 hover:text-neutral-12 rounded-full p-1 text-right text-xs transition-all",onClick:async()=>{const{flow:t}=D.current$.peek();ke(t);const{removed:r}=e(t.data.nodeHistory),n=t.data.nodeHistory.splice(-r);n.length!==0&&(D.removeMessagesSentByNodeIds(n),D.setInput(void 0),n.pop(),n.map(i=>t.nodes.find(o=>o.id===i)).filter(Boolean).flatMap(Fd).forEach(i=>delete t.data.submissions[i]),D.current$.value={...D.current$.value})},children:"Undo"})}),Ld=Object.freeze(Object.defineProperty({__proto__:null,ChatbotBody:Nd},Symbol.toStringTag,{value:"Module"}))})();
45
+ }`},nu=({_internal_domManager:e=ql(),theme:t})=>Ze(({apiClient:r,logger:n,analytics:i})=>{let o=!1;const s=()=>{if(typeof window>"u")return;const a=[T("style",{id:"inploi-chatbot-styles"},Kl),T("style",{id:"inploi-chatbot-theme"},ru(t))],l=e.getOrCreateChatbotElement();lt(T(q,{},[a,T(Ul,{apiClient:r,logger:n,analytics:i})]),l),o=!0};return{prepare:async()=>{if(!(typeof window>"u"))try{if(o)return;s(),n.info("Chatbot plugin prepared")}catch(a){n.error("Error preparing chatbot plugin",a)}},fetchFlowByJobId:async a=>r.fetch(`/flow/job/${a}`).then(l=>{const u=Pt(Hl,l);return{context:{job_id:u.job.id,flow_id:u.flow.id,flow_version:u.flow.version},flow:u.flow,title:`Applying for “${u.job.title}”`,flowKeys:[u.job.id]}}),fetchFlowById:async a=>r.fetch(`/flow/id/${a}`).then(l=>{const u=Pt(zl,l);return{flow:u.flow,context:{flow_id:u.flow.id,flow_version:u.flow.version},title:"Chatbot",flowKeys:[]}}),open:async a=>{if(!(typeof window>"u"))try{D.cancelCurrentFlow(),D.viewState$.value="maximised",o||s(),a instanceof Promise?(D.current$.value={state:"loading"},a.then(async l=>{const u=Pt(Wl,l);D.startFlow(u)}).catch(l=>{const u=l instanceof Error?l.message:"An error occurred";D.current$.value={state:"error",error:u}})):D.startFlow(a)}catch(l){n.error("Error starting flow",l)}},startApplication:void 0,closeApplication:void 0,close:async()=>{typeof window>"u"||(D.cancelCurrentFlow(),n.info("Closed flow from an external source"))}}});if(!window.inploi)throw new Error("Please insert the SDK script tag above the plugins.");window.inploi.chatbotPlugin=nu;const cs=({node:e,nodes:t,stopWhen:r})=>{if((r==null?void 0:r(e))===!0)return e;const n=e.nextId?t.find(i=>i.id===e.nextId):void 0;if(n)return cs({node:n,nodes:t,stopWhen:r})},iu=({childNode:e,nodes:t})=>{const n=t.filter(i=>i.type==="if-block").find(i=>{if(!i.branchId)return!1;const o=t.find(a=>a.id===i.branchId);if(!o)return!1;const s=cs({node:o,nodes:t,stopWhen:a=>a.id===e.id});return!(!s||s.id!==e.id)});if(n!=null&&n.nextId)return t.find(i=>i.id===n.nextId)},ou=({flow:e,analytics:t,logger:r,context:n,apiClient:i,getSubmissions:o,chatService:s,onFlowEnd:a,onInterpret:l})=>{let u=new AbortController;const p=async(c,v)=>{const b=o();l==null||l(c,v);try{await su({analytics:t,logger:r,apiClient:i,context:n,node:c,submissions:b,chat:{sendMessage:async m=>s.send({groupId:c.id,message:m,signal:u.signal}),userInput:async m=>s.input({input:m,signal:u.signal})},next:m=>{const h=m?e.find(_=>_.id===m):iu({childNode:c,nodes:e});return h?p(h,c):a==null?void 0:a(c)},end:()=>a==null?void 0:a(c)})}catch(m){if(m instanceof Rt)return;throw m}};return{interpret:async c=>{const v=e.find(b=>b.id===c)??ts(e);return p(v)},undo:c=>{let v=1;const b=e.find(h=>h.id===c[c.length-1]);for(let h=c.length-2;h>0;h--){const _=c[h],k=e.find(w=>w.id===_);if(!k||(v++,k.type.startsWith("question-")))break}u.abort(),u=new AbortController;const m=e.find(h=>h.id===c[c.length-v]);return ke(m,"Undo failed: new start node not found"),p(m,b),{removed:v}},abort:()=>{u.abort()}}};async function su(e){return await Ne(e).with({node:{type:"text"}},uu).with({node:{type:"image"}},du).with({node:{type:"question-text"}},fu).with({node:{type:"question-enum"}},hu).with({node:{type:"question-number"}},pu).with({node:{type:"question-boolean"}},vu).with({node:{type:"question-file"}},gu).with({node:{type:"question-address"}},mu).with({node:{type:"end-flow"}},bu).with({node:{type:"if-block"}},lu).with({node:{type:"jump"}},({node:t,next:r})=>r(t.data.targetId)).with({node:{type:"link"}},cu).with({node:{type:"integration-application-submit"}},au).with({node:{type:"integration-workflow-get"}},()=>Error("Unreachable")).exhaustive()}async function au({chat:e,next:t,node:r,logger:n,apiClient:i,submissions:o,context:s,analytics:a}){r.data.skipConfirmation!==!0&&await e.userInput({type:"submit",key:void 0,config:{label:r.data.submitLabel}}),await e.sendMessage({type:"system",variant:"info",text:"Submitting…"});const{anonymous_id:l,session_id:u}=a.getSessionInfo(),p=await i.fetch("/flow/apply",{method:"POST",body:JSON.stringify({...s,integration_id:r.data.integrationId,anonymous_id:l,session_id:u,submissions:Il(o||{})})}).catch(c=>c);await Ne(p).with({ats_data:{redirect_url:fe.string}},async c=>{await e.sendMessage({type:"text",author:"bot",text:"Almost there! Please complete your submission here:"});const v=new URL(c.ats_data.redirect_url);l&&!v.searchParams.has("anonymous_id")&&v.searchParams.set("anonymous_id",l),await e.sendMessage({type:"link",href:v.toString(),text:"Complete submission"}),t(r.nextId)}).with({success:!0},async()=>{await e.sendMessage({type:"system",variant:"success",text:"Submission completed!"}),t(r.nextId)}).otherwise(async c=>{n.error(c),await e.sendMessage({type:"system",variant:"error",text:"Failed to submit"}),t(r.id)})}async function cu({chat:e,next:t,node:r,submissions:n}){await e.sendMessage({type:"link",href:r.data.href,text:ot(r.data.cta,n)}),t(r.nextId)}async function lu({submissions:e,next:t,node:r}){const n=yu(r,e)?r.branchId:r.nextId;t(n)}async function uu({chat:e,next:t,node:r,submissions:n}){await e.sendMessage({author:"bot",type:"text",text:ot(r.data.text,n)}),t(r.nextId)}async function du({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 fu({chat:e,next:t,node:r,submissions:n}){await e.sendMessage({author:"bot",type:"text",text:ot(r.data.question,n)});const i=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}});i.value===null?await e.sendMessage({type:"system",variant:"info",text:"Skipped"}):await e.sendMessage({author:"user",type:"text",text:i.value}),t(r.nextId)}async function pu({chat:e,next:t,node:r,submissions:n}){await e.sendMessage({author:"bot",type:"text",text:ot(r.data.question,n)});const i=await e.userInput({key:r.data.key,type:"text",config:{optional:r.data.optional,placeholder:r.data.placeholder,format:"text"}});i.value===null?await e.sendMessage({type:"system",variant:"info",text:"Skipped"}):await e.sendMessage({author:"user",type:"text",text:i.value}),t(r.nextId)}async function hu({chat:e,next:t,node:r,submissions:n}){await e.sendMessage({author:"bot",type:"text",text:ot(r.data.question,n)});const i=await e.userInput({key:r.data.key,type:"multiple-choice",config:r.data});i.value.length===0?await e.sendMessage({type:"system",variant:"info",text:"Skipped"}):await e.sendMessage({author:"user",type:"text",text:r.data.options.filter(o=>i.value.includes(o.value)).map(o=>o.label).join(", ")}),t(r.nextId)}async function vu({chat:e,next:t,node:r,submissions:n}){await e.sendMessage({author:"bot",type:"text",text:ot(r.data.question,n)});const o=(await e.userInput({key:r.data.key,type:"boolean",config:{optional:r.data.optional,labels:{true:r.data.trueLabel,false:r.data.falseLabel}}})).value;o===null?await e.sendMessage({type:"system",variant:"info",text:"Skipped"}):await e.sendMessage({author:"user",type:"text",text:{true:r.data.trueLabel,false:r.data.falseLabel}[o]}),t(r.nextId)}async function mu({chat:e,next:t,node:r}){await e.sendMessage({author:"bot",type:"text",text:r.data.question});const n=await e.userInput({type:"address",key:r.data.key,config:{optional:r.data.optional,keys:r.data.keys,placeholder:r.data.placeholder}});if(n.value===null)await e.sendMessage({type:"system",variant:"info",text:"Skipped"});else{const i=Object.values(n.value).filter(o=>o&&o.trim().length>0).join(", ");await e.sendMessage({author:"user",type:"text",text:i})}return t(r.nextId)}async function gu({node:e,chat:t,next:r,submissions:n}){await t.sendMessage({author:"bot",type:"text",text:ot(e.data.question,n)});const i=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(i.value===null)await t.sendMessage({type:"system",variant:"info",text:"Skipped"});else for(const o of i.value)await t.sendMessage({author:"user",type:"file",fileName:o.name,fileSizeKb:o.sizeKb});r(e.nextId)}async function bu({chat:e,end:t,node:r}){await e.sendMessage({type:"system",variant:"info",text:r.data.systemMessage}),t()}const ls=fe.union(fe.string,fe.array(fe.string),null),yu=(e,t)=>{const r=t==null?void 0:t[e.data.compareKey];return r?Ne({...e.data,answer:r}).with({compare:"equals"},({compareValue:n})=>typeof r.value=="string"||typeof r.value=="boolean"?n===r.value.toString():!1).with({compare:"notEquals"},({compareValue:n})=>typeof r.value=="string"||typeof r.value=="boolean"?n!==r.value.toString():!1).with({compare:"contains",answer:{value:ls}},({compareValue:n,answer:i})=>i.value!==null&&i.value.includes(n)).with({compare:"notContains",answer:{value:ls}},({compareValue:n,answer:i})=>i.value===null||!i.value.includes(n)).with({answer:{type:"file"}},()=>!1).with({answer:{type:"address",value:fe.any}},()=>!1).exhaustive():!1},ot=(e,t)=>{const r=/{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g;return e.replace(r,(n,i,o="")=>{i=i.trim();const s=t==null?void 0:t[i];if(!s)return o;switch(s.type){case"boolean":return s.value==="true"?"true":"false";case"file":return s.value?s.value.map(a=>`${a.name} (${Lt(a.sizeKb)})`).join(", "):"no files";case"multiple-choice":return s.value.join(", ");default:return s.value||o}})};function wu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Pn(e,t,r){var n,i,o,s,a;t==null&&(t=100);function l(){var p=Date.now()-s;p<t&&p>=0?n=setTimeout(l,t-p):(n=null,r||(a=e.apply(o,i),o=i=null))}var u=function(){o=this,i=arguments,s=Date.now();var p=r&&!n;return n||(n=setTimeout(l,t)),p&&(a=e.apply(o,i),o=i=null),a};return u.clear=function(){n&&(clearTimeout(n),n=null)},u.flush=function(){n&&(a=e.apply(o,i),o=i=null,clearTimeout(n),n=null)},u}Pn.debounce=Pn;var _u=Pn;const us=wu(_u);function xu(e){let{debounce:t,scroll:r,polyfill:n,offsetSize:i}=e===void 0?{debounce:0,scroll:!1,offsetSize:!1}:e;const o=n||(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[s,a]=Y({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),l=L({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s}),u=t?typeof t=="number"?t:t.scroll:null,p=t?typeof t=="number"?t:t.resize:null,c=L(!1);V(()=>(c.current=!0,()=>void(c.current=!1)));const[v,b,m]=se(()=>{const w=()=>{if(!l.current.element)return;const{left:P,top:I,width:O,height:z,bottom:W,right:N,x:F,y:ie}=l.current.element.getBoundingClientRect(),ee={left:P,top:I,width:O,height:z,bottom:W,right:N,x:F,y:ie};l.current.element instanceof HTMLElement&&i&&(ee.height=l.current.element.offsetHeight,ee.width=l.current.element.offsetWidth),Object.freeze(ee),c.current&&!Eu(l.current.lastBounds,ee)&&a(l.current.lastBounds=ee)};return[w,p?us(w,p):w,u?us(w,u):w]},[a,i,u,p]);function h(){l.current.scrollContainers&&(l.current.scrollContainers.forEach(w=>w.removeEventListener("scroll",m,!0)),l.current.scrollContainers=null),l.current.resizeObserver&&(l.current.resizeObserver.disconnect(),l.current.resizeObserver=null)}function _(){l.current.element&&(l.current.resizeObserver=new o(m),l.current.resizeObserver.observe(l.current.element),r&&l.current.scrollContainers&&l.current.scrollContainers.forEach(w=>w.addEventListener("scroll",m,{capture:!0,passive:!0})))}const k=w=>{!w||w===l.current.element||(h(),l.current.element=w,l.current.scrollContainers=ds(w),_())};return $u(m,!!r),ku(b),V(()=>{h(),_()},[r,m,b]),V(()=>h,[]),[k,s,v]}function ku(e){V(()=>{const t=e;return window.addEventListener("resize",t),()=>void window.removeEventListener("resize",t)},[e])}function $u(e,t){V(()=>{if(t){const r=e;return window.addEventListener("scroll",r,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",r,!0)}},[e,t])}function ds(e){const t=[];if(!e||e===document.body)return t;const{overflow:r,overflowX:n,overflowY:i}=window.getComputedStyle(e);return[r,n,i].some(o=>o==="auto"||o==="scroll")&&t.push(e),[...t,...ds(e.parentElement)]}const Su=["x","y","top","bottom","left","right","width","height"],Eu=(e,t)=>Su.every(r=>e[r]===t[r]),jt=({class:e,...t})=>d("button",{class:Ue("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:d("svg",{class:"block",width:"16",height:"16",viewBox:"0 0 16 16",fill:"transparent",stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",children:[d("title",{children:"Send"}),d("path",{d:"M3.5 7.5L8 3L12.5 7.5"}),d("path",{d:"M8 4V13"})]})}),Cu=25,An=We({instant:()=>{},smooth:()=>{}}),ce={onSubmitSuccessFn$:We(()=>{}),isBotTyping$:We(!1),scrollToEnd:{instant:()=>An.value.instant(),smooth:()=>An.value.smooth()}},Ou=()=>{const e=L(null);ye(()=>{An.value={instant:()=>{var r;return(r=e.current)==null?void 0:r.scrollTo({top:e.current.scrollHeight,behavior:"instant"})},smooth:()=>{e.current&&e.current.scrollHeight-e.current.scrollTop<=e.current.clientHeight*1.5&&e.current.scrollTo({top:e.current.scrollHeight,behavior:"smooth"})}}},[e]);const t=se(()=>({send:async({message:r,signal:n,groupId:i})=>{if(await Ne(r).with({author:"bot",type:"text"},async o=>{if(n!=null&&n.aborted)throw new Rt;ce.isBotTyping$.value=!0;const s=Math.min(Math.max(20,o.text.length),100)*Cu;await new Promise(a=>setTimeout(a,s,{signal:n})),ce.isBotTyping$.value=!1}).otherwise(async()=>{}),n!=null&&n.aborted)throw new Rt;D.addMessage(r,i)},input:async({input:r,signal:n})=>{if(n!=null&&n.aborted)throw new Rt;return D.setInput(r),await new Promise(i=>{const o=s=>{if(n!=null&&n.aborted)throw new Rt;D.setInput(void 0),r.key&&D.setSubmission(r.key,s),i(s)};ce.onSubmitSuccessFn$.value=o})}}),[]);return{chatRef:e,chatService:t}},Ut=({class:e,...t})=>d("button",{type:"button",class:Ue("fr text-neutral-9 flex flex-shrink-0 items-center justify-center gap-1 rounded-full py-[6px] pl-2 pr-3 text-sm underline-offset-2 transition-all",e),...t,children:[d("svg",{class:"block",width:"16",height:"16",viewBox:"0 0 16 16",fill:"transparent",stroke:"currentColor","stroke-linecap":"round","stroke-width":"1.5",children:[d("title",{children:"Skip"}),d("path",{d:"M3.25 11.25A5 5 0 0 1 12 7"}),d("path",{d:"M13.25 4.5V8.25H9.5"})]}),"Skip"]}),fs={line1:["street_number","floor","room","premise"],line2:["subpremise","street_address","route"],line3:["sublocality","neighborhood"],city:["locality","postal_town"],state:["administrative_area_level_1"],postcode:["postal_code"],country:["country"]},_r=Object.keys(fs),Pu=e=>_r.reduce((t,r)=>{const n=fs[r],i=e.filter(o=>o.types.some(s=>n.includes(s))).map(o=>o.long_name).join(", ");return i&&(t[r]=i),t},{}),Au=document.createElement("div"),Iu=()=>se(()=>{const{google:e}=window;if(!("google"in window)||!("maps"in e)||!("places"in e.maps))return{enabled:!1};const t=new e.maps.places.AutocompleteService,r=new e.maps.places.PlacesService(Au);return{enabled:!0,getPredictions:async n=>{const{predictions:i}=await t.getPlacePredictions({input:n});return i.map(o=>({label:o.description,value:o.place_id}))},getPlaceDetails:async n=>await new Promise((o,s)=>r.getDetails({placeId:n,fields:["address_components"]},(a,l)=>l!==e.maps.places.PlacesServiceStatus.OK?s(l):a===null?s("ZERO_RESULTS"):o({ok:!0,place:a}))).catch(async o=>(console.error("Failed to get address details",o),{ok:!1}))}},[]),In=e=>d("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:[d("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:d("path",{d:"M10 3L5 8L10 13"})}),d("span",{children:"Back"})]}),Dn={label:"Fill in manually",value:""},Du=({input:e,onSubmitSuccess:t})=>{const[r,n]=Y(""),[i,o]=Y(),[s,a]=Y([]),[l,u]=Y(),{enabled:p,getPredictions:c,getPlaceDetails:v}=Iu(),[b,m]=Y(p?"query":"manual"),h=se(()=>rs(_=>{if(ke(p,"Query state should not be enabled if Google Places isn't available"),n(_),_===""){a([]);return}c(_).then(k=>{a(k)})},500),[p,c]);switch(V(()=>{if(p&&!(l===void 0||l===""))return v(l).then(_=>{if(!_.ok||!_.place.address_components){o({});return}const k=Pu(_.place.address_components);o(k),m("details")}),()=>{o(void 0)}},[l,v,p]),b){case"query":return ke(p,"Query state should not be enabled if Google Places isn't available"),d(Tu,{input:e,onSkip:()=>t(null),onAddressSelect:_=>{u(_),m("loading")},onInputChange:h,suggestions:s,query:r});case"loading":return d(Tn,{input:e,onSubmitSuccess:t,addressFields:{},actions:d(In,{onClick:()=>{u(void 0),m("query")}})});case"details":return ke(i!==void 0),d(Tn,{input:e,onSubmitSuccess:t,addressFields:i,actions:d(In,{onClick:()=>{u(void 0),m("query")}})});case"manual":return d(Tn,{input:e,onSubmitSuccess:t,addressFields:{},actions:p?d(In,{onClick:()=>{u(void 0),m("query")}}):void 0})}},Tu=({input:e,onSkip:t,suggestions:r,onAddressSelect:n,query:i,onInputChange:o})=>{const s=L(null);return ye(()=>{s.current&&(s.current.focus(),s.current.select())},[]),d(q,{children:[d("form",{noValidate:!0,onSubmit:a=>{a.preventDefault},class:"flex flex-col justify-end gap-1 p-2.5",children:[d("input",{onChange:a=>{o(a.currentTarget.value)},ref:s,name:"address",id:"chat-address",autocomplete:"on",autoFocus:!0,class:"outline-divider ease-expo-out placeholder:text-neutral-10 text-neutral-12 focus-visible:outline-accent-7 caret-accent-9 bg-lowest w-full rounded-full px-3 py-1 text-base outline outline-2 transition-all",placeholder:e.config.placeholder||"Search an address",defaultValue:i}),!e.config.optional&&d(Ut,{class:"absolute right-3",onClick:t})]}),d("ul",{children:[r.map(a=>d("li",{children:d("button",{class:"text-neutral-11 fr hover: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:()=>{n(a.value)},children:[d("span",{class:"flex-grow",children:a.label}),d("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:d("path",{d:"M6 3L11 8L6 13"})})]})},a.label)),d("li",{children:d("button",{class:"text-neutral-11 fr hover: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:()=>{n(Dn.value)},children:d("span",{class:"flex-grow",children:Dn.label})})},Dn.label)]})]})},Nu={line1:"Line 1",line2:"Line 2",line3:"Line 3",city:"City",state:"State",postcode:"Postcode",country:"Country"},Tn=({addressFields:e,onSubmitSuccess:t,actions:r})=>{const n=L(null);return ye(()=>{if(n.current){const i=n.current.querySelector("input");i&&(i.focus(),i.select())}},[]),d("form",{class:"bg-neutral-1/90 flex flex-col justify-end gap-2 p-2",onSubmit:i=>{const o=new FormData(i.currentTarget),s=Object.fromEntries(o.entries());t(s)},children:[d("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:n,children:_r.map((i,o)=>{const s=`isdk_${i}`;return d(q,{children:[d("label",{for:s,class:"text-neutral-9 [&:has(+*>input:focus)]:text-neutral-11 w-24 pb-2 text-xs uppercase leading-3 tracking-widest transition-colors",children:Nu[i]}),d("div",{class:"flex flex-col items-stretch gap-1.5",children:[d("input",{autoFocus:o===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 focus:outline-none",name:i,id:s,defaultValue:e[i],required:!0}),o!==_r.length-1&&d("hr",{class:"border-b-neutral-5 m-0 w-full border-b border-solid"}),o===_r.length-1&&d("hr",{class:"m-0 w-full border-b border-b-transparent"})]})]})})}),d("div",{class:"flex w-full flex-1 ",children:[d("div",{class:"flex-grow",children:r}),d(jt,{class:"flex items-center justify-center"})]})]})},Nn=()=>{const e=L(null);return V(()=>{var t;(t=e.current)==null||t.focus()},[]),e},ps=["true","false"],Fu=sa(ps),Mu="answer",Lu=({input:e,onSubmitSuccess:t})=>{const r=Nn();return d("form",{noValidate:!0,class:"",onSubmit:n=>{n.preventDefault();const i=Ne(n).with({nativeEvent:{submitter:fe.select(fe.union(fe.instanceOf(HTMLButtonElement),fe.instanceOf(HTMLInputElement)))}},s=>s.value).otherwise(()=>{throw new Error("invalid form")}),o=Pt(Fu,i);t(o)},children:[d("div",{class:"flex items-center gap-2 p-2.5",children:ps.map((n,i)=>d("button",{ref:i===0?r:null,type:"submit",name:Mu,value:n,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 flex-1 overflow-hidden rounded-2xl px-2.5 py-2.5 ring-2 transition-all selection:bg-transparent",children:d("p",{class:"truncate text-center text-base",children:e.config.labels[n]})}))}),e.config.optional&&d("div",{class:"px-2 pb-2",children:d(Ut,{class:"w-full",type:"button",onClick:()=>t(null)})})]})},Fn=({error:e})=>e?d("div",{role:"alert",class:"text-error-11 flex max-w-full items-center gap-1 overflow-hidden rounded-full px-2 py-2",children:[d("svg",{class:"text-error-9 h-4 w-4",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[d("circle",{cx:"8",cy:"8",r:"6.3",stroke:"currentColor","stroke-width":"1.4"}),d("rect",{x:"7",y:"4",width:"2",height:"5",fill:"currentColor"}),d("rect",{x:"7",y:"10",width:"2",height:"2",fill:"currentColor"})]}),d("p",{class:"truncate pr-1 text-sm",children:e.message})]}):null,Ru=e=>new Promise((t,r)=>{const n=new FileReader;n.readAsDataURL(e),n.onload=()=>n.result?t(n.result.toString()):r("No result from reader"),n.onerror=r}),Vu=e=>e.reduce((t,r)=>t+r.sizeKb,0),Bu=xn("file"),hs=3,ju=({file:e,class:t,...r})=>{const n=e.name.split(".").pop(),i=e.name.replace(new RegExp(`.${n}$`),"");return d("div",{class:Ue("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:[d("p",{"aria-label":"File name",class:"text-accent-12 flex flex-grow overflow-hidden",children:[d("span",{class:"block truncate",children:i}),d("span",{children:[".",n]})]}),d("p",{"aria-label":"File size",class:"text-accent-11",children:Lt(e.sizeKb)})]})},vs=({class:e,...t})=>d("li",{class:Ue("outline-neutral-6 text-neutral-11 bg-neutral-1 block rounded-md px-1 py-0.5 text-xs outline outline-1",e),...t}),ms=e=>{const t=e.split(".").pop();if(!t)throw new Error("No file extension found");return t?"."+t:""},Uu=({allowedExtensions:e,files:t})=>{const r=e.map(n=>n.toLowerCase());return t.every(n=>r.includes(ms(n.name).toLowerCase()))},zu=(e,t)=>{const r=ms(e);return`${e.replace(new RegExp(`${r}$`),"").slice(0,t)}${r}`},Hu=({input:e,onSubmitSuccess:t})=>{var p;const r=(p=D.current$.value.flow)==null?void 0:p.data.submissions[e.key],[n,i]=Y(Bu(r)&&r.value!==null?r.value:[]),[o,s]=Y(),a=n.length-hs,l=Vu(n),u=Nn();return d("form",{class:"flex flex-col gap-1 p-2.5",onSubmit:c=>(c.preventDefault(),s(void 0),n.length===0?s({type:"required",message:"Please select a file"}):e.config.extensions.length>0&&!Uu({allowedExtensions:e.config.extensions,files:n})?s({type:"validate",message:`Please upload ${e.config.extensions.join(", ")} files only`}):e.config.fileSizeLimitKib&&l>e.config.fileSizeLimitKib?s({type:"max",message:`File size exceeds limit of ${Lt(e.config.fileSizeLimitKib)}`}):e.config.allowMultiple===!1&&n.length>1?s({type:"invalid",message:"Only one file is allowed"}):t(n)),children:[d("div",{class:"flex items-center gap-2",children:[d("label",{ref:u,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:[n.length>0?d(q,{children:[d("ul",{class:"flex max-w-full flex-wrap justify-center gap-1 overflow-hidden p-1",children:[n.slice(0,hs).map(c=>{const v=c.name.split(".").pop(),b=c.name.replace(new RegExp(`.${v}$`),"");return d(vs,{class:"flex overflow-hidden",children:[d("span",{class:"block truncate",children:b}),d("span",{children:[".",v]})]})}),a>0?d(vs,{children:["+",a," file",a!==1?"s":""]}):null]}),d("p",{class:"text-neutral-11 text-xs",children:[Lt(l)," ",n.length>1?"total":""]})]}):d("div",{class:"flex flex-col justify-center gap-4 pb-6 pt-5",children:[d("header",{class:"flex flex-col items-center gap-0",children:[d("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:d("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"})}),d("p",{class:"text-neutral-12 tracking-[-0.01em]",children:[e.config.allowMultiple?"Select files":"Select a file"," to upload"]}),e.config.fileSizeLimitKib?d("p",{class:"text-neutral-10 text-xs",children:["(max ",Lt(e.config.fileSizeLimitKib),")"]}):null]}),d("aside",{class:"flex flex-col items-center gap-2",children:[d("p",{id:"accepted-filetypes",class:"sr-only",children:"Accepted file extensions"}),d("ul",{"aria-describedby":"accepted-filetypes",class:"flex flex-wrap justify-center gap-2",children:e.config.extensions.map(c=>d("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:c.replace(".","")}))})]})]}),d("input",{id:"dropzone-file",onInput:async c=>{ke(c.target instanceof HTMLInputElement);const v=c.target.files?Array.from(c.target.files):[],b=await Promise.allSettled(v.map(async h=>{const _=await Ru(h);return{name:zu(h.name,42),data:_,sizeKb:h.size/1e3}}));if(b.some(({status:h})=>h==="rejected"))return s({type:"invalid",message:"Invalid file"});const m=b.map(h=>h.status==="fulfilled"?h.value:null).filter(Boolean);i(m)},multiple:e.config.allowMultiple,type:"file",class:"sr-only"})]}),d("div",{class:"flex h-full flex-col items-center gap-2",children:[d(jt,{disabled:n.length===0}),e.config.optional&&d(Ut,{onClick:()=>t(null)})]})]}),o&&d(Fn,{error:o})]})};var zt=e=>e.type==="checkbox",_t=e=>e instanceof Date,le=e=>e==null;const gs=e=>typeof e=="object";var J=e=>!le(e)&&!Array.isArray(e)&&gs(e)&&!_t(e),Wu=e=>J(e)&&e.target?zt(e.target)?e.target.checked:e.target.value:e,Ku=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,qu=(e,t)=>e.has(Ku(t)),Yu=e=>{const t=e.constructor&&e.constructor.prototype;return J(t)&&t.hasOwnProperty("isPrototypeOf")},Mn=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Fe(e){let t;const r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(Mn&&(e instanceof Blob||e instanceof FileList))&&(r||J(e)))if(t=r?[]:{},!r&&!Yu(e))t=e;else for(const n in e)e.hasOwnProperty(n)&&(t[n]=Fe(e[n]));else return e;return t}var Ht=e=>Array.isArray(e)?e.filter(Boolean):[],Z=e=>e===void 0,E=(e,t,r)=>{if(!t||!J(e))return r;const n=Ht(t.split(/[,[\].]+?/)).reduce((i,o)=>le(i)?i:i[o],e);return Z(n)||n===e?Z(e[t])?r:e[t]:n},Ye=e=>typeof e=="boolean";const bs={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},$e={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Me={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};xe.createContext(null);var Gu=(e,t,r,n=!0)=>{const i={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(i,o,{get:()=>{const s=o;return t._proxyFormState[s]!==$e.all&&(t._proxyFormState[s]=!n||$e.all),r&&(r[s]=!0),e[s]}});return i},we=e=>J(e)&&!Object.keys(e).length,Zu=(e,t,r,n)=>{r(e);const{name:i,...o}=e;return we(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(s=>t[s]===(!n||$e.all))},Ln=e=>Array.isArray(e)?e:[e];function Qu(e){const t=xe.useRef(e);t.current=e,xe.useEffect(()=>{const r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}},[e.disabled])}var Oe=e=>typeof e=="string",Xu=(e,t,r,n,i)=>Oe(e)?(n&&t.watch.add(e),E(r,e,i)):Array.isArray(e)?e.map(o=>(n&&t.watch.add(o),E(r,o))):(n&&(t.watchAll=!0),r),Rn=e=>/^\w*$/.test(e),ys=e=>Ht(e.replace(/["|']|\]/g,"").split(/\.|\[/));function U(e,t,r){let n=-1;const i=Rn(t)?[t]:ys(t),o=i.length,s=o-1;for(;++n<o;){const a=i[n];let l=r;if(n!==s){const u=e[a];l=J(u)||Array.isArray(u)?u:isNaN(+i[n+1])?{}:[]}e[a]=l,e=e[a]}return e}var ws=(e,t,r,n,i)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:i||!0}}:{},_s=e=>({isOnSubmit:!e||e===$e.onSubmit,isOnBlur:e===$e.onBlur,isOnChange:e===$e.onChange,isOnAll:e===$e.all,isOnTouch:e===$e.onTouched}),xs=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const xr=(e,t,r,n)=>{for(const i of r||Object.keys(e)){const o=E(e,i);if(o){const{_f:s,...a}=o;if(s){if(s.refs&&s.refs[0]&&t(s.refs[0],i)&&!n)break;if(s.ref&&t(s.ref,s.name)&&!n)break}else J(a)&&xr(a,t)}}};var Ju=(e,t,r)=>{const n=Ht(E(e,r));return U(n,"root",t[r]),U(e,r,n),e},Vn=e=>e.type==="file",Ge=e=>typeof e=="function",kr=e=>{if(!Mn)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},$r=e=>Oe(e),Bn=e=>e.type==="radio",Sr=e=>e instanceof RegExp;const ks={value:!1,isValid:!1},$s={value:!0,isValid:!0};var Ss=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&&!Z(e[0].attributes.value)?Z(e[0].value)||e[0].value===""?$s:{value:e[0].value,isValid:!0}:$s:ks}return ks};const Es={isValid:!1,value:null};var Cs=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,Es):Es;function Os(e,t,r="validate"){if($r(e)||Array.isArray(e)&&e.every($r)||Ye(e)&&!e)return{type:r,message:$r(e)?e:"",ref:t}}var xt=e=>J(e)&&!Sr(e)?e:{value:e,message:""},Ps=async(e,t,r,n,i)=>{const{ref:o,refs:s,required:a,maxLength:l,minLength:u,min:p,max:c,pattern:v,validate:b,name:m,valueAsNumber:h,mount:_,disabled:k}=e._f,w=E(t,m);if(!_||k)return{};const P=s?s[0]:o,I=B=>{n&&P.reportValidity&&(P.setCustomValidity(Ye(B)?"":B||""),P.reportValidity())},O={},z=Bn(o),W=zt(o),N=z||W,F=(h||Vn(o))&&Z(o.value)&&Z(w)||kr(o)&&o.value===""||w===""||Array.isArray(w)&&!w.length,ie=ws.bind(null,m,r,O),ee=(B,M,Q,pe=Me.maxLength,_e=Me.minLength)=>{const Pe=B?M:Q;O[m]={type:B?pe:_e,message:Pe,ref:o,...ie(B?pe:_e,Pe)}};if(i?!Array.isArray(w)||!w.length:a&&(!N&&(F||le(w))||Ye(w)&&!w||W&&!Ss(s).isValid||z&&!Cs(s).isValid)){const{value:B,message:M}=$r(a)?{value:!!a,message:a}:xt(a);if(B&&(O[m]={type:Me.required,message:M,ref:P,...ie(Me.required,M)},!r))return I(M),O}if(!F&&(!le(p)||!le(c))){let B,M;const Q=xt(c),pe=xt(p);if(!le(w)&&!isNaN(w)){const _e=o.valueAsNumber||w&&+w;le(Q.value)||(B=_e>Q.value),le(pe.value)||(M=_e<pe.value)}else{const _e=o.valueAsDate||new Date(w),Pe=Or=>new Date(new Date().toDateString()+" "+Or),at=o.type=="time",Kt=o.type=="week";Oe(Q.value)&&w&&(B=at?Pe(w)>Pe(Q.value):Kt?w>Q.value:_e>new Date(Q.value)),Oe(pe.value)&&w&&(M=at?Pe(w)<Pe(pe.value):Kt?w<pe.value:_e<new Date(pe.value))}if((B||M)&&(ee(!!B,Q.message,pe.message,Me.max,Me.min),!r))return I(O[m].message),O}if((l||u)&&!F&&(Oe(w)||i&&Array.isArray(w))){const B=xt(l),M=xt(u),Q=!le(B.value)&&w.length>+B.value,pe=!le(M.value)&&w.length<+M.value;if((Q||pe)&&(ee(Q,B.message,M.message),!r))return I(O[m].message),O}if(v&&!F&&Oe(w)){const{value:B,message:M}=xt(v);if(Sr(B)&&!w.match(B)&&(O[m]={type:Me.pattern,message:M,ref:o,...ie(Me.pattern,M)},!r))return I(M),O}if(b){if(Ge(b)){const B=await b(w,t),M=Os(B,P);if(M&&(O[m]={...M,...ie(Me.validate,M.message)},!r))return I(M.message),O}else if(J(b)){let B={};for(const M in b){if(!we(B)&&!r)break;const Q=Os(await b[M](w,t),P,M);Q&&(B={...Q,...ie(M,Q.message)},I(Q.message),r&&(O[m]=B))}if(!we(B)&&(O[m]={ref:P,...B},!r))return O}}return I(!0),O};function ed(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Z(e)?n++:e[t[n++]];return e}function td(e){for(const t in e)if(e.hasOwnProperty(t)&&!Z(e[t]))return!1;return!0}function ne(e,t){const r=Array.isArray(t)?t:Rn(t)?[t]:ys(t),n=r.length===1?e:ed(e,r),i=r.length-1,o=r[i];return n&&delete n[o],i!==0&&(J(n)&&we(n)||Array.isArray(n)&&td(n))&&ne(e,r.slice(0,-1)),e}function jn(){let e=[];return{get observers(){return e},next:i=>{for(const o of e)o.next&&o.next(i)},subscribe:i=>(e.push(i),{unsubscribe:()=>{e=e.filter(o=>o!==i)}}),unsubscribe:()=>{e=[]}}}var Er=e=>le(e)||!gs(e);function st(e,t){if(Er(e)||Er(t))return e===t;if(_t(e)&&_t(t))return e.getTime()===t.getTime();const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const i of r){const o=e[i];if(!n.includes(i))return!1;if(i!=="ref"){const s=t[i];if(_t(o)&&_t(s)||J(o)&&J(s)||Array.isArray(o)&&Array.isArray(s)?!st(o,s):o!==s)return!1}}return!0}var As=e=>e.type==="select-multiple",rd=e=>Bn(e)||zt(e),Un=e=>kr(e)&&e.isConnected,Is=e=>{for(const t in e)if(Ge(e[t]))return!0;return!1};function Cr(e,t={}){const r=Array.isArray(e);if(J(e)||r)for(const n in e)Array.isArray(e[n])||J(e[n])&&!Is(e[n])?(t[n]=Array.isArray(e[n])?[]:{},Cr(e[n],t[n])):le(e[n])||(t[n]=!0);return t}function Ds(e,t,r){const n=Array.isArray(e);if(J(e)||n)for(const i in e)Array.isArray(e[i])||J(e[i])&&!Is(e[i])?Z(t)||Er(r[i])?r[i]=Array.isArray(e[i])?Cr(e[i],[]):{...Cr(e[i])}:Ds(e[i],le(t)?{}:t[i],r[i]):r[i]=!st(e[i],t[i]);return r}var zn=(e,t)=>Ds(e,t,Cr(t)),Ts=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Z(e)?e:t?e===""?NaN:e&&+e:r&&Oe(e)?new Date(e):n?n(e):e;function Hn(e){const t=e.ref;if(!(e.refs?e.refs.every(r=>r.disabled):t.disabled))return Vn(t)?t.files:Bn(t)?Cs(e.refs).value:As(t)?[...t.selectedOptions].map(({value:r})=>r):zt(t)?Ss(e.refs).value:Ts(Z(t.value)?e.ref.value:t.value,e)}var nd=(e,t,r,n)=>{const i={};for(const o of e){const s=E(t,o);s&&U(i,o,s._f)}return{criteriaMode:r,names:[...e],fields:i,shouldUseNativeValidation:n}},Wt=e=>Z(e)?e:Sr(e)?e.source:J(e)?Sr(e.value)?e.value.source:e.value:e,id=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Ns(e,t,r){const n=E(e,r);if(n||Rn(r))return{error:n,name:r};const i=r.split(".");for(;i.length;){const o=i.join("."),s=E(t,o),a=E(e,o);if(s&&!Array.isArray(s)&&r!==o)return{name:r};if(a&&a.type)return{name:o,error:a};i.pop()}return{name:r}}var od=(e,t,r,n,i)=>i.isOnAll?!1:!r&&i.isOnTouch?!(t||e):(r?n.isOnBlur:i.isOnBlur)?!e:(r?n.isOnChange:i.isOnChange)?e:!0,sd=(e,t)=>!Ht(E(e,t)).length&&ne(e,t);const ad={mode:$e.onSubmit,reValidateMode:$e.onChange,shouldFocusError:!0};function cd(e={},t){let r={...ad,...e},n={submitCount:0,isDirty:!1,isLoading:Ge(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{},disabled:!1},i={},o=J(r.defaultValues)||J(r.values)?Fe(r.defaultValues||r.values)||{}:{},s=r.shouldUnregister?{}:Fe(o),a={action:!1,mount:!1,watch:!1},l={mount:new Set,unMount:new Set,array:new Set,watch:new Set},u,p=0;const c={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},v={values:jn(),array:jn(),state:jn()},b=e.resetOptions&&e.resetOptions.keepDirtyValues,m=_s(r.mode),h=_s(r.reValidateMode),_=r.criteriaMode===$e.all,k=f=>g=>{clearTimeout(p),p=setTimeout(f,g)},w=async f=>{if(c.isValid||f){const g=r.resolver?we((await F()).errors):await ee(i,!0);g!==n.isValid&&v.state.next({isValid:g})}},P=f=>c.isValidating&&v.state.next({isValidating:f}),I=(f,g=[],y,C,$=!0,x=!0)=>{if(C&&y){if(a.action=!0,x&&Array.isArray(E(i,f))){const A=y(E(i,f),C.argA,C.argB);$&&U(i,f,A)}if(x&&Array.isArray(E(n.errors,f))){const A=y(E(n.errors,f),C.argA,C.argB);$&&U(n.errors,f,A),sd(n.errors,f)}if(c.touchedFields&&x&&Array.isArray(E(n.touchedFields,f))){const A=y(E(n.touchedFields,f),C.argA,C.argB);$&&U(n.touchedFields,f,A)}c.dirtyFields&&(n.dirtyFields=zn(o,s)),v.state.next({name:f,isDirty:M(f,g),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else U(s,f,g)},O=(f,g)=>{U(n.errors,f,g),v.state.next({errors:n.errors})},z=(f,g,y,C)=>{const $=E(i,f);if($){const x=E(s,f,Z(y)?E(o,f):y);Z(x)||C&&C.defaultChecked||g?U(s,f,g?x:Hn($._f)):_e(f,x),a.mount&&w()}},W=(f,g,y,C,$)=>{let x=!1,A=!1;const H={name:f};if(!y||C){c.isDirty&&(A=n.isDirty,n.isDirty=H.isDirty=M(),x=A!==H.isDirty);const X=st(E(o,f),g);A=E(n.dirtyFields,f),X?ne(n.dirtyFields,f):U(n.dirtyFields,f,!0),H.dirtyFields=n.dirtyFields,x=x||c.dirtyFields&&A!==!X}if(y){const X=E(n.touchedFields,f);X||(U(n.touchedFields,f,y),H.touchedFields=n.touchedFields,x=x||c.touchedFields&&X!==y)}return x&&$&&v.state.next(H),x?H:{}},N=(f,g,y,C)=>{const $=E(n.errors,f),x=c.isValid&&Ye(g)&&n.isValid!==g;if(e.delayError&&y?(u=k(()=>O(f,y)),u(e.delayError)):(clearTimeout(p),u=null,y?U(n.errors,f,y):ne(n.errors,f)),(y?!st($,y):$)||!we(C)||x){const A={...C,...x&&Ye(g)?{isValid:g}:{},errors:n.errors,name:f};n={...n,...A},v.state.next(A)}P(!1)},F=async f=>r.resolver(s,r.context,nd(f||l.mount,i,r.criteriaMode,r.shouldUseNativeValidation)),ie=async f=>{const{errors:g}=await F(f);if(f)for(const y of f){const C=E(g,y);C?U(n.errors,y,C):ne(n.errors,y)}else n.errors=g;return g},ee=async(f,g,y={valid:!0})=>{for(const C in f){const $=f[C];if($){const{_f:x,...A}=$;if(x){const H=l.array.has(x.name),X=await Ps($,s,_,r.shouldUseNativeValidation&&!g,H);if(X[x.name]&&(y.valid=!1,g))break;!g&&(E(X,x.name)?H?Ju(n.errors,X,x.name):U(n.errors,x.name,X[x.name]):ne(n.errors,x.name))}A&&await ee(A,g,y)}}return y.valid},B=()=>{for(const f of l.unMount){const g=E(i,f);g&&(g._f.refs?g._f.refs.every(y=>!Un(y)):!Un(g._f.ref))&&Kn(f)}l.unMount=new Set},M=(f,g)=>(f&&g&&U(s,f,g),!st(Rs(),o)),Q=(f,g,y)=>Xu(f,l,{...a.mount?s:Z(g)?o:Oe(f)?{[f]:g}:g},y,g),pe=f=>Ht(E(a.mount?s:o,f,e.shouldUnregister?E(o,f,[]):[])),_e=(f,g,y={})=>{const C=E(i,f);let $=g;if(C){const x=C._f;x&&(!x.disabled&&U(s,f,Ts(g,x)),$=kr(x.ref)&&le(g)?"":g,As(x.ref)?[...x.ref.options].forEach(A=>A.selected=$.includes(A.value)):x.refs?zt(x.ref)?x.refs.length>1?x.refs.forEach(A=>(!A.defaultChecked||!A.disabled)&&(A.checked=Array.isArray($)?!!$.find(H=>H===A.value):$===A.value)):x.refs[0]&&(x.refs[0].checked=!!$):x.refs.forEach(A=>A.checked=A.value===$):Vn(x.ref)?x.ref.value="":(x.ref.value=$,x.ref.type||v.values.next({name:f,values:{...s}})))}(y.shouldDirty||y.shouldTouch)&&W(f,$,y.shouldTouch,y.shouldDirty,!0),y.shouldValidate&&Wn(f)},Pe=(f,g,y)=>{for(const C in g){const $=g[C],x=`${f}.${C}`,A=E(i,x);(l.array.has(f)||!Er($)||A&&!A._f)&&!_t($)?Pe(x,$,y):_e(x,$,y)}},at=(f,g,y={})=>{const C=E(i,f),$=l.array.has(f),x=Fe(g);U(s,f,x),$?(v.array.next({name:f,values:{...s}}),(c.isDirty||c.dirtyFields)&&y.shouldDirty&&v.state.next({name:f,dirtyFields:zn(o,s),isDirty:M(f,x)})):C&&!C._f&&!le(x)?Pe(f,x,y):_e(f,x,y),xs(f,l)&&v.state.next({...n}),v.values.next({name:f,values:{...s}}),!a.mount&&t()},Kt=async f=>{const g=f.target;let y=g.name,C=!0;const $=E(i,y),x=()=>g.type?Hn($._f):Wu(f),A=H=>{C=Number.isNaN(H)||H===E(s,y,H)};if($){let H,X;const Pr=x(),$t=f.type===bs.BLUR||f.type===bs.FOCUS_OUT,Ud=!id($._f)&&!r.resolver&&!E(n.errors,y)&&!$._f.deps||od($t,E(n.touchedFields,y),n.isSubmitted,h,m),Yn=xs(y,l,$t);U(s,y,Pr),$t?($._f.onBlur&&$._f.onBlur(f),u&&u(0)):$._f.onChange&&$._f.onChange(f);const Gn=W(y,Pr,$t,!1),zd=!we(Gn)||Yn;if(!$t&&v.values.next({name:y,type:f.type,values:{...s}}),Ud)return c.isValid&&w(),zd&&v.state.next({name:y,...Yn?{}:Gn});if(!$t&&Yn&&v.state.next({...n}),P(!0),r.resolver){const{errors:Ks}=await F([y]);if(A(Pr),C){const Hd=Ns(n.errors,i,y),qs=Ns(Ks,i,Hd.name||y);H=qs.error,y=qs.name,X=we(Ks)}}else H=(await Ps($,s,_,r.shouldUseNativeValidation))[y],A(Pr),C&&(H?X=!1:c.isValid&&(X=await ee(i,!0)));C&&($._f.deps&&Wn($._f.deps),N(y,X,H,Gn))}},Or=(f,g)=>{if(E(n.errors,g)&&f.focus)return f.focus(),1},Wn=async(f,g={})=>{let y,C;const $=Ln(f);if(P(!0),r.resolver){const x=await ie(Z(f)?f:$);y=we(x),C=f?!$.some(A=>E(x,A)):y}else f?(C=(await Promise.all($.map(async x=>{const A=E(i,x);return await ee(A&&A._f?{[x]:A}:A)}))).every(Boolean),!(!C&&!n.isValid)&&w()):C=y=await ee(i);return v.state.next({...!Oe(f)||c.isValid&&y!==n.isValid?{}:{name:f},...r.resolver||!f?{isValid:y}:{},errors:n.errors,isValidating:!1}),g.shouldFocus&&!C&&xr(i,Or,f?$:l.mount),C},Rs=f=>{const g={...o,...a.mount?s:{}};return Z(f)?g:Oe(f)?E(g,f):f.map(y=>E(g,y))},Vs=(f,g)=>({invalid:!!E((g||n).errors,f),isDirty:!!E((g||n).dirtyFields,f),isTouched:!!E((g||n).touchedFields,f),error:E((g||n).errors,f)}),Rd=f=>{f&&Ln(f).forEach(g=>ne(n.errors,g)),v.state.next({errors:f?n.errors:{}})},Bs=(f,g,y)=>{const C=(E(i,f,{_f:{}})._f||{}).ref;U(n.errors,f,{...g,ref:C}),v.state.next({name:f,errors:n.errors,isValid:!1}),y&&y.shouldFocus&&C&&C.focus&&C.focus()},Vd=(f,g)=>Ge(f)?v.values.subscribe({next:y=>f(Q(void 0,g),y)}):Q(f,g,!0),Kn=(f,g={})=>{for(const y of f?Ln(f):l.mount)l.mount.delete(y),l.array.delete(y),g.keepValue||(ne(i,y),ne(s,y)),!g.keepError&&ne(n.errors,y),!g.keepDirty&&ne(n.dirtyFields,y),!g.keepTouched&&ne(n.touchedFields,y),!r.shouldUnregister&&!g.keepDefaultValue&&ne(o,y);v.values.next({values:{...s}}),v.state.next({...n,...g.keepDirty?{isDirty:M()}:{}}),!g.keepIsValid&&w()},js=({disabled:f,name:g,field:y,fields:C,value:$})=>{if(Ye(f)){const x=f?void 0:Z($)?Hn(y?y._f:E(C,g)._f):$;U(s,g,x),W(g,x,!1,!1,!0)}},qn=(f,g={})=>{let y=E(i,f);const C=Ye(g.disabled);return U(i,f,{...y||{},_f:{...y&&y._f?y._f:{ref:{name:f}},name:f,mount:!0,...g}}),l.mount.add(f),y?js({field:y,disabled:g.disabled,name:f}):z(f,!0,g.value),{...C?{disabled:g.disabled}:{},...r.progressive?{required:!!g.required,min:Wt(g.min),max:Wt(g.max),minLength:Wt(g.minLength),maxLength:Wt(g.maxLength),pattern:Wt(g.pattern)}:{},name:f,onChange:Kt,onBlur:Kt,ref:$=>{if($){qn(f,g),y=E(i,f);const x=Z($.value)&&$.querySelectorAll&&$.querySelectorAll("input,select,textarea")[0]||$,A=rd(x),H=y._f.refs||[];if(A?H.find(X=>X===x):x===y._f.ref)return;U(i,f,{_f:{...y._f,...A?{refs:[...H.filter(Un),x,...Array.isArray(E(o,f))?[{}]:[]],ref:{type:x.type,name:f}}:{ref:x}}}),z(f,!1,void 0,x)}else y=E(i,f,{}),y._f&&(y._f.mount=!1),(r.shouldUnregister||g.shouldUnregister)&&!(qu(l.array,f)&&a.action)&&l.unMount.add(f)}}},Us=()=>r.shouldFocusError&&xr(i,Or,l.mount),Bd=f=>{Ye(f)&&(v.state.next({disabled:f}),xr(i,g=>{g.disabled=f},0,!1))},zs=(f,g)=>async y=>{y&&(y.preventDefault&&y.preventDefault(),y.persist&&y.persist());let C=Fe(s);if(v.state.next({isSubmitting:!0}),r.resolver){const{errors:$,values:x}=await F();n.errors=$,C=x}else await ee(i);ne(n.errors,"root"),we(n.errors)?(v.state.next({errors:{}}),await f(C,y)):(g&&await g({...n.errors},y),Us(),setTimeout(Us)),v.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:we(n.errors),submitCount:n.submitCount+1,errors:n.errors})},jd=(f,g={})=>{E(i,f)&&(Z(g.defaultValue)?at(f,E(o,f)):(at(f,g.defaultValue),U(o,f,g.defaultValue)),g.keepTouched||ne(n.touchedFields,f),g.keepDirty||(ne(n.dirtyFields,f),n.isDirty=g.defaultValue?M(f,E(o,f)):M()),g.keepError||(ne(n.errors,f),c.isValid&&w()),v.state.next({...n}))},Hs=(f,g={})=>{const y=f?Fe(f):o,C=Fe(y),$=f&&!we(f)?C:o;if(g.keepDefaultValues||(o=y),!g.keepValues){if(g.keepDirtyValues||b)for(const x of l.mount)E(n.dirtyFields,x)?U($,x,E(s,x)):at(x,E($,x));else{if(Mn&&Z(f))for(const x of l.mount){const A=E(i,x);if(A&&A._f){const H=Array.isArray(A._f.refs)?A._f.refs[0]:A._f.ref;if(kr(H)){const X=H.closest("form");if(X){X.reset();break}}}}i={}}s=e.shouldUnregister?g.keepDefaultValues?Fe(o):{}:Fe($),v.array.next({values:{...$}}),v.values.next({values:{...$}})}l={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!a.mount&&t(),a.mount=!c.isValid||!!g.keepIsValid,a.watch=!!e.shouldUnregister,v.state.next({submitCount:g.keepSubmitCount?n.submitCount:0,isDirty:g.keepDirty?n.isDirty:!!(g.keepDefaultValues&&!st(f,o)),isSubmitted:g.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:g.keepDirtyValues?n.dirtyFields:g.keepDefaultValues&&f?zn(o,f):{},touchedFields:g.keepTouched?n.touchedFields:{},errors:g.keepErrors?n.errors:{},isSubmitSuccessful:g.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},Ws=(f,g)=>Hs(Ge(f)?f(s):f,g);return{control:{register:qn,unregister:Kn,getFieldState:Vs,handleSubmit:zs,setError:Bs,_executeSchema:F,_getWatch:Q,_getDirty:M,_updateValid:w,_removeUnmounted:B,_updateFieldArray:I,_updateDisabledField:js,_getFieldArray:pe,_reset:Hs,_resetDefaultValues:()=>Ge(r.defaultValues)&&r.defaultValues().then(f=>{Ws(f,r.resetOptions),v.state.next({isLoading:!1})}),_updateFormState:f=>{n={...n,...f}},_disableForm:Bd,_subjects:v,_proxyFormState:c,get _fields(){return i},get _formValues(){return s},get _state(){return a},set _state(f){a=f},get _defaultValues(){return o},get _names(){return l},set _names(f){l=f},get _formState(){return n},set _formState(f){n=f},get _options(){return r},set _options(f){r={...r,...f}}},trigger:Wn,register:qn,handleSubmit:zs,watch:Vd,setValue:at,getValues:Rs,reset:Ws,resetField:jd,clearErrors:Rd,unregister:Kn,setError:Bs,setFocus:(f,g={})=>{const y=E(i,f),C=y&&y._f;if(C){const $=C.refs?C.refs[0]:C.ref;$.focus&&($.focus(),g.shouldSelect&&$.select())}},getFieldState:Vs}}function Fs(e={}){const t=xe.useRef(),r=xe.useRef(),[n,i]=xe.useState({isDirty:!1,isValidating:!1,isLoading:Ge(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},disabled:!1,defaultValues:Ge(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...cd(e,()=>i(s=>({...s}))),formState:n});const o=t.current.control;return o._options=e,Qu({subject:o._subjects.state,next:s=>{Zu(s,o._proxyFormState,o._updateFormState,!0)&&i({...o._formState})}}),xe.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),xe.useEffect(()=>{if(o._proxyFormState.isDirty){const s=o._getDirty();s!==n.isDirty&&o._subjects.state.next({isDirty:s})}},[o,n.isDirty]),xe.useEffect(()=>{e.values&&!st(e.values,r.current)?(o._reset(e.values,o._options.resetOptions),r.current=e.values):o._resetDefaultValues()},[e.values,o]),xe.useEffect(()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=Gu(n,o),t.current}var Ms=function(e,t,r){if(e&&"reportValidity"in e){var n=E(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},ld=function(e,t){var r=function(i){var o=t.fields[i];o&&o.ref&&"reportValidity"in o.ref?Ms(o.ref,i,e):o.refs&&o.refs.forEach(function(s){return Ms(s,i,e)})};for(var n in t.fields)r(n)},ud=function(e,t){t.shouldUseNativeValidation&&ld(e,t);var r={};for(var n in e){var i=E(t.fields,n),o=Object.assign(e[n]||{},{ref:i&&i.ref});if(fd(t.names||Object.keys(e),n)){var s=Object.assign({},dd(E(r,n)));U(s,"root",o),U(r,n,s)}else U(r,n,o)}return r},dd=function(e){return Array.isArray(e)?e.filter(Boolean):[]},fd=function(e,t){return e.some(function(r){return r.startsWith(t+".")})},pd=function(e,t){for(var r={};e.issues.length;){var n=e.issues[0];if(n.path){var i=n.path.map(function(a){return a.key}).join(".");if(r[i]||(r[i]={message:n.message,type:n.validation}),t){var o=r[i].types,s=o&&o[n.validation];r[i]=ws(i,t,r,n.validation,s?[].concat(s,n.message):n.message)}e.issues.shift()}}return r},Ls=function(e,t,r){return r===void 0&&(r={}),function(n,i,o){try{return Promise.resolve(function(s,a){try{var l=function(){function u(c){return{values:r.raw?n:c,errors:{}}}var p=Object.assign({},{abortEarly:!1,abortPipeEarly:!1},t);return r.mode==="sync"?u(Pt(e,n,p)):Promise.resolve(la(e,n,p)).then(u)}()}catch(u){return a(u)}return l&&l.then?l.then(void 0,a):l}(0,function(s){if(s instanceof Nr)return{values:{},errors:ud(pd(s,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw s}))}catch(s){return Promise.reject(s)}}};const hd=27,vd=12,md=10,gd=e=>{const t=Object.fromEntries(new FormData(e).entries());Object.keys(t).length&&e.dispatchEvent(new Event("submit",{bubbles:!0}))},bd=xn("multiple-choice"),yd=e=>{const t={min:e.minSelected??0,max:e.maxSelected??e.options.length};return Ls(Be({checked:yi(bi(ia()),r=>Object.entries(r).filter(([n,i])=>i).map(([n,i])=>n),[At(t.max,`Please select at most ${t.max} option${t.max!==1?"s":""}`),wi(t.min,`Please select at least ${t.min} option${t.min!==1?"s":""}`)])}))},wd=({input:e,onSubmitSuccess:t})=>{var l,u;const r=e.key?(l=D.current$.value.flow)==null?void 0:l.data.submissions[e.key]:void 0,n=(e.config.minSelected===1||e.config.minSelected===void 0)&&e.config.maxSelected===1,{register:i,handleSubmit:o,formState:{errors:s}}=Fs({defaultValues:{checked:n?{}:bd(r)?Object.fromEntries(r.value.map(p=>[p,!0])):{}},resolver:yd(e.config)}),a=Nn();return d("form",{noValidate:!0,class:"flex flex-col gap-1 pr-2.5",onChange:p=>{n&&gd(p.currentTarget)},onSubmit:o(p=>{const c=p.checked;t(c)}),children:[d("div",{class:"flex items-center gap-1",children:[d("ul",{style:{maxHeight:6.5*hd+5*vd+2*md},class:Ue("gutter-stable flex w-full flex-1 flex-wrap gap-3 overflow-y-auto rounded-xl p-2.5 pr-4",{"justify-center":e.config.options.length===1}),children:e.config.options.map((p,c)=>{const v=`checked.${p.value}`,{ref:b,...m}=i(v);return d("li",{class:"relative",children:[d("input",{autoFocus:c===0,ref:h=>{h&&c===0&&(a.current=h),b(h)},id:v,...m,class:"peer sr-only h-full",type:"checkbox"}),d("label",{class:"bg-lowest peer-focus-visible:ring-accent-7 active:outline-neutral-10 ease-expo-out outline-divider text-neutral-11 peer-checked:outline-accent-7 peer-checked:bg-accent-2 peer-checked:text-accent-9 block rounded-2xl px-2.5 py-1 outline outline-2 ring-0 ring-transparent transition-all selection:bg-transparent peer-focus-visible:ring-4 peer-focus-visible:ring-offset-2",htmlFor:v,children:p.label})]},p.value)})}),d("div",{class:"flex flex-col items-center gap-2",children:[!n&&d(jt,{}),e.config.minSelected===0&&d(Ut,{type:"button",onClick:()=>t([])})]})]}),d("div",{class:"px-1",children:d(Fn,{error:(u=s.checked)==null?void 0:u.root})})]})},_d=({input:e,onSubmitSuccess:t})=>d("div",{class:"flex flex-col items-center py-3",children:d("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:d("span",{class:"flex items-center gap-1.5",children:[d("span",{class:"inline-flex items-center text-sm font-medium",children:e.config.label}),d("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:[d("path",{d:"M4 8L8 4L12 8"}),d("path",{d:"M8 4V13"})]})]})})}),kt={empty:"Please enter some text",email:"That doesn’t look like a valid email address",phone:"That doesn’t look like a valid phone number",url:"That doesn’t look like a valid URL"},xd=be(kt.phone,[fa(/^\+?[0-9 -]+$/,kt.phone)]),kd={email:{type:"email",inputMode:"email",formNoValidate:!0},phone:{type:"tel",inputMode:"tel"},text:{type:"text",inputMode:"text"},url:{type:"url",inputMode:"url",formNoValidate:!0}},$d=xn("text"),Sd=e=>{const t=`Please enter no more than ${e.maxChars} characters`;return Ls(Be({text:{email:be(kt.email,[da(kt.email),At(e.maxChars??1/0,t)]),phone:yi(xd,r=>r.replace(/[^0-9]/g,""),[At(e.maxChars??1/0,t)]),text:be([wi(1,kt.empty),At(e.maxChars??1/0,t)]),url:be([pa(kt.url),At(e.maxChars??1/0,t)])}[e.format]}))},Ed=({input:e,onSubmitSuccess:t})=>{var p;const r=e.key?(p=D.current$.value.flow)==null?void 0:p.data.submissions[e.key]:void 0,n=e.config.defaultValue,{register:i,handleSubmit:o,formState:{errors:s}}=Fs({defaultValues:{text:n||($d(r)?r.value:"")},resolver:Sd(e.config)}),{ref:a,...l}=i("text",{required:!e.config.optional}),u=L();return ye(()=>{u.current&&(u.current.focus(),u.current.select())},[]),d(q,{children:d("form",{noValidate:!0,class:"flex flex-col gap-1 p-2.5",onSubmit:o(c=>{t(c.text)}),children:[d("div",{class:"flex items-center gap-2",children:[d("div",{class:"relative min-w-0 flex-grow",children:[d("input",{id:"chat-input",...l,...kd[e.config.format],autocomplete:"off",autoCapitalize:"off",autoCorrect:"off",autoFocus:!0,ref:c=>{c&&(u.current=c),a(c)},class:"outline-divider ease-expo-out placeholder:text-neutral-10 text-neutral-12 focus-visible:outline-accent-7 caret-accent-9 bg-lowest w-full rounded-full px-3 py-1 text-base outline outline-2 transition-all",placeholder:e.config.placeholder}),e.config.optional&&d(Ut,{class:"absolute right-0 top-0",onClick:()=>t(null)})]}),d(jt,{})]}),d(Fn,{error:s.text})]})})},Cd=()=>{var o;const e=(o=D.current$.value.flow)==null?void 0:o.data.currentInput,[t,r]=xu(),n=L(null);D.inputHeight$.value=r.height,V(()=>{const s=n.current;if(s)return s.addEventListener("transitionstart",ce.scrollToEnd.smooth),s.addEventListener("transitioncancel",ce.scrollToEnd.smooth),s.addEventListener("transitionend",ce.scrollToEnd.smooth),()=>{s.removeEventListener("transitionstart",ce.scrollToEnd.smooth),s.removeEventListener("transitioncancel",ce.scrollToEnd.smooth),s.removeEventListener("transitionend",ce.scrollToEnd.smooth)}},[]);const i=s=>a=>ce.onSubmitSuccessFn$.value({type:s,value:a});return d("div",{ref:n,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:r.height},children:d("div",{ref:t,class:"border-divider flex flex-col justify-end border-t",children:Ne({input:e}).with({input:fe.nullish},()=>d("div",{class:"flex items-center gap-2 p-2.5",children:[d("input",{"aria-hidden":"true",id:"chat-input",class:"outline-divider flex-grow rounded-full bg-transparent px-3 py-1 text-base outline outline-2",disabled:!0}),d(jt,{disabled:!0,"aria-hidden":"true",tabIndex:-1})]})).with({input:{type:"text"}},s=>d(Ed,{onSubmitSuccess:i(s.input.type),...s})).with({input:{type:"multiple-choice"}},s=>d(wd,{onSubmitSuccess:i(s.input.type),...s})).with({input:{type:"boolean"}},s=>d(Lu,{onSubmitSuccess:i(s.input.type),...s})).with({input:{type:"file"}},s=>d(Hu,{onSubmitSuccess:i(s.input.type),...s})).with({input:{type:"submit"}},s=>d(_d,{onSubmitSuccess:i(s.input.type),...s})).with({input:{type:"address"}},s=>d(Du,{onSubmitSuccess:i(s.input.type),...s})).exhaustive()})})},Od=on("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"}}),Pd=({children:e,className:t,animate:r,side:n,...i})=>d("p",{style:{transformOrigin:n==="left"?"0% 50%":"100% 50%"},class:Od({className:t,side:n,animate:r}),...i,children:e}),Ad=({className:e,...t})=>(V(()=>{ce.scrollToEnd.smooth()}),d("div",{"aria-hidden":!0,children:ce.isBotTyping$.value===!0?d("div",{"aria-label":"Typing…",class:Ue("flex gap-1 p-4",e),...t,children:Array.from({length:3},(r,n)=>d("div",{class:"bg-accent-9 h-1.5 w-1.5 animate-bounce rounded-full",style:{animationDelay:`${-n*200}ms`}}))}):void 0})),Id={bot:"left",user:"right"},Dd=on("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]"}}}),Td=({lastSentMessageFooter:e})=>{var r;const t=((r=D.current$.value.flow)==null?void 0:r.data.messages)??[];return V(()=>{ce.scrollToEnd.smooth()},[t.length]),d("ol",{"aria-label":"Chat messages",class:"flex flex-col justify-end gap-2 p-2 pt-[calc(var(--header-height)+1rem)]",children:[t.map((n,i)=>d(q,{children:d("li",{class:"flex",children:Ne(n).with({type:"system"},o=>d("p",{class:Dd({variant:o.variant}),children:o.text})).with({type:"text",author:fe.union("bot","user")},o=>{const s=o.author==="user"&&!t.slice(i+1).some(l=>l.type==="text"&&l.author==="user"),a=i===t.length-1;return d(Pd,{animate:a,side:Id[o.author],children:[o.text,s?e:null]},i)}).with({type:"link"},o=>d("div",{class:"bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl px-2 py-2",children:d("a",{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:o.href,children:[o.text,d("svg",{class:"flex-none",width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:d("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"})})]})})).with({type:"image"},o=>d("img",{class:"shadow-surface-md w-full max-w-[min(100%,24rem)] rounded-2xl",src:o.url,style:{aspectRatio:o.width/o.height}})).with({type:"file"},o=>d(ju,{class:o.author==="bot"?"":"ml-auto",file:{name:o.fileName,sizeKb:o.fileSizeKb}})).exhaustive()})},i)),d(Ad,{},"typing")]})},Nd=({logger:e,apiClient:t,analytics:r})=>{const{flow:n}=D.current$.value;ke(n,"Flow is required to exist to show chatbot body");const i=D.viewState$.value,{chatRef:o,chatService:s}=Ou(),[a,l]=Y();return ye(()=>{i==="maximised"&&ce.scrollToEnd.instant()},[i]),ye(()=>{const{state:u,flow:p}=D.current$.peek();if(u!=="loaded")throw new Error(pl.invalid_state);let c=p.data.nodeHistory.at(-1);if(ce.scrollToEnd.instant(),D.setInput(void 0),p.data.isFinished)return;c===void 0?(c=ts(n.nodes).id,D.setCurrentNodeId(c),r.log({event:"FLOW_START",properties:{flow_id:n.id,flow_version:n.version,flow_session_id:p.data.flowSessionId},customProperties:n.context})):D.removeMessagesSentByNodeIds([c]);const{interpret:v,abort:b,undo:m}=ou({context:n.context,analytics:r,apiClient:t,logger:e,flow:n.nodes,chatService:s,getSubmissions:()=>{var h;return(h=D.current$.peek().flow)==null?void 0:h.data.submissions},onInterpret:(h,_)=>{const k=D.current$.peek().flow;ke(k),_&&(k.data.sequence=k.data.sequence+1,r.log({event:"FLOW_NODE",properties:{flow_id:n.id,flow_version:n.version,from_node_id:_.id,to_node_id:h.id,sequence:k.data.sequence,flow_session_id:k.data.flowSessionId},customProperties:n.context})),D.setCurrentNodeId(h.id)},onFlowEnd:async()=>{D.markAsFinished();const h=D.current$.peek().flow;ke(h),r.log({event:"FLOW_END",properties:{flow_id:n.id,flow_version:n.version,flow_session_id:h.data.flowSessionId},customProperties:n.context})}});return l(()=>m),v(c),b},[r,t,s,e,n]),d(q,{children:[d("div",{ref:o,className:"hide-scrollbars relative flex w-full max-w-full flex-grow flex-col overflow-y-scroll",style:{WebkitOverflowScrolling:"touch",paddingBottom:D.inputHeight$.value},children:d(Td,{lastSentMessageFooter:n.data.isFinished||!a?null:d(Md,{undoFn:a})})}),d(Cd,{})]})},Fd=e=>"key"in e.data&&e.data.key?[e.data.key]:"keys"in e.data?Object.values(e.data.keys).filter(t=>typeof t=="string"):[],Md=({undoFn:e})=>d("div",{class:"absolute bottom-0 right-0 flex w-full translate-y-full justify-end",children:d("button",{class:"fr touch-hitbox text-neutral-9 hover:text-neutral-12 rounded-full p-1 text-right text-xs transition-all",onClick:async()=>{const{flow:t}=D.current$.peek();ke(t);const{removed:r}=e(t.data.nodeHistory),n=t.data.nodeHistory.splice(-r);n.length!==0&&(D.removeMessagesSentByNodeIds(n),D.setInput(void 0),n.pop(),n.map(i=>t.nodes.find(o=>o.id===i)).filter(Boolean).flatMap(Fd).forEach(i=>delete t.data.submissions[i]),D.current$.value={...D.current$.value})},children:"Undo"})}),Ld=Object.freeze(Object.defineProperty({__proto__:null,ChatbotBody:Nd},Symbol.toStringTag,{value:"Module"}))})();
@@ -1,4 +1,4 @@
1
- import { _, g as getHeadOrThrow, i as invariant, A as AbortedError, N, a as getFlowSubmissionsPayload, k as kbToReadableSize, h, b as _$1, p, F, o as o$1, c as clsx, y, s as store, d as a$2, e as debounce$1, f as k, j as parse, l as picklist, m as isSubmissionOfType, C as Cn, n as parseAsync, V as ValiError, q as object, t as transform, r as maxLength, u as minLength, v as record, w as boolean, x as string, z as email, B as url, D as regex, E as cva, G as ERROR_MESSAGES } from "./index-767d53bf.js";
1
+ import { _, g as getHeadOrThrow, i as invariant, A as AbortedError, N, a as getFlowSubmissionsPayload, k as kbToReadableSize, h, b as _$1, p, F, o as o$1, c as clsx, y, s as store, d as a$2, e as debounce$1, f as k, j as parse, l as picklist, m as isSubmissionOfType, C as Cn, n as parseAsync, V as ValiError, q as object, t as transform, r as maxLength, u as minLength, v as record, w as boolean, x as string, z as email, B as url, D as regex, E as cva, G as ERROR_MESSAGES } from "./index-16ef9a7a.js";
2
2
  import "@inploi/sdk";
3
3
  const followNodes = ({
4
4
  node,
@@ -1236,8 +1236,11 @@ const ChatInputAddressDetails = ({
1236
1236
  const ref = _$1(null);
1237
1237
  y(() => {
1238
1238
  if (ref.current) {
1239
- ref.current.focus();
1240
- ref.current.select();
1239
+ const firstInput = ref.current.querySelector("input");
1240
+ if (firstInput) {
1241
+ firstInput.focus();
1242
+ firstInput.select();
1243
+ }
1241
1244
  }
1242
1245
  }, []);
1243
1246
  return o$1("form", {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-58417acc.cjs");
3
+ const index = require("./index-4d52a3ee.cjs");
4
4
  require("@inploi/sdk");
5
5
  const followNodes = ({
6
6
  node,
@@ -1238,8 +1238,11 @@ const ChatInputAddressDetails = ({
1238
1238
  const ref = index._$1(null);
1239
1239
  index.y(() => {
1240
1240
  if (ref.current) {
1241
- ref.current.focus();
1242
- ref.current.select();
1241
+ const firstInput = ref.current.querySelector("input");
1242
+ if (firstInput) {
1243
+ firstInput.focus();
1244
+ firstInput.select();
1245
+ }
1243
1246
  }
1244
1247
  }, []);
1245
1248
  return index.o("form", {
@@ -4731,7 +4731,7 @@ const StatusBar = ({
4731
4731
  })
4732
4732
  });
4733
4733
  };
4734
- const ChatbotBody = M(() => import("./chatbot-body-d6f85db2.js").then((module) => module.ChatbotBody));
4734
+ const ChatbotBody = M(() => import("./chatbot-body-07c6a730.js").then((module) => module.ChatbotBody));
4735
4735
  const chatbotContentClass = cva("selection:bg-accent-4 selection:text-accent-12 fixed bottom-2 left-2 right-2 isolate mx-auto max-h-full max-w-[450px] focus:outline-none", {
4736
4736
  variants: {
4737
4737
  view: {
@@ -4732,7 +4732,7 @@ const StatusBar = ({
4732
4732
  })
4733
4733
  });
4734
4734
  };
4735
- const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-da121658.cjs")).then((module2) => module2.ChatbotBody));
4735
+ const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-56aa93b9.cjs")).then((module2) => module2.ChatbotBody));
4736
4736
  const chatbotContentClass = cva("selection:bg-accent-4 selection:text-accent-12 fixed bottom-2 left-2 right-2 isolate mx-auto max-h-full max-w-[450px] focus:outline-none", {
4737
4737
  variants: {
4738
4738
  view: {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-58417acc.cjs");
3
+ const index = require("./index-4d52a3ee.cjs");
4
4
  require("@inploi/sdk");
5
5
  exports.chatbotPlugin = index.chatbotPlugin;
@@ -1,4 +1,4 @@
1
- import { H } from "./index-767d53bf.js";
1
+ import { H } from "./index-16ef9a7a.js";
2
2
  import "@inploi/sdk";
3
3
  export {
4
4
  H as chatbotPlugin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inploi/plugin-chatbot",
3
- "version": "3.13.0",
3
+ "version": "3.13.1",
4
4
  "type": "module",
5
5
  "main": "dist/plugin-chatbot.js",
6
6
  "types": "dist/index.d.ts",
@@ -67,7 +67,7 @@
67
67
  "vite-tsconfig-paths": "^4.2.1",
68
68
  "@inploi/core": "1.12.0",
69
69
  "@inploi/design-tokens": "0.2.1",
70
- "@inploi/sdk": "1.12.2",
70
+ "@inploi/sdk": "1.12.3",
71
71
  "eslint-config-custom": "0.1.0",
72
72
  "tsconfig": "0.1.0"
73
73
  },