@inploi/plugin-chatbot 3.22.0 → 3.22.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 +1 -1
- package/dist/{chatbot-body-e6a3f53d.cjs → chatbot-body-7dbeea50.cjs} +1 -2
- package/dist/{chatbot-body-ced5f714.js → chatbot-body-8e509812.js} +1 -2
- package/dist/{index-160169ee.js → index-794ce056.js} +1 -1
- package/dist/{index-9daf272b.cjs → index-e1616316.cjs} +1 -1
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +1 -1
- package/package.json +2 -2
package/cdn/index.js
CHANGED
|
@@ -42,4 +42,4 @@ var vm=Object.defineProperty;var mm=(Je,be,Ve)=>be in Je?vm(Je,be,{enumerable:!0
|
|
|
42
42
|
`,Ha="isdk",mh={not_in_local_storage:"Application not found in local storage",invalid_end_node:"Unexpected node type to finish flow",no_submissions:"Application ended without any fields submitted",invalid_state:"Invalid state"},bh=()=>({getOrCreateChatbotElement:()=>{const e=document.getElementById(Ha);if(e)return document.body.appendChild(e),e;const t=document.createElement("div");return document.body.appendChild(t),t.id=Ha,t}});var gh=["1","2","3","4","5","6","7","8","9","10","11","12"],yh={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]}},_h=(e,t=1,r)=>n=>{const[o,i]=yh[r][n];return"oklch("+o+"% "+i*t+" "+e+")"},Un=e=>{const t=_h(e.hue,e.chroma,e.mode);return Object.fromEntries(gh.map(r=>[e.prefix+r,e.transform(t(r))]))},Hn=e=>e,wh=e=>{const t=Object.keys(e).flatMap(r=>{const n=e[r];return typeof n=="object"&&n!==null?Object.keys(n).map(o=>{const i=n[o];return[`${String(r)}.${o}`,i]}):[[r,n]]});return Object.fromEntries(t)},Dr=e=>!!e&&typeof e=="object"&&!Array.isArray(e),qn=(e,...t)=>{if(!t.length)return e;const r=t.shift();if(Dr(e)&&Dr(r))for(const n in r){const o=r[n];if(Dr(o)){e[n]||Object.assign(e,{[n]:{}});const i=e[n];Dr(i)&&qn(i,o)}else Object.assign(e,{[n]:r[n]})}return qn(e,...t)},xh=e=>{function t(r,n){const o=[e.prefix,n.toString().replace(/\./g,"-")].join("");return r==="declaration"?`--${o}`:`var(--${o})`}return t},kh=()=>({core:e=>({semantic:t=>({component:r=>({from:n=>{const{theme:o,getToken:i}=n,a=h=>i("reference",h.toString()),s=e({theme:o}),l=t({theme:o,core:a,raw:{core:s}}),u=r({theme:o,core:a,semantic:a,raw:{core:s,semantic:l}}),f=wh(qn(s,l,u)),c=([h,g],m)=>{const v=[m,h].filter(Boolean).join(".");return typeof g=="object"?Object.entries(g).flatMap(_=>c(_,v)):[[n.getToken("declaration",v),g]]};return{values:f,declarations:Object.fromEntries(Object.entries(f).flatMap(h=>c(h))),ref:h=>i("reference",h.toString())}}})})})});const[Kn,Wn,qa]=["oklch(0% 0 0)","oklch(100% 0 0)","transparent"],$h=kh().core(({theme:e})=>({color:{black:Kn,white:Wn,lowest:e.mode==="light"?Wn:Kn,highest:e.mode==="light"?Kn:Wn,...Un({prefix:"a-",hue:e.hue,chroma:e.chroma,mode:e.mode,transform:Hn}),...Un({prefix:"n-",hue:e.hue,chroma:.05,mode:e.mode,transform:Hn}),...Un({prefix:"e-",hue:20,chroma:e.chroma,mode:e.mode,transform:Hn})},typography:{}})).semantic(({core:e,raw:t,theme:r})=>{const n=(o,i)=>t.core.color[o].replace(")",` / ${i})`);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:qa,"bg-hover":n("n-10",.4),"bg-active":n("n-10",.5)}}}).component(({raw:e,theme:t,semantic:r,core:n})=>{const o=(i,a)=>e.core.color[i].replace(")",` / ${a})`);return{app:{bg:n(t.mode==="dark"?"color.n-1":"color.n-2")},overlay:{bg:o("black",.4)},bubble:{"weak-bg":n(t.mode==="dark"?"color.n-3":"color.lowest"),"weak-outline":r("color.divider"),"strong-shadow":o("a-9",.05)},"status-bar":{bg:o("n-2",.8),"bg-button":qa,"bg-button-hover":o("n-10",.4),"bg-button-active":o("n-10",.5)},"submit-button":{"bg-active":n(t.mode==="dark"?"color.a-8":"color.a-11")}}}),Sh=xh({prefix:"i-"}),Ch=e=>{const t=$h.from({theme:e,getToken:Sh}),r=Object.entries(t.declarations).map(([n,o])=>`${n}: ${o};`);return`#isdk {
|
|
43
43
|
${r.concat(r).join(`
|
|
44
44
|
`)}
|
|
45
|
-
}`},Ka=({context:e,schema:t,logger:r})=>{if(t)for(const n in t){const o=t[n];if(!o)continue;const i=Dt(e,n,null);if(o.required&&i===null){const a=`Configuration error in context: ${n} is required`;throw r.error(a),new Error(a)}switch(o.type){case"number":if(typeof i!="number")throw new Error(`Configuration error in context: ${n} is not a number`);break;case"string":if(typeof i!="string")throw new Error(`Configuration error in context: ${n} is not a string`);break;default:o.type}}},Eh=({_internal_domManager:e=bh(),theme:t})=>Je(({apiClient:r,logger:n,analytics:o})=>{let i=!1;const a=()=>{if(typeof window>"u")return;const s=[D("style",{id:"inploi-chatbot-styles"},vh),D("style",{id:"inploi-chatbot-theme"},Ch(t))],l=e.getOrCreateChatbotElement();ht(D(W,{},[s,D(fh,{apiClient:r,logger:n,analytics:o})]),l),i=!0};return{prepare:async()=>{if(!(typeof window>"u"))try{if(i)return;a(),n.info("Chatbot plugin prepared")}catch(s){n.error("Error preparing chatbot plugin",s)}},fetchFlowByJobId:async(s,l)=>r.fetch(`/flow/job/${s}`).then(u=>{var c;const f=sr(hh,u);return{flow:f.flow,title:`Applying for “${f.job.title}”`,flowKeys:[f.job.id,...(l==null?void 0:l.flowKeys)??[]],...l,analytics:{customProperties:{job_id:f.job.id,flow_id:f.flow.id,flow_version:f.flow.version,...(c=l==null?void 0:l.analytics)==null?void 0:c.customProperties}}}}),fetchFlowById:async(s,l)=>r.fetch(`/flow/id/${s}`).then(u=>{var c;const f=sr(ph,u);return{flow:f.flow,title:"Chatbot",flowKeys:(l==null?void 0:l.flowKeys)??[],...l,analytics:{customProperties:{flow_id:f.flow.id,flow_version:f.flow.version,...(c=l==null?void 0:l.analytics)==null?void 0:c.customProperties}}}}),open:async s=>{if(!(typeof window>"u"))try{P.cancelCurrentFlow(),P.viewState$.value="maximised",i||a(),s instanceof Promise?(P.current$.value={state:"loading"},s.then(async l=>{Ka({context:l.context||{},schema:l.flow.context_schema,logger:n}),P.startFlow(l)}).catch(l=>{const u=l instanceof Error?l.message:"An error occurred";P.current$.value={state:"error",error:u}})):(Ka({context:s.context||{},schema:s.flow.context_schema,logger:n}),P.startFlow(s))}catch(l){n.error("Error starting flow",l)}},startApplication:void 0,closeApplication:void 0,close:async()=>{typeof window>"u"||(P.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=Eh;const Yt=(e,{context:t,submissions:r})=>{const[n,...o]=e.data.compareKey.split(".");if(!n)return!1;const i=Ga({context:t,key:n,path:o,submissions:r});if(!i)return!1;switch(i.type){case"address":{const a=Dt(i.value,o.join("."));switch(e.data.compare){case"equals":return a===e.data.compareValue;case"contains":return a?a.includes(e.data.compareValue):!1;case"notEquals":return a!==e.data.compareValue;case"notContains":return a?!a.includes(e.data.compareValue):!0}break}case"integration":{if(typeof i.value!="object"||Array.isArray(i.value))return!1;const a=Dt(i.value,o.join(".")),s={...e,data:{...e.data,compareKey:"_temp"}};switch(typeof a){case"boolean":return Yt(s,{submissions:{_temp:{value:a,type:"boolean"}},context:t});case"string":return Yt(s,{submissions:{_temp:{value:a,type:"string"}},context:t});case"number":return Yt(s,{submissions:{_temp:{value:a,type:"number"}},context:t});case"object":return Array.isArray(a)&&a.every(Ra)?Yt(s,{submissions:{_temp:{value:a,type:"enum"}},context:t}):!1}break}case"boolean":{const a=e.data.compareValue==="true";switch(e.data.compare){case"equals":return i.value===a;case"notEquals":return i.value!==a}break}case"string":switch(e.data.compare){case"equals":return i.value===e.data.compareValue;case"contains":return i.value?i.value.includes(e.data.compareValue):!1;case"notEquals":return i.value!==e.data.compareValue;case"notContains":return i.value?!i.value.includes(e.data.compareValue):!0}break;case"number":{try{const a=Number(e.data.compareValue);switch(e.data.compare){case"equals":return i.value===a;case"notEquals":return i.value!==a;case"greaterThan":return i.value>a;case"greaterThanOrEqualTo":return i.value>=a;case"lessThan":return i.value<a;case"lessThanOrEqualTo":return i.value<=a}}catch{return console.error(`Failed to parse number in if-block ${e.id}`,i.value),!1}break}case"enum":switch(e.data.compare){case"equals":return i.value.length===1&&i.value[0]===e.data.compareValue;case"notEquals":return i.value.length===1&&i.value[0]!==e.data.compareValue;case"contains":return i.value.includes(e.data.compareValue);case"notContains":return!i.value.includes(e.data.compareValue)}break}return!1},Oh=/{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g,Ze=(e,{context:t,submissions:r})=>e.replace(Oh,(n,o,i="")=>{const[a,...s]=o.trim().split("."),l=Ga({key:a,path:s,submissions:r,context:t});if(!l)return i;switch(l.type){case"boolean":return l.value===!0?"true":"false";case"file":return l.value.map(u=>`${u.name} (${qt(u.sizeKb)})`).join(", ");case"enum":return l.value.join(", ");case"address":return Object.values(l.value).filter(u=>u&&u.trim().length>0).join(", ");case"number":case"string":return l.value?l.value.toString():i;case"integration":{if(typeof l.value!="object"||Array.isArray(l.value))break;const u=Dt(l.value,s.join("."));switch(typeof u){case"boolean":return u===!0?"true":"false";case"string":return u;case"number":return u.toString();case"object":if(Array.isArray(u)&&u.every(Ra))return u.join(", ")}break}}return i}),Wa=({node:e,nodes:t,stopWhen:r})=>{if((r==null?void 0:r(e))===!0)return e;const n=e.nextId?t.find(o=>o.id===e.nextId):void 0;if(n)return Wa({node:n,nodes:t,stopWhen:r})},Ih=({childNode:e,nodes:t})=>{const n=t.filter(o=>o.type==="if-block").find(o=>{if(!o.branchId)return!1;const i=t.find(s=>s.id===o.branchId);if(!i)return!1;const a=Wa({node:i,nodes:t,stopWhen:s=>s.id===e.id});return!(!a||a.id!==e.id)});if(n!=null&&n.nextId)return t.find(o=>o.id===n.nextId)},Ah=({flow:e,analytics:t,logger:r,context:n,apiClient:o,getSubmissions:i,chatService:a,onFlowEnd:s,onInterpret:l})=>{let u=new AbortController;const f={...t.service,log:h=>t.service.log({...h,customProperties:{...h.customProperties,...t.customProperties}})},c=async(h,g)=>{const m=i();l==null||l(h,g);try{await Th({flow:e,analytics:f,logger:r,apiClient:o,context:n,node:h,submissions:m,chat:{sendMessage:async v=>a.send({groupId:h.id,message:v,signal:u.signal}),userInput:async v=>a.input({input:v,signal:u.signal}),addToSubmissions:a.addToSubmissions},next:v=>{const _=v?e.nodes.find(x=>x.id===v):Ih({childNode:h,nodes:e.nodes});return _?c(_,h):s==null?void 0:s(h)},end:()=>s==null?void 0:s(h)})}catch(v){if(v instanceof Kt)return;throw v}};return{interpret:async h=>{const g=e.nodes.find(m=>m.id===h)??Fa(e.nodes);return c(g)},undo:h=>{let g=1;const m=e.nodes.find(_=>_.id===h[h.length-1]);for(let _=h.length-2;_>0;_--){const x=h[_],w=e.nodes.find(O=>O.id===x);if(!w||(g++,w.type.startsWith("question-")))break}u.abort(),u=new AbortController;const v=e.nodes.find(_=>_.id===h[h.length-g]);return xe(v,"Undo failed: new start node not found"),c(v,m),{removed:g}},abort:()=>{u.abort()}}};async function Th(e){return await Ke(e).with({node:{type:"text"}},Mh).with({node:{type:"image"}},Fh).with({node:{type:"question-text"}},Lh).with({node:{type:"question-enum"}},Vh).with({node:{type:"question-number"}},Rh).with({node:{type:"question-boolean"}},jh).with({node:{type:"question-file"}},zh).with({node:{type:"question-address"}},Bh).with({node:{type:"end-flow"}},Uh).with({node:{type:"if-block"}},Nh).with({node:{type:"jump"}},({node:t,next:r})=>r(t.data.targetId)).with({node:{type:"link"}},Dh).with({node:{type:"integration-application-submit"}},Ph).with({node:{type:"integration-workflow-get"}},()=>Error("Unreachable")).exhaustive()}async function Ph({chat:e,next:t,node:r,logger:n,apiClient:o,submissions:i,context:a,analytics:s,flow:l}){const u=async f=>{f!==!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:c,session_id:h}=s.getSessionInfo(),g=await o.fetch("/flow/submit",{method:"POST",body:JSON.stringify({...a,integration_id:r.data.integrationId,anonymous_id:c,session_id:h,submissions:eh(i||{})})}).catch(m=>m);r.data.key&&e.addToSubmissions(r.data.key,{type:"integration",value:g}),await Ke(g).with({ats_data:{redirect_url:Oe.string}},async m=>{await e.sendMessage({type:"text",author:"bot",text:"Almost there! Please complete your submission here:"});const v=new URL(m.ats_data.redirect_url);c&&!v.searchParams.has("anonymous_id")&&v.searchParams.set("anonymous_id",c),await e.sendMessage({type:"link",href:v.toString(),text:"Complete submission",onClick:()=>{if(alert("kek"),!h)return n.error("session_id not set, cannot log FLOW_REDIRECT event");s.log({event:"FLOW_REDIRECT",properties:{flow_build:l.build,flow_id:l.id,flow_session_id:h,flow_version:l.version,href:v.toString()}})}}),t(r.nextId)}).with({success:!0},async()=>{await e.sendMessage({type:"system",variant:"success",text:"Submission completed!"}),t(r.nextId)}).with({sucess:!1,ats_data:{message:Oe.string}},async m=>{n.error(m.ats_data),await e.sendMessage({type:"system",variant:"error",text:m.ats_data.message}),await u(!1)}).otherwise(async m=>{n.error(m),await e.sendMessage({type:"system",variant:"error",text:"Failed to submit"}),await u(!1)})};await u(r.data.skipConfirmation)}async function Dh({chat:e,next:t,node:r,submissions:n,context:o,analytics:i,flow:a,logger:s}){const{session_id:l}=i.getSessionInfo();await e.sendMessage({type:"link",href:Ze(r.data.href,{submissions:n,context:o}),text:Ze(r.data.cta,{submissions:n,context:o}),onClick:()=>{if(!l)return s.error("session_id not set, cannot log FLOW_REDIRECT event");i.log({event:"FLOW_REDIRECT",properties:{flow_build:a.build,flow_id:a.id,flow_session_id:l,flow_version:a.version,href:r.data.href}})}}),t(r.nextId)}async function Nh({submissions:e,next:t,node:r,context:n}){t(Yt(r,{submissions:e,context:n})?r.branchId:r.nextId)}async function Mh({chat:e,next:t,node:r,submissions:n,context:o}){await e.sendMessage({author:"bot",type:"text",text:Ze(r.data.text,{submissions:n,context:o})}),t(r.nextId)}async function Fh({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 Lh({chat:e,next:t,node:r,submissions:n,context:o}){await e.sendMessage({author:"bot",type:"text",text:Ze(r.data.question,{submissions:n,context:o})});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===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 Rh({chat:e,next:t,node:r,submissions:n,context:o}){await e.sendMessage({author:"bot",type:"text",text:Ze(r.data.question,{submissions:n,context:o})});const i=await e.userInput({key:r.data.key,type:"number",config:{max:r.data.max,min:r.data.min,optional:r.data.optional,placeholder:r.data.placeholder,decimalCases:r.data.decimalCases}});i===null?await e.sendMessage({type:"system",variant:"info",text:"Skipped"}):await e.sendMessage({author:"user",type:"text",text:i.value.toString()}),t(r.nextId)}async function Vh({chat:e,next:t,node:r,submissions:n,context:o}){await e.sendMessage({author:"bot",type:"text",text:Ze(r.data.question,{submissions:n,context:o})});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(a=>i.value.includes(a.value)).map(a=>a.label).join(", ")}),t(r.nextId)}async function jh({chat:e,next:t,node:r,submissions:n,context:o}){await e.sendMessage({author:"bot",type:"text",text:Ze(r.data.question,{submissions:n,context:o})});const i=await e.userInput({key:r.data.key,type:"boolean",config:{optional:r.data.optional,labels:{true:r.data.trueLabel,false:r.data.falseLabel}}});i===null?await e.sendMessage({type:"system",variant:"info",text:"Skipped"}):await e.sendMessage({author:"user",type:"text",text:i.value===!0?r.data.trueLabel:r.data.falseLabel}),t(r.nextId)}async function Bh({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===null)await e.sendMessage({type:"system",variant:"info",text:"Skipped"});else{const o=Object.values(n.value).filter(i=>i&&i.trim().length>0).join(", ");await e.sendMessage({author:"user",type:"text",text:o})}return t(r.nextId)}async function zh({node:e,chat:t,next:r,submissions:n,context:o}){await t.sendMessage({author:"bot",type:"text",text:Ze(e.data.question,{submissions:n,context:o})});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===null)await t.sendMessage({type:"system",variant:"info",text:"Skipped"});else for(const a of i.value)await t.sendMessage({author:"user",type:"file",fileName:a.name,fileSizeKb:a.sizeKb});r(e.nextId)}async function Uh({chat:e,end:t,node:r}){await e.sendMessage({type:"system",variant:"info",text:r.data.systemMessage}),t()}const Ga=({key:e,path:t,submissions:r,context:n})=>{if(e==="$context"){if(!t)return;const o=Dt(n,t.join("."));switch(typeof o){case"string":return{type:"string",value:o};case"number":return{type:"number",value:o};case"boolean":return{type:"boolean",value:o};default:console.warn(`Unexpected type for $context.${t.join(".")}`,o);return}}return r==null?void 0:r[e]};function Gn(e,t,r){var n,o,i,a,s;t==null&&(t=100);function l(){var f=Date.now()-a;f<t&&f>=0?n=setTimeout(l,t-f):(n=null,r||(s=e.apply(i,o),i=o=null))}var u=function(){i=this,o=arguments,a=Date.now();var f=r&&!n;return n||(n=setTimeout(l,t)),f&&(s=e.apply(i,o),i=o=null),s};return u.clear=function(){n&&(clearTimeout(n),n=null)},u.flush=function(){n&&(s=e.apply(i,o),i=o=null,clearTimeout(n),n=null)},u}Gn.debounce=Gn;var Hh=Gn;const Ya=Ve(Hh);function qh(e){let{debounce:t,scroll:r,polyfill:n,offsetSize:o}=e===void 0?{debounce:0,scroll:!1,offsetSize:!1}:e;const i=n||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[a,s]=G({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:a}),u=t?typeof t=="number"?t:t.scroll:null,f=t?typeof t=="number"?t:t.resize:null,c=L(!1);V(()=>(c.current=!0,()=>void(c.current=!1)));const[h,g,m]=ce(()=>{const w=()=>{if(!l.current.element)return;const{left:O,top:A,width:I,height:U,bottom:q,right:N,x:M,y:ae}=l.current.element.getBoundingClientRect(),te={left:O,top:A,width:I,height:U,bottom:q,right:N,x:M,y:ae};l.current.element instanceof HTMLElement&&o&&(te.height=l.current.element.offsetHeight,te.width=l.current.element.offsetWidth),Object.freeze(te),c.current&&!Yh(l.current.lastBounds,te)&&s(l.current.lastBounds=te)};return[w,f?Ya(w,f):w,u?Ya(w,u):w]},[s,o,u,f]);function v(){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 i(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 x=w=>{!w||w===l.current.element||(v(),l.current.element=w,l.current.scrollContainers=Za(w),_())};return Wh(m,!!r),Kh(g),V(()=>{v(),_()},[r,m,g]),V(()=>v,[]),[x,a,h]}function Kh(e){V(()=>{const t=e;return window.addEventListener("resize",t),()=>void window.removeEventListener("resize",t)},[e])}function Wh(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 Za(e){const t=[];if(!e||e===document.body)return t;const{overflow:r,overflowX:n,overflowY:o}=window.getComputedStyle(e);return[r,n,o].some(i=>i==="auto"||i==="scroll")&&t.push(e),[...t,...Za(e.parentElement)]}const Gh=["x","y","top","bottom","left","right","width","height"],Yh=(e,t)=>Gh.every(r=>e[r]===t[r]),Ct=({class:e,...t})=>d("button",{class:it("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"})]})}),Zh=25,Yn=We({instant:()=>{},smooth:()=>{}}),Z={onSubmitSuccessFn$:We(()=>{}),isBotTyping$:We(!1),scrollToEnd:{instant:()=>Yn.value.instant(),smooth:()=>Yn.value.smooth()}},Xh=()=>{const e=L(null);he(()=>{Yn.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*2&&e.current.scrollTo({top:e.current.scrollHeight,behavior:"smooth"})}}},[e]);const t=ce(()=>({addToSubmissions:(n,o)=>P.setSubmission(n,o),send:async({message:n,signal:o,groupId:i})=>{if(await Ke(n).with({author:"bot",type:"text"},async a=>{if(o!=null&&o.aborted)throw new Kt;Z.isBotTyping$.value=!0;const s=Math.min(Math.max(20,a.text.length),100)*Zh;await new Promise(l=>setTimeout(l,s,{signal:o})),Z.isBotTyping$.value=!1}).otherwise(async()=>{}),o!=null&&o.aborted)throw new Kt;P.addMessage(n,i)},input:({input:n,signal:o})=>{if(o!=null&&o.aborted)throw new Kt;return P.setInput(n),new Promise(i=>{const a=s=>{if(o!=null&&o.aborted)throw new Kt;P.setInput(void 0),n.key&&P.setSubmission(n.key,s),i(s)};Z.onSubmitSuccessFn$.value=a})}}),[]);return{chatRef:e,chatService:t}},Et=({class:e,...t})=>d("button",{type:"button",class:it("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"]}),Xa=["Afghanistan","Albania","Algeria","American Samoa","Andorra","Angola","Anguilla","Antarctica","Antigua and Barbuda","Argentina","Armenia","Aruba","Australia","Austria","Azerbaijan","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bermuda","Bhutan","Bolivia","Bosnia and Herzegovina","Botswana","Bouvet Island","Brazil","British Indian Ocean Territory","British Virgin Islands","Brunei","Bulgaria","Burkina Faso","Burundi","Cabo Verde","Cambodia","Cameroon","Canada","Caribbean Netherlands","Cayman Islands","Central African Republic","Chad","Chile","China","Christmas Island","Cocos (Keeling) Islands","Colombia","Comoros","Cook Islands","Costa Rica","Croatia","Cuba","Curaçao","Cyprus","Czechia","Côte d'Ivoire","Democratic Republic of the Congo","Denmark","Djibouti","Dominican Republic","Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia","Eswatini","Ethiopia","Falkland Islands (Islas Malvinas)","Faroe Islands","Fiji","Finland","France","French Guiana","French Polynesia","French Southern and Antarctic Lands","Gabon","Georgia","Germany","Ghana","Gibraltar","Greece","Greenland","Grenada","Guadeloupe","Guam","Guatemala","Guernsey","Guinea","Guinea-Bissau","Guyana","Haiti","Heard Island and McDonald Islands","Honduras","Hong Kong","Hungary","Iceland","India","Indonesia","Iran","Iraq","Ireland","Isle of Man","Israel","Italy","Jamaica","Japan","Jersey","Jordan","Kazakhstan","Kenya","Kiribati","Kosovo","Kuwait","Kyrgyzstan","Laos","Latvia","Lebanon","Lesotho","Liberia","Libya","Liechtenstein","Lithuania","Luxembourg","Macao","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Marshall Islands","Martinique","Mauritania","Mauritius","Mayotte","Mexico","Micronesia","Moldova","Monaco","Mongolia","Montenegro","Montserrat","Morocco","Mozambique","Myanmar (Burma)","Namibia","Nauru","Nepal","Netherlands","New Caledonia","New Zealand","Nicaragua","Niger","Nigeria","Niue","Norfolk Island","North Korea","North Macedonia","Northern Mariana Islands","Norway","Oman","Pakistan","Palau","Palestine","Panama","Papua New Guinea","Paraguay","Peru","Philippines","Pitcairn Islands","Poland","Portugal","Puerto Rico","Qatar","Romania","Russia","Rwanda","Réunion","Saint Barthélemy","Saint Helena, Ascension and Tristan da Cunha","Saint Kitts and Nevis","Saint Lucia","Saint Martin","Saint Pierre and Miquelon","Saint Vincent and the Grenadines","Samoa","San Marino","Saudi Arabia","Senegal","Serbia","Seychelles","Sierra Leone","Singapore","Sint Maarten","Slovakia","Slovenia","Solomon Islands","Somalia","South Africa","South Georgia and the South Sandwich Islands","South Korea","South Sudan","Spain","Sri Lanka","Sudan","Suriname","Svalbard and Jan Mayen","Sweden","Switzerland","Syria","São Tomé and Príncipe","Taiwan","Tajikistan","Tanzania","Thailand","The Bahamas","The Gambia","Timor-Leste","Togo","Tokelau","Tonga","Trinidad and Tobago","Tunisia","Turkmenistan","Turks and Caicos Islands","Tuvalu","Türkiye","U.S. Virgin Islands","Uganda","Ukraine","United Arab Emirates","United Kingdom","United States","United States Minor Outlying Islands","Uruguay","Uzbekistan","Vanuatu","Vatican City","Venezuela","Vietnam","Wallis and Futuna","Western Sahara","Yemen","Zambia","Zimbabwe","Åland Islands"],Qa={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"]},Nr=Object.keys(Qa),Qh=e=>Nr.reduce((t,r)=>{const n=Qa[r],o=e.filter(i=>i.types.some(a=>n.includes(a))).map(i=>i.long_name).join(", ");return o&&(t[r]=o),t},{}),Jh=document.createElement("div"),ev=()=>ce(()=>{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(Jh);return{enabled:!0,getPredictions:async n=>{const{predictions:o}=await t.getPlacePredictions({input:n,language:"en"});return o.map(i=>({label:i.description,value:i.place_id}))},getPlaceDetails:async n=>await new Promise((i,a)=>r.getDetails({placeId:n,fields:["address_components"],language:"en"},(s,l)=>l!==e.maps.places.PlacesServiceStatus.OK?a(l):s===null?a("ZERO_RESULTS"):i({ok:!0,place:s}))).catch(async i=>(console.error("Failed to get address details",i),{ok:!1}))}},[]),Zn=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"})]}),Xn={label:"Fill in manually",value:""},tv=({input:e,onSubmitSuccess:t})=>{const[r,n]=G(""),[o,i]=G(),[a,s]=G([]),[l,u]=G(),{enabled:f,getPredictions:c,getPlaceDetails:h}=ev(),[g,m]=G(f?"query":"manual"),v=ce(()=>La(_=>{xe(f,"Query state should not be enabled if Google Places isn't available"),n(_),_===""&&s([]),!(_.length<3)&&c(_).then(x=>{s(x)})},500),[f,c]);switch(V(()=>{if(f&&!(l===void 0||l===""))return h(l).then(_=>{if(!_.ok||!_.place.address_components){i({});return}const x=Qh(_.place.address_components);i(x),m("details")}),()=>{i(void 0)}},[l,h,f]),g){case"query":return xe(f,"Query state should not be enabled if Google Places isn't available"),d(rv,{input:e,onSkip:()=>t(null),onAddressSelect:_=>{u(_),m("loading")},onInputChange:v,suggestions:a,query:r});case"loading":return d(Qn,{input:e,onSubmitSuccess:t,addressFields:{},actions:d(Zn,{onClick:()=>{u(void 0),m("query")}})});case"details":return xe(o!==void 0),d(Qn,{input:e,onSubmitSuccess:t,addressFields:o,actions:d(Zn,{onClick:()=>{u(void 0),m("query")}})});case"manual":return d(Qn,{input:e,onSubmitSuccess:t,addressFields:{},actions:f?d(Zn,{onClick:()=>{u(void 0),m("query")}}):void 0})}},rv=({input:e,onSkip:t,suggestions:r,onAddressSelect:n,query:o,onInputChange:i})=>{const a=L(null);return he(()=>{a.current&&(a.current.focus(),a.current.select())},[]),d(W,{children:[d("form",{noValidate:!0,onSubmit:s=>{s.preventDefault()},class:"flex flex-col justify-end gap-1 p-2.5",children:[d("input",{onChange:s=>{i(s.currentTarget.value)},ref:a,name:"address",id:"chat-address",autocomplete:"address-line1 country-name postal-code",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:o}),e.config.optional&&d(Et,{class:"absolute right-3",onClick:t})]}),d("ul",{children:[r.map(s=>d("li",{children:d("button",{class:"text-neutral-11 fr hover:bg-neutral-3 focus-visible:bg-neutral-3 hover:text-neutral-12 border-b-neutral-3 flex w-full items-center border border-b border-solid border-transparent px-4 py-3 text-sm transition-colors duration-100",onClick:()=>{n(s.value)},children:[d("span",{class:"flex-grow",children:s.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"})})]})},s.label)),d("li",{children:d("button",{class:"text-neutral-11 fr hover:bg-neutral-3 focus-visible:bg-neutral-3 hover:text-neutral-12 border-b-neutral-3 flex w-full items-center border border-b border-solid border-transparent px-4 py-3 text-sm transition-colors duration-100",onClick:()=>{n(Xn.value)},children:d("span",{class:"flex-grow",children:Xn.label})})},Xn.label)]})]})},nv={line1:"Line 1",line2:"Line 2",line3:"Line 3",city:"City",state:"State",postcode:"Postcode",country:"Country"},Qn=({addressFields:e,onSubmitSuccess:t,actions:r,input:n})=>{const o=L(null);return he(()=>{if(o.current){const i=o.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 a=new FormData(i.currentTarget),s=Object.fromEntries(a.entries());t({type:"address",value: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:o,children:Nr.map((i,a)=>{const s=`isdk_${i}`,l=n.config.keys[i];return l?d(W,{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:nv[i]}),d("div",{class:"flex flex-col items-stretch gap-1.5",children:[i==="country"?d("div",{class:"relative",children:[d("select",{class:"text-neutral-12 hover:bg-neutral-4 placeholder:text-neutral-8 focus:bg-neutral-5 w-full flex-1 appearance-none rounded-lg border-solid bg-transparent bg-none px-3 py-1.5 text-base transition-colors focus:outline-none",name:l,id:s,defaultValue:e[i],required:!0,children:[e.country&&!Xa.includes(e.country)?d("option",{value:e[i],children:e[i]}):d("option",{value:"",children:"Select a country"}),Xa.map(u=>d("option",{value:u,children:u},u))]}),d("svg",{class:"text-neutral-12 absolute bottom-2.5 right-2 flex items-center justify-center",width:"16",height:"16",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:d("path",{d:"M4 6.5L8 10.5L12 6.5"})})]}):d("input",{autoFocus:a===0?!0:void 0,class:"text-neutral-12 hover:bg-neutral-4 placeholder:text-neutral-8 focus:bg-neutral-5 flex-1 rounded-lg border-solid bg-transparent px-3 py-1.5 text-base transition-colors autofill:shadow-[inset_0_0_0_1000px_hsl(210_16.7%_97.6%)] focus:outline-none",name:l,id:s,defaultValue:e[i],required:!0}),a!==Nr.length-1&&d("hr",{class:"border-b-neutral-5 m-0 w-full border-b border-solid"}),a===Nr.length-1&&d("hr",{class:"m-0 w-full border-b border-b-transparent"})]})]}):null})}),d("div",{class:"flex w-full flex-1 ",children:[d("div",{class:"flex-grow",children:r}),d(Ct,{class:"flex items-center justify-center"})]})]})},Jn=()=>{const e=L(null);return V(()=>{var t;(t=e.current)==null||t.focus()},[]),e},Ja=["true","false"],iv=Cd(Ja),ov="answer",es="flex items-center gap-2 p-2.5",ts=re(({label:e,...t},r)=>d("button",{class:"bg-lowest ease-expo-out ring-divider text-neutral-12 active:ring-accent-7 active:bg-accent-2 active:text-accent-11 fr block w-full overflow-hidden rounded-2xl px-2.5 py-2.5 ring-2 transition-all selection:bg-transparent",...t,ref:r,children:d("p",{class:"truncate text-center text-base",children:e})})),av=({input:e,onSubmitSuccess:t})=>{const r=Jn();return d("form",{noValidate:!0,class:"",onSubmit:n=>{n.preventDefault();const o=rh(n).value,i=sr(iv,o);t({type:"boolean",value:i==="true"})},children:[d("ul",{class:es,children:Ja.map((n,o)=>d("li",{class:"flex-1",children:d(ts,{ref:o===0?r:null,type:"submit",name:ov,value:n,label:e.config.labels[n]},n)}))}),e.config.optional&&d("div",{class:"px-2 pb-2",children:d(Et,{class:"w-full",type:"button",onClick:()=>t(null)})})]})},Mr=({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,sv=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}),lv=e=>e.reduce((t,r)=>t+r.sizeKb,0),cv=Ar("file"),rs=3,uv=({file:e,class:t,...r})=>{const n=e.name.split(".").pop(),o=e.name.replace(new RegExp(`.${n}$`),"");return d("div",{class:it("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:o}),d("span",{children:[".",n]})]}),d("p",{"aria-label":"File size",class:"text-accent-11",children:qt(e.sizeKb)})]})},ns=({class:e,...t})=>d("li",{class:it("outline-neutral-6 text-neutral-11 bg-neutral-1 block rounded-md px-1 py-0.5 text-xs outline outline-1",e),...t}),is=e=>{const t=e.split(".").pop();if(!t)throw new Error("No file extension found");return t?"."+t:""},dv=({allowedExtensions:e,files:t})=>{const r=e.map(n=>n.toLowerCase());return t.every(n=>r.includes(is(n.name).toLowerCase()))},fv=(e,t)=>{const r=is(e);return`${e.replace(new RegExp(`${r}$`),"").slice(0,t)}${r}`},pv=({input:e,onSubmitSuccess:t})=>{var f;const r=(f=P.current$.value.flow)==null?void 0:f.data.submissions[e.key],[n,o]=G(cv(r)?r.value:[]),[i,a]=G(),s=n.length-rs,l=lv(n),u=Jn();return d("form",{class:"flex flex-col gap-1 p-2.5",onSubmit:c=>(c.preventDefault(),a(void 0),n.length===0?a({type:"required",message:"Please select a file"}):e.config.extensions.length>0&&!dv({allowedExtensions:e.config.extensions,files:n})?a({type:"validate",message:`Please upload ${e.config.extensions.join(", ")} files only`}):e.config.fileSizeLimitKib&&l>e.config.fileSizeLimitKib?a({type:"max",message:`File size exceeds limit of ${qt(e.config.fileSizeLimitKib)}`}):e.config.allowMultiple===!1&&n.length>1?a({type:"invalid",message:"Only one file is allowed"}):t({type:"file",value: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(W,{children:[d("ul",{class:"flex max-w-full flex-wrap justify-center gap-1 overflow-hidden p-1",children:[n.slice(0,rs).map(c=>{const h=c.name.split(".").pop(),g=c.name.replace(new RegExp(`.${h}$`),"");return d(ns,{class:"flex overflow-hidden",children:[d("span",{class:"block truncate",children:g}),d("span",{children:[".",h]})]})}),s>0?d(ns,{children:["+",s," file",s!==1?"s":""]}):null]}),d("p",{class:"text-neutral-11 text-xs",children:[qt(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 ",qt(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=>{xe(c.target instanceof HTMLInputElement);const h=c.target.files?Array.from(c.target.files):[],g=await Promise.allSettled(h.map(async v=>{const _=await sv(v);return{name:fv(v.name,42),data:_,sizeKb:v.size/1e3}}));if(g.some(({status:v})=>v==="rejected"))return a({type:"invalid",message:"Invalid file"});const m=g.map(v=>v.status==="fulfilled"?v.value:null).filter(Boolean);o(m)},multiple:e.config.allowMultiple,type:"file",class:"sr-only"})]}),d("div",{class:"flex h-full flex-col items-center gap-2",children:[d(Ct,{disabled:n.length===0}),e.config.optional&&d(Et,{onClick:()=>t(null)})]})]}),d(Mr,{error:i})]})};var Zt=e=>e.type==="checkbox",Ot=e=>e instanceof Date,ue=e=>e==null;const os=e=>typeof e=="object";var ee=e=>!ue(e)&&!Array.isArray(e)&&os(e)&&!Ot(e),hv=e=>ee(e)&&e.target?Zt(e.target)?e.target.checked:e.target.value:e,vv=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,mv=(e,t)=>e.has(vv(t)),bv=e=>{const t=e.constructor&&e.constructor.prototype;return ee(t)&&t.hasOwnProperty("isPrototypeOf")},ei=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Le(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(!(ei&&(e instanceof Blob||e instanceof FileList))&&(r||ee(e)))if(t=r?[]:{},!r&&!bv(e))t=e;else for(const n in e)e.hasOwnProperty(n)&&(t[n]=Le(e[n]));else return e;return t}var Xt=e=>Array.isArray(e)?e.filter(Boolean):[],X=e=>e===void 0,C=(e,t,r)=>{if(!t||!ee(e))return r;const n=Xt(t.split(/[,[\].]+?/)).reduce((o,i)=>ue(o)?o:o[i],e);return X(n)||n===e?X(e[t])?r:e[t]:n},Xe=e=>typeof e=="boolean";const as={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},ke={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Re={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};we.createContext(null);var gv=(e,t,r,n=!0)=>{const o={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(o,i,{get:()=>{const a=i;return t._proxyFormState[a]!==ke.all&&(t._proxyFormState[a]=!n||ke.all),r&&(r[a]=!0),e[a]}});return o},ye=e=>ee(e)&&!Object.keys(e).length,yv=(e,t,r,n)=>{r(e);const{name:o,...i}=e;return ye(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(a=>t[a]===(!n||ke.all))},ti=e=>Array.isArray(e)?e:[e];function _v(e){const t=we.useRef(e);t.current=e,we.useEffect(()=>{const r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}},[e.disabled])}var Ie=e=>typeof e=="string",wv=(e,t,r,n,o)=>Ie(e)?(n&&t.watch.add(e),C(r,e,o)):Array.isArray(e)?e.map(i=>(n&&t.watch.add(i),C(r,i))):(n&&(t.watchAll=!0),r),ri=e=>/^\w*$/.test(e),ss=e=>Xt(e.replace(/["|']|\]/g,"").split(/\.|\[/));function z(e,t,r){let n=-1;const o=ri(t)?[t]:ss(t),i=o.length,a=i-1;for(;++n<i;){const s=o[n];let l=r;if(n!==a){const u=e[s];l=ee(u)||Array.isArray(u)?u:isNaN(+o[n+1])?{}:[]}e[s]=l,e=e[s]}return e}var ls=(e,t,r,n,o)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:o||!0}}:{},cs=e=>({isOnSubmit:!e||e===ke.onSubmit,isOnBlur:e===ke.onBlur,isOnChange:e===ke.onChange,isOnAll:e===ke.all,isOnTouch:e===ke.onTouched}),us=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Fr=(e,t,r,n)=>{for(const o of r||Object.keys(e)){const i=C(e,o);if(i){const{_f:a,...s}=i;if(a){if(a.refs&&a.refs[0]&&t(a.refs[0],o)&&!n)break;if(a.ref&&t(a.ref,a.name)&&!n)break}else ee(s)&&Fr(s,t)}}};var xv=(e,t,r)=>{const n=Xt(C(e,r));return z(n,"root",t[r]),z(e,r,n),e},ni=e=>e.type==="file",Qe=e=>typeof e=="function",Lr=e=>{if(!ei)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Rr=e=>Ie(e),ii=e=>e.type==="radio",Vr=e=>e instanceof RegExp;const ds={value:!1,isValid:!1},fs={value:!0,isValid:!0};var ps=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&&!X(e[0].attributes.value)?X(e[0].value)||e[0].value===""?fs:{value:e[0].value,isValid:!0}:fs:ds}return ds};const hs={isValid:!1,value:null};var vs=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,hs):hs;function ms(e,t,r="validate"){if(Rr(e)||Array.isArray(e)&&e.every(Rr)||Xe(e)&&!e)return{type:r,message:Rr(e)?e:"",ref:t}}var It=e=>ee(e)&&!Vr(e)?e:{value:e,message:""},bs=async(e,t,r,n,o)=>{const{ref:i,refs:a,required:s,maxLength:l,minLength:u,min:f,max:c,pattern:h,validate:g,name:m,valueAsNumber:v,mount:_,disabled:x}=e._f,w=C(t,m);if(!_||x)return{};const O=a?a[0]:i,A=j=>{n&&O.reportValidity&&(O.setCustomValidity(Xe(j)?"":j||""),O.reportValidity())},I={},U=ii(i),q=Zt(i),N=U||q,M=(v||ni(i))&&X(i.value)&&X(w)||Lr(i)&&i.value===""||w===""||Array.isArray(w)&&!w.length,ae=ls.bind(null,m,r,I),te=(j,F,Q,pe=Re.maxLength,_e=Re.minLength)=>{const Ae=j?F:Q;I[m]={type:j?pe:_e,message:Ae,ref:i,...ae(j?pe:_e,Ae)}};if(o?!Array.isArray(w)||!w.length:s&&(!N&&(M||ue(w))||Xe(w)&&!w||q&&!ps(a).isValid||U&&!vs(a).isValid)){const{value:j,message:F}=Rr(s)?{value:!!s,message:s}:It(s);if(j&&(I[m]={type:Re.required,message:F,ref:O,...ae(Re.required,F)},!r))return A(F),I}if(!M&&(!ue(f)||!ue(c))){let j,F;const Q=It(c),pe=It(f);if(!ue(w)&&!isNaN(w)){const _e=i.valueAsNumber||w&&+w;ue(Q.value)||(j=_e>Q.value),ue(pe.value)||(F=_e<pe.value)}else{const _e=i.valueAsDate||new Date(w),Ae=Ur=>new Date(new Date().toDateString()+" "+Ur),ct=i.type=="time",Jt=i.type=="week";Ie(Q.value)&&w&&(j=ct?Ae(w)>Ae(Q.value):Jt?w>Q.value:_e>new Date(Q.value)),Ie(pe.value)&&w&&(F=ct?Ae(w)<Ae(pe.value):Jt?w<pe.value:_e<new Date(pe.value))}if((j||F)&&(te(!!j,Q.message,pe.message,Re.max,Re.min),!r))return A(I[m].message),I}if((l||u)&&!M&&(Ie(w)||o&&Array.isArray(w))){const j=It(l),F=It(u),Q=!ue(j.value)&&w.length>+j.value,pe=!ue(F.value)&&w.length<+F.value;if((Q||pe)&&(te(Q,j.message,F.message),!r))return A(I[m].message),I}if(h&&!M&&Ie(w)){const{value:j,message:F}=It(h);if(Vr(j)&&!w.match(j)&&(I[m]={type:Re.pattern,message:F,ref:i,...ae(Re.pattern,F)},!r))return A(F),I}if(g){if(Qe(g)){const j=await g(w,t),F=ms(j,O);if(F&&(I[m]={...F,...ae(Re.validate,F.message)},!r))return A(F.message),I}else if(ee(g)){let j={};for(const F in g){if(!ye(j)&&!r)break;const Q=ms(await g[F](w,t),O,F);Q&&(j={...Q,...ae(F,Q.message)},A(Q.message),r&&(I[m]=j))}if(!ye(j)&&(I[m]={ref:O,...j},!r))return I}}return A(!0),I};function kv(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=X(e)?n++:e[t[n++]];return e}function $v(e){for(const t in e)if(e.hasOwnProperty(t)&&!X(e[t]))return!1;return!0}function oe(e,t){const r=Array.isArray(t)?t:ri(t)?[t]:ss(t),n=r.length===1?e:kv(e,r),o=r.length-1,i=r[o];return n&&delete n[i],o!==0&&(ee(n)&&ye(n)||Array.isArray(n)&&$v(n))&&oe(e,r.slice(0,-1)),e}function oi(){let e=[];return{get observers(){return e},next:o=>{for(const i of e)i.next&&i.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(i=>i!==o)}}),unsubscribe:()=>{e=[]}}}var jr=e=>ue(e)||!os(e);function lt(e,t){if(jr(e)||jr(t))return e===t;if(Ot(e)&&Ot(t))return e.getTime()===t.getTime();const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const o of r){const i=e[o];if(!n.includes(o))return!1;if(o!=="ref"){const a=t[o];if(Ot(i)&&Ot(a)||ee(i)&&ee(a)||Array.isArray(i)&&Array.isArray(a)?!lt(i,a):i!==a)return!1}}return!0}var gs=e=>e.type==="select-multiple",Sv=e=>ii(e)||Zt(e),ai=e=>Lr(e)&&e.isConnected,ys=e=>{for(const t in e)if(Qe(e[t]))return!0;return!1};function Br(e,t={}){const r=Array.isArray(e);if(ee(e)||r)for(const n in e)Array.isArray(e[n])||ee(e[n])&&!ys(e[n])?(t[n]=Array.isArray(e[n])?[]:{},Br(e[n],t[n])):ue(e[n])||(t[n]=!0);return t}function _s(e,t,r){const n=Array.isArray(e);if(ee(e)||n)for(const o in e)Array.isArray(e[o])||ee(e[o])&&!ys(e[o])?X(t)||jr(r[o])?r[o]=Array.isArray(e[o])?Br(e[o],[]):{...Br(e[o])}:_s(e[o],ue(t)?{}:t[o],r[o]):r[o]=!lt(e[o],t[o]);return r}var si=(e,t)=>_s(e,t,Br(t)),ws=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>X(e)?e:t?e===""?NaN:e&&+e:r&&Ie(e)?new Date(e):n?n(e):e;function li(e){const t=e.ref;if(!(e.refs?e.refs.every(r=>r.disabled):t.disabled))return ni(t)?t.files:ii(t)?vs(e.refs).value:gs(t)?[...t.selectedOptions].map(({value:r})=>r):Zt(t)?ps(e.refs).value:ws(X(t.value)?e.ref.value:t.value,e)}var Cv=(e,t,r,n)=>{const o={};for(const i of e){const a=C(t,i);a&&z(o,i,a._f)}return{criteriaMode:r,names:[...e],fields:o,shouldUseNativeValidation:n}},Qt=e=>X(e)?e:Vr(e)?e.source:ee(e)?Vr(e.value)?e.value.source:e.value:e,Ev=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function xs(e,t,r){const n=C(e,r);if(n||ri(r))return{error:n,name:r};const o=r.split(".");for(;o.length;){const i=o.join("."),a=C(t,i),s=C(e,i);if(a&&!Array.isArray(a)&&r!==i)return{name:r};if(s&&s.type)return{name:i,error:s};o.pop()}return{name:r}}var Ov=(e,t,r,n,o)=>o.isOnAll?!1:!r&&o.isOnTouch?!(t||e):(r?n.isOnBlur:o.isOnBlur)?!e:(r?n.isOnChange:o.isOnChange)?e:!0,Iv=(e,t)=>!Xt(C(e,t)).length&&oe(e,t);const Av={mode:ke.onSubmit,reValidateMode:ke.onChange,shouldFocusError:!0};function Tv(e={},t){let r={...Av,...e},n={submitCount:0,isDirty:!1,isLoading:Qe(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{},disabled:!1},o={},i=ee(r.defaultValues)||ee(r.values)?Le(r.defaultValues||r.values)||{}:{},a=r.shouldUnregister?{}:Le(i),s={action:!1,mount:!1,watch:!1},l={mount:new Set,unMount:new Set,array:new Set,watch:new Set},u,f=0;const c={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},h={values:oi(),array:oi(),state:oi()},g=e.resetOptions&&e.resetOptions.keepDirtyValues,m=cs(r.mode),v=cs(r.reValidateMode),_=r.criteriaMode===ke.all,x=p=>b=>{clearTimeout(f),f=setTimeout(p,b)},w=async p=>{if(c.isValid||p){const b=r.resolver?ye((await M()).errors):await te(o,!0);b!==n.isValid&&h.state.next({isValid:b})}},O=p=>c.isValidating&&h.state.next({isValidating:p}),A=(p,b=[],y,E,$=!0,k=!0)=>{if(E&&y){if(s.action=!0,k&&Array.isArray(C(o,p))){const T=y(C(o,p),E.argA,E.argB);$&&z(o,p,T)}if(k&&Array.isArray(C(n.errors,p))){const T=y(C(n.errors,p),E.argA,E.argB);$&&z(n.errors,p,T),Iv(n.errors,p)}if(c.touchedFields&&k&&Array.isArray(C(n.touchedFields,p))){const T=y(C(n.touchedFields,p),E.argA,E.argB);$&&z(n.touchedFields,p,T)}c.dirtyFields&&(n.dirtyFields=si(i,a)),h.state.next({name:p,isDirty:F(p,b),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else z(a,p,b)},I=(p,b)=>{z(n.errors,p,b),h.state.next({errors:n.errors})},U=(p,b,y,E)=>{const $=C(o,p);if($){const k=C(a,p,X(y)?C(i,p):y);X(k)||E&&E.defaultChecked||b?z(a,p,b?k:li($._f)):_e(p,k),s.mount&&w()}},q=(p,b,y,E,$)=>{let k=!1,T=!1;const H={name:p};if(!y||E){c.isDirty&&(T=n.isDirty,n.isDirty=H.isDirty=F(),k=T!==H.isDirty);const J=lt(C(i,p),b);T=C(n.dirtyFields,p),J?oe(n.dirtyFields,p):z(n.dirtyFields,p,!0),H.dirtyFields=n.dirtyFields,k=k||c.dirtyFields&&T!==!J}if(y){const J=C(n.touchedFields,p);J||(z(n.touchedFields,p,y),H.touchedFields=n.touchedFields,k=k||c.touchedFields&&J!==y)}return k&&$&&h.state.next(H),k?H:{}},N=(p,b,y,E)=>{const $=C(n.errors,p),k=c.isValid&&Xe(b)&&n.isValid!==b;if(e.delayError&&y?(u=x(()=>I(p,y)),u(e.delayError)):(clearTimeout(f),u=null,y?z(n.errors,p,y):oe(n.errors,p)),(y?!lt($,y):$)||!ye(E)||k){const T={...E,...k&&Xe(b)?{isValid:b}:{},errors:n.errors,name:p};n={...n,...T},h.state.next(T)}O(!1)},M=async p=>r.resolver(a,r.context,Cv(p||l.mount,o,r.criteriaMode,r.shouldUseNativeValidation)),ae=async p=>{const{errors:b}=await M(p);if(p)for(const y of p){const E=C(b,y);E?z(n.errors,y,E):oe(n.errors,y)}else n.errors=b;return b},te=async(p,b,y={valid:!0})=>{for(const E in p){const $=p[E];if($){const{_f:k,...T}=$;if(k){const H=l.array.has(k.name),J=await bs($,a,_,r.shouldUseNativeValidation&&!b,H);if(J[k.name]&&(y.valid=!1,b))break;!b&&(C(J,k.name)?H?xv(n.errors,J,k.name):z(n.errors,k.name,J[k.name]):oe(n.errors,k.name))}T&&await te(T,b,y)}}return y.valid},j=()=>{for(const p of l.unMount){const b=C(o,p);b&&(b._f.refs?b._f.refs.every(y=>!ai(y)):!ai(b._f.ref))&&fi(p)}l.unMount=new Set},F=(p,b)=>(p&&b&&z(a,p,b),!lt(Os(),i)),Q=(p,b,y)=>wv(p,l,{...s.mount?a:X(b)?i:Ie(p)?{[p]:b}:b},y,b),pe=p=>Xt(C(s.mount?a:i,p,e.shouldUnregister?C(i,p,[]):[])),_e=(p,b,y={})=>{const E=C(o,p);let $=b;if(E){const k=E._f;k&&(!k.disabled&&z(a,p,ws(b,k)),$=Lr(k.ref)&&ue(b)?"":b,gs(k.ref)?[...k.ref.options].forEach(T=>T.selected=$.includes(T.value)):k.refs?Zt(k.ref)?k.refs.length>1?k.refs.forEach(T=>(!T.defaultChecked||!T.disabled)&&(T.checked=Array.isArray($)?!!$.find(H=>H===T.value):$===T.value)):k.refs[0]&&(k.refs[0].checked=!!$):k.refs.forEach(T=>T.checked=T.value===$):ni(k.ref)?k.ref.value="":(k.ref.value=$,k.ref.type||h.values.next({name:p,values:{...a}})))}(y.shouldDirty||y.shouldTouch)&&q(p,$,y.shouldTouch,y.shouldDirty,!0),y.shouldValidate&&di(p)},Ae=(p,b,y)=>{for(const E in b){const $=b[E],k=`${p}.${E}`,T=C(o,k);(l.array.has(p)||!jr($)||T&&!T._f)&&!Ot($)?Ae(k,$,y):_e(k,$,y)}},ct=(p,b,y={})=>{const E=C(o,p),$=l.array.has(p),k=Le(b);z(a,p,k),$?(h.array.next({name:p,values:{...a}}),(c.isDirty||c.dirtyFields)&&y.shouldDirty&&h.state.next({name:p,dirtyFields:si(i,a),isDirty:F(p,k)})):E&&!E._f&&!ue(k)?Ae(p,k,y):_e(p,k,y),us(p,l)&&h.state.next({...n}),h.values.next({name:p,values:{...a}}),!s.mount&&t()},Jt=async p=>{const b=p.target;let y=b.name,E=!0;const $=C(o,y),k=()=>b.type?li($._f):hv(p),T=H=>{E=Number.isNaN(H)||H===C(a,y,H)};if($){let H,J;const Hr=k(),Tt=p.type===as.BLUR||p.type===as.FOCUS_OUT,fm=!Ev($._f)&&!r.resolver&&!C(n.errors,y)&&!$._f.deps||Ov(Tt,C(n.touchedFields,y),n.isSubmitted,v,m),hi=us(y,l,Tt);z(a,y,Hr),Tt?($._f.onBlur&&$._f.onBlur(p),u&&u(0)):$._f.onChange&&$._f.onChange(p);const vi=q(y,Hr,Tt,!1),pm=!ye(vi)||hi;if(!Tt&&h.values.next({name:y,type:p.type,values:{...a}}),fm)return c.isValid&&w(),pm&&h.state.next({name:y,...hi?{}:vi});if(!Tt&&hi&&h.state.next({...n}),O(!0),r.resolver){const{errors:Fs}=await M([y]);if(T(Hr),E){const hm=xs(n.errors,o,y),Ls=xs(Fs,o,hm.name||y);H=Ls.error,y=Ls.name,J=ye(Fs)}}else H=(await bs($,a,_,r.shouldUseNativeValidation))[y],T(Hr),E&&(H?J=!1:c.isValid&&(J=await te(o,!0)));E&&($._f.deps&&di($._f.deps),N(y,J,H,vi))}},Ur=(p,b)=>{if(C(n.errors,b)&&p.focus)return p.focus(),1},di=async(p,b={})=>{let y,E;const $=ti(p);if(O(!0),r.resolver){const k=await ae(X(p)?p:$);y=ye(k),E=p?!$.some(T=>C(k,T)):y}else p?(E=(await Promise.all($.map(async k=>{const T=C(o,k);return await te(T&&T._f?{[k]:T}:T)}))).every(Boolean),!(!E&&!n.isValid)&&w()):E=y=await te(o);return h.state.next({...!Ie(p)||c.isValid&&y!==n.isValid?{}:{name:p},...r.resolver||!p?{isValid:y}:{},errors:n.errors,isValidating:!1}),b.shouldFocus&&!E&&Fr(o,Ur,p?$:l.mount),E},Os=p=>{const b={...i,...s.mount?a:{}};return X(p)?b:Ie(p)?C(b,p):p.map(y=>C(b,y))},Is=(p,b)=>({invalid:!!C((b||n).errors,p),isDirty:!!C((b||n).dirtyFields,p),isTouched:!!C((b||n).touchedFields,p),error:C((b||n).errors,p)}),lm=p=>{p&&ti(p).forEach(b=>oe(n.errors,b)),h.state.next({errors:p?n.errors:{}})},As=(p,b,y)=>{const E=(C(o,p,{_f:{}})._f||{}).ref;z(n.errors,p,{...b,ref:E}),h.state.next({name:p,errors:n.errors,isValid:!1}),y&&y.shouldFocus&&E&&E.focus&&E.focus()},cm=(p,b)=>Qe(p)?h.values.subscribe({next:y=>p(Q(void 0,b),y)}):Q(p,b,!0),fi=(p,b={})=>{for(const y of p?ti(p):l.mount)l.mount.delete(y),l.array.delete(y),b.keepValue||(oe(o,y),oe(a,y)),!b.keepError&&oe(n.errors,y),!b.keepDirty&&oe(n.dirtyFields,y),!b.keepTouched&&oe(n.touchedFields,y),!r.shouldUnregister&&!b.keepDefaultValue&&oe(i,y);h.values.next({values:{...a}}),h.state.next({...n,...b.keepDirty?{isDirty:F()}:{}}),!b.keepIsValid&&w()},Ts=({disabled:p,name:b,field:y,fields:E,value:$})=>{if(Xe(p)){const k=p?void 0:X($)?li(y?y._f:C(E,b)._f):$;z(a,b,k),q(b,k,!1,!1,!0)}},pi=(p,b={})=>{let y=C(o,p);const E=Xe(b.disabled);return z(o,p,{...y||{},_f:{...y&&y._f?y._f:{ref:{name:p}},name:p,mount:!0,...b}}),l.mount.add(p),y?Ts({field:y,disabled:b.disabled,name:p}):U(p,!0,b.value),{...E?{disabled:b.disabled}:{},...r.progressive?{required:!!b.required,min:Qt(b.min),max:Qt(b.max),minLength:Qt(b.minLength),maxLength:Qt(b.maxLength),pattern:Qt(b.pattern)}:{},name:p,onChange:Jt,onBlur:Jt,ref:$=>{if($){pi(p,b),y=C(o,p);const k=X($.value)&&$.querySelectorAll&&$.querySelectorAll("input,select,textarea")[0]||$,T=Sv(k),H=y._f.refs||[];if(T?H.find(J=>J===k):k===y._f.ref)return;z(o,p,{_f:{...y._f,...T?{refs:[...H.filter(ai),k,...Array.isArray(C(i,p))?[{}]:[]],ref:{type:k.type,name:p}}:{ref:k}}}),U(p,!1,void 0,k)}else y=C(o,p,{}),y._f&&(y._f.mount=!1),(r.shouldUnregister||b.shouldUnregister)&&!(mv(l.array,p)&&s.action)&&l.unMount.add(p)}}},Ps=()=>r.shouldFocusError&&Fr(o,Ur,l.mount),um=p=>{Xe(p)&&(h.state.next({disabled:p}),Fr(o,b=>{b.disabled=p},0,!1))},Ds=(p,b)=>async y=>{y&&(y.preventDefault&&y.preventDefault(),y.persist&&y.persist());let E=Le(a);if(h.state.next({isSubmitting:!0}),r.resolver){const{errors:$,values:k}=await M();n.errors=$,E=k}else await te(o);oe(n.errors,"root"),ye(n.errors)?(h.state.next({errors:{}}),await p(E,y)):(b&&await b({...n.errors},y),Ps(),setTimeout(Ps)),h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ye(n.errors),submitCount:n.submitCount+1,errors:n.errors})},dm=(p,b={})=>{C(o,p)&&(X(b.defaultValue)?ct(p,C(i,p)):(ct(p,b.defaultValue),z(i,p,b.defaultValue)),b.keepTouched||oe(n.touchedFields,p),b.keepDirty||(oe(n.dirtyFields,p),n.isDirty=b.defaultValue?F(p,C(i,p)):F()),b.keepError||(oe(n.errors,p),c.isValid&&w()),h.state.next({...n}))},Ns=(p,b={})=>{const y=p?Le(p):i,E=Le(y),$=p&&!ye(p)?E:i;if(b.keepDefaultValues||(i=y),!b.keepValues){if(b.keepDirtyValues||g)for(const k of l.mount)C(n.dirtyFields,k)?z($,k,C(a,k)):ct(k,C($,k));else{if(ei&&X(p))for(const k of l.mount){const T=C(o,k);if(T&&T._f){const H=Array.isArray(T._f.refs)?T._f.refs[0]:T._f.ref;if(Lr(H)){const J=H.closest("form");if(J){J.reset();break}}}}o={}}a=e.shouldUnregister?b.keepDefaultValues?Le(i):{}:Le($),h.array.next({values:{...$}}),h.values.next({values:{...$}})}l={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!s.mount&&t(),s.mount=!c.isValid||!!b.keepIsValid,s.watch=!!e.shouldUnregister,h.state.next({submitCount:b.keepSubmitCount?n.submitCount:0,isDirty:b.keepDirty?n.isDirty:!!(b.keepDefaultValues&&!lt(p,i)),isSubmitted:b.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:b.keepDirtyValues?n.dirtyFields:b.keepDefaultValues&&p?si(i,p):{},touchedFields:b.keepTouched?n.touchedFields:{},errors:b.keepErrors?n.errors:{},isSubmitSuccessful:b.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},Ms=(p,b)=>Ns(Qe(p)?p(a):p,b);return{control:{register:pi,unregister:fi,getFieldState:Is,handleSubmit:Ds,setError:As,_executeSchema:M,_getWatch:Q,_getDirty:F,_updateValid:w,_removeUnmounted:j,_updateFieldArray:A,_updateDisabledField:Ts,_getFieldArray:pe,_reset:Ns,_resetDefaultValues:()=>Qe(r.defaultValues)&&r.defaultValues().then(p=>{Ms(p,r.resetOptions),h.state.next({isLoading:!1})}),_updateFormState:p=>{n={...n,...p}},_disableForm:um,_subjects:h,_proxyFormState:c,get _fields(){return o},get _formValues(){return a},get _state(){return s},set _state(p){s=p},get _defaultValues(){return i},get _names(){return l},set _names(p){l=p},get _formState(){return n},set _formState(p){n=p},get _options(){return r},set _options(p){r={...r,...p}}},trigger:di,register:pi,handleSubmit:Ds,watch:cm,setValue:ct,getValues:Os,reset:Ms,resetField:dm,clearErrors:lm,unregister:fi,setError:As,setFocus:(p,b={})=>{const y=C(o,p),E=y&&y._f;if(E){const $=E.refs?E.refs[0]:E.ref;$.focus&&($.focus(),b.shouldSelect&&$.select())}},getFieldState:Is}}function ci(e={}){const t=we.useRef(),r=we.useRef(),[n,o]=we.useState({isDirty:!1,isValidating:!1,isLoading:Qe(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},disabled:!1,defaultValues:Qe(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...Tv(e,()=>o(a=>({...a}))),formState:n});const i=t.current.control;return i._options=e,_v({subject:i._subjects.state,next:a=>{yv(a,i._proxyFormState,i._updateFormState,!0)&&o({...i._formState})}}),we.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),we.useEffect(()=>{if(i._proxyFormState.isDirty){const a=i._getDirty();a!==n.isDirty&&i._subjects.state.next({isDirty:a})}},[i,n.isDirty]),we.useEffect(()=>{e.values&&!lt(e.values,r.current)?(i._reset(e.values,i._options.resetOptions),r.current=e.values):i._resetDefaultValues()},[e.values,i]),we.useEffect(()=>{i._state.mount||(i._updateValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=gv(n,i),t.current}var ks=function(e,t,r){if(e&&"reportValidity"in e){var n=C(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Pv=function(e,t){var r=function(o){var i=t.fields[o];i&&i.ref&&"reportValidity"in i.ref?ks(i.ref,o,e):i.refs&&i.refs.forEach(function(a){return ks(a,o,e)})};for(var n in t.fields)r(n)},Dv=function(e,t){t.shouldUseNativeValidation&&Pv(e,t);var r={};for(var n in e){var o=C(t.fields,n),i=Object.assign(e[n]||{},{ref:o&&o.ref});if(Mv(t.names||Object.keys(e),n)){var a=Object.assign({},Nv(C(r,n)));z(a,"root",i),z(r,n,a)}else z(r,n,i)}return r},Nv=function(e){return Array.isArray(e)?e.filter(Boolean):[]},Mv=function(e,t){return e.some(function(r){return r.startsWith(t+".")})},Fv=function(e,t){for(var r={};e.issues.length;){var n=e.issues[0];if(n.path){var o=n.path.map(function(s){return s.key}).join(".");if(r[o]||(r[o]={message:n.message,type:n.validation}),t){var i=r[o].types,a=i&&i[n.validation];r[o]=ls(o,t,r,n.validation,a?[].concat(a,n.message):n.message)}e.issues.shift()}}return r},ui=function(e,t,r){return r===void 0&&(r={}),function(n,o,i){try{return Promise.resolve(function(a,s){try{var l=function(){function u(c){return{values:r.raw?n:c,errors:{}}}var f=Object.assign({},{abortEarly:!1,abortPipeEarly:!1},t);return r.mode==="sync"?u(sr(e,n,f)):Promise.resolve(Ad(e,n,f)).then(u)}()}catch(u){return s(u)}return l&&l.then?l.then(void 0,s):l}(0,function(a){if(a instanceof tn)return{values:{},errors:Dv(Fv(a,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw a}))}catch(a){return Promise.reject(a)}}};const $s=27,Ss=12,Cs=10,Lv=Ar("enum"),Rv=e=>{const t={min:e.minSelected??0,max:e.maxSelected??e.options.length};return ui(Ne({checked:to(eo(Qi()),r=>Object.entries(r).filter(([n,o])=>o).map(([n,o])=>n),[Rt(t.max,`Please select at most ${t.max} option${t.max!==1?"s":""}`),ro(t.min,`Please select at least ${t.min} option${t.min!==1?"s":""}`)])}))},Vv=re(({option:e,...t},r)=>d(W,{children:[d("input",{class:"peer sr-only h-full",type:"checkbox",...t,ref:r}),d("label",{class:"bg-lowest hover:bg-neutral-2 active:outline-neutral-8 ease-expo-out outline-divider text-neutral-11 peer-checked:outline-accent-7 peer-checked:bg-accent-2 peer-checked:text-accent-9 peer-focus-visible:ring-accent-9 peer-focus-visible:ring-offset-accent-7 block cursor-pointer select-none rounded-2xl px-3 py-1.5 outline outline-1 ring-0 ring-transparent transition-all selection:bg-transparent peer-focus-visible:ring-4",htmlFor:t.id,children:e.label})]})),Es=xr("gutter-stable flex w-full flex-1 flex-wrap gap-3 overflow-y-auto rounded-xl p-2.5 pr-4",{variants:{variant:{singleOption:"justify-center",booleanLike:es}}}),jv=({input:e,onSubmitSuccess:t})=>{var u,f;const r=e.key?(u=P.current$.value.flow)==null?void 0:u.data.submissions[e.key]:void 0,n=(e.config.minSelected===1||e.config.minSelected===void 0)&&e.config.maxSelected===1,o=n&&e.config.options.length===2,{register:i,handleSubmit:a,formState:{errors:s}}=ci({defaultValues:{checked:n?{}:Lv(r)?Object.fromEntries(r.value.map(c=>[c,!0])):{}},resolver:Rv(e.config)}),l=Jn();return o?d("ul",{style:{maxHeight:6.5*$s+5*Ss+2*Cs},class:Es({variant:"booleanLike"}),children:e.config.options.map((c,h)=>d("li",{class:"flex-1",children:d(ts,{type:"submit",ref:g=>{g&&h===0&&(l.current=g)},label:c.label,value:"true",onClick:()=>t({type:"enum",value:[c.value]})})},c.value))}):d("form",{noValidate:!0,onSubmit:c=>a(h=>{const g=h.checked;t({type:"enum",value:g})})(c),children:[d("div",{class:"flex items-center gap-1",children:[d("ul",{style:{maxHeight:6.5*$s+5*Ss+2*Cs},class:Es({variant:e.config.options.length===1?"singleOption":void 0}),children:e.config.options.map((c,h)=>{const g=`checked.${c.value}`,{ref:m,...v}=i(g);return d("li",{class:"relative",children:d(Vv,{option:c,autoFocus:h===0,ref:_=>{_&&h===0&&(l.current=_),m(_)},id:g,...v,onClick:n?()=>t({type:"enum",value:[c.value]}):void 0})},c.value)})}),d("div",{class:"flex flex-col items-center gap-2 pr-2.5 pt-2.5",children:[n?null:d(Ct,{}),e.config.minSelected===0&&d(Et,{type:"button",onClick:()=>t({type:"enum",value:[]})})]})]}),d("div",{class:"px-1",children:d(Mr,{error:(f=s.checked)==null?void 0:f.root})})]})},Bv=Ar("number"),zr={number:()=>"Please enter a valid number",min:e=>`Please enter a number greater than or equal to ${e}`,max:e=>`Please enter a number less than or equal to ${e}`,decimalCases:e=>`Please enter a number with at most ${e} decimal cases`},zv=e=>{const t=e.min??Number.MIN_SAFE_INTEGER,r=e.max??Number.MAX_SAFE_INTEGER,n=e.decimalCases??0;return ui(Ne({number:rn(zr.number(),[Md(t,zr.min(t)),Nd(r,zr.max(r)),Pd(o=>o===Number(o.toFixed(n)),zr.decimalCases(n))])}))},Uv=({input:e,onSubmitSuccess:t})=>{var f;const r=e.config.defaultValue,n=e.key?(f=P.current$.value.flow)==null?void 0:f.data.submissions[e.key]:void 0,{register:o,handleSubmit:i,formState:{errors:a}}=ci({defaultValues:{number:r?Number(r):Bv(n)?n.value:void 0},resolver:zv(e.config)}),{ref:s,...l}=o("number",{required:!e.config.optional,valueAsNumber:!0}),u=L();return he(()=>{u.current&&(u.current.focus(),u.current.select())},[]),d("form",{class:"flex flex-col gap-1 p-2.5",onSubmit:i(c=>{c.number!==void 0&&t({type:"number",value:c.number})}),children:[d("div",{class:"flex items-center gap-2",children:[d("div",{class:"relative min-w-0 flex-grow",children:[d("input",{...l,id:"chat-input",autocomplete:"off",autoCapitalize:"off",autoCorrect:"off",autoFocus:!0,ref:c=>{c&&(u.current=c),s(c)},type:"text",min:e.config.min,max:e.config.max,class:"outline-divider ease-expo-out placeholder:text-neutral-10 text-neutral-12 focus-visible:outline-accent-7 caret-accent-9 bg-lowest [type=number:-webkit-inner-spin-button] w-full rounded-full px-3 py-1 text-base outline outline-2 transition-all [-webkit-outer-spin-button:none]",placeholder:e.config.placeholder}),e.config.optional&&d(Et,{class:"absolute right-0 top-0",onClick:()=>t(null)})]}),d(Ct,{})]}),d(Mr,{error:a.number})]})},Hv=({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"})]})]})})}),At={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"},qv=$e(At.phone,[Fd(/^\+?[0-9 -]+$/,At.phone)]),Kv={email:{type:"email",inputMode:"email",formNoValidate:!0},phone:{type:"tel",inputMode:"tel"},text:{type:"text",inputMode:"text"},url:{type:"url",inputMode:"url",formNoValidate:!0}},Wv=Ar("string"),Gv=e=>{const t=`Please enter no more than ${e.maxChars} characters`;return ui(Ne({text:{email:$e(At.email,[Dd(At.email),Rt(e.maxChars??1/0,t)]),phone:to(qv,r=>r.replace(/[^0-9]/g,""),[Rt(e.maxChars??1/0,t)]),text:$e([ro(1,At.empty),Rt(e.maxChars??1/0,t)]),url:$e([Ld(At.url),Rt(e.maxChars??1/0,t)])}[e.format]}))},Yv=({input:e,onSubmitSuccess:t})=>{var f;const r=e.key?(f=P.current$.value.flow)==null?void 0:f.data.submissions[e.key]:void 0,n=e.config.defaultValue,{register:o,handleSubmit:i,formState:{errors:a}}=ci({defaultValues:{text:n||(Wv(r)?r.value:"")},resolver:Gv(e.config)}),{ref:s,...l}=o("text",{required:!e.config.optional}),u=L();return he(()=>{u.current&&(u.current.focus(),u.current.select())},[]),d("form",{noValidate:!0,class:"flex flex-col gap-1 p-2.5",onSubmit:i(c=>{t({type:"string",value: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,...Kv[e.config.format],autocomplete:"off",autoCapitalize:"off",autoCorrect:"off",autoFocus:!0,ref:c=>{c&&(u.current=c),s(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(Et,{class:"absolute right-0 top-0",onClick:()=>t(null)})]}),d(Ct,{})]}),d(Mr,{error:a.text})]})},Zv=()=>{var o;const e=(o=P.current$.value.flow)==null?void 0:o.data.currentInput,[t,r]=qh(),n=L(null);return P.inputHeight$.value=r.height,V(()=>{const i=n.current;if(i)return i.addEventListener("transitionstart",Z.scrollToEnd.smooth),i.addEventListener("transitioncancel",Z.scrollToEnd.smooth),i.addEventListener("transitionend",Z.scrollToEnd.smooth),()=>{i.removeEventListener("transitionstart",Z.scrollToEnd.smooth),i.removeEventListener("transitioncancel",Z.scrollToEnd.smooth),i.removeEventListener("transitionend",Z.scrollToEnd.smooth)}},[]),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:Ke({input:e}).with({input:Oe.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(Ct,{disabled:!0,"aria-hidden":"true",tabIndex:-1})]})).with({input:{type:"text"}},i=>d(Yv,{onSubmitSuccess:Z.onSubmitSuccessFn$.value,...i})).with({input:{type:"multiple-choice"}},i=>d(jv,{onSubmitSuccess:Z.onSubmitSuccessFn$.value,...i})).with({input:{type:"boolean"}},i=>d(av,{onSubmitSuccess:Z.onSubmitSuccessFn$.value,...i})).with({input:{type:"file"}},i=>d(pv,{onSubmitSuccess:Z.onSubmitSuccessFn$.value,...i})).with({input:{type:"submit"}},i=>d(Hv,{onSubmitSuccess:Z.onSubmitSuccessFn$.value,...i})).with({input:{type:"address"}},i=>d(tv,{onSubmitSuccess:Z.onSubmitSuccessFn$.value,...i})).with({input:{type:"number"}},i=>d(Uv,{onSubmitSuccess:Z.onSubmitSuccessFn$.value,...i})).exhaustive()})})},Xv=xr("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"}}),Qv=({children:e,className:t,animate:r,side:n,...o})=>d("p",{style:{transformOrigin:n==="left"?"0% 50%":"100% 50%"},class:Xv({className:t,side:n,animate:r}),...o,children:e}),Jv=({message:e})=>d("div",{class:"bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl px-2 py-2",children:d("a",{onClick:e.onClick,class:"bg-lowest shadow-surface-sm ring-accent-6 hover:ring-accent-8 active:bg-accent-2 active:text-accent-10 text-accent-9 focus-visible:ring-accent-7/50 text-wrap-balance flex items-center gap-1.5 rounded-full py-2 pl-4 pr-2.5 text-center no-underline ring-1 transition-all focus:outline-none focus-visible:ring-4 focus-visible:ring-offset-2",target:"_blank",href:e.href,children:[e.text,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"})})]})}),em=({className:e,...t})=>(V(()=>{Z.scrollToEnd.smooth()}),d("div",{"aria-hidden":!0,children:Z.isBotTyping$.value===!0?d("div",{"aria-label":"Typing…",class:it("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})),tm={bot:"left",user:"right"},rm=xr("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]"}}}),nm=({lastSentMessageFooter:e})=>{var r;const t=((r=P.current$.value.flow)==null?void 0:r.data.messages)??[];return V(()=>{Z.scrollToEnd.smooth()},[t.length]),d("ol",{"aria-label":"Chat messages",class:"mt-auto flex flex-col justify-end gap-2 p-2 pt-[calc(var(--header-height)+1rem)]",children:[t.map((n,o)=>d(W,{children:d("li",{class:"flex",children:Ke(n).with({type:"system"},i=>d("p",{class:rm({variant:i.variant}),children:i.text})).with({type:"text",author:Oe.union("bot","user")},i=>{const a=i.author==="user"&&!t.slice(o+1).some(l=>l.type==="text"&&l.author==="user"),s=o===t.length-1;return d(Qv,{animate:s,side:tm[i.author],children:[i.text,a?e:null]},o)}).with({type:"link"},i=>d(Jv,{message:i})).with({type:"image"},i=>d("img",{class:"shadow-surface-md w-full max-w-[min(100%,24rem)] rounded-2xl",src:i.url,style:{aspectRatio:i.width/i.height}})).with({type:"file"},i=>d(uv,{class:i.author==="bot"?void 0:"ml-auto",file:{name:i.fileName,sizeKb:i.fileSizeKb}})).exhaustive()})},o)),d(em,{},"typing")]})},im=({logger:e,apiClient:t,analytics:r})=>{const{flow:n}=P.current$.value;xe(n,"Flow is required to exist to show chatbot body");const o=P.viewState$.value,{chatRef:i,chatService:a}=Xh(),[s,l]=G();return he(()=>{o==="maximised"&&Z.scrollToEnd.instant()},[o]),he(()=>{var v,_;const{state:u,flow:f}=P.current$.peek();if(u!=="loaded")throw new Error(mh.invalid_state);let c=f.data.nodeHistory.at(-1);if(Z.scrollToEnd.instant(),P.setInput(void 0),f.data.isFinished)return;c===void 0?(c=Fa(n.nodes).id,P.setCurrentNodeId(c),r.log({event:"FLOW_START",properties:{flow_id:n.id,flow_version:n.version,flow_session_id:f.data.flowSessionId,flow_build:n.build},customProperties:(v=n.analytics)==null?void 0:v.customProperties})):P.removeMessagesSentByNodeIds([c]);const{interpret:h,abort:g,undo:m}=Ah({context:n.context,analytics:{service:r,customProperties:(_=n.analytics)==null?void 0:_.customProperties},apiClient:t,logger:e,flow:n,chatService:a,getSubmissions:()=>{var x;return(x=P.current$.peek().flow)==null?void 0:x.data.submissions},onInterpret:(x,w)=>{var A;const O=P.current$.peek().flow;xe(O),w&&(O.data.sequence=O.data.sequence+1,r.log({event:"FLOW_NODE",properties:{flow_id:n.id,flow_version:n.version,from_node_id:w.id,flow_build:n.build,to_node_id:x.id,sequence:O.data.sequence,flow_session_id:O.data.flowSessionId},customProperties:(A=n.analytics)==null?void 0:A.customProperties})),P.setCurrentNodeId(x.id)},onFlowEnd:async()=>{var w;P.markAsFinished();const x=P.current$.peek().flow;xe(x),r.log({event:"FLOW_END",properties:{flow_id:n.id,flow_version:n.version,flow_session_id:x.data.flowSessionId,flow_build:n.build},customProperties:(w=n.analytics)==null?void 0:w.customProperties})}});return l(()=>m),h(c),g},[r,t,a,e,n]),d(W,{children:[d("div",{ref:i,className:"hide-scrollbars relative flex w-full max-w-full flex-grow flex-col overflow-y-scroll",style:{WebkitOverflowScrolling:"touch",paddingBottom:P.inputHeight$.value},children:d(nm,{lastSentMessageFooter:n.data.isFinished||!s?null:d(am,{undoFn:s})})}),d(Zv,{})]})},om=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"):[],am=({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}=P.current$.peek();xe(t);const{removed:r}=e(t.data.nodeHistory),n=t.data.nodeHistory.splice(-r);n.length!==0&&(P.removeMessagesSentByNodeIds(n),P.setInput(void 0),n.pop(),n.map(o=>t.nodes.find(i=>i.id===o)).filter(Boolean).flatMap(om).forEach(o=>delete t.data.submissions[o]),P.current$.value={...P.current$.value})},children:"Undo"})}),sm=Object.freeze(Object.defineProperty({__proto__:null,ChatbotBody:im},Symbol.toStringTag,{value:"Module"}))})();
|
|
45
|
+
}`},Ka=({context:e,schema:t,logger:r})=>{if(t)for(const n in t){const o=t[n];if(!o)continue;const i=Dt(e,n,null);if(o.required&&i===null){const a=`Configuration error in context: ${n} is required`;throw r.error(a),new Error(a)}switch(o.type){case"number":if(typeof i!="number")throw new Error(`Configuration error in context: ${n} is not a number`);break;case"string":if(typeof i!="string")throw new Error(`Configuration error in context: ${n} is not a string`);break;default:o.type}}},Eh=({_internal_domManager:e=bh(),theme:t})=>Je(({apiClient:r,logger:n,analytics:o})=>{let i=!1;const a=()=>{if(typeof window>"u")return;const s=[D("style",{id:"inploi-chatbot-styles"},vh),D("style",{id:"inploi-chatbot-theme"},Ch(t))],l=e.getOrCreateChatbotElement();ht(D(W,{},[s,D(fh,{apiClient:r,logger:n,analytics:o})]),l),i=!0};return{prepare:async()=>{if(!(typeof window>"u"))try{if(i)return;a(),n.info("Chatbot plugin prepared")}catch(s){n.error("Error preparing chatbot plugin",s)}},fetchFlowByJobId:async(s,l)=>r.fetch(`/flow/job/${s}`).then(u=>{var c;const f=sr(hh,u);return{flow:f.flow,title:`Applying for “${f.job.title}”`,flowKeys:[f.job.id,...(l==null?void 0:l.flowKeys)??[]],...l,analytics:{customProperties:{job_id:f.job.id,flow_id:f.flow.id,flow_version:f.flow.version,...(c=l==null?void 0:l.analytics)==null?void 0:c.customProperties}}}}),fetchFlowById:async(s,l)=>r.fetch(`/flow/id/${s}`).then(u=>{var c;const f=sr(ph,u);return{flow:f.flow,title:"Chatbot",flowKeys:(l==null?void 0:l.flowKeys)??[],...l,analytics:{customProperties:{flow_id:f.flow.id,flow_version:f.flow.version,...(c=l==null?void 0:l.analytics)==null?void 0:c.customProperties}}}}),open:async s=>{if(!(typeof window>"u"))try{P.cancelCurrentFlow(),P.viewState$.value="maximised",i||a(),s instanceof Promise?(P.current$.value={state:"loading"},s.then(async l=>{Ka({context:l.context||{},schema:l.flow.context_schema,logger:n}),P.startFlow(l)}).catch(l=>{const u=l instanceof Error?l.message:"An error occurred";P.current$.value={state:"error",error:u}})):(Ka({context:s.context||{},schema:s.flow.context_schema,logger:n}),P.startFlow(s))}catch(l){n.error("Error starting flow",l)}},startApplication:void 0,closeApplication:void 0,close:async()=>{typeof window>"u"||(P.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=Eh;const Yt=(e,{context:t,submissions:r})=>{const[n,...o]=e.data.compareKey.split(".");if(!n)return!1;const i=Ga({context:t,key:n,path:o,submissions:r});if(!i)return!1;switch(i.type){case"address":{const a=Dt(i.value,o.join("."));switch(e.data.compare){case"equals":return a===e.data.compareValue;case"contains":return a?a.includes(e.data.compareValue):!1;case"notEquals":return a!==e.data.compareValue;case"notContains":return a?!a.includes(e.data.compareValue):!0}break}case"integration":{if(typeof i.value!="object"||Array.isArray(i.value))return!1;const a=Dt(i.value,o.join(".")),s={...e,data:{...e.data,compareKey:"_temp"}};switch(typeof a){case"boolean":return Yt(s,{submissions:{_temp:{value:a,type:"boolean"}},context:t});case"string":return Yt(s,{submissions:{_temp:{value:a,type:"string"}},context:t});case"number":return Yt(s,{submissions:{_temp:{value:a,type:"number"}},context:t});case"object":return Array.isArray(a)&&a.every(Ra)?Yt(s,{submissions:{_temp:{value:a,type:"enum"}},context:t}):!1}break}case"boolean":{const a=e.data.compareValue==="true";switch(e.data.compare){case"equals":return i.value===a;case"notEquals":return i.value!==a}break}case"string":switch(e.data.compare){case"equals":return i.value===e.data.compareValue;case"contains":return i.value?i.value.includes(e.data.compareValue):!1;case"notEquals":return i.value!==e.data.compareValue;case"notContains":return i.value?!i.value.includes(e.data.compareValue):!0}break;case"number":{try{const a=Number(e.data.compareValue);switch(e.data.compare){case"equals":return i.value===a;case"notEquals":return i.value!==a;case"greaterThan":return i.value>a;case"greaterThanOrEqualTo":return i.value>=a;case"lessThan":return i.value<a;case"lessThanOrEqualTo":return i.value<=a}}catch{return console.error(`Failed to parse number in if-block ${e.id}`,i.value),!1}break}case"enum":switch(e.data.compare){case"equals":return i.value.length===1&&i.value[0]===e.data.compareValue;case"notEquals":return i.value.length===1&&i.value[0]!==e.data.compareValue;case"contains":return i.value.includes(e.data.compareValue);case"notContains":return!i.value.includes(e.data.compareValue)}break}return!1},Oh=/{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g,Ze=(e,{context:t,submissions:r})=>e.replace(Oh,(n,o,i="")=>{const[a,...s]=o.trim().split("."),l=Ga({key:a,path:s,submissions:r,context:t});if(!l)return i;switch(l.type){case"boolean":return l.value===!0?"true":"false";case"file":return l.value.map(u=>`${u.name} (${qt(u.sizeKb)})`).join(", ");case"enum":return l.value.join(", ");case"address":return Object.values(l.value).filter(u=>u&&u.trim().length>0).join(", ");case"number":case"string":return l.value?l.value.toString():i;case"integration":{if(typeof l.value!="object"||Array.isArray(l.value))break;const u=Dt(l.value,s.join("."));switch(typeof u){case"boolean":return u===!0?"true":"false";case"string":return u;case"number":return u.toString();case"object":if(Array.isArray(u)&&u.every(Ra))return u.join(", ")}break}}return i}),Wa=({node:e,nodes:t,stopWhen:r})=>{if((r==null?void 0:r(e))===!0)return e;const n=e.nextId?t.find(o=>o.id===e.nextId):void 0;if(n)return Wa({node:n,nodes:t,stopWhen:r})},Ih=({childNode:e,nodes:t})=>{const n=t.filter(o=>o.type==="if-block").find(o=>{if(!o.branchId)return!1;const i=t.find(s=>s.id===o.branchId);if(!i)return!1;const a=Wa({node:i,nodes:t,stopWhen:s=>s.id===e.id});return!(!a||a.id!==e.id)});if(n!=null&&n.nextId)return t.find(o=>o.id===n.nextId)},Ah=({flow:e,analytics:t,logger:r,context:n,apiClient:o,getSubmissions:i,chatService:a,onFlowEnd:s,onInterpret:l})=>{let u=new AbortController;const f={...t.service,log:h=>t.service.log({...h,customProperties:{...h.customProperties,...t.customProperties}})},c=async(h,g)=>{const m=i();l==null||l(h,g);try{await Th({flow:e,analytics:f,logger:r,apiClient:o,context:n,node:h,submissions:m,chat:{sendMessage:async v=>a.send({groupId:h.id,message:v,signal:u.signal}),userInput:async v=>a.input({input:v,signal:u.signal}),addToSubmissions:a.addToSubmissions},next:v=>{const _=v?e.nodes.find(x=>x.id===v):Ih({childNode:h,nodes:e.nodes});return _?c(_,h):s==null?void 0:s(h)},end:()=>s==null?void 0:s(h)})}catch(v){if(v instanceof Kt)return;throw v}};return{interpret:async h=>{const g=e.nodes.find(m=>m.id===h)??Fa(e.nodes);return c(g)},undo:h=>{let g=1;const m=e.nodes.find(_=>_.id===h[h.length-1]);for(let _=h.length-2;_>0;_--){const x=h[_],w=e.nodes.find(O=>O.id===x);if(!w||(g++,w.type.startsWith("question-")))break}u.abort(),u=new AbortController;const v=e.nodes.find(_=>_.id===h[h.length-g]);return xe(v,"Undo failed: new start node not found"),c(v,m),{removed:g}},abort:()=>{u.abort()}}};async function Th(e){return await Ke(e).with({node:{type:"text"}},Mh).with({node:{type:"image"}},Fh).with({node:{type:"question-text"}},Lh).with({node:{type:"question-enum"}},Vh).with({node:{type:"question-number"}},Rh).with({node:{type:"question-boolean"}},jh).with({node:{type:"question-file"}},zh).with({node:{type:"question-address"}},Bh).with({node:{type:"end-flow"}},Uh).with({node:{type:"if-block"}},Nh).with({node:{type:"jump"}},({node:t,next:r})=>r(t.data.targetId)).with({node:{type:"link"}},Dh).with({node:{type:"integration-application-submit"}},Ph).with({node:{type:"integration-workflow-get"}},()=>Error("Unreachable")).exhaustive()}async function Ph({chat:e,next:t,node:r,logger:n,apiClient:o,submissions:i,context:a,analytics:s,flow:l}){const u=async f=>{f!==!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:c,session_id:h}=s.getSessionInfo(),g=await o.fetch("/flow/submit",{method:"POST",body:JSON.stringify({...a,integration_id:r.data.integrationId,anonymous_id:c,session_id:h,submissions:eh(i||{})})}).catch(m=>m);r.data.key&&e.addToSubmissions(r.data.key,{type:"integration",value:g}),await Ke(g).with({ats_data:{redirect_url:Oe.string}},async m=>{await e.sendMessage({type:"text",author:"bot",text:"Almost there! Please complete your submission here:"});const v=new URL(m.ats_data.redirect_url);c&&!v.searchParams.has("anonymous_id")&&v.searchParams.set("anonymous_id",c),await e.sendMessage({type:"link",href:v.toString(),text:"Complete submission",onClick:()=>{if(!h)return n.error("session_id not set, cannot log FLOW_REDIRECT event");s.log({event:"FLOW_REDIRECT",properties:{flow_build:l.build,flow_id:l.id,flow_session_id:h,flow_version:l.version,href:v.toString()}})}}),t(r.nextId)}).with({success:!0},async()=>{await e.sendMessage({type:"system",variant:"success",text:"Submission completed!"}),t(r.nextId)}).with({sucess:!1,ats_data:{message:Oe.string}},async m=>{n.error(m.ats_data),await e.sendMessage({type:"system",variant:"error",text:m.ats_data.message}),await u(!1)}).otherwise(async m=>{n.error(m),await e.sendMessage({type:"system",variant:"error",text:"Failed to submit"}),await u(!1)})};await u(r.data.skipConfirmation)}async function Dh({chat:e,next:t,node:r,submissions:n,context:o,analytics:i,flow:a,logger:s}){const{session_id:l}=i.getSessionInfo();await e.sendMessage({type:"link",href:Ze(r.data.href,{submissions:n,context:o}),text:Ze(r.data.cta,{submissions:n,context:o}),onClick:()=>{if(!l)return s.error("session_id not set, cannot log FLOW_REDIRECT event");i.log({event:"FLOW_REDIRECT",properties:{flow_build:a.build,flow_id:a.id,flow_session_id:l,flow_version:a.version,href:r.data.href}})}}),t(r.nextId)}async function Nh({submissions:e,next:t,node:r,context:n}){t(Yt(r,{submissions:e,context:n})?r.branchId:r.nextId)}async function Mh({chat:e,next:t,node:r,submissions:n,context:o}){await e.sendMessage({author:"bot",type:"text",text:Ze(r.data.text,{submissions:n,context:o})}),t(r.nextId)}async function Fh({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 Lh({chat:e,next:t,node:r,submissions:n,context:o}){await e.sendMessage({author:"bot",type:"text",text:Ze(r.data.question,{submissions:n,context:o})});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===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 Rh({chat:e,next:t,node:r,submissions:n,context:o}){await e.sendMessage({author:"bot",type:"text",text:Ze(r.data.question,{submissions:n,context:o})});const i=await e.userInput({key:r.data.key,type:"number",config:{max:r.data.max,min:r.data.min,optional:r.data.optional,placeholder:r.data.placeholder,decimalCases:r.data.decimalCases}});i===null?await e.sendMessage({type:"system",variant:"info",text:"Skipped"}):await e.sendMessage({author:"user",type:"text",text:i.value.toString()}),t(r.nextId)}async function Vh({chat:e,next:t,node:r,submissions:n,context:o}){await e.sendMessage({author:"bot",type:"text",text:Ze(r.data.question,{submissions:n,context:o})});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(a=>i.value.includes(a.value)).map(a=>a.label).join(", ")}),t(r.nextId)}async function jh({chat:e,next:t,node:r,submissions:n,context:o}){await e.sendMessage({author:"bot",type:"text",text:Ze(r.data.question,{submissions:n,context:o})});const i=await e.userInput({key:r.data.key,type:"boolean",config:{optional:r.data.optional,labels:{true:r.data.trueLabel,false:r.data.falseLabel}}});i===null?await e.sendMessage({type:"system",variant:"info",text:"Skipped"}):await e.sendMessage({author:"user",type:"text",text:i.value===!0?r.data.trueLabel:r.data.falseLabel}),t(r.nextId)}async function Bh({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===null)await e.sendMessage({type:"system",variant:"info",text:"Skipped"});else{const o=Object.values(n.value).filter(i=>i&&i.trim().length>0).join(", ");await e.sendMessage({author:"user",type:"text",text:o})}return t(r.nextId)}async function zh({node:e,chat:t,next:r,submissions:n,context:o}){await t.sendMessage({author:"bot",type:"text",text:Ze(e.data.question,{submissions:n,context:o})});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===null)await t.sendMessage({type:"system",variant:"info",text:"Skipped"});else for(const a of i.value)await t.sendMessage({author:"user",type:"file",fileName:a.name,fileSizeKb:a.sizeKb});r(e.nextId)}async function Uh({chat:e,end:t,node:r}){await e.sendMessage({type:"system",variant:"info",text:r.data.systemMessage}),t()}const Ga=({key:e,path:t,submissions:r,context:n})=>{if(e==="$context"){if(!t)return;const o=Dt(n,t.join("."));switch(typeof o){case"string":return{type:"string",value:o};case"number":return{type:"number",value:o};case"boolean":return{type:"boolean",value:o};default:console.warn(`Unexpected type for $context.${t.join(".")}`,o);return}}return r==null?void 0:r[e]};function Gn(e,t,r){var n,o,i,a,s;t==null&&(t=100);function l(){var f=Date.now()-a;f<t&&f>=0?n=setTimeout(l,t-f):(n=null,r||(s=e.apply(i,o),i=o=null))}var u=function(){i=this,o=arguments,a=Date.now();var f=r&&!n;return n||(n=setTimeout(l,t)),f&&(s=e.apply(i,o),i=o=null),s};return u.clear=function(){n&&(clearTimeout(n),n=null)},u.flush=function(){n&&(s=e.apply(i,o),i=o=null,clearTimeout(n),n=null)},u}Gn.debounce=Gn;var Hh=Gn;const Ya=Ve(Hh);function qh(e){let{debounce:t,scroll:r,polyfill:n,offsetSize:o}=e===void 0?{debounce:0,scroll:!1,offsetSize:!1}:e;const i=n||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[a,s]=G({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:a}),u=t?typeof t=="number"?t:t.scroll:null,f=t?typeof t=="number"?t:t.resize:null,c=L(!1);V(()=>(c.current=!0,()=>void(c.current=!1)));const[h,g,m]=ce(()=>{const w=()=>{if(!l.current.element)return;const{left:O,top:A,width:I,height:U,bottom:q,right:N,x:M,y:ae}=l.current.element.getBoundingClientRect(),te={left:O,top:A,width:I,height:U,bottom:q,right:N,x:M,y:ae};l.current.element instanceof HTMLElement&&o&&(te.height=l.current.element.offsetHeight,te.width=l.current.element.offsetWidth),Object.freeze(te),c.current&&!Yh(l.current.lastBounds,te)&&s(l.current.lastBounds=te)};return[w,f?Ya(w,f):w,u?Ya(w,u):w]},[s,o,u,f]);function v(){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 i(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 x=w=>{!w||w===l.current.element||(v(),l.current.element=w,l.current.scrollContainers=Za(w),_())};return Wh(m,!!r),Kh(g),V(()=>{v(),_()},[r,m,g]),V(()=>v,[]),[x,a,h]}function Kh(e){V(()=>{const t=e;return window.addEventListener("resize",t),()=>void window.removeEventListener("resize",t)},[e])}function Wh(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 Za(e){const t=[];if(!e||e===document.body)return t;const{overflow:r,overflowX:n,overflowY:o}=window.getComputedStyle(e);return[r,n,o].some(i=>i==="auto"||i==="scroll")&&t.push(e),[...t,...Za(e.parentElement)]}const Gh=["x","y","top","bottom","left","right","width","height"],Yh=(e,t)=>Gh.every(r=>e[r]===t[r]),Ct=({class:e,...t})=>d("button",{class:it("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"})]})}),Zh=25,Yn=We({instant:()=>{},smooth:()=>{}}),Z={onSubmitSuccessFn$:We(()=>{}),isBotTyping$:We(!1),scrollToEnd:{instant:()=>Yn.value.instant(),smooth:()=>Yn.value.smooth()}},Xh=()=>{const e=L(null);he(()=>{Yn.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*2&&e.current.scrollTo({top:e.current.scrollHeight,behavior:"smooth"})}}},[e]);const t=ce(()=>({addToSubmissions:(n,o)=>P.setSubmission(n,o),send:async({message:n,signal:o,groupId:i})=>{if(await Ke(n).with({author:"bot",type:"text"},async a=>{if(o!=null&&o.aborted)throw new Kt;Z.isBotTyping$.value=!0;const s=Math.min(Math.max(20,a.text.length),100)*Zh;await new Promise(l=>setTimeout(l,s,{signal:o})),Z.isBotTyping$.value=!1}).otherwise(async()=>{}),o!=null&&o.aborted)throw new Kt;P.addMessage(n,i)},input:({input:n,signal:o})=>{if(o!=null&&o.aborted)throw new Kt;return P.setInput(n),new Promise(i=>{const a=s=>{if(o!=null&&o.aborted)throw new Kt;P.setInput(void 0),n.key&&P.setSubmission(n.key,s),i(s)};Z.onSubmitSuccessFn$.value=a})}}),[]);return{chatRef:e,chatService:t}},Et=({class:e,...t})=>d("button",{type:"button",class:it("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"]}),Xa=["Afghanistan","Albania","Algeria","American Samoa","Andorra","Angola","Anguilla","Antarctica","Antigua and Barbuda","Argentina","Armenia","Aruba","Australia","Austria","Azerbaijan","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bermuda","Bhutan","Bolivia","Bosnia and Herzegovina","Botswana","Bouvet Island","Brazil","British Indian Ocean Territory","British Virgin Islands","Brunei","Bulgaria","Burkina Faso","Burundi","Cabo Verde","Cambodia","Cameroon","Canada","Caribbean Netherlands","Cayman Islands","Central African Republic","Chad","Chile","China","Christmas Island","Cocos (Keeling) Islands","Colombia","Comoros","Cook Islands","Costa Rica","Croatia","Cuba","Curaçao","Cyprus","Czechia","Côte d'Ivoire","Democratic Republic of the Congo","Denmark","Djibouti","Dominican Republic","Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia","Eswatini","Ethiopia","Falkland Islands (Islas Malvinas)","Faroe Islands","Fiji","Finland","France","French Guiana","French Polynesia","French Southern and Antarctic Lands","Gabon","Georgia","Germany","Ghana","Gibraltar","Greece","Greenland","Grenada","Guadeloupe","Guam","Guatemala","Guernsey","Guinea","Guinea-Bissau","Guyana","Haiti","Heard Island and McDonald Islands","Honduras","Hong Kong","Hungary","Iceland","India","Indonesia","Iran","Iraq","Ireland","Isle of Man","Israel","Italy","Jamaica","Japan","Jersey","Jordan","Kazakhstan","Kenya","Kiribati","Kosovo","Kuwait","Kyrgyzstan","Laos","Latvia","Lebanon","Lesotho","Liberia","Libya","Liechtenstein","Lithuania","Luxembourg","Macao","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Marshall Islands","Martinique","Mauritania","Mauritius","Mayotte","Mexico","Micronesia","Moldova","Monaco","Mongolia","Montenegro","Montserrat","Morocco","Mozambique","Myanmar (Burma)","Namibia","Nauru","Nepal","Netherlands","New Caledonia","New Zealand","Nicaragua","Niger","Nigeria","Niue","Norfolk Island","North Korea","North Macedonia","Northern Mariana Islands","Norway","Oman","Pakistan","Palau","Palestine","Panama","Papua New Guinea","Paraguay","Peru","Philippines","Pitcairn Islands","Poland","Portugal","Puerto Rico","Qatar","Romania","Russia","Rwanda","Réunion","Saint Barthélemy","Saint Helena, Ascension and Tristan da Cunha","Saint Kitts and Nevis","Saint Lucia","Saint Martin","Saint Pierre and Miquelon","Saint Vincent and the Grenadines","Samoa","San Marino","Saudi Arabia","Senegal","Serbia","Seychelles","Sierra Leone","Singapore","Sint Maarten","Slovakia","Slovenia","Solomon Islands","Somalia","South Africa","South Georgia and the South Sandwich Islands","South Korea","South Sudan","Spain","Sri Lanka","Sudan","Suriname","Svalbard and Jan Mayen","Sweden","Switzerland","Syria","São Tomé and Príncipe","Taiwan","Tajikistan","Tanzania","Thailand","The Bahamas","The Gambia","Timor-Leste","Togo","Tokelau","Tonga","Trinidad and Tobago","Tunisia","Turkmenistan","Turks and Caicos Islands","Tuvalu","Türkiye","U.S. Virgin Islands","Uganda","Ukraine","United Arab Emirates","United Kingdom","United States","United States Minor Outlying Islands","Uruguay","Uzbekistan","Vanuatu","Vatican City","Venezuela","Vietnam","Wallis and Futuna","Western Sahara","Yemen","Zambia","Zimbabwe","Åland Islands"],Qa={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"]},Nr=Object.keys(Qa),Qh=e=>Nr.reduce((t,r)=>{const n=Qa[r],o=e.filter(i=>i.types.some(a=>n.includes(a))).map(i=>i.long_name).join(", ");return o&&(t[r]=o),t},{}),Jh=document.createElement("div"),ev=()=>ce(()=>{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(Jh);return{enabled:!0,getPredictions:async n=>{const{predictions:o}=await t.getPlacePredictions({input:n,language:"en"});return o.map(i=>({label:i.description,value:i.place_id}))},getPlaceDetails:async n=>await new Promise((i,a)=>r.getDetails({placeId:n,fields:["address_components"],language:"en"},(s,l)=>l!==e.maps.places.PlacesServiceStatus.OK?a(l):s===null?a("ZERO_RESULTS"):i({ok:!0,place:s}))).catch(async i=>(console.error("Failed to get address details",i),{ok:!1}))}},[]),Zn=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"})]}),Xn={label:"Fill in manually",value:""},tv=({input:e,onSubmitSuccess:t})=>{const[r,n]=G(""),[o,i]=G(),[a,s]=G([]),[l,u]=G(),{enabled:f,getPredictions:c,getPlaceDetails:h}=ev(),[g,m]=G(f?"query":"manual"),v=ce(()=>La(_=>{xe(f,"Query state should not be enabled if Google Places isn't available"),n(_),_===""&&s([]),!(_.length<3)&&c(_).then(x=>{s(x)})},500),[f,c]);switch(V(()=>{if(f&&!(l===void 0||l===""))return h(l).then(_=>{if(!_.ok||!_.place.address_components){i({});return}const x=Qh(_.place.address_components);i(x),m("details")}),()=>{i(void 0)}},[l,h,f]),g){case"query":return xe(f,"Query state should not be enabled if Google Places isn't available"),d(rv,{input:e,onSkip:()=>t(null),onAddressSelect:_=>{u(_),m("loading")},onInputChange:v,suggestions:a,query:r});case"loading":return d(Qn,{input:e,onSubmitSuccess:t,addressFields:{},actions:d(Zn,{onClick:()=>{u(void 0),m("query")}})});case"details":return xe(o!==void 0),d(Qn,{input:e,onSubmitSuccess:t,addressFields:o,actions:d(Zn,{onClick:()=>{u(void 0),m("query")}})});case"manual":return d(Qn,{input:e,onSubmitSuccess:t,addressFields:{},actions:f?d(Zn,{onClick:()=>{u(void 0),m("query")}}):void 0})}},rv=({input:e,onSkip:t,suggestions:r,onAddressSelect:n,query:o,onInputChange:i})=>{const a=L(null);return he(()=>{a.current&&(a.current.focus(),a.current.select())},[]),d(W,{children:[d("form",{noValidate:!0,onSubmit:s=>{s.preventDefault()},class:"flex flex-col justify-end gap-1 p-2.5",children:[d("input",{onChange:s=>{i(s.currentTarget.value)},ref:a,name:"address",id:"chat-address",autocomplete:"address-line1 country-name postal-code",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:o}),e.config.optional&&d(Et,{class:"absolute right-3",onClick:t})]}),d("ul",{children:[r.map(s=>d("li",{children:d("button",{class:"text-neutral-11 fr hover:bg-neutral-3 focus-visible:bg-neutral-3 hover:text-neutral-12 border-b-neutral-3 flex w-full items-center border border-b border-solid border-transparent px-4 py-3 text-sm transition-colors duration-100",onClick:()=>{n(s.value)},children:[d("span",{class:"flex-grow",children:s.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"})})]})},s.label)),d("li",{children:d("button",{class:"text-neutral-11 fr hover:bg-neutral-3 focus-visible:bg-neutral-3 hover:text-neutral-12 border-b-neutral-3 flex w-full items-center border border-b border-solid border-transparent px-4 py-3 text-sm transition-colors duration-100",onClick:()=>{n(Xn.value)},children:d("span",{class:"flex-grow",children:Xn.label})})},Xn.label)]})]})},nv={line1:"Line 1",line2:"Line 2",line3:"Line 3",city:"City",state:"State",postcode:"Postcode",country:"Country"},Qn=({addressFields:e,onSubmitSuccess:t,actions:r,input:n})=>{const o=L(null);return he(()=>{if(o.current){const i=o.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 a=new FormData(i.currentTarget),s=Object.fromEntries(a.entries());t({type:"address",value: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:o,children:Nr.map((i,a)=>{const s=`isdk_${i}`,l=n.config.keys[i];return l?d(W,{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:nv[i]}),d("div",{class:"flex flex-col items-stretch gap-1.5",children:[i==="country"?d("div",{class:"relative",children:[d("select",{class:"text-neutral-12 hover:bg-neutral-4 placeholder:text-neutral-8 focus:bg-neutral-5 w-full flex-1 appearance-none rounded-lg border-solid bg-transparent bg-none px-3 py-1.5 text-base transition-colors focus:outline-none",name:l,id:s,defaultValue:e[i],required:!0,children:[e.country&&!Xa.includes(e.country)?d("option",{value:e[i],children:e[i]}):d("option",{value:"",children:"Select a country"}),Xa.map(u=>d("option",{value:u,children:u},u))]}),d("svg",{class:"text-neutral-12 absolute bottom-2.5 right-2 flex items-center justify-center",width:"16",height:"16",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:d("path",{d:"M4 6.5L8 10.5L12 6.5"})})]}):d("input",{autoFocus:a===0?!0:void 0,class:"text-neutral-12 hover:bg-neutral-4 placeholder:text-neutral-8 focus:bg-neutral-5 flex-1 rounded-lg border-solid bg-transparent px-3 py-1.5 text-base transition-colors autofill:shadow-[inset_0_0_0_1000px_hsl(210_16.7%_97.6%)] focus:outline-none",name:l,id:s,defaultValue:e[i],required:!0}),a!==Nr.length-1&&d("hr",{class:"border-b-neutral-5 m-0 w-full border-b border-solid"}),a===Nr.length-1&&d("hr",{class:"m-0 w-full border-b border-b-transparent"})]})]}):null})}),d("div",{class:"flex w-full flex-1 ",children:[d("div",{class:"flex-grow",children:r}),d(Ct,{class:"flex items-center justify-center"})]})]})},Jn=()=>{const e=L(null);return V(()=>{var t;(t=e.current)==null||t.focus()},[]),e},Ja=["true","false"],iv=Cd(Ja),ov="answer",es="flex items-center gap-2 p-2.5",ts=re(({label:e,...t},r)=>d("button",{class:"bg-lowest ease-expo-out ring-divider text-neutral-12 active:ring-accent-7 active:bg-accent-2 active:text-accent-11 fr block w-full overflow-hidden rounded-2xl px-2.5 py-2.5 ring-2 transition-all selection:bg-transparent",...t,ref:r,children:d("p",{class:"truncate text-center text-base",children:e})})),av=({input:e,onSubmitSuccess:t})=>{const r=Jn();return d("form",{noValidate:!0,class:"",onSubmit:n=>{n.preventDefault();const o=rh(n).value,i=sr(iv,o);t({type:"boolean",value:i==="true"})},children:[d("ul",{class:es,children:Ja.map((n,o)=>d("li",{class:"flex-1",children:d(ts,{ref:o===0?r:null,type:"submit",name:ov,value:n,label:e.config.labels[n]},n)}))}),e.config.optional&&d("div",{class:"px-2 pb-2",children:d(Et,{class:"w-full",type:"button",onClick:()=>t(null)})})]})},Mr=({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,sv=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}),lv=e=>e.reduce((t,r)=>t+r.sizeKb,0),cv=Ar("file"),rs=3,uv=({file:e,class:t,...r})=>{const n=e.name.split(".").pop(),o=e.name.replace(new RegExp(`.${n}$`),"");return d("div",{class:it("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:o}),d("span",{children:[".",n]})]}),d("p",{"aria-label":"File size",class:"text-accent-11",children:qt(e.sizeKb)})]})},ns=({class:e,...t})=>d("li",{class:it("outline-neutral-6 text-neutral-11 bg-neutral-1 block rounded-md px-1 py-0.5 text-xs outline outline-1",e),...t}),is=e=>{const t=e.split(".").pop();if(!t)throw new Error("No file extension found");return t?"."+t:""},dv=({allowedExtensions:e,files:t})=>{const r=e.map(n=>n.toLowerCase());return t.every(n=>r.includes(is(n.name).toLowerCase()))},fv=(e,t)=>{const r=is(e);return`${e.replace(new RegExp(`${r}$`),"").slice(0,t)}${r}`},pv=({input:e,onSubmitSuccess:t})=>{var f;const r=(f=P.current$.value.flow)==null?void 0:f.data.submissions[e.key],[n,o]=G(cv(r)?r.value:[]),[i,a]=G(),s=n.length-rs,l=lv(n),u=Jn();return d("form",{class:"flex flex-col gap-1 p-2.5",onSubmit:c=>(c.preventDefault(),a(void 0),n.length===0?a({type:"required",message:"Please select a file"}):e.config.extensions.length>0&&!dv({allowedExtensions:e.config.extensions,files:n})?a({type:"validate",message:`Please upload ${e.config.extensions.join(", ")} files only`}):e.config.fileSizeLimitKib&&l>e.config.fileSizeLimitKib?a({type:"max",message:`File size exceeds limit of ${qt(e.config.fileSizeLimitKib)}`}):e.config.allowMultiple===!1&&n.length>1?a({type:"invalid",message:"Only one file is allowed"}):t({type:"file",value: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(W,{children:[d("ul",{class:"flex max-w-full flex-wrap justify-center gap-1 overflow-hidden p-1",children:[n.slice(0,rs).map(c=>{const h=c.name.split(".").pop(),g=c.name.replace(new RegExp(`.${h}$`),"");return d(ns,{class:"flex overflow-hidden",children:[d("span",{class:"block truncate",children:g}),d("span",{children:[".",h]})]})}),s>0?d(ns,{children:["+",s," file",s!==1?"s":""]}):null]}),d("p",{class:"text-neutral-11 text-xs",children:[qt(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 ",qt(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=>{xe(c.target instanceof HTMLInputElement);const h=c.target.files?Array.from(c.target.files):[],g=await Promise.allSettled(h.map(async v=>{const _=await sv(v);return{name:fv(v.name,42),data:_,sizeKb:v.size/1e3}}));if(g.some(({status:v})=>v==="rejected"))return a({type:"invalid",message:"Invalid file"});const m=g.map(v=>v.status==="fulfilled"?v.value:null).filter(Boolean);o(m)},multiple:e.config.allowMultiple,type:"file",class:"sr-only"})]}),d("div",{class:"flex h-full flex-col items-center gap-2",children:[d(Ct,{disabled:n.length===0}),e.config.optional&&d(Et,{onClick:()=>t(null)})]})]}),d(Mr,{error:i})]})};var Zt=e=>e.type==="checkbox",Ot=e=>e instanceof Date,ue=e=>e==null;const os=e=>typeof e=="object";var ee=e=>!ue(e)&&!Array.isArray(e)&&os(e)&&!Ot(e),hv=e=>ee(e)&&e.target?Zt(e.target)?e.target.checked:e.target.value:e,vv=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,mv=(e,t)=>e.has(vv(t)),bv=e=>{const t=e.constructor&&e.constructor.prototype;return ee(t)&&t.hasOwnProperty("isPrototypeOf")},ei=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Le(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(!(ei&&(e instanceof Blob||e instanceof FileList))&&(r||ee(e)))if(t=r?[]:{},!r&&!bv(e))t=e;else for(const n in e)e.hasOwnProperty(n)&&(t[n]=Le(e[n]));else return e;return t}var Xt=e=>Array.isArray(e)?e.filter(Boolean):[],X=e=>e===void 0,C=(e,t,r)=>{if(!t||!ee(e))return r;const n=Xt(t.split(/[,[\].]+?/)).reduce((o,i)=>ue(o)?o:o[i],e);return X(n)||n===e?X(e[t])?r:e[t]:n},Xe=e=>typeof e=="boolean";const as={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},ke={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Re={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};we.createContext(null);var gv=(e,t,r,n=!0)=>{const o={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(o,i,{get:()=>{const a=i;return t._proxyFormState[a]!==ke.all&&(t._proxyFormState[a]=!n||ke.all),r&&(r[a]=!0),e[a]}});return o},ye=e=>ee(e)&&!Object.keys(e).length,yv=(e,t,r,n)=>{r(e);const{name:o,...i}=e;return ye(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(a=>t[a]===(!n||ke.all))},ti=e=>Array.isArray(e)?e:[e];function _v(e){const t=we.useRef(e);t.current=e,we.useEffect(()=>{const r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}},[e.disabled])}var Ie=e=>typeof e=="string",wv=(e,t,r,n,o)=>Ie(e)?(n&&t.watch.add(e),C(r,e,o)):Array.isArray(e)?e.map(i=>(n&&t.watch.add(i),C(r,i))):(n&&(t.watchAll=!0),r),ri=e=>/^\w*$/.test(e),ss=e=>Xt(e.replace(/["|']|\]/g,"").split(/\.|\[/));function z(e,t,r){let n=-1;const o=ri(t)?[t]:ss(t),i=o.length,a=i-1;for(;++n<i;){const s=o[n];let l=r;if(n!==a){const u=e[s];l=ee(u)||Array.isArray(u)?u:isNaN(+o[n+1])?{}:[]}e[s]=l,e=e[s]}return e}var ls=(e,t,r,n,o)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:o||!0}}:{},cs=e=>({isOnSubmit:!e||e===ke.onSubmit,isOnBlur:e===ke.onBlur,isOnChange:e===ke.onChange,isOnAll:e===ke.all,isOnTouch:e===ke.onTouched}),us=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Fr=(e,t,r,n)=>{for(const o of r||Object.keys(e)){const i=C(e,o);if(i){const{_f:a,...s}=i;if(a){if(a.refs&&a.refs[0]&&t(a.refs[0],o)&&!n)break;if(a.ref&&t(a.ref,a.name)&&!n)break}else ee(s)&&Fr(s,t)}}};var xv=(e,t,r)=>{const n=Xt(C(e,r));return z(n,"root",t[r]),z(e,r,n),e},ni=e=>e.type==="file",Qe=e=>typeof e=="function",Lr=e=>{if(!ei)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Rr=e=>Ie(e),ii=e=>e.type==="radio",Vr=e=>e instanceof RegExp;const ds={value:!1,isValid:!1},fs={value:!0,isValid:!0};var ps=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&&!X(e[0].attributes.value)?X(e[0].value)||e[0].value===""?fs:{value:e[0].value,isValid:!0}:fs:ds}return ds};const hs={isValid:!1,value:null};var vs=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,hs):hs;function ms(e,t,r="validate"){if(Rr(e)||Array.isArray(e)&&e.every(Rr)||Xe(e)&&!e)return{type:r,message:Rr(e)?e:"",ref:t}}var It=e=>ee(e)&&!Vr(e)?e:{value:e,message:""},bs=async(e,t,r,n,o)=>{const{ref:i,refs:a,required:s,maxLength:l,minLength:u,min:f,max:c,pattern:h,validate:g,name:m,valueAsNumber:v,mount:_,disabled:x}=e._f,w=C(t,m);if(!_||x)return{};const O=a?a[0]:i,A=j=>{n&&O.reportValidity&&(O.setCustomValidity(Xe(j)?"":j||""),O.reportValidity())},I={},U=ii(i),q=Zt(i),N=U||q,M=(v||ni(i))&&X(i.value)&&X(w)||Lr(i)&&i.value===""||w===""||Array.isArray(w)&&!w.length,ae=ls.bind(null,m,r,I),te=(j,F,Q,pe=Re.maxLength,_e=Re.minLength)=>{const Ae=j?F:Q;I[m]={type:j?pe:_e,message:Ae,ref:i,...ae(j?pe:_e,Ae)}};if(o?!Array.isArray(w)||!w.length:s&&(!N&&(M||ue(w))||Xe(w)&&!w||q&&!ps(a).isValid||U&&!vs(a).isValid)){const{value:j,message:F}=Rr(s)?{value:!!s,message:s}:It(s);if(j&&(I[m]={type:Re.required,message:F,ref:O,...ae(Re.required,F)},!r))return A(F),I}if(!M&&(!ue(f)||!ue(c))){let j,F;const Q=It(c),pe=It(f);if(!ue(w)&&!isNaN(w)){const _e=i.valueAsNumber||w&&+w;ue(Q.value)||(j=_e>Q.value),ue(pe.value)||(F=_e<pe.value)}else{const _e=i.valueAsDate||new Date(w),Ae=Ur=>new Date(new Date().toDateString()+" "+Ur),ct=i.type=="time",Jt=i.type=="week";Ie(Q.value)&&w&&(j=ct?Ae(w)>Ae(Q.value):Jt?w>Q.value:_e>new Date(Q.value)),Ie(pe.value)&&w&&(F=ct?Ae(w)<Ae(pe.value):Jt?w<pe.value:_e<new Date(pe.value))}if((j||F)&&(te(!!j,Q.message,pe.message,Re.max,Re.min),!r))return A(I[m].message),I}if((l||u)&&!M&&(Ie(w)||o&&Array.isArray(w))){const j=It(l),F=It(u),Q=!ue(j.value)&&w.length>+j.value,pe=!ue(F.value)&&w.length<+F.value;if((Q||pe)&&(te(Q,j.message,F.message),!r))return A(I[m].message),I}if(h&&!M&&Ie(w)){const{value:j,message:F}=It(h);if(Vr(j)&&!w.match(j)&&(I[m]={type:Re.pattern,message:F,ref:i,...ae(Re.pattern,F)},!r))return A(F),I}if(g){if(Qe(g)){const j=await g(w,t),F=ms(j,O);if(F&&(I[m]={...F,...ae(Re.validate,F.message)},!r))return A(F.message),I}else if(ee(g)){let j={};for(const F in g){if(!ye(j)&&!r)break;const Q=ms(await g[F](w,t),O,F);Q&&(j={...Q,...ae(F,Q.message)},A(Q.message),r&&(I[m]=j))}if(!ye(j)&&(I[m]={ref:O,...j},!r))return I}}return A(!0),I};function kv(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=X(e)?n++:e[t[n++]];return e}function $v(e){for(const t in e)if(e.hasOwnProperty(t)&&!X(e[t]))return!1;return!0}function oe(e,t){const r=Array.isArray(t)?t:ri(t)?[t]:ss(t),n=r.length===1?e:kv(e,r),o=r.length-1,i=r[o];return n&&delete n[i],o!==0&&(ee(n)&&ye(n)||Array.isArray(n)&&$v(n))&&oe(e,r.slice(0,-1)),e}function oi(){let e=[];return{get observers(){return e},next:o=>{for(const i of e)i.next&&i.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(i=>i!==o)}}),unsubscribe:()=>{e=[]}}}var jr=e=>ue(e)||!os(e);function lt(e,t){if(jr(e)||jr(t))return e===t;if(Ot(e)&&Ot(t))return e.getTime()===t.getTime();const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const o of r){const i=e[o];if(!n.includes(o))return!1;if(o!=="ref"){const a=t[o];if(Ot(i)&&Ot(a)||ee(i)&&ee(a)||Array.isArray(i)&&Array.isArray(a)?!lt(i,a):i!==a)return!1}}return!0}var gs=e=>e.type==="select-multiple",Sv=e=>ii(e)||Zt(e),ai=e=>Lr(e)&&e.isConnected,ys=e=>{for(const t in e)if(Qe(e[t]))return!0;return!1};function Br(e,t={}){const r=Array.isArray(e);if(ee(e)||r)for(const n in e)Array.isArray(e[n])||ee(e[n])&&!ys(e[n])?(t[n]=Array.isArray(e[n])?[]:{},Br(e[n],t[n])):ue(e[n])||(t[n]=!0);return t}function _s(e,t,r){const n=Array.isArray(e);if(ee(e)||n)for(const o in e)Array.isArray(e[o])||ee(e[o])&&!ys(e[o])?X(t)||jr(r[o])?r[o]=Array.isArray(e[o])?Br(e[o],[]):{...Br(e[o])}:_s(e[o],ue(t)?{}:t[o],r[o]):r[o]=!lt(e[o],t[o]);return r}var si=(e,t)=>_s(e,t,Br(t)),ws=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>X(e)?e:t?e===""?NaN:e&&+e:r&&Ie(e)?new Date(e):n?n(e):e;function li(e){const t=e.ref;if(!(e.refs?e.refs.every(r=>r.disabled):t.disabled))return ni(t)?t.files:ii(t)?vs(e.refs).value:gs(t)?[...t.selectedOptions].map(({value:r})=>r):Zt(t)?ps(e.refs).value:ws(X(t.value)?e.ref.value:t.value,e)}var Cv=(e,t,r,n)=>{const o={};for(const i of e){const a=C(t,i);a&&z(o,i,a._f)}return{criteriaMode:r,names:[...e],fields:o,shouldUseNativeValidation:n}},Qt=e=>X(e)?e:Vr(e)?e.source:ee(e)?Vr(e.value)?e.value.source:e.value:e,Ev=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function xs(e,t,r){const n=C(e,r);if(n||ri(r))return{error:n,name:r};const o=r.split(".");for(;o.length;){const i=o.join("."),a=C(t,i),s=C(e,i);if(a&&!Array.isArray(a)&&r!==i)return{name:r};if(s&&s.type)return{name:i,error:s};o.pop()}return{name:r}}var Ov=(e,t,r,n,o)=>o.isOnAll?!1:!r&&o.isOnTouch?!(t||e):(r?n.isOnBlur:o.isOnBlur)?!e:(r?n.isOnChange:o.isOnChange)?e:!0,Iv=(e,t)=>!Xt(C(e,t)).length&&oe(e,t);const Av={mode:ke.onSubmit,reValidateMode:ke.onChange,shouldFocusError:!0};function Tv(e={},t){let r={...Av,...e},n={submitCount:0,isDirty:!1,isLoading:Qe(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{},disabled:!1},o={},i=ee(r.defaultValues)||ee(r.values)?Le(r.defaultValues||r.values)||{}:{},a=r.shouldUnregister?{}:Le(i),s={action:!1,mount:!1,watch:!1},l={mount:new Set,unMount:new Set,array:new Set,watch:new Set},u,f=0;const c={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},h={values:oi(),array:oi(),state:oi()},g=e.resetOptions&&e.resetOptions.keepDirtyValues,m=cs(r.mode),v=cs(r.reValidateMode),_=r.criteriaMode===ke.all,x=p=>b=>{clearTimeout(f),f=setTimeout(p,b)},w=async p=>{if(c.isValid||p){const b=r.resolver?ye((await M()).errors):await te(o,!0);b!==n.isValid&&h.state.next({isValid:b})}},O=p=>c.isValidating&&h.state.next({isValidating:p}),A=(p,b=[],y,E,$=!0,k=!0)=>{if(E&&y){if(s.action=!0,k&&Array.isArray(C(o,p))){const T=y(C(o,p),E.argA,E.argB);$&&z(o,p,T)}if(k&&Array.isArray(C(n.errors,p))){const T=y(C(n.errors,p),E.argA,E.argB);$&&z(n.errors,p,T),Iv(n.errors,p)}if(c.touchedFields&&k&&Array.isArray(C(n.touchedFields,p))){const T=y(C(n.touchedFields,p),E.argA,E.argB);$&&z(n.touchedFields,p,T)}c.dirtyFields&&(n.dirtyFields=si(i,a)),h.state.next({name:p,isDirty:F(p,b),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else z(a,p,b)},I=(p,b)=>{z(n.errors,p,b),h.state.next({errors:n.errors})},U=(p,b,y,E)=>{const $=C(o,p);if($){const k=C(a,p,X(y)?C(i,p):y);X(k)||E&&E.defaultChecked||b?z(a,p,b?k:li($._f)):_e(p,k),s.mount&&w()}},q=(p,b,y,E,$)=>{let k=!1,T=!1;const H={name:p};if(!y||E){c.isDirty&&(T=n.isDirty,n.isDirty=H.isDirty=F(),k=T!==H.isDirty);const J=lt(C(i,p),b);T=C(n.dirtyFields,p),J?oe(n.dirtyFields,p):z(n.dirtyFields,p,!0),H.dirtyFields=n.dirtyFields,k=k||c.dirtyFields&&T!==!J}if(y){const J=C(n.touchedFields,p);J||(z(n.touchedFields,p,y),H.touchedFields=n.touchedFields,k=k||c.touchedFields&&J!==y)}return k&&$&&h.state.next(H),k?H:{}},N=(p,b,y,E)=>{const $=C(n.errors,p),k=c.isValid&&Xe(b)&&n.isValid!==b;if(e.delayError&&y?(u=x(()=>I(p,y)),u(e.delayError)):(clearTimeout(f),u=null,y?z(n.errors,p,y):oe(n.errors,p)),(y?!lt($,y):$)||!ye(E)||k){const T={...E,...k&&Xe(b)?{isValid:b}:{},errors:n.errors,name:p};n={...n,...T},h.state.next(T)}O(!1)},M=async p=>r.resolver(a,r.context,Cv(p||l.mount,o,r.criteriaMode,r.shouldUseNativeValidation)),ae=async p=>{const{errors:b}=await M(p);if(p)for(const y of p){const E=C(b,y);E?z(n.errors,y,E):oe(n.errors,y)}else n.errors=b;return b},te=async(p,b,y={valid:!0})=>{for(const E in p){const $=p[E];if($){const{_f:k,...T}=$;if(k){const H=l.array.has(k.name),J=await bs($,a,_,r.shouldUseNativeValidation&&!b,H);if(J[k.name]&&(y.valid=!1,b))break;!b&&(C(J,k.name)?H?xv(n.errors,J,k.name):z(n.errors,k.name,J[k.name]):oe(n.errors,k.name))}T&&await te(T,b,y)}}return y.valid},j=()=>{for(const p of l.unMount){const b=C(o,p);b&&(b._f.refs?b._f.refs.every(y=>!ai(y)):!ai(b._f.ref))&&fi(p)}l.unMount=new Set},F=(p,b)=>(p&&b&&z(a,p,b),!lt(Os(),i)),Q=(p,b,y)=>wv(p,l,{...s.mount?a:X(b)?i:Ie(p)?{[p]:b}:b},y,b),pe=p=>Xt(C(s.mount?a:i,p,e.shouldUnregister?C(i,p,[]):[])),_e=(p,b,y={})=>{const E=C(o,p);let $=b;if(E){const k=E._f;k&&(!k.disabled&&z(a,p,ws(b,k)),$=Lr(k.ref)&&ue(b)?"":b,gs(k.ref)?[...k.ref.options].forEach(T=>T.selected=$.includes(T.value)):k.refs?Zt(k.ref)?k.refs.length>1?k.refs.forEach(T=>(!T.defaultChecked||!T.disabled)&&(T.checked=Array.isArray($)?!!$.find(H=>H===T.value):$===T.value)):k.refs[0]&&(k.refs[0].checked=!!$):k.refs.forEach(T=>T.checked=T.value===$):ni(k.ref)?k.ref.value="":(k.ref.value=$,k.ref.type||h.values.next({name:p,values:{...a}})))}(y.shouldDirty||y.shouldTouch)&&q(p,$,y.shouldTouch,y.shouldDirty,!0),y.shouldValidate&&di(p)},Ae=(p,b,y)=>{for(const E in b){const $=b[E],k=`${p}.${E}`,T=C(o,k);(l.array.has(p)||!jr($)||T&&!T._f)&&!Ot($)?Ae(k,$,y):_e(k,$,y)}},ct=(p,b,y={})=>{const E=C(o,p),$=l.array.has(p),k=Le(b);z(a,p,k),$?(h.array.next({name:p,values:{...a}}),(c.isDirty||c.dirtyFields)&&y.shouldDirty&&h.state.next({name:p,dirtyFields:si(i,a),isDirty:F(p,k)})):E&&!E._f&&!ue(k)?Ae(p,k,y):_e(p,k,y),us(p,l)&&h.state.next({...n}),h.values.next({name:p,values:{...a}}),!s.mount&&t()},Jt=async p=>{const b=p.target;let y=b.name,E=!0;const $=C(o,y),k=()=>b.type?li($._f):hv(p),T=H=>{E=Number.isNaN(H)||H===C(a,y,H)};if($){let H,J;const Hr=k(),Tt=p.type===as.BLUR||p.type===as.FOCUS_OUT,fm=!Ev($._f)&&!r.resolver&&!C(n.errors,y)&&!$._f.deps||Ov(Tt,C(n.touchedFields,y),n.isSubmitted,v,m),hi=us(y,l,Tt);z(a,y,Hr),Tt?($._f.onBlur&&$._f.onBlur(p),u&&u(0)):$._f.onChange&&$._f.onChange(p);const vi=q(y,Hr,Tt,!1),pm=!ye(vi)||hi;if(!Tt&&h.values.next({name:y,type:p.type,values:{...a}}),fm)return c.isValid&&w(),pm&&h.state.next({name:y,...hi?{}:vi});if(!Tt&&hi&&h.state.next({...n}),O(!0),r.resolver){const{errors:Fs}=await M([y]);if(T(Hr),E){const hm=xs(n.errors,o,y),Ls=xs(Fs,o,hm.name||y);H=Ls.error,y=Ls.name,J=ye(Fs)}}else H=(await bs($,a,_,r.shouldUseNativeValidation))[y],T(Hr),E&&(H?J=!1:c.isValid&&(J=await te(o,!0)));E&&($._f.deps&&di($._f.deps),N(y,J,H,vi))}},Ur=(p,b)=>{if(C(n.errors,b)&&p.focus)return p.focus(),1},di=async(p,b={})=>{let y,E;const $=ti(p);if(O(!0),r.resolver){const k=await ae(X(p)?p:$);y=ye(k),E=p?!$.some(T=>C(k,T)):y}else p?(E=(await Promise.all($.map(async k=>{const T=C(o,k);return await te(T&&T._f?{[k]:T}:T)}))).every(Boolean),!(!E&&!n.isValid)&&w()):E=y=await te(o);return h.state.next({...!Ie(p)||c.isValid&&y!==n.isValid?{}:{name:p},...r.resolver||!p?{isValid:y}:{},errors:n.errors,isValidating:!1}),b.shouldFocus&&!E&&Fr(o,Ur,p?$:l.mount),E},Os=p=>{const b={...i,...s.mount?a:{}};return X(p)?b:Ie(p)?C(b,p):p.map(y=>C(b,y))},Is=(p,b)=>({invalid:!!C((b||n).errors,p),isDirty:!!C((b||n).dirtyFields,p),isTouched:!!C((b||n).touchedFields,p),error:C((b||n).errors,p)}),lm=p=>{p&&ti(p).forEach(b=>oe(n.errors,b)),h.state.next({errors:p?n.errors:{}})},As=(p,b,y)=>{const E=(C(o,p,{_f:{}})._f||{}).ref;z(n.errors,p,{...b,ref:E}),h.state.next({name:p,errors:n.errors,isValid:!1}),y&&y.shouldFocus&&E&&E.focus&&E.focus()},cm=(p,b)=>Qe(p)?h.values.subscribe({next:y=>p(Q(void 0,b),y)}):Q(p,b,!0),fi=(p,b={})=>{for(const y of p?ti(p):l.mount)l.mount.delete(y),l.array.delete(y),b.keepValue||(oe(o,y),oe(a,y)),!b.keepError&&oe(n.errors,y),!b.keepDirty&&oe(n.dirtyFields,y),!b.keepTouched&&oe(n.touchedFields,y),!r.shouldUnregister&&!b.keepDefaultValue&&oe(i,y);h.values.next({values:{...a}}),h.state.next({...n,...b.keepDirty?{isDirty:F()}:{}}),!b.keepIsValid&&w()},Ts=({disabled:p,name:b,field:y,fields:E,value:$})=>{if(Xe(p)){const k=p?void 0:X($)?li(y?y._f:C(E,b)._f):$;z(a,b,k),q(b,k,!1,!1,!0)}},pi=(p,b={})=>{let y=C(o,p);const E=Xe(b.disabled);return z(o,p,{...y||{},_f:{...y&&y._f?y._f:{ref:{name:p}},name:p,mount:!0,...b}}),l.mount.add(p),y?Ts({field:y,disabled:b.disabled,name:p}):U(p,!0,b.value),{...E?{disabled:b.disabled}:{},...r.progressive?{required:!!b.required,min:Qt(b.min),max:Qt(b.max),minLength:Qt(b.minLength),maxLength:Qt(b.maxLength),pattern:Qt(b.pattern)}:{},name:p,onChange:Jt,onBlur:Jt,ref:$=>{if($){pi(p,b),y=C(o,p);const k=X($.value)&&$.querySelectorAll&&$.querySelectorAll("input,select,textarea")[0]||$,T=Sv(k),H=y._f.refs||[];if(T?H.find(J=>J===k):k===y._f.ref)return;z(o,p,{_f:{...y._f,...T?{refs:[...H.filter(ai),k,...Array.isArray(C(i,p))?[{}]:[]],ref:{type:k.type,name:p}}:{ref:k}}}),U(p,!1,void 0,k)}else y=C(o,p,{}),y._f&&(y._f.mount=!1),(r.shouldUnregister||b.shouldUnregister)&&!(mv(l.array,p)&&s.action)&&l.unMount.add(p)}}},Ps=()=>r.shouldFocusError&&Fr(o,Ur,l.mount),um=p=>{Xe(p)&&(h.state.next({disabled:p}),Fr(o,b=>{b.disabled=p},0,!1))},Ds=(p,b)=>async y=>{y&&(y.preventDefault&&y.preventDefault(),y.persist&&y.persist());let E=Le(a);if(h.state.next({isSubmitting:!0}),r.resolver){const{errors:$,values:k}=await M();n.errors=$,E=k}else await te(o);oe(n.errors,"root"),ye(n.errors)?(h.state.next({errors:{}}),await p(E,y)):(b&&await b({...n.errors},y),Ps(),setTimeout(Ps)),h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ye(n.errors),submitCount:n.submitCount+1,errors:n.errors})},dm=(p,b={})=>{C(o,p)&&(X(b.defaultValue)?ct(p,C(i,p)):(ct(p,b.defaultValue),z(i,p,b.defaultValue)),b.keepTouched||oe(n.touchedFields,p),b.keepDirty||(oe(n.dirtyFields,p),n.isDirty=b.defaultValue?F(p,C(i,p)):F()),b.keepError||(oe(n.errors,p),c.isValid&&w()),h.state.next({...n}))},Ns=(p,b={})=>{const y=p?Le(p):i,E=Le(y),$=p&&!ye(p)?E:i;if(b.keepDefaultValues||(i=y),!b.keepValues){if(b.keepDirtyValues||g)for(const k of l.mount)C(n.dirtyFields,k)?z($,k,C(a,k)):ct(k,C($,k));else{if(ei&&X(p))for(const k of l.mount){const T=C(o,k);if(T&&T._f){const H=Array.isArray(T._f.refs)?T._f.refs[0]:T._f.ref;if(Lr(H)){const J=H.closest("form");if(J){J.reset();break}}}}o={}}a=e.shouldUnregister?b.keepDefaultValues?Le(i):{}:Le($),h.array.next({values:{...$}}),h.values.next({values:{...$}})}l={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!s.mount&&t(),s.mount=!c.isValid||!!b.keepIsValid,s.watch=!!e.shouldUnregister,h.state.next({submitCount:b.keepSubmitCount?n.submitCount:0,isDirty:b.keepDirty?n.isDirty:!!(b.keepDefaultValues&&!lt(p,i)),isSubmitted:b.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:b.keepDirtyValues?n.dirtyFields:b.keepDefaultValues&&p?si(i,p):{},touchedFields:b.keepTouched?n.touchedFields:{},errors:b.keepErrors?n.errors:{},isSubmitSuccessful:b.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},Ms=(p,b)=>Ns(Qe(p)?p(a):p,b);return{control:{register:pi,unregister:fi,getFieldState:Is,handleSubmit:Ds,setError:As,_executeSchema:M,_getWatch:Q,_getDirty:F,_updateValid:w,_removeUnmounted:j,_updateFieldArray:A,_updateDisabledField:Ts,_getFieldArray:pe,_reset:Ns,_resetDefaultValues:()=>Qe(r.defaultValues)&&r.defaultValues().then(p=>{Ms(p,r.resetOptions),h.state.next({isLoading:!1})}),_updateFormState:p=>{n={...n,...p}},_disableForm:um,_subjects:h,_proxyFormState:c,get _fields(){return o},get _formValues(){return a},get _state(){return s},set _state(p){s=p},get _defaultValues(){return i},get _names(){return l},set _names(p){l=p},get _formState(){return n},set _formState(p){n=p},get _options(){return r},set _options(p){r={...r,...p}}},trigger:di,register:pi,handleSubmit:Ds,watch:cm,setValue:ct,getValues:Os,reset:Ms,resetField:dm,clearErrors:lm,unregister:fi,setError:As,setFocus:(p,b={})=>{const y=C(o,p),E=y&&y._f;if(E){const $=E.refs?E.refs[0]:E.ref;$.focus&&($.focus(),b.shouldSelect&&$.select())}},getFieldState:Is}}function ci(e={}){const t=we.useRef(),r=we.useRef(),[n,o]=we.useState({isDirty:!1,isValidating:!1,isLoading:Qe(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},disabled:!1,defaultValues:Qe(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...Tv(e,()=>o(a=>({...a}))),formState:n});const i=t.current.control;return i._options=e,_v({subject:i._subjects.state,next:a=>{yv(a,i._proxyFormState,i._updateFormState,!0)&&o({...i._formState})}}),we.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),we.useEffect(()=>{if(i._proxyFormState.isDirty){const a=i._getDirty();a!==n.isDirty&&i._subjects.state.next({isDirty:a})}},[i,n.isDirty]),we.useEffect(()=>{e.values&&!lt(e.values,r.current)?(i._reset(e.values,i._options.resetOptions),r.current=e.values):i._resetDefaultValues()},[e.values,i]),we.useEffect(()=>{i._state.mount||(i._updateValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=gv(n,i),t.current}var ks=function(e,t,r){if(e&&"reportValidity"in e){var n=C(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Pv=function(e,t){var r=function(o){var i=t.fields[o];i&&i.ref&&"reportValidity"in i.ref?ks(i.ref,o,e):i.refs&&i.refs.forEach(function(a){return ks(a,o,e)})};for(var n in t.fields)r(n)},Dv=function(e,t){t.shouldUseNativeValidation&&Pv(e,t);var r={};for(var n in e){var o=C(t.fields,n),i=Object.assign(e[n]||{},{ref:o&&o.ref});if(Mv(t.names||Object.keys(e),n)){var a=Object.assign({},Nv(C(r,n)));z(a,"root",i),z(r,n,a)}else z(r,n,i)}return r},Nv=function(e){return Array.isArray(e)?e.filter(Boolean):[]},Mv=function(e,t){return e.some(function(r){return r.startsWith(t+".")})},Fv=function(e,t){for(var r={};e.issues.length;){var n=e.issues[0];if(n.path){var o=n.path.map(function(s){return s.key}).join(".");if(r[o]||(r[o]={message:n.message,type:n.validation}),t){var i=r[o].types,a=i&&i[n.validation];r[o]=ls(o,t,r,n.validation,a?[].concat(a,n.message):n.message)}e.issues.shift()}}return r},ui=function(e,t,r){return r===void 0&&(r={}),function(n,o,i){try{return Promise.resolve(function(a,s){try{var l=function(){function u(c){return{values:r.raw?n:c,errors:{}}}var f=Object.assign({},{abortEarly:!1,abortPipeEarly:!1},t);return r.mode==="sync"?u(sr(e,n,f)):Promise.resolve(Ad(e,n,f)).then(u)}()}catch(u){return s(u)}return l&&l.then?l.then(void 0,s):l}(0,function(a){if(a instanceof tn)return{values:{},errors:Dv(Fv(a,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw a}))}catch(a){return Promise.reject(a)}}};const $s=27,Ss=12,Cs=10,Lv=Ar("enum"),Rv=e=>{const t={min:e.minSelected??0,max:e.maxSelected??e.options.length};return ui(Ne({checked:to(eo(Qi()),r=>Object.entries(r).filter(([n,o])=>o).map(([n,o])=>n),[Rt(t.max,`Please select at most ${t.max} option${t.max!==1?"s":""}`),ro(t.min,`Please select at least ${t.min} option${t.min!==1?"s":""}`)])}))},Vv=re(({option:e,...t},r)=>d(W,{children:[d("input",{class:"peer sr-only h-full",type:"checkbox",...t,ref:r}),d("label",{class:"bg-lowest hover:bg-neutral-2 active:outline-neutral-8 ease-expo-out outline-divider text-neutral-11 peer-checked:outline-accent-7 peer-checked:bg-accent-2 peer-checked:text-accent-9 peer-focus-visible:ring-accent-9 peer-focus-visible:ring-offset-accent-7 block cursor-pointer select-none rounded-2xl px-3 py-1.5 outline outline-1 ring-0 ring-transparent transition-all selection:bg-transparent peer-focus-visible:ring-4",htmlFor:t.id,children:e.label})]})),Es=xr("gutter-stable flex w-full flex-1 flex-wrap gap-3 overflow-y-auto rounded-xl p-2.5 pr-4",{variants:{variant:{singleOption:"justify-center",booleanLike:es}}}),jv=({input:e,onSubmitSuccess:t})=>{var u,f;const r=e.key?(u=P.current$.value.flow)==null?void 0:u.data.submissions[e.key]:void 0,n=(e.config.minSelected===1||e.config.minSelected===void 0)&&e.config.maxSelected===1,o=n&&e.config.options.length===2,{register:i,handleSubmit:a,formState:{errors:s}}=ci({defaultValues:{checked:n?{}:Lv(r)?Object.fromEntries(r.value.map(c=>[c,!0])):{}},resolver:Rv(e.config)}),l=Jn();return o?d("ul",{style:{maxHeight:6.5*$s+5*Ss+2*Cs},class:Es({variant:"booleanLike"}),children:e.config.options.map((c,h)=>d("li",{class:"flex-1",children:d(ts,{type:"submit",ref:g=>{g&&h===0&&(l.current=g)},label:c.label,value:"true",onClick:()=>t({type:"enum",value:[c.value]})})},c.value))}):d("form",{noValidate:!0,onSubmit:c=>a(h=>{const g=h.checked;t({type:"enum",value:g})})(c),children:[d("div",{class:"flex items-center gap-1",children:[d("ul",{style:{maxHeight:6.5*$s+5*Ss+2*Cs},class:Es({variant:e.config.options.length===1?"singleOption":void 0}),children:e.config.options.map((c,h)=>{const g=`checked.${c.value}`,{ref:m,...v}=i(g);return d("li",{class:"relative",children:d(Vv,{option:c,autoFocus:h===0,ref:_=>{_&&h===0&&(l.current=_),m(_)},id:g,...v,onClick:n?()=>t({type:"enum",value:[c.value]}):void 0})},c.value)})}),d("div",{class:"flex flex-col items-center gap-2 pr-2.5 pt-2.5",children:[n?null:d(Ct,{}),e.config.minSelected===0&&d(Et,{type:"button",onClick:()=>t({type:"enum",value:[]})})]})]}),d("div",{class:"px-1",children:d(Mr,{error:(f=s.checked)==null?void 0:f.root})})]})},Bv=Ar("number"),zr={number:()=>"Please enter a valid number",min:e=>`Please enter a number greater than or equal to ${e}`,max:e=>`Please enter a number less than or equal to ${e}`,decimalCases:e=>`Please enter a number with at most ${e} decimal cases`},zv=e=>{const t=e.min??Number.MIN_SAFE_INTEGER,r=e.max??Number.MAX_SAFE_INTEGER,n=e.decimalCases??0;return ui(Ne({number:rn(zr.number(),[Md(t,zr.min(t)),Nd(r,zr.max(r)),Pd(o=>o===Number(o.toFixed(n)),zr.decimalCases(n))])}))},Uv=({input:e,onSubmitSuccess:t})=>{var f;const r=e.config.defaultValue,n=e.key?(f=P.current$.value.flow)==null?void 0:f.data.submissions[e.key]:void 0,{register:o,handleSubmit:i,formState:{errors:a}}=ci({defaultValues:{number:r?Number(r):Bv(n)?n.value:void 0},resolver:zv(e.config)}),{ref:s,...l}=o("number",{required:!e.config.optional,valueAsNumber:!0}),u=L();return he(()=>{u.current&&(u.current.focus(),u.current.select())},[]),d("form",{class:"flex flex-col gap-1 p-2.5",onSubmit:i(c=>{c.number!==void 0&&t({type:"number",value:c.number})}),children:[d("div",{class:"flex items-center gap-2",children:[d("div",{class:"relative min-w-0 flex-grow",children:[d("input",{...l,id:"chat-input",autocomplete:"off",autoCapitalize:"off",autoCorrect:"off",autoFocus:!0,ref:c=>{c&&(u.current=c),s(c)},type:"text",min:e.config.min,max:e.config.max,class:"outline-divider ease-expo-out placeholder:text-neutral-10 text-neutral-12 focus-visible:outline-accent-7 caret-accent-9 bg-lowest [type=number:-webkit-inner-spin-button] w-full rounded-full px-3 py-1 text-base outline outline-2 transition-all [-webkit-outer-spin-button:none]",placeholder:e.config.placeholder}),e.config.optional&&d(Et,{class:"absolute right-0 top-0",onClick:()=>t(null)})]}),d(Ct,{})]}),d(Mr,{error:a.number})]})},Hv=({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"})]})]})})}),At={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"},qv=$e(At.phone,[Fd(/^\+?[0-9 -]+$/,At.phone)]),Kv={email:{type:"email",inputMode:"email",formNoValidate:!0},phone:{type:"tel",inputMode:"tel"},text:{type:"text",inputMode:"text"},url:{type:"url",inputMode:"url",formNoValidate:!0}},Wv=Ar("string"),Gv=e=>{const t=`Please enter no more than ${e.maxChars} characters`;return ui(Ne({text:{email:$e(At.email,[Dd(At.email),Rt(e.maxChars??1/0,t)]),phone:to(qv,r=>r.replace(/[^0-9]/g,""),[Rt(e.maxChars??1/0,t)]),text:$e([ro(1,At.empty),Rt(e.maxChars??1/0,t)]),url:$e([Ld(At.url),Rt(e.maxChars??1/0,t)])}[e.format]}))},Yv=({input:e,onSubmitSuccess:t})=>{var f;const r=e.key?(f=P.current$.value.flow)==null?void 0:f.data.submissions[e.key]:void 0,n=e.config.defaultValue,{register:o,handleSubmit:i,formState:{errors:a}}=ci({defaultValues:{text:n||(Wv(r)?r.value:"")},resolver:Gv(e.config)}),{ref:s,...l}=o("text",{required:!e.config.optional}),u=L();return he(()=>{u.current&&(u.current.focus(),u.current.select())},[]),d("form",{noValidate:!0,class:"flex flex-col gap-1 p-2.5",onSubmit:i(c=>{t({type:"string",value: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,...Kv[e.config.format],autocomplete:"off",autoCapitalize:"off",autoCorrect:"off",autoFocus:!0,ref:c=>{c&&(u.current=c),s(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(Et,{class:"absolute right-0 top-0",onClick:()=>t(null)})]}),d(Ct,{})]}),d(Mr,{error:a.text})]})},Zv=()=>{var o;const e=(o=P.current$.value.flow)==null?void 0:o.data.currentInput,[t,r]=qh(),n=L(null);return P.inputHeight$.value=r.height,V(()=>{const i=n.current;if(i)return i.addEventListener("transitionstart",Z.scrollToEnd.smooth),i.addEventListener("transitioncancel",Z.scrollToEnd.smooth),i.addEventListener("transitionend",Z.scrollToEnd.smooth),()=>{i.removeEventListener("transitionstart",Z.scrollToEnd.smooth),i.removeEventListener("transitioncancel",Z.scrollToEnd.smooth),i.removeEventListener("transitionend",Z.scrollToEnd.smooth)}},[]),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:Ke({input:e}).with({input:Oe.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(Ct,{disabled:!0,"aria-hidden":"true",tabIndex:-1})]})).with({input:{type:"text"}},i=>d(Yv,{onSubmitSuccess:Z.onSubmitSuccessFn$.value,...i})).with({input:{type:"multiple-choice"}},i=>d(jv,{onSubmitSuccess:Z.onSubmitSuccessFn$.value,...i})).with({input:{type:"boolean"}},i=>d(av,{onSubmitSuccess:Z.onSubmitSuccessFn$.value,...i})).with({input:{type:"file"}},i=>d(pv,{onSubmitSuccess:Z.onSubmitSuccessFn$.value,...i})).with({input:{type:"submit"}},i=>d(Hv,{onSubmitSuccess:Z.onSubmitSuccessFn$.value,...i})).with({input:{type:"address"}},i=>d(tv,{onSubmitSuccess:Z.onSubmitSuccessFn$.value,...i})).with({input:{type:"number"}},i=>d(Uv,{onSubmitSuccess:Z.onSubmitSuccessFn$.value,...i})).exhaustive()})})},Xv=xr("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"}}),Qv=({children:e,className:t,animate:r,side:n,...o})=>d("p",{style:{transformOrigin:n==="left"?"0% 50%":"100% 50%"},class:Xv({className:t,side:n,animate:r}),...o,children:e}),Jv=({message:e})=>d("div",{class:"bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl px-2 py-2",children:d("a",{onClick:e.onClick,class:"bg-lowest shadow-surface-sm ring-accent-6 hover:ring-accent-8 active:bg-accent-2 active:text-accent-10 text-accent-9 focus-visible:ring-accent-7/50 text-wrap-balance flex items-center gap-1.5 rounded-full py-2 pl-4 pr-2.5 text-center no-underline ring-1 transition-all focus:outline-none focus-visible:ring-4 focus-visible:ring-offset-2",target:"_blank",href:e.href,children:[e.text,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"})})]})}),em=({className:e,...t})=>(V(()=>{Z.scrollToEnd.smooth()}),d("div",{"aria-hidden":!0,children:Z.isBotTyping$.value===!0?d("div",{"aria-label":"Typing…",class:it("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})),tm={bot:"left",user:"right"},rm=xr("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]"}}}),nm=({lastSentMessageFooter:e})=>{var r;const t=((r=P.current$.value.flow)==null?void 0:r.data.messages)??[];return V(()=>{Z.scrollToEnd.smooth()},[t.length]),d("ol",{"aria-label":"Chat messages",class:"mt-auto flex flex-col justify-end gap-2 p-2 pt-[calc(var(--header-height)+1rem)]",children:[t.map((n,o)=>d(W,{children:d("li",{class:"flex",children:Ke(n).with({type:"system"},i=>d("p",{class:rm({variant:i.variant}),children:i.text})).with({type:"text",author:Oe.union("bot","user")},i=>{const a=i.author==="user"&&!t.slice(o+1).some(l=>l.type==="text"&&l.author==="user"),s=o===t.length-1;return d(Qv,{animate:s,side:tm[i.author],children:[i.text,a?e:null]},o)}).with({type:"link"},i=>d(Jv,{message:i})).with({type:"image"},i=>d("img",{class:"shadow-surface-md w-full max-w-[min(100%,24rem)] rounded-2xl",src:i.url,style:{aspectRatio:i.width/i.height}})).with({type:"file"},i=>d(uv,{class:i.author==="bot"?void 0:"ml-auto",file:{name:i.fileName,sizeKb:i.fileSizeKb}})).exhaustive()})},o)),d(em,{},"typing")]})},im=({logger:e,apiClient:t,analytics:r})=>{const{flow:n}=P.current$.value;xe(n,"Flow is required to exist to show chatbot body");const o=P.viewState$.value,{chatRef:i,chatService:a}=Xh(),[s,l]=G();return he(()=>{o==="maximised"&&Z.scrollToEnd.instant()},[o]),he(()=>{var v,_;const{state:u,flow:f}=P.current$.peek();if(u!=="loaded")throw new Error(mh.invalid_state);let c=f.data.nodeHistory.at(-1);if(Z.scrollToEnd.instant(),P.setInput(void 0),f.data.isFinished)return;c===void 0?(c=Fa(n.nodes).id,P.setCurrentNodeId(c),r.log({event:"FLOW_START",properties:{flow_id:n.id,flow_version:n.version,flow_session_id:f.data.flowSessionId,flow_build:n.build},customProperties:(v=n.analytics)==null?void 0:v.customProperties})):P.removeMessagesSentByNodeIds([c]);const{interpret:h,abort:g,undo:m}=Ah({context:n.context,analytics:{service:r,customProperties:(_=n.analytics)==null?void 0:_.customProperties},apiClient:t,logger:e,flow:n,chatService:a,getSubmissions:()=>{var x;return(x=P.current$.peek().flow)==null?void 0:x.data.submissions},onInterpret:(x,w)=>{var A;const O=P.current$.peek().flow;xe(O),w&&(O.data.sequence=O.data.sequence+1,r.log({event:"FLOW_NODE",properties:{flow_id:n.id,flow_version:n.version,from_node_id:w.id,flow_build:n.build,to_node_id:x.id,sequence:O.data.sequence,flow_session_id:O.data.flowSessionId},customProperties:(A=n.analytics)==null?void 0:A.customProperties})),P.setCurrentNodeId(x.id)},onFlowEnd:async()=>{var w;P.markAsFinished();const x=P.current$.peek().flow;xe(x),r.log({event:"FLOW_END",properties:{flow_id:n.id,flow_version:n.version,flow_session_id:x.data.flowSessionId,flow_build:n.build},customProperties:(w=n.analytics)==null?void 0:w.customProperties})}});return l(()=>m),h(c),g},[r,t,a,e,n]),d(W,{children:[d("div",{ref:i,className:"hide-scrollbars relative flex w-full max-w-full flex-grow flex-col overflow-y-scroll",style:{WebkitOverflowScrolling:"touch",paddingBottom:P.inputHeight$.value},children:d(nm,{lastSentMessageFooter:n.data.isFinished||!s?null:d(am,{undoFn:s})})}),d(Zv,{})]})},om=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"):[],am=({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}=P.current$.peek();xe(t);const{removed:r}=e(t.data.nodeHistory),n=t.data.nodeHistory.splice(-r);n.length!==0&&(P.removeMessagesSentByNodeIds(n),P.setInput(void 0),n.pop(),n.map(o=>t.nodes.find(i=>i.id===o)).filter(Boolean).flatMap(om).forEach(o=>delete t.data.submissions[o]),P.current$.value={...P.current$.value})},children:"Undo"})}),sm=Object.freeze(Object.defineProperty({__proto__:null,ChatbotBody:im},Symbol.toStringTag,{value:"Module"}))})();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const index = require("./index-
|
|
3
|
+
const index = require("./index-e1616316.cjs");
|
|
4
4
|
require("@inploi/sdk");
|
|
5
5
|
const isIfBlockConditionMet = (ifBlock, {
|
|
6
6
|
context,
|
|
@@ -473,7 +473,6 @@ async function interpretSubmitNode({
|
|
|
473
473
|
href: href.toString(),
|
|
474
474
|
text: "Complete submission",
|
|
475
475
|
onClick: () => {
|
|
476
|
-
alert("kek");
|
|
477
476
|
if (!session_id)
|
|
478
477
|
return logger.error("session_id not set, cannot log FLOW_REDIRECT event");
|
|
479
478
|
analytics.log({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as get$1, i as isString$1, k as kbToReadableSize, a as getHeadOrThrow, b as invariant, A as AbortedError, N, c as getFlowSubmissionsPayload, _, d as getDefaultExportFromCjs, h, e as _$1, p, F, o as o$1, f as clsx, y, s as store, j as a$2, l as debounce$1, m as k, n as k$1, q as getFormSubmitter, r as parse, t as picklist, u as isSubmissionOfType, C as Cn, v as parseAsync, V as ValiError, w as object, x as transform, z as cva, B as maxLength, D as minLength, E as record, G as boolean, H as number, I as minValue, J as maxValue, K as custom, L as string, M as email, O as url, P as regex, Q as ERROR_MESSAGES } from "./index-
|
|
1
|
+
import { g as get$1, i as isString$1, k as kbToReadableSize, a as getHeadOrThrow, b as invariant, A as AbortedError, N, c as getFlowSubmissionsPayload, _, d as getDefaultExportFromCjs, h, e as _$1, p, F, o as o$1, f as clsx, y, s as store, j as a$2, l as debounce$1, m as k, n as k$1, q as getFormSubmitter, r as parse, t as picklist, u as isSubmissionOfType, C as Cn, v as parseAsync, V as ValiError, w as object, x as transform, z as cva, B as maxLength, D as minLength, E as record, G as boolean, H as number, I as minValue, J as maxValue, K as custom, L as string, M as email, O as url, P as regex, Q as ERROR_MESSAGES } from "./index-794ce056.js";
|
|
2
2
|
import "@inploi/sdk";
|
|
3
3
|
const isIfBlockConditionMet = (ifBlock, {
|
|
4
4
|
context,
|
|
@@ -471,7 +471,6 @@ async function interpretSubmitNode({
|
|
|
471
471
|
href: href.toString(),
|
|
472
472
|
text: "Complete submission",
|
|
473
473
|
onClick: () => {
|
|
474
|
-
alert("kek");
|
|
475
474
|
if (!session_id)
|
|
476
475
|
return logger.error("session_id not set, cannot log FLOW_REDIRECT event");
|
|
477
476
|
analytics.log({
|
|
@@ -5312,7 +5312,7 @@ const StatusBar = ({
|
|
|
5312
5312
|
})
|
|
5313
5313
|
});
|
|
5314
5314
|
};
|
|
5315
|
-
const ChatbotBody = M(() => import("./chatbot-body-
|
|
5315
|
+
const ChatbotBody = M(() => import("./chatbot-body-8e509812.js").then((module) => module.ChatbotBody));
|
|
5316
5316
|
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", {
|
|
5317
5317
|
variants: {
|
|
5318
5318
|
view: {
|
|
@@ -5313,7 +5313,7 @@ const StatusBar = ({
|
|
|
5313
5313
|
})
|
|
5314
5314
|
});
|
|
5315
5315
|
};
|
|
5316
|
-
const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-
|
|
5316
|
+
const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-7dbeea50.cjs")).then((module2) => module2.ChatbotBody));
|
|
5317
5317
|
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", {
|
|
5318
5318
|
variants: {
|
|
5319
5319
|
view: {
|
package/dist/plugin-chatbot.cjs
CHANGED
package/dist/plugin-chatbot.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inploi/plugin-chatbot",
|
|
3
|
-
"version": "3.22.
|
|
3
|
+
"version": "3.22.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/plugin-chatbot.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"vite-tsconfig-paths": "^4.2.1",
|
|
69
69
|
"@inploi/core": "1.14.2",
|
|
70
70
|
"@inploi/design-tokens": "0.2.1",
|
|
71
|
-
"@inploi/sdk": "1.14.1",
|
|
72
71
|
"eslint-config-custom": "0.1.0",
|
|
72
|
+
"@inploi/sdk": "1.14.1",
|
|
73
73
|
"tsconfig": "0.1.0"
|
|
74
74
|
},
|
|
75
75
|
"msw": {
|