@feathery/react 2.39.2 → 2.39.3
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/cjs/TwemojiCountryFlags.woff2 +0 -0
- package/cjs/auth/LoginForm.d.ts.map +1 -1
- package/cjs/elements/fields/PhoneField/index.d.ts.map +1 -1
- package/cjs/{fthry_AssistantChat.BSp_EiFF.js → fthry_AssistantChat.Do9Ujq9D.js} +4 -4
- package/cjs/{fthry_FormControl.BAz8KMLW.js → fthry_FormControl.P35fCu0k.js} +1 -1
- package/cjs/{fthry_InlineTooltip.CDXkipwb.js → fthry_InlineTooltip.Bak-7e6n.js} +2 -2
- package/cjs/{fthry_Overlay.wuNAvqeJ.js → fthry_Overlay.DilDYonW.js} +1 -1
- package/cjs/{fthry_PaymentMethodField.DnxZBq-w.js → fthry_PaymentMethodField.C2hrFVnH.js} +4 -4
- package/cjs/{fthry_Placeholder.DrHFBOh_.js → fthry_Placeholder.B3-G02Bh.js} +1 -1
- package/cjs/{fthry_ShowEyeIcon._6ksHPwN.js → fthry_ShowEyeIcon.cKtFl23S.js} +1 -1
- package/cjs/{fthry_highlighted-body-TPN3WLV5.Dp-fvL7C.js → fthry_highlighted-body-TPN3WLV5.BUyd2LkM.js} +3 -3
- package/cjs/{fthry_index.4ZXR8SL9.js → fthry_index.5UEJU5L5.js} +1 -1
- package/cjs/{fthry_index.DUkqZ-as.js → fthry_index.9q-J6H-U.js} +1 -1
- package/cjs/{fthry_index.DSyEDydJ.js → fthry_index.B6DKRqF4.js} +4 -4
- package/cjs/{fthry_index.DzDA3IX8.js → fthry_index.B8dM90us.js} +6 -6
- package/cjs/{fthry_index.DY9ygk0Y.js → fthry_index.BGwV0ujG.js} +14 -6
- package/cjs/{fthry_index.BJajJHtH.js → fthry_index.BW42pxTr.js} +3559 -2367
- package/cjs/{fthry_index.s_5Chdtm.js → fthry_index.BrLNinbH.js} +1 -1
- package/cjs/{fthry_index.Ms9sGsox.js → fthry_index.CIwGx-kQ.js} +3 -3
- package/cjs/{fthry_index.BwalT1tQ.js → fthry_index.CS_Y7wr2.js} +3 -3
- package/cjs/{fthry_index.CuXaIMn3.js → fthry_index.CVmniSIU.js} +1 -1
- package/cjs/{fthry_index.BghgBPkl.js → fthry_index.CZXZNqLu.js} +8 -8
- package/cjs/{fthry_index.E7LuB_Ph.js → fthry_index.CcA1lyx4.js} +2 -2
- package/cjs/{fthry_index.o-LtLkoE.js → fthry_index.ChndtckS.js} +1 -1
- package/cjs/{fthry_index.B5Xu12yG.js → fthry_index.CurkjKk3.js} +1 -1
- package/cjs/{fthry_index.DcCOWhoL.js → fthry_index.CvYB4XZG.js} +6 -6
- package/cjs/{fthry_index.D7xRatdF.js → fthry_index.CzgMz0Zx.js} +2 -2
- package/cjs/{fthry_index.BYvA3D_3.js → fthry_index.DJLW1zLP.js} +6 -6
- package/cjs/{fthry_index.DOYQzCXH.js → fthry_index.DSeQsNLX.js} +1 -1
- package/cjs/{fthry_index.B6SQDsIY.js → fthry_index.DlD_KScI.js} +5 -5
- package/cjs/{fthry_index.BBXxFT_O.js → fthry_index.DqGd-rC0.js} +1 -1
- package/cjs/{fthry_index.CsDimu__.js → fthry_index.MX2rvPw4.js} +5 -5
- package/cjs/{fthry_index.DgNpj-sZ.js → fthry_index.Q01SxjQX.js} +5 -5
- package/cjs/{fthry_index.BghdBLn4.js → fthry_index.Vn_GxZy5.js} +5 -5
- package/cjs/{fthry_index.DnBxm6I1.js → fthry_index.t1eHdn42.js} +1 -1
- package/cjs/{fthry_index.XCniPDI8.js → fthry_index.vXK1VN34.js} +4 -4
- package/cjs/{fthry_input.nJV_eL13.js → fthry_input.C5PNyr0t.js} +1 -1
- package/cjs/{fthry_mermaid-O7DHMXV3.BR_o8JHL.js → fthry_mermaid-O7DHMXV3.ntyfADzr.js} +3 -3
- package/cjs/{fthry_script.CUBMT4WF.js → fthry_script.DROa80lC.js} +1 -1
- package/cjs/{fthry_styles.BGX0fC61.js → fthry_styles.CHUy-8cR.js} +1 -1
- package/cjs/{fthry_useElementSize.Dcu30O6B.js → fthry_useElementSize.PV91LYqP.js} +1 -1
- package/cjs/{fthry_useSalesforceSync.BNT_mind.js → fthry_useSalesforceSync.CNkXldKe.js} +1 -1
- package/cjs/{fthry_webfontloader.DGAKZE20.js → fthry_webfontloader.CgPBmgxa.js} +1 -1
- package/cjs/index.js +1 -1
- package/cjs/integrations/segment.d.ts.map +1 -1
- package/cjs/integrations/utils.d.ts.map +1 -1
- package/dist/TwemojiCountryFlags.woff2 +0 -0
- package/dist/auth/LoginForm.d.ts.map +1 -1
- package/dist/elements/fields/PhoneField/index.d.ts.map +1 -1
- package/dist/{fthry_AssistantChat.884z0Zp7.js → fthry_AssistantChat.7IHFhmWu.js} +4 -4
- package/dist/{fthry_FormControl.CTESUYeJ.js → fthry_FormControl.DPSb7yUR.js} +1 -1
- package/dist/{fthry_InlineTooltip.nfGgJEKf.js → fthry_InlineTooltip.CvjSSGKM.js} +2 -2
- package/dist/{fthry_Overlay.DnqeyVo3.js → fthry_Overlay.BV_vE3K3.js} +1 -1
- package/dist/{fthry_PaymentMethodField.BebObmRD.js → fthry_PaymentMethodField.BRFKNkQe.js} +4 -4
- package/dist/{fthry_Placeholder.DCCeoyfo.js → fthry_Placeholder.Do45acle.js} +1 -1
- package/dist/{fthry_ShowEyeIcon.CgAZDJB7.js → fthry_ShowEyeIcon.DgeKOLlH.js} +1 -1
- package/dist/{fthry_highlighted-body-TPN3WLV5.D42jF_vF.js → fthry_highlighted-body-TPN3WLV5.0WkAj9kk.js} +3 -3
- package/dist/{fthry_index.DNIBLjwI.js → fthry_index.BEPJGeYZ.js} +5 -5
- package/dist/{fthry_index.CrCg7lJr.js → fthry_index.BL77F8L5.js} +5 -5
- package/dist/{fthry_index.CzqvVKao.js → fthry_index.BUpr7PPc.js} +5 -5
- package/dist/{fthry_index.BiCTg964.js → fthry_index.BWutFEHx.js} +1 -1
- package/dist/{fthry_index.COTa1fqp.js → fthry_index.BhXiGbN_.js} +4 -4
- package/dist/{fthry_index.C0pEDMdM.js → fthry_index.BmbcZtaY.js} +1 -1
- package/dist/{fthry_index.NeC1jkrE.js → fthry_index.CLkq8RJ5.js} +4 -4
- package/dist/{fthry_index.CTKw49iT.js → fthry_index.CPJDFJws.js} +1 -1
- package/dist/{fthry_index.DPHqqGOo.js → fthry_index.Cg_MIfff.js} +13 -6
- package/dist/{fthry_index.B7XCRUoo.js → fthry_index.ChwXJfUv.js} +1 -1
- package/dist/{fthry_index.DeeoucaO.js → fthry_index.CpPyr71U.js} +3559 -2367
- package/dist/{fthry_index.B_5l52vt.js → fthry_index.Cq7pT83J.js} +6 -6
- package/dist/{fthry_index.I0vC5XAf.js → fthry_index.D1OVjTFi.js} +1 -1
- package/dist/{fthry_index.By7AocA5.js → fthry_index.DBzRf4Xn.js} +1 -1
- package/dist/{fthry_index.75rkS5d5.js → fthry_index.DCca32vH.js} +3 -3
- package/dist/{fthry_index.CApxuM0r.js → fthry_index.DH2CYFCC.js} +8 -8
- package/dist/{fthry_index.CCS5seyf.js → fthry_index.DIeH1Fha.js} +5 -5
- package/dist/{fthry_index.CvPGodEw.js → fthry_index.DOENWZLY.js} +1 -1
- package/dist/{fthry_index.BIx1vkLQ.js → fthry_index.DYZfE6Eb.js} +2 -2
- package/dist/{fthry_index.YZT4cLIz.js → fthry_index.D_fIGqLO.js} +1 -1
- package/dist/{fthry_index.CJOc-fiI.js → fthry_index.DgtRP8YP.js} +3 -3
- package/dist/{fthry_index.DlskLXaD.js → fthry_index.DjKiRDR5.js} +1 -1
- package/dist/{fthry_index.Bc-4LJH9.js → fthry_index.DuFvbDvW.js} +6 -6
- package/dist/{fthry_index.Diz_2Nyp.js → fthry_index.FI8-xIR_.js} +6 -6
- package/dist/{fthry_index.KgxY79Zs.js → fthry_index.yQ6xXxSy.js} +2 -2
- package/dist/{fthry_input.D7VVukkT.js → fthry_input.DSLxO-Fg.js} +1 -1
- package/dist/{fthry_mermaid-O7DHMXV3.DSccfc1D.js → fthry_mermaid-O7DHMXV3.BAO4irKu.js} +3 -3
- package/dist/{fthry_script.6jrHgqMU.js → fthry_script.Citmw5JL.js} +1 -1
- package/dist/{fthry_styles.T5bAbNxN.js → fthry_styles.jykBHQWz.js} +1 -1
- package/dist/{fthry_useElementSize.B8cKWlMG.js → fthry_useElementSize.C2KEM4Ci.js} +1 -1
- package/dist/{fthry_useSalesforceSync.BafOPFGx.js → fthry_useSalesforceSync.99Af5jox.js} +1 -1
- package/dist/{fthry_webfontloader.CF84T5ds.js → fthry_webfontloader.0HWdUjSQ.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/integrations/segment.d.ts.map +1 -1
- package/dist/integrations/utils.d.ts.map +1 -1
- package/package.json +13 -3
- package/umd/{AssistantChat.2f8dbf760e2412585af9.js → AssistantChat.1d48433115b848b43bb9.js} +1 -1
- package/umd/{DropdownField.36bb515df8083884f0f3.js → DropdownField.9f0f8a425ddf09771ad8.js} +1 -1
- package/umd/{PhoneField.8183bed71fa92767aa3a.js → PhoneField.b9293ead8e5a2a3b7c37.js} +1 -1
- package/umd/{TableElement.8e41e1015eb1543af90b.js → TableElement.1076e69a66923cfe6434.js} +1 -1
- package/umd/e40fbca868d3568f1b57.woff2 +0 -0
- package/umd/index.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(this.webpackChunkFeathery=this.webpackChunkFeathery||[]).push([[917],{9649:(e,t,n)=>{n.r(t),n.d(t,{default:()=>et});var r=n(5944),o=n(7294),i=n(1247),a=n(4790),l=n(4438),u=function(){return u=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},u.apply(this,arguments)},s=function(e){return(0,r.tZ)("svg",u({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},e,{children:(0,r.tZ)("path",{d:"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})}))},c=function(e){return(0,r.tZ)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:(0,r.tZ)("path",{d:"m6 9 6 6 6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))},d=function(e){return(0,r.BX)("svg",u({width:"20",height:"20",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"m22 2-7 20-4-9-9-4 20-7z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"m22 2-11 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},p=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",style:{borderRadius:"50%"},viewBox:"0 0 50 50"},e,{children:[(0,r.tZ)("circle",{cx:25,cy:25,r:22.5,style:{fill:"none",stroke:"#f5cbcb",strokeWidth:3,opacity:1}}),(0,r.tZ)("circle",{cx:25,cy:25,r:22.5,style:{fill:"none",stroke:"#e2626e",strokeWidth:3,opacity:1,strokeLinecap:"round",transformOrigin:"50% 50%",transform:"rotate3d(0,0,1,0deg)",animation:"2156ms ease-in-out 0s infinite normal none running feathery-spinner-arc,1829ms linear 0s infinite normal none running feathery-spinner-rotate"}})]}))},f=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"M18 6 6 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"m6 6 12 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},h=function(e){return(0,r.tZ)("svg",u({width:"14",height:"14",viewBox:"0 0 24 24",fill:"none"},e,{children:(0,r.tZ)("polyline",{points:"20 6 9 17 4 12",stroke:"#10b981",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))},v=function(e){return(0,r.tZ)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:(0,r.tZ)("path",{d:"m6 9 6 6 6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))},y=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"2"}),(0,r.tZ)("rect",{x:"12",y:"12",width:"7",height:"7",rx:"1",stroke:"currentColor",strokeWidth:"2"})]}))},g=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"2"}),(0,r.tZ)("path",{d:"M9 3v18",stroke:"currentColor",strokeWidth:"2"})]}))},m=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"2"}),(0,r.tZ)("path",{d:"M15 3v18",stroke:"currentColor",strokeWidth:"2"})]}))},b=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"M4 9V5a1 1 0 0 1 1-1h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"M20 9V5a1 1 0 0 0-1-1h-4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"M4 15v4a1 1 0 0 0 1 1h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"M20 15v4a1 1 0 0 1-1 1h-4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},x=function(e){return(0,r.tZ)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:(0,r.tZ)("path",{d:"M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}))},k=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"m11 17-5-5 5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"m18 17-5-5 5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},w=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"m6 17 5-5-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"m13 17 5-5-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},S=function(e){return(0,r.BX)("svg",u({width:"12",height:"12",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},C="#6b7280",Z="#f9fafb",_="#e5e7eb",A="#9ca3af",L="#6b7280",j="#1f2937",B="#ef4444",T=function(e,t){var n=parseInt(e.replace("#",""),16),r=Math.min(255,Math.max(0,(n>>16)+Math.round(2.55*t))),o=Math.min(255,Math.max(0,(n>>8&255)+Math.round(2.55*t))),i=Math.min(255,Math.max(0,(255&n)+Math.round(2.55*t)));return"#".concat((r<<16|o<<8|i).toString(16).padStart(6,"0"))},I=function(){return I=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},I.apply(this,arguments)},W=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},z=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},R={searchDocuments:{running:"Searching documents...",done:"Searched the documents"},searchWeb:{running:"Searching the web...",done:"Searched the web"},scrapeUrl:{running:"Reading web page...",done:"Read the web page"},getPanelRuntime:{running:"Reading the page...",done:"Reviewed the page"},getPanelSnapshot:{running:"Reading the form...",done:"Reviewed the form"},getFuserSnapshot:{running:"Looking up your submission...",done:"Reviewed the submission"},listFormExtractions:{running:"Looking up extractions...",done:"Reviewed available extractions"},getExtractionSnapshot:{running:"Reading extraction setup...",done:"Reviewed the extraction setup"},getExtractionResults:{running:"Reading extraction results...",done:"Reviewed the extraction results"},setFieldValue:{running:"Updating form fields...",done:"Updated form fields"},clickElement:{running:"Just a moment...",done:"Triggered a form action"},getLogicRules:{running:"Reading form logic...",done:"Reviewed form logic"}},E=function(e){try{var t=new URL(e);return t.hostname+("/"!==t.pathname?t.pathname:"")}catch(t){return e}},O=function(e){if(!e||"object"!=typeof e)return[];var t=e,n=[],r=function(e){return e.map((function(e){return"object"==typeof e&&null!==e&&e.url||""})).filter(Boolean)};return Array.isArray(t.web)&&n.push.apply(n,z([],W(r(t.web)),!1)),Array.isArray(t.news)&&n.push.apply(n,z([],W(r(t.news)),!1)),Array.isArray(t.images)&&n.push.apply(n,z([],W(r(t.images)),!1)),"string"==typeof t.url&&t.url&&n.push(t.url),n.length>0?Array.from(new Set(n)):Array.isArray(e)?Array.from(new Set(r(e))):[]},M=function(e){return"input-streaming"===e||"input-available"===e},F=function(e){return"output-error"===e},X=function(e){var t,n=e.row,o=e.linkColor,i=e.indent,a=void 0===i?24:i,l=null===(t=n.input)||void 0===t?void 0:t.query,u=O(n.output);return l||u.length>0?(0,r.BX)("div",I({css:{display:"flex",flexDirection:"column",gap:"4px",paddingLeft:"".concat(a,"px"),marginTop:"2px",marginBottom:"4px"}},{children:[l&&(0,r.BX)("div",I({css:{color:A,fontSize:"12px",fontStyle:"italic"}},{children:['"',l.length>80?l.substring(0,80)+"...":l,'"']})),u.map((function(e,t){return(0,r.BX)("a",I({href:e,target:"_blank",rel:"noopener noreferrer",css:{fontSize:"12px",color:o,textDecoration:"none",display:"flex",alignItems:"center",gap:"4px",minWidth:0,":hover":{textDecoration:"underline"}}},{children:[(0,r.tZ)(S,{css:{flexShrink:0}}),(0,r.tZ)("span",I({css:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:E(e)}))]}),t)}))]})):null},K=function(e){var t;return!!(null===(t=e.input)||void 0===t?void 0:t.query)||O(e.output).length>0},D=function(e){var t,n,r=R[e.toolName]||{running:"Working...",done:"Done"};return M(e.state)?r.running:F(e.state)?null!==(t=r.done)&&void 0!==t?t:"Failed":null!==(n=r.done)&&void 0!==n?n:r.running},P={backgroundImage:"linear-gradient(90deg, ".concat(L," 25%, #d1d5db 50%, ").concat(L," 75%)"),backgroundSize:"220% 100%",backgroundClip:"text",WebkitBackgroundClip:"text",color:"transparent",animation:"feathery-tool-shimmer 1.6s linear infinite","@keyframes feathery-tool-shimmer":{from:{backgroundPosition:"160% 0"},to:{backgroundPosition:"-60% 0"}}},N=function(e){var t=e.rows,n=e.followedByText,i=e.turnFinished,a=e.linkColor,l=void 0===a?C:a,u=e.isFirstChunk,s=void 0!==u&&u,d=t.some((function(e){return M(e.state)})),p=!d&&(n||i),h=!(!d&&n),v=W((0,o.useState)(null),2),y=v[0],g=v[1],m=null!=y?y:h,b=function(){return g(!m)},x=I({display:"flex",flexDirection:"column",gap:"2px",fontSize:"13px",minWidth:0,paddingLeft:"".concat(14,"px")},s?{}:{animation:"feathery-chunk-fade-in 220ms ease-out both","@keyframes feathery-chunk-fade-in":{from:{opacity:0,transform:"translateY(4px)"},to:{opacity:1,transform:"translateY(0)"}}});if(p&&1===t.length){var k=t[0],w=F(k.state),S=K(k);return(0,r.BX)("div",I({css:x},{children:[(0,r.BX)("button",I({type:"button",onClick:S?b:void 0,css:{display:"inline-flex",alignItems:"center",gap:"6px",background:"none",border:"none",padding:"4px 0",cursor:S?"pointer":"default",color:L,textAlign:"left",font:"inherit",fontSize:"13px",alignSelf:"flex-start"}},{children:[w&&(0,r.tZ)(f,{css:{width:"12px",height:"12px",color:B}}),(0,r.tZ)("span",{children:D(k)}),S&&(0,r.tZ)(c,{css:{width:"12px",height:"12px",color:A,transform:m?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.2s ease",flexShrink:0}})]})),S&&m&&(0,r.tZ)(X,{row:k,linkColor:l,indent:6})]}))}var Z=p?"Finished working":"Working on it...";return(0,r.BX)("div",I({css:x},{children:[(0,r.BX)("button",I({type:"button",onClick:b,css:{display:"inline-flex",alignItems:"center",gap:"6px",background:"none",border:"none",padding:"4px 0",cursor:"pointer",color:L,textAlign:"left",font:"inherit",fontSize:"13px",alignSelf:"flex-start"}},{children:[(0,r.tZ)("span",I({css:p?void 0:P},{children:Z})),(0,r.tZ)(c,{css:{width:"12px",height:"12px",color:A,transform:m?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.2s ease",flexShrink:0}})]})),m&&(0,r.tZ)("div",I({css:{display:"flex",flexDirection:"column",gap:"2px",marginLeft:"5px",paddingLeft:"13px",borderLeft:"2px solid ".concat(_)}},{children:t.map((function(e){return(0,r.tZ)(V,{row:e,linkColor:l},e.key)}))}))]}))},V=function(e){var t=e.row,n=e.linkColor,i=K(t),a=M(t.state),l=F(t.state),u=W((0,o.useState)(null),2),s=u[0],d=u[1],v=null!=s?s:a,y=i?"button":"div";return(0,r.BX)("div",I({css:{display:"flex",flexDirection:"column",gap:"2px"}},{children:[(0,r.BX)(y,I({type:i?"button":void 0,onClick:i?function(){return d(!v)}:void 0,css:{display:"inline-flex",alignItems:"center",gap:"6px",color:l?B:L,background:"none",border:"none",padding:"2px 0",textAlign:"left",cursor:i?"pointer":"default",font:"inherit",fontSize:"13px",alignSelf:"flex-start"}},{children:[a?(0,r.tZ)(p,{css:{width:"12px",height:"12px"}}):l?(0,r.tZ)(f,{css:{width:"12px",height:"12px"}}):(0,r.tZ)(h,{css:{width:"12px",height:"12px"}}),(0,r.tZ)("span",I({css:a?P:void 0},{children:D(t)})),i&&(0,r.tZ)(c,{css:{width:"10px",height:"10px",color:A,transform:v?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.2s ease",flexShrink:0}})]})),i&&v&&(0,r.tZ)(X,{row:t,linkColor:n})]}))},q=function(){return(0,r.tZ)("div",I({css:{display:"flex",flexDirection:"column",gap:"2px",fontSize:"13px",minWidth:0,paddingLeft:"14px",animation:"feathery-chunk-fade-in 220ms ease-out both","@keyframes feathery-chunk-fade-in":{from:{opacity:0,transform:"translateY(4px)"},to:{opacity:1,transform:"translateY(0)"}}}},{children:(0,r.tZ)("div",I({css:{padding:"4px 0",color:L,fontSize:"13px",alignSelf:"flex-start"}},{children:(0,r.tZ)("span",I({css:P},{children:"Working on it..."}))}))}))},Y=n(917),H=n(4123),U=function(){return U=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},U.apply(this,arguments)},J=(0,Y.iv)({color:"#2563eb",fontWeight:400,textDecoration:"underline",textUnderlineOffset:"0.12em",textDecorationSkipInk:"auto",overflowWrap:"break-word","&:visited":{color:"#6d28d9"},"&:hover":{color:"#1d4ed8"}}),G=(0,Y.iv)('\n & p,\n & [data-streamdown="ordered-list"],\n & [data-streamdown="unordered-list"],\n & [data-streamdown="blockquote"],\n & [data-streamdown="code-block"],\n & [data-streamdown^="heading-"],\n & [data-streamdown="horizontal-rule"] {\n margin-top: 0 !important;\n margin-bottom: 0.6em !important;\n }\n & > *:last-child,\n & p:last-child,\n & [data-streamdown="ordered-list"]:last-child,\n & [data-streamdown="unordered-list"]:last-child,\n & [data-streamdown="blockquote"]:last-child,\n & [data-streamdown="code-block"]:last-child,\n & [data-streamdown^="heading-"]:last-child {\n margin-bottom: 0 !important;\n }\n\n & [data-streamdown="strong"],\n & strong,\n & b {\n font-weight: 600 !important;\n }\n & em,\n & i {\n font-style: italic !important;\n }\n\n & [data-streamdown="heading-1"] {\n font-size: 1.25em !important;\n font-weight: 600 !important;\n }\n & [data-streamdown="heading-2"] {\n font-size: 1.15em !important;\n font-weight: 600 !important;\n }\n & [data-streamdown="heading-3"] {\n font-size: 1.05em !important;\n font-weight: 600 !important;\n }\n & [data-streamdown="heading-4"],\n & [data-streamdown="heading-5"],\n & [data-streamdown="heading-6"] {\n font-size: 1em !important;\n font-weight: 600 !important;\n }\n\n & [data-streamdown="ordered-list"],\n & [data-streamdown="unordered-list"] {\n padding-left: 1.25em !important;\n }\n & [data-streamdown="ordered-list"] {\n list-style: decimal !important;\n }\n & [data-streamdown="unordered-list"] {\n list-style: disc !important;\n }\n & [data-streamdown="list-item"] {\n margin-bottom: 0.2em !important;\n }\n & [data-streamdown="list-item"]:last-child {\n margin-bottom: 0 !important;\n }\n\n & [data-streamdown="inline-code"] {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;\n font-size: 0.9em !important;\n padding: 0.1em 0.3em !important;\n border-radius: 4px !important;\n background-color: rgba(0, 0, 0, 0.06) !important;\n }\n & [data-streamdown="code-block"] {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;\n font-size: 0.9em !important;\n padding: 0.5em 0.75em !important;\n border-radius: 6px !important;\n background-color: rgba(0, 0, 0, 0.06) !important;\n overflow-x: auto !important;\n }\n\n & [data-streamdown="blockquote"] {\n padding-left: 0.75em !important;\n border-left: 3px solid rgba(0, 0, 0, 0.15) !important;\n color: rgba(0, 0, 0, 0.75) !important;\n }\n\n & [data-streamdown="horizontal-rule"] {\n border: 0 !important;\n border-top: 1px solid rgba(0, 0, 0, 0.12) !important;\n margin: 0.6em 0 !important;\n }\n'),Q={a:function(e){var t=e.href,n=e.children;return(0,r.tZ)("a",U({href:t,target:"_blank",rel:"noopener noreferrer",css:J},{children:n}))}},$=(0,o.memo)((function(e){var t=e.text,n=e.isStreaming,o=void 0!==n&&n;return(0,r.tZ)("div",U({css:G},{children:(0,r.tZ)(H.qI,U({components:Q,isAnimating:o,parseIncompleteMarkdown:o},{children:t}))}))}));$.displayName="MarkdownText";const ee=$;var te=function(){return te=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},te.apply(this,arguments)},ne=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function l(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}u((r=r.apply(e,t||[])).next())}))},re=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}},oe=function(e,t){return ne(void 0,void 0,void 0,(function(){var n;return re(this,(function(r){switch(r.label){case 0:return[4,fetch("".concat(e,"threads/"),{headers:t()})];case 1:return(n=r.sent()).ok?[2,n.json()]:[2,null]}}))}))},ie=function(e,t,n){return ne(void 0,void 0,void 0,(function(){var r;return re(this,(function(o){switch(o.label){case 0:return[4,fetch("".concat(e,"threads/").concat(n,"/"),{headers:t()})];case 1:return(r=o.sent()).ok?[2,r.json()]:[2,null]}}))}))},ae=function(e,t,n){return ne(void 0,void 0,void 0,(function(){return re(this,(function(r){switch(r.label){case 0:return[4,fetch("".concat(e,"threads/").concat(n,"/"),{method:"DELETE",headers:t()})];case 1:return r.sent(),[2]}}))}))},le=function(e,t){var n,r;if(!Array.isArray(e)||!Array.isArray(t)||0===t.length)return[];var o=[];try{for(var i=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(e),a=i.next();!a.done;a=i.next()){var l=a.value,u=Array.isArray(null==l?void 0:l.position)?l.position:[];if(!(u.length>=t.length)){for(var s=!0,c=0;c<u.length;c++)if(u[c]!==t[c]){s=!1;break}s&&o.push(l)}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return o.sort((function(e,t){return t.position.length-e.position.length})),o},ue=n(1142),se=n(9479),ce=n(4428),de=n(4665),pe=function(){return pe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},pe.apply(this,arguments)},fe=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},he=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},ve=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ye=function(e){var t=e.text;if("string"==typeof t&&t.trim())return t;var n=e.text_formatted,r=Array.isArray(n)?n:null==n?void 0:n.ops;return Array.isArray(r)?r.map((function(e){return"string"==typeof(null==e?void 0:e.insert)?e.insert:""})).join("").trim():""},ge=function(e,t){if(!e)return"";try{return(0,de.xf)(e,t)}catch(t){return e}},me=new Set(["submit","load"]),be=function(e,t,n,r){return(null!=e?e:[]).some((function(e){if((null==e?void 0:e.trigger_event)!==t)return!1;if(!1===e.enabled||!1===e.valid)return!1;var o=e.steps,i=e.elements;return!(Array.isArray(o)&&o.length>0&&!o.includes(n))&&(!!me.has(t)||Array.isArray(i)&&i.includes(r))}))},xe=function(e){var t,n,r,o,i,a,l,u,s,c,d,p,f,h,v,y,g,m,b,x,k=ce.Z[e];if(!k||!k.currentStep)return null;var w=k.currentStep,S=null!==(i=k.visiblePositions)&&void 0!==i?i:{},C=null!==(a=k.fields)&&void 0!==a?a:{},Z=null!==(l=k.inlineErrors)&&void 0!==l?l:{},_=k.logicRules,A=!(!(null===(u=k.formSettings)||void 0===u?void 0:u.readOnly)&&"readOnly"!==ue.Hi.collaboratorReview),L=(null!==(s=w.subgrids)&&void 0!==s?s:[]).filter((function(e){var t,n,r=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t.actions;return!!(Array.isArray(r)&&r.length>0)||be(_,"action",w.id,null!==(n=e.id)&&void 0!==n?n:"")})),j=function(e){return le(L,Array.isArray(null==e?void 0:e.position)?e.position:[]).map((function(e){var t;return null!==(t=e.id)&&void 0!==t?t:""}))},B=(null!==(c=w.servar_fields)&&void 0!==c?c:[]).map((function(e){var t,n,r,o,i,a,l,u=(null===(t=e.position)||void 0===t?void 0:t.join(","))||"root",s=S[u],c=!Array.isArray(s)||s.some(Boolean),d=C[e.servar.key],p=null!==(n=e.properties)&&void 0!==n?n:{},f="string"==typeof p.placeholder&&p.placeholder.trim()?ge(p.placeholder):void 0,h="string"==typeof p.tooltipText&&p.tooltipText.trim()?ge(p.tooltipText):void 0,v=null===(r=Z[e.servar.key])||void 0===r?void 0:r.message,y=null!==(o=e.servar)&&void 0!==o?o:{},g=null!==(i=y.metadata)&&void 0!==i?i:{},m=Array.isArray(g.options)?g.options:null,b=Array.isArray(g.labels)?g.labels:[],x=m?m.map((function(e,t){var n,r;return{value:String(null!=e?e:""),label:String(null!==(r=null!==(n=b[t])&&void 0!==n?n:e)&&void 0!==r?r:"")}})):void 0,k=Array.isArray(g.questions)?g.questions:null,L=k?k.map((function(e){var t,n;return{id:String(null!==(t=null==e?void 0:e.id)&&void 0!==t?t:""),label:String(null!==(n=null==e?void 0:e.label)&&void 0!==n?n:"")}})).filter((function(e){return e.id||e.label})):void 0,B=he(he([],fe(Array.isArray(g.file_types)?g.file_types:[]),!1),fe(Array.isArray(g.custom_file_types)?g.custom_file_types.map((function(e){return".".concat(e)})):[]),!1),T=g.min_val_label||g.max_val_label?pe(pe({},g.min_val_label?{min:String(g.min_val_label)}:{}),g.max_val_label?{max:String(g.max_val_label)}:{}):void 0,I=!(!p.disabled&&!A),W=be(_,"change",w.id,null!==(a=y.id)&&void 0!==a?a:""),z=j(e);return pe(pe(pe(pe(pe(pe(pe(pe(pe(pe(pe(pe(pe(pe(pe({key:y.key,type:y.type,value:null!==(l=null==d?void 0:d.value)&&void 0!==l?l:null,visible:c,disabled:I,required:!!y.required,repeated:!!y.repeated},W?{hasLogicRules:!0}:{}),z.length>0?{clickableAncestorIds:z}:{}),f?{placeholder:f}:{}),h?{tooltip:h}:{}),v?{error:v}:{}),x?{options:x}:{}),L?{questions:L}:{}),"number"==typeof y.min_length?{minLength:y.min_length}:{}),"number"==typeof y.max_length?{maxLength:y.max_length}:{}),y.format?{format:String(y.format)}:{}),B.length>0?{fileTypes:B}:{}),g.multiple?{multipleFiles:!0}:{}),"button_group"===y.type?{multiple:!!g.multiple}:{}),T?{sliderLabels:T}:{}),"number"==typeof g.step_size?{stepSize:g.step_size}:{})})),T=new Set;try{for(var I=ve(Object.keys(null!==(d=k.steps)&&void 0!==d?d:{})),W=I.next();!W.done;W=I.next()){var z=W.value,R=k.steps[z];(null!==(p=null==R?void 0:R.servar_fields)&&void 0!==p?p:[]).forEach((function(e){var t;(null===(t=null==e?void 0:e.servar)||void 0===t?void 0:t.key)&&T.add(e.servar.key)}))}}catch(e){t={error:e}}finally{try{W&&!W.done&&(n=I.return)&&n.call(I)}finally{if(t)throw t.error}}var E=function(e){return!(null==e||"string"==typeof e&&""===e||Array.isArray(e)&&0===e.length)},O={},M={};try{for(var F=ve(Object.keys(C)),X=F.next();!X.done;X=F.next()){var K=X.value,D=null!==(h=null===(f=C[K])||void 0===f?void 0:f.value)&&void 0!==h?h:null;T.has(K)?O[K]=D:E(D)&&(M[K]=D)}}catch(e){r={error:e}}finally{try{X&&!X.done&&(o=F.return)&&o.call(F)}finally{if(r)throw r.error}}var P=[],N=function(e){var t,n=(null===(t=e.position)||void 0===t?void 0:t.join(","))||"root",r=S[n];return!Array.isArray(r)||r.some(Boolean)};L.forEach((function(e){var t,n,r=e.properties.actions,o=be(_,"action",w.id,null!==(t=e.id)&&void 0!==t?t:""),i=j(e);P.push(pe(pe({type:"container",id:null!==(n=e.id)&&void 0!==n?n:"",visible:N(e),actions:r},o?{hasLogicRules:!0}:{}),i.length>0?{clickableAncestorIds:i}:{}))})),(null!==(v=w.texts)&&void 0!==v?v:[]).forEach((function(e){var t,n,r,o=ye(null!==(t=null==e?void 0:e.properties)&&void 0!==t?t:{});if(o){var i=ge(o),a=null!==(n=null==e?void 0:e.properties)&&void 0!==n?n:{},l=Array.isArray(a.actions)?a.actions:[],u=be(_,"action",w.id,null!==(r=e.id)&&void 0!==r?r:""),s=j(e);P.push(pe(pe(pe(pe(pe({type:"text",text:i,visible:N(e)},e.id?{id:e.id}:{}),o!==i?{templateText:o}:{}),l.length>0?{actions:l}:{}),u?{hasLogicRules:!0}:{}),s.length>0?{clickableAncestorIds:s}:{}))}})),(null!==(y=w.buttons)&&void 0!==y?y:[]).forEach((function(e){var t,n,r,o,i=ye(null!==(t=null==e?void 0:e.properties)&&void 0!==t?t:{});if(i){var a=null!==(n=null==e?void 0:e.properties)&&void 0!==n?n:{},l=Array.isArray(a.actions)?a.actions:[],u=be(_,"action",w.id,null!==(r=e.id)&&void 0!==r?r:"")||!!a.submit&&(be(_,"submit",w.id,"")||be(_,"form_complete",w.id,""));P.push(pe({type:"button",id:null!==(o=e.id)&&void 0!==o?o:"",text:ge(i),visible:N(e),submit:!!a.submit,actions:l},u?{hasLogicRules:!0}:{}))}})),(null!==(g=w.images)&&void 0!==g?g:[]).forEach((function(e){var t,n=null!==(t=null==e?void 0:e.properties)&&void 0!==t?t:{},r="string"==typeof n.alt_text&&n.alt_text||"string"==typeof n.caption&&n.caption||"";if(r){var o=j(e);P.push(pe({type:"image",text:ge(r),visible:N(e)},o.length>0?{clickableAncestorIds:o}:{}))}})),(null!==(m=w.progress_bars)&&void 0!==m?m:[]).forEach((function(e){var t,n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t.num_segments;P.push(pe(pe({type:"progress"},"number"==typeof n?{segments:n}:{}),{visible:N(e)}))}));var V=[];return(null!==(b=w.tables)&&void 0!==b?b:[]).forEach((function(e){var t,n,r=null!==(n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t.columns)&&void 0!==n?n:[];if(0!==r.length){var o=r.reduce((function(e,t){var n,r=t.field_key?null===(n=C[t.field_key])||void 0===n?void 0:n.value:void 0;return Array.isArray(r)?Math.max(e,r.length):e}),0),i=Array.from({length:o},(function(e,t){return r.map((function(e){var n,r,o=e.field_key?null===(n=C[e.field_key])||void 0===n?void 0:n.value:null;return Array.isArray(o)?null!==(r=o[t])&&void 0!==r?r:null:null!=o?o:null}))}));V.push({columns:r.map((function(e){var t,n,r;return{name:null!==(n=null!==(t=e.name)&&void 0!==t?t:e.field_key)&&void 0!==n?n:"",fieldKey:null!==(r=e.field_key)&&void 0!==r?r:""}})),rows:i,visible:N(e)})}})),{currentStep:{id:w.id,key:w.key},previousStepName:k.previousStepName||void 0,totalSteps:Object.keys(null!==(x=k.steps)&&void 0!==x?x:{}).length,currentStepFields:B,currentStepElements:P,currentStepTables:V,values:O,hiddenFieldValues:M}},ke=n(9234),we=n(1075),Se=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function l(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}u((r=r.apply(e,t||[])).next())}))},Ce=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}},Ze=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},_e=new Set(["file_upload","signature"]),Ae=new Set(["text_field","text_area","email","phone_number","url","password","ssn","ein","gmap_line_1","gmap_line_2","gmap_city","gmap_state","gmap_country","gmap_zip"]),Le=new Set(["integer_field","slider","rating"]),je=new Set(["dropdown","radio"]),Be=new Set(["dropdown_multi","multiselect","checkbox_group","button_group"]);function Te(e,t,n){var r,o=null!==(r=null==n?void 0:n.currentStepFields)&&void 0!==r?r:[],i=o.find((function(t){return t.key===e}));if(!i){var a=o.map((function(e){return e.key})).join(", ")||"(none)";return{ok:!1,errorType:"not_on_step",error:"Field '".concat(e,"' is not on the current step. Available field keys here: ").concat(a,".")}}if(!i.visible)return{ok:!1,errorType:"hidden",error:"Field '".concat(e,"' is on the current step but is hidden right now.")};if(i.disabled)return{ok:!1,errorType:"disabled",error:"Field '".concat(e,"' is disabled and cannot be written.")};if(_e.has(i.type))return{ok:!1,errorType:"unwriteable_type",error:"Field '".concat(e,"' (").concat(i.type,") cannot be filled by the assistant; the user has to provide this themselves.")};var l=t;"phone_number"===i.type&&"number"==typeof l&&Number.isFinite(l)&&(l=String(Math.trunc(l)));var u=function(e,t){var n,r;if("checkbox"===e.type)return"boolean"==typeof t?null:"Field '".concat(e.key,"' (checkbox) expects a boolean.");if(Le.has(e.type))return"number"==typeof t&&Number.isFinite(t)?"number"==typeof e.minLength&&t<e.minLength?"Value below minimum (".concat(e.minLength,")."):"number"==typeof e.maxLength&&t>e.maxLength?"Value above maximum (".concat(e.maxLength,")."):null:"Field '".concat(e.key,"' (").concat(e.type,") expects a number.");if("date_selector"===e.type)return"string"!=typeof t?"Field '".concat(e.key,"' (date_selector) expects a string."):/^\d{4}-\d{2}-\d{2}$/.test(t)?null:"Field '".concat(e.key,"' expects ISO date 'YYYY-MM-DD'.");if(je.has(e.type)){if("string"!=typeof t)return"Field '".concat(e.key,"' (").concat(e.type,") expects a single option value (string).");var o=(null!==(n=e.options)&&void 0!==n?n:[]).map((function(e){return e.value}));return o.length>0&&!o.includes(t)?"Value not in allowed options. Allowed: ".concat(o.join(", "),"."):null}if(Be.has(e.type)){if(!Array.isArray(t)||!t.every((function(e){return"string"==typeof e})))return"Field '".concat(e.key,"' (").concat(e.type,") expects an array of option-value strings.");if("button_group"===e.type&&!e.multiple&&t.length>1)return"Field '".concat(e.key,"' (button_group) is single-select; pass at most one option.");var i=new Set((null!==(r=e.options)&&void 0!==r?r:[]).map((function(e){return e.value})));if(i.size>0){var a=t.filter((function(e){return!i.has(e)}));if(a.length>0)return"Values not in allowed options: ".concat(a.join(", "),".")}return null}return Ae.has(e.type)?"string"!=typeof t?"Field '".concat(e.key,"' (").concat(e.type,") expects a string."):"number"==typeof e.minLength&&t.length<e.minLength?"Value shorter than minimum length (".concat(e.minLength,")."):"number"==typeof e.maxLength&&t.length>e.maxLength?"Value exceeds maximum length (".concat(e.maxLength,")."):null:null}(i,l);return u?{ok:!1,errorType:"shape_mismatch",error:u}:{ok:!0,value:l}}function Ie(e,t){return Se(this,void 0,void 0,(function(){var n,r,o,i,a,l,u,s,c,d,p,f;return Ce(this,(function(h){switch(h.label){case 0:if(!e||0===t.length)return[2];if(!(n=ce.Z[e]))return[2];r={},h.label=1;case 1:h.trys.push([1,8,9,10]),o=Ze(t),i=o.next(),h.label=2;case 2:return i.done?[3,7]:(a=i.value,l=a.fieldKey,u=a.value,s=function(e,t){var n,r,o,i,a,l=null!==(o=e.steps)&&void 0!==o?o:{};try{for(var u=Ze(Object.keys(l)),s=u.next();!s.done;s=u.next()){var c=(null!==(a=null===(i=l[s.value])||void 0===i?void 0:i.servar_fields)&&void 0!==a?a:[]).find((function(e){var n;return(null===(n=null==e?void 0:e.servar)||void 0===n?void 0:n.key)===t}));if(c)return c.servar}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}return null}(n,l),c=u,"gmap_state"!==(null==s?void 0:s.type)?[3,3]:(c=function(e,t){var n,r;if("string"!=typeof e||!e)return e;var o=!!(null===(n=t.metadata)||void 0===n?void 0:n.store_abbreviation),i=null===(r=t.metadata)||void 0===r?void 0:r.default_country,a=(i&&"auto"!==i?i:"us").toLowerCase(),l=we.P3[a];if(!l||0===l.length)return e;var u=e.toLowerCase(),s=l.find((function(e){return e.code.toLowerCase()===u||e.name.toLowerCase()===u}));return s?o?s.code:s.name:e}(u,s),[3,5]));case 3:return"phone_number"!==(null==s?void 0:s.type)?[3,5]:[4,We(u,s,n,l)];case 4:c=h.sent(),h.label=5;case 5:r[l]=c,h.label=6;case 6:return i=o.next(),[3,2];case 7:return[3,10];case 8:return d=h.sent(),p={error:d},[3,10];case 9:try{i&&!i.done&&(f=o.return)&&f.call(o)}finally{if(p)throw p.error}return[7];case 10:return(0,ue.Ax)(r,!0,!0),[2]}}))}))}function We(e,t,n,r){return Se(this,void 0,void 0,(function(){var o,i,a;return Ce(this,(function(l){switch(l.label){case 0:return(o="number"==typeof e?String(Math.trunc(e)):"string"==typeof e?e:"").replace(/\D/g,"")?(ke.BZ||(0,ke.bq)(),[4,ke.hV]):[2,e];case 1:return l.sent(),ke.BZ?(i=function(e,t,n){var r,o,i,a=null===(o=null===(r=e.fields)||void 0===r?void 0:r[t])||void 0===o?void 0:o.value;if(a&&"string"==typeof a&&ke.BZ)try{var l=ke.BZ.parsePhoneNumber("+".concat(a));if(null==l?void 0:l.country)return l.country}catch(e){}var u=null===(i=n.metadata)||void 0===i?void 0:i.default_country;return u&&"auto"!==u?u:"US"}(n,r,t),(null==(a=function(){try{return ke.BZ.parsePhoneNumber(o,i)}catch(e){return}}())?void 0:a.isValid())?[2,a.number.replace(/^\+/,"")]:[2,e]):[2,e]}}))}))}var ze=function(){return ze=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ze.apply(this,arguments)},Re=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ee=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},Oe=function(e){var t,n,r,o,i=null!==(r=null==e?void 0:e.inlineErrors)&&void 0!==r?r:{},a={};try{for(var l=Re(Object.keys(i)),u=l.next();!u.done;u=l.next()){var s=u.value,c=null===(o=i[s])||void 0===o?void 0:o.message;"string"==typeof c&&c.length>0&&(a[s]=c)}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}return a};function Me(e,t){var n,r,o,i,a,l,u;return i=this,a=void 0,u=function(){var i,a,l,u,s,c,d,p,f,h,v,y,g,m,b,x,k,w,S,C,Z,_,A;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,(function(L){switch(L.label){case 0:if(!e)return[2,{ok:!1,errorType:"no_form_state",error:"Form has not loaded yet."}];if(!(i=ce.Z[e])||!i.currentStep||!i.assistantClient)return[2,{ok:!1,errorType:"no_form_state",error:"Form has not loaded yet."}];if("string"!=typeof t||0===t.length)return[2,{ok:!1,errorType:"shape_mismatch",error:"elementId is required."}];if(a=function(e,t){var n,r,o,i=null==e?void 0:e.currentStep;if(!i)return null;var a=[[i.buttons,"button"],[i.texts,"text"],[i.subgrids,"container"]];try{for(var l=Re(a),u=l.next();!u.done;u=l.next()){var s=Ee(u.value,2),c=s[0],d=s[1],p=(null!=c?c:[]).find((function(e){return(null==e?void 0:e.id)===t}));if(p){var f=null===(o=null==p?void 0:p.properties)||void 0===o?void 0:o.actions;return{element:p,elementType:d,actions:Array.isArray(f)?f:[],position:Array.isArray(p.position)?p.position:[]}}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}return null}(i,t),!a)return[2,{ok:!1,errorType:"not_on_step",error:"Element '".concat(t,"' is not on the current step.")}];if(!function(e,t){var n,r=t.join(",")||"root",o=null===(n=e.visiblePositions)||void 0===n?void 0:n[r];return!Array.isArray(o)||o.some(Boolean)}(i,a.position))return[2,{ok:!1,errorType:"hidden",error:"Element '".concat(t,"' is on the current step but is hidden right now.")}];l=i.assistantClient,u=i.currentStep.key,s=Oe(i),L.label=1;case 1:return L.trys.push([1,13,,14]),"button"!==a.elementType?[3,3]:[4,l.click(a.element)];case 2:return L.sent(),[3,12];case 3:return c=le(i.currentStep.subgrids,a.position),[4,l.runActions({actions:a.actions,element:a.element,elementType:a.elementType})];case 4:L.sent(),L.label=5;case 5:L.trys.push([5,10,11,12]),d=Re(c),p=d.next(),L.label=6;case 6:return p.done?[3,9]:(f=p.value,h=null===(n=null==f?void 0:f.properties)||void 0===n?void 0:n.actions,[4,l.runActions({actions:Array.isArray(h)?h:[],element:f,elementType:"container"})]);case 7:L.sent(),L.label=8;case 8:return p=d.next(),[3,6];case 9:return[3,12];case 10:return v=L.sent(),C={error:v},[3,12];case 11:try{p&&!p.done&&(Z=d.return)&&Z.call(d)}finally{if(C)throw C.error}return[7];case 12:return[3,14];case 13:return[2,{ok:!1,errorType:"dispatch_failed",error:(y=L.sent())instanceof Error?y.message:String(y)}];case 14:g=null!==(o=null===(r=i.currentStep)||void 0===r?void 0:r.key)&&void 0!==o?o:u,m=Oe(i),b={};try{for(x=Re(Object.keys(m)),k=x.next();!k.done;k=x.next())w=k.value,m[w]!==s[w]&&(b[w]=m[w])}catch(e){_={error:e}}finally{try{k&&!k.done&&(A=x.return)&&A.call(x)}finally{if(_)throw _.error}}return S="button"===a.elementType?b[t]:void 0,delete b[t],[2,ze(ze({ok:!0,navigated:g!==u?{fromStepKey:u,toStepKey:g}:null},S?{buttonError:S}:{}),Object.keys(b).length>0?{fieldErrors:b}:{})]}}))},new((l=void 0)||(l=Promise))((function(e,t){function n(e){try{o(u.next(e))}catch(e){t(e)}}function r(e){try{o(u.throw(e))}catch(e){t(e)}}function o(t){var o;t.done?e(t.value):(o=t.value,o instanceof l?o:new l((function(e){e(o)}))).then(n,r)}o((u=u.apply(i,a||[])).next())}))}var Fe=function(){return Fe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Fe.apply(this,arguments)},Xe=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function l(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}u((r=r.apply(e,t||[])).next())}))},Ke=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}},De=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},Pe=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ne=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},Ve="feathery.assistant.mode",qe="current",Ye=function(){try{var e=(0,se.Kv)().localStorage.getItem(Ve);return"current"===(t=e)||"sidebar-left"===t||"sidebar-right"===t||"fullscreen"===t?e:qe}catch(e){return qe}var t},He="feathery.assistant.sidebarWidth",Ue=380,Je=function(e){var t=Math.max(280,function(){try{return Math.min(800,Math.floor(.6*(0,se.Kv)().innerWidth))}catch(e){return 800}}());return e<280?280:e>t?t:e},Ge=function(){try{var e=(0,se.Kv)().localStorage.getItem(He),t=e?parseInt(e,10):NaN;return Number.isFinite(t)&&t>0?Je(t):Ue}catch(e){return Ue}},Qe=function(e){try{(0,se.Kv)().localStorage.setItem(He,String(e))}catch(e){}},$e=["current","sidebar-left","sidebar-right","fullscreen"];const et=function(e){var t,n,u,c=e.instanceId,p=e.getTargets,h=e.getJwt,S=e.baseUrl,L=e.bottom,B=void 0===L?20:L,I=e.color,W=e.workflowActions,z=void 0===W?[]:W,R=e.allowedModes,E=void 0===R?$e:R,O=e.onLayoutChange,M=(0,o.useMemo)((function(){if(h)return function(){return{Authorization:"Bearer ".concat(h())}};var e=(0,ue.JQ)().sdkKey;return function(){var t={Authorization:"Token ".concat(e)},n=(0,se.ej)("feathery_session_token");return n&&(t["X-Feathery-Session"]=n),t}}),[h]),F=De((0,o.useState)(!1),2),X=F[0],K=F[1],D=De((0,o.useState)(Ye),2),P=D[0],V=D[1],Y=(0,o.useCallback)((function(e){V(e),function(e){try{(0,se.Kv)().localStorage.setItem(Ve,e)}catch(e){}}(e)}),[]),H=De((0,o.useState)(Ge),2),U=H[0],J=H[1],G=De((0,o.useState)(!1),2),Q=G[0],$=G[1];(0,o.useEffect)((function(){var e=function(){J((function(e){var t=Je(e);return t!==e&&Qe(t),t}))};return(0,se.Kv)().addEventListener("resize",e),function(){return(0,se.Kv)().removeEventListener("resize",e)}}),[]);var le=(0,o.useCallback)((function(e){return function(t){if(0===t.button){t.preventDefault(),$(!0);var n=(0,se.me)().body;n.style.cursor="col-resize",n.style.userSelect="none";var r=U,o=function(t){var n="right"===e?(0,se.Kv)().innerWidth-t.clientX:t.clientX;r=Je(n),J(r)},i=function(){(0,se.Kv)().removeEventListener("pointermove",o),(0,se.Kv)().removeEventListener("pointerup",i),(0,se.Kv)().removeEventListener("pointercancel",i),$(!1),n.style.cursor="",n.style.userSelect="",Qe(r)};(0,se.Kv)().addEventListener("pointermove",o),(0,se.Kv)().addEventListener("pointerup",i),(0,se.Kv)().addEventListener("pointercancel",i)}}}),[U]),de=(0,o.useCallback)((function(){J(Ue),Qe(Ue)}),[]),pe=De((0,o.useState)(""),2),fe=pe[0],he=pe[1],ve=De((0,o.useState)([]),2),ye=ve[0],ge=ve[1],me=De((0,o.useState)(null),2),be=me[0],ke=me[1],we=De((0,o.useState)(!1),2),Se=we[0],Ce=we[1],Ze=De((0,o.useState)(!1),2),_e=Ze[0],Ae=Ze[1],Le=De((0,o.useState)(null),2),je=Le[0],Be=Le[1],We=(0,o.useRef)(null),ze=(0,o.useRef)(null),Re=(0,o.useRef)(!0),Ee=(0,o.useCallback)((function(){var e=ze.current;if(e){var t=e.scrollHeight-e.scrollTop-e.clientHeight;Re.current=t<60}}),[]),Oe=(0,o.useMemo)((function(){return{primary:e=I||C,hover:T(e,-15),disabled:T(e,30),light:(t=e,90,n=parseInt(t.replace("#",""),16),r=n>>16&255,o=n>>8&255,i=255&n,.9,a=Math.round(r+.9*(255-r)),l=Math.round(o+.9*(255-o)),u=Math.round(i+.9*(255-i)),"#".concat((a<<16|l<<8|u).toString(16).padStart(6,"0")))};var e,t,n,r,o,i,a,l,u}),[I]),qe=function(e,t,n){void 0===t&&(t=[]);var r=e,o=!!n,i=new l.PD({api:S,headers:M,body:function(){return Fe(Fe({},function(){var e={},t=p();if(t.length>0&&(e.targets=t),c){var n=xe(c);n&&(e.panel_runtime=n)}return e}()),{thread_id:r||null})},fetch:function(e,t){return Xe(void 0,void 0,void 0,(function(){var n,i,a,l,s,d,f,h,v,y;return Ke(this,(function(g){switch(g.label){case 0:return[4,fetch(e,t)];case 1:return n=g.sent(),(i=n.headers.get("X-Thread-Id"))&&!r&&(r=i,ge((function(e){return e.map((function(e){return e.chat===u?Fe(Fe({},e),{id:i,isTemporary:!1}):e}))})),ke(i),ie(S,M,i).then((function(e){e&&ge((function(t){return t.map((function(t){return t.id===i?Fe(Fe({},e),{chat:u,title:t.title||e.title}):t}))}))}))),o||(a=null===(y=null===(v=null===(h=u.messages.find((function(e){return"user"===e.role})))||void 0===h?void 0:h.parts)||void 0===v?void 0:v[0])||void 0===y?void 0:y.text)&&(o=!0,l=r||i||null,s={},(d=p()).length>0&&(s.targets=d),c&&(f=function(e){var t,n;return null===(n=null===(t=ce.Z[e])||void 0===t?void 0:t.currentStep)||void 0===n?void 0:n.key}(c),f&&(s.current_step=f)),function(e,t,n,r,o){return ne(void 0,void 0,void 0,(function(){var i,a,l;return re(this,(function(u){switch(u.label){case 0:return[4,fetch("".concat(e,"threads/title/"),{method:"POST",headers:te(te({},t()),{"Content-Type":"application/json"}),body:JSON.stringify(te({message:r,thread_id:null!=n?n:void 0},null!=o?o:{}))})];case 1:return(i=u.sent()).ok?[4,i.json()]:[2,null];case 2:return a=u.sent(),[2,null!==(l=a.title)&&void 0!==l?l:null]}}))}))}(S,M,l,a,s).then((function(e){e&&ge(l?function(t){return t.map((function(t){return t.id===l?Fe(Fe({},t),{title:e}):t}))}:function(t){return t.map((function(t){return t.chat===u?Fe(Fe({},t),{title:e}):t}))})}))),[2,n]}}))}))}}),u=new a.en({transport:i,messages:t,sendAutomaticallyWhen:l.Qk,onToolCall:function(e){var t=e.toolCall;return Xe(void 0,void 0,void 0,(function(){var e,n,r,o,i,a,l,s,d,p,f,h,v,y,g,m,b,x,k,w,S,C,Z,_,A,L,j;return Ke(this,(function(B){switch(B.label){case 0:if(t.dynamic)return[2];if("setFieldValue"!==t.toolName)return[3,5];e=null!==(L=t.input)&&void 0!==L?L:{},n=Array.isArray(e.fields)?e.fields:[],r=c?xe(c):null,o=[],i=[];try{for(a=Pe(n),l=a.next();!l.done;l=a.next())s=l.value,(m="string"==typeof(null==s?void 0:s.fieldKey)?s.fieldKey:"")?(d=Te(m,s.value,r)).ok?i.push({fieldKey:m,value:d.value}):o.push({fieldKey:m,ok:!1,error:d.error,errorType:d.errorType}):o.push({fieldKey:m,ok:!1,errorType:"shape_mismatch",error:"fieldKey is required."})}catch(e){w={error:e}}finally{try{l&&!l.done&&(S=a.return)&&S.call(a)}finally{if(w)throw w.error}}B.label=1;case 1:return B.trys.push([1,3,,4]),[4,Ie(c,i)];case 2:B.sent();try{for(p=Pe(i),f=p.next();!f.done;f=p.next())m=f.value.fieldKey,o.push({fieldKey:m,ok:!0})}catch(e){C={error:e}}finally{try{f&&!f.done&&(Z=p.return)&&Z.call(p)}finally{if(C)throw C.error}}return[3,4];case 3:h=B.sent(),v=h instanceof Error?h.message:String(h);try{for(y=Pe(i),g=y.next();!g.done;g=y.next())m=g.value.fieldKey,o.push({fieldKey:m,ok:!1,errorType:"apply_failed",error:v})}catch(e){_={error:e}}finally{try{g&&!g.done&&(A=y.return)&&A.call(y)}finally{if(_)throw _.error}}return[3,4];case 4:return u.addToolOutput({tool:"setFieldValue",toolCallId:t.toolCallId,output:{results:o}}),[3,7];case 5:return"clickElement"!==t.toolName?[3,7]:(b=null!==(j=t.input)&&void 0!==j?j:{},x="string"==typeof b.elementId?b.elementId:"",[4,Me(c,x)]);case 6:k=B.sent(),u.addToolOutput({tool:"clickElement",toolCallId:t.toolCallId,output:k}),B.label=7;case 7:return[2]}}))}))},onFinish:function(e){var t=e.isAbort,n=e.isError;t||n||!r||ge((function(e){var t=e.find((function(e){return e.id===r}));return t?Ne([Fe(Fe({},t),{updated_at:(new Date).toISOString()})],De(e.filter((function(e){return e.id!==r}))),!1):e}))}});return u},He=(0,o.useMemo)((function(){return qe(null)}),[M,p,h]),et=ye.find((function(e){return e.id===be})),tt=null!==(u=null==et?void 0:et.chat)&&void 0!==u?u:He,nt=(0,a.RJ)({chat:tt}),rt=nt.messages,ot=nt.sendMessage,it=nt.status,at=nt.error,lt=(0,o.useMemo)((function(){var e,t,n,r,o=[];try{for(var i=Pe(rt),a=i.next();!a.done;a=i.next()){var l=a.value,u=o[o.length-1];u&&"assistant"===u.role&&"assistant"===l.role?o[o.length-1]=Fe(Fe({},u),{parts:Ne(Ne([],De(null!==(n=u.parts)&&void 0!==n?n:[]),!1),De(null!==(r=l.parts)&&void 0!==r?r:[]),!1)}):o.push(l)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return o}),[rt]);(0,o.useEffect)((function(){var e;Re.current&&(null===(e=We.current)||void 0===e||e.scrollIntoView({behavior:"smooth"}))}),[lt]),(0,o.useEffect)((function(){if("ready"===it&&Re.current){var e=(0,se.Kv)().requestAnimationFrame((function(){var e;null===(e=We.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"end"})}));return function(){return(0,se.Kv)().cancelAnimationFrame(e)}}}),[it]);var ut=(0,o.useCallback)((function(){return Xe(void 0,void 0,void 0,(function(){var e;return Ke(this,(function(t){switch(t.label){case 0:return[4,oe(S,M)];case 1:return(e=t.sent())?(ge((function(t){return Ne(Ne([],De(e.map((function(e){var n;return Fe(Fe({},e),{chat:null===(n=t.find((function(t){return t.id===e.id})))||void 0===n?void 0:n.chat})}))),!1),De(t.filter((function(t){return!e.find((function(e){return e.id===t.id}))}))),!1)})),[2]):[2]}}))}))}),[M,S]);(0,o.useEffect)((function(){X&&ut()}),[X,ut]);var st=function(){Re.current=!0;var e=(0,i.Z)(),t=(new Date).toISOString(),n=qe(null);ge((function(r){return Ne([{id:e,title:"",created_at:t,updated_at:t,isTemporary:!0,chat:n}],De(r.filter((function(e){return!e.isTemporary||e.title}))),!1)})),ke(e)},ct=function(){if(fe.trim()&&"ready"===it){Re.current=!0;var e=(new Date).toISOString();if(be)et&&!et.title&&ge((function(t){return Ne([Fe(Fe({},et),{title:"New Chat",updated_at:e})],De(t.filter((function(e){return e.id!==be}))),!1)}));else{var t=(0,i.Z)();ge((function(n){return Ne([{id:t,title:"New Chat",created_at:e,updated_at:e,isTemporary:!0,chat:tt}],De(n),!1)})),ke(t)}ot({text:fe}),he("")}},dt=ye.filter((function(e){return e.title})),pt="submitted"===it||"streaming"===it,ft="sidebar-left"===P?"left":"sidebar-right"===P?"right":null,ht=X&&ft?U:0,vt=(0,o.useRef)(O);vt.current=O,(0,o.useEffect)((function(){var e;null===(e=vt.current)||void 0===e||e.call(vt,{mode:P,isOpen:X,side:ft,width:ht,isResizing:Q})}),[P,X,ft,ht,Q]);var yt="sidebar-left"===P?k:"sidebar-right"===P?w:"fullscreen"===P?f:x,gt="sidebar-left"===P?g:"sidebar-right"===P?m:"fullscreen"===P?b:y,mt="sidebar-left"===P,bt=mt?{left:"20px"}:{right:"20px"},xt=mt?20:B;if(!X)return(0,r.tZ)("button",Fe({type:"button",onClick:function(){return K(!0)},css:Fe(Fe({position:"fixed",bottom:"".concat(xt,"px")},bt),{width:"".concat(56,"px"),height:"".concat(56,"px"),borderRadius:"50%",backgroundColor:Oe.primary,color:"white",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",transition:"transform 0.2s, box-shadow 0.2s, background-color 0.2s",zIndex:1e3,":hover":{backgroundColor:Oe.hover,transform:"scale(1.05)",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)"}})},{children:(0,r.tZ)(s,{})}));var kt="sidebar-left"===P?{top:0,left:0,width:"".concat(U,"px"),height:"100vh",borderRadius:0,boxShadow:"4px 0 24px rgba(0, 0, 0, 0.12)",borderRight:"1px solid ".concat(_)}:"sidebar-right"===P?{top:0,right:0,width:"".concat(U,"px"),height:"100vh",borderRadius:0,boxShadow:"-4px 0 24px rgba(0, 0, 0, 0.12)",borderLeft:"1px solid ".concat(_)}:"fullscreen"===P?{inset:0,borderRadius:0,boxShadow:"none",border:"none"}:{bottom:"".concat(B,"px"),right:"20px",width:"".concat(380,"px"),height:"".concat(500,"px"),borderRadius:"12px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.12)",border:"1px solid ".concat(_)};return(0,r.BX)("div",Fe({css:Fe({position:"fixed",backgroundColor:"white",display:"flex",flexDirection:"column",overflow:"hidden",zIndex:1e3},kt)},{children:[ft&&(0,r.tZ)("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize assistant panel",title:"Drag to resize, double-click to reset",onPointerDown:le(ft),onDoubleClick:de,css:(t={position:"absolute",top:0},t["right"===ft?"left":"right"]=0,t.width="6px",t.height="100%",t.cursor="col-resize",t.zIndex=2,t.touchAction="none",t.userSelect="none",t["::after"]=(n={content:'""',position:"absolute",top:0},n["right"===ft?"left":"right"]="2px",n.width="2px",n.height="100%",n.backgroundColor="transparent",n.transition="background-color 120ms ease",n),t[":hover::after"]={backgroundColor:"rgba(0, 0, 0, 0.15)"},t)}),(0,r.BX)("div",Fe({css:Fe({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"2px",padding:"12px 16px",backgroundColor:Oe.primary,color:"white",position:"relative"},ft?{minHeight:"var(--main-nav-height, 55px)",boxSizing:"border-box"}:{})},{children:[(0,r.BX)("div",Fe({css:{display:"flex",alignItems:"center",gap:"8px",minWidth:0,flex:1,overflow:"hidden"}},{children:[(0,r.tZ)(s,{}),(0,r.BX)("button",Fe({type:"button",onClick:function(){return Ce((function(e){return!e}))},css:{background:"none",border:"none",color:"white",cursor:"pointer",fontWeight:600,fontSize:"14px",padding:"4px",borderRadius:"4px",display:"flex",alignItems:"center",gap:"4px",minWidth:0,maxWidth:"100%",":hover":{backgroundColor:"rgba(255, 255, 255, 0.1)"}}},{children:[(0,r.tZ)("span",Fe({css:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0}},{children:(null==et?void 0:et.title)||"AI Assistant"})),(0,r.tZ)("span",Fe({css:{display:"flex",opacity:.8,flexShrink:0}},{children:(0,r.tZ)(v,{})}))]}))]})),(0,r.BX)("div",Fe({css:{display:"flex",alignItems:"center",gap:"2px",position:"relative",flexShrink:0}},{children:[(0,r.tZ)("button",Fe({type:"button",onClick:function(){return Ae((function(e){return!e}))},css:{background:"none",border:"none",color:"white",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",":hover":{backgroundColor:"rgba(255, 255, 255, 0.1)"}}},{children:(0,r.tZ)(gt,{})})),(0,r.tZ)("button",Fe({type:"button",onClick:function(){return K(!1)},css:{background:"none",border:"none",color:"white",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",":hover":{backgroundColor:"rgba(255, 255, 255, 0.1)"}}},{children:(0,r.tZ)(yt,{})})),_e&&(0,r.BX)(r.HY,{children:[(0,r.tZ)("div",{css:{position:"fixed",inset:0,zIndex:1e3},onClick:function(){return Ae(!1)}}),(0,r.tZ)("div",Fe({css:{position:"absolute",top:"100%",right:0,marginTop:"4px",minWidth:"180px",backgroundColor:"white",border:"1px solid ".concat(_),borderRadius:"8px",boxShadow:"0 8px 16px rgba(0,0,0,0.12)",zIndex:1001,overflow:"hidden"}},{children:[{value:"current",label:"Floating",Icon:y},{value:"sidebar-left",label:"Sidebar left",Icon:g},{value:"sidebar-right",label:"Sidebar right",Icon:m},{value:"fullscreen",label:"Fullscreen",Icon:b}].filter((function(e){var t=e.value;return E.includes(t)})).map((function(e){var t=e.value,n=e.label,o=e.Icon;return(0,r.BX)("button",Fe({type:"button",onClick:function(){Y(t),Ae(!1)},css:{width:"100%",padding:"10px 14px",background:t===P?Oe.light:"white",border:"none",cursor:"pointer",fontSize:"13px",color:j,textAlign:"left",display:"flex",alignItems:"center",gap:"10px",":hover":{backgroundColor:Z}}},{children:[(0,r.tZ)("span",Fe({css:{display:"flex",color:A,flexShrink:0}},{children:(0,r.tZ)(o,{})})),(0,r.tZ)("span",{children:n})]}),t)}))}))]})]})),Se&&(0,r.BX)(r.HY,{children:[(0,r.tZ)("div",{css:{position:"fixed",inset:0,zIndex:1e3},onClick:function(){return Ce(!1)}}),(0,r.BX)("div",Fe({css:{position:"absolute",top:"100%",left:0,width:"100%",backgroundColor:"white",border:"1px solid ".concat(_),borderTop:"none",borderRadius:"0 0 8px 8px",boxShadow:"0 8px 16px rgba(0,0,0,0.12)",zIndex:1001,maxHeight:"240px",overflowY:"scroll"}},{children:[(0,r.tZ)("button",Fe({type:"button",onClick:function(){st(),Ce(!1)},css:{width:"100%",padding:"10px 14px",background:"none",border:"none",borderBottom:"1px solid ".concat("#f3f4f6"),cursor:"pointer",fontSize:"13px",fontWeight:600,color:Oe.primary,textAlign:"left",":hover":{backgroundColor:Z}}},{children:"+ New Chat"})),0===dt.length&&(0,r.tZ)("div",Fe({css:{padding:"12px 14px",fontSize:"13px",color:A}},{children:"No chats yet"})),dt.map((function(e){return(0,r.BX)("div",Fe({onClick:function(){return t=e.id,Xe(void 0,void 0,void 0,(function(){var e,n,r,o;return Ke(this,(function(i){switch(i.label){case 0:return Re.current=!0,(null===(r=ye.find((function(e){return e.id===t})))||void 0===r?void 0:r.chat)?(ke(t),Ce(!1),[2]):[4,ie(S,M,t)];case 1:return(e=i.sent())?(n=qe(t,null!==(o=e.messages)&&void 0!==o?o:[],e.title),ge((function(r){return r.map((function(r){return r.id===t?Fe(Fe({},e),{chat:n}):r}))})),ke(t),Ce(!1),[2]):[2]}}))}));var t},css:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 14px",cursor:"pointer",backgroundColor:e.id===be?Oe.light:"white",":hover":{backgroundColor:Z}}},{children:[(0,r.BX)("div",Fe({css:{flex:1,minWidth:0}},{children:[(0,r.tZ)("div",Fe({css:{fontSize:"13px",fontWeight:500,color:j,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:e.title||"Untitled conversation"})),(0,r.tZ)("div",Fe({css:{fontSize:"11px",color:A,marginTop:"2px"}},{children:new Date(e.updated_at).toLocaleDateString()}))]})),(0,r.tZ)("button",Fe({type:"button",onClick:function(t){return function(e,t){return Xe(void 0,void 0,void 0,(function(){var n;return Ke(this,(function(r){switch(r.label){case 0:return t.stopPropagation(),(null==(n=ye.find((function(t){return t.id===e})))?void 0:n.isTemporary)?[3,2]:[4,ae(S,M,e)];case 1:r.sent(),r.label=2;case 2:return ge((function(t){return t.filter((function(t){return t.id!==e}))})),be===e&&st(),[2]}}))}))}(e.id,t)},css:{background:"none",border:"none",cursor:"pointer",color:A,fontSize:"16px",padding:"2px 6px",marginLeft:"8px",borderRadius:"4px",lineHeight:1,":hover":{color:"#dc2626",backgroundColor:"#fef2f2"}}},{children:"×"}))]}),e.id)}))]}))]})]})),(0,r.BX)("div",Fe({ref:ze,onScroll:Ee,css:{flex:1,overflowY:"auto",padding:"16px",display:"flex",flexDirection:"column",gap:"12px"}},{children:[0===lt.length&&(0,r.tZ)("div",Fe({css:{textAlign:"center",color:A,fontSize:"14px",marginTop:"40px"}},{children:"How can I help?"})),lt.map((function(e,t){return"user"===e.role?(0,r.tZ)("div",Fe({css:{display:"flex",justifyContent:"flex-end"}},{children:(0,r.tZ)("div",Fe({css:{maxWidth:"80%",padding:"10px 14px",borderRadius:"12px",fontSize:"14px",lineHeight:"1.5",backgroundColor:Oe.primary,color:"white",overflowWrap:"anywhere",wordBreak:"break-word"}},{children:e.parts.filter((function(e){return!e.hidden})).map((function(e,t){return"text"===e.type?(0,r.tZ)("span",{children:e.text},t):null}))}))}),e.id):(0,r.tZ)(o.Fragment,{children:(n=t===lt.length-1,i=function(e){var t=[];return e.forEach((function(e,n){if("text"===e.type&&e.text.trim()){var r=t[t.length-1];r&&"text"===r.kind?r.text="".concat(r.text,"\n\n").concat(e.text):t.push({kind:"text",key:"text-".concat(n),text:e.text})}else{var o=function(e){if("text"===(null==e?void 0:e.type))return{kind:"text"};var t="string"==typeof(null==e?void 0:e.type)&&e.type.startsWith("tool-"),n="dynamic-tool"===(null==e?void 0:e.type);return t||n?{kind:"tool",toolName:t?e.type.replace("tool-",""):e.toolName||"unknown"}:null}(e);if(o&&"tool"===o.kind&&o.toolName){var i={key:"tool-".concat(n),toolName:o.toolName,state:e.state,input:e.input,output:e.output},a=t[t.length-1];a&&"tools"===a.kind?a.rows.push(i):t.push({kind:"tools",key:"tools-".concat(n),rows:[i]})}}})),t}(e.parts),a=e.parts[e.parts.length-1],l=!n||"ready"===it&&"text"===(null==a?void 0:a.type),i.map((function(e,t){if("text"===e.kind)return(0,r.tZ)("div",Fe({css:{display:"flex",justifyContent:"flex-start"}},{children:(0,r.tZ)("div",Fe({css:{maxWidth:"80%",padding:"10px 14px",borderRadius:"12px",fontSize:"14px",lineHeight:"1.5",backgroundColor:Oe.light,color:j,overflowWrap:"anywhere",wordBreak:"break-word"}},{children:(0,r.tZ)(ee,{text:e.text,isStreaming:pt&&n&&t===i.length-1})}))}),e.key);var o=i.slice(t+1).some((function(e){return"text"===e.kind}));return(0,r.tZ)("div",Fe({css:{display:"flex",justifyContent:"flex-start",maxWidth:"80%",minWidth:0}},{children:(0,r.tZ)(N,{rows:e.rows,turnFinished:l,followedByText:o,linkColor:Oe.primary,isFirstChunk:0===t})}),e.key)})))},e.id);var n,i,a,l})),function(){if(!pt)return null;var e=lt[lt.length-1];if(!e)return null;if("user"!==e.role){var t=(e.parts||[]).some((function(e){var t;if("text"===(null==e?void 0:e.type))return(null!==(t=e.text)&&void 0!==t?t:"").trim().length>0;var n="string"==typeof(null==e?void 0:e.type)?e.type:"";return n.startsWith("tool-")||"dynamic-tool"===n}));if(t)return null}return(0,r.tZ)(q,{})}(),at&&(0,r.tZ)("div",Fe({css:{padding:"10px 14px",borderRadius:"8px",backgroundColor:"#fef2f2",color:"#dc2626",fontSize:"14px"}},{children:"Something went wrong. Please try again."})),(0,r.tZ)("div",{ref:We})]})),z.length>0&&(0,r.BX)("div",Fe({css:{position:"relative",zIndex:1,borderTop:"1px solid ".concat(_),backgroundColor:Z,padding:"8px 16px",display:"flex",gap:"6px",overflowX:"auto"}},{children:[z.map((function(e,t){return(0,r.tZ)("button",Fe({type:"button",disabled:pt,onClick:function(){return function(e){if("ready"===it){var t=(new Date).toISOString();if(be)et&&!et.title&&ge((function(e){return Ne([Fe(Fe({},et),{title:"New Chat",updated_at:t})],De(e.filter((function(e){return e.id!==be}))),!1)}));else{var n=(0,i.Z)();ge((function(e){return Ne([{id:n,title:"New Chat",created_at:t,updated_at:t,isTemporary:!0,chat:tt}],De(e),!1)})),ke(n)}ot({parts:[{type:"text",text:e.name},{type:"text",text:e.instructions,hidden:!0,interpolate:!0}]})}}(e)},onMouseEnter:function(t){if(e.description){var n=t.currentTarget.getBoundingClientRect();Be({text:e.description,x:n.left+n.width/2,y:n.top})}},onMouseLeave:function(){return Be(null)},css:{flexShrink:0,padding:"4px 10px",fontSize:"12px",border:"1px solid ".concat(Oe.primary),borderRadius:"12px",backgroundColor:"white",color:Oe.primary,cursor:"pointer",whiteSpace:"nowrap",":disabled":{opacity:.5,cursor:"not-allowed"},":hover:not(:disabled)":{backgroundColor:Oe.light},transition:"background-color 0.15s, color 0.15s"}},{children:e.name}),t)})),je&&(0,r.tZ)("div",Fe({css:{position:"fixed",top:je.y-34,left:je.x,transform:"translateX(-50%)",backgroundColor:"rgba(0,0,0,0.9)",color:"white",fontSize:"12px",padding:"4px 8px",borderRadius:"4px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:1e4}},{children:je.text}))]})),(0,r.BX)("div",Fe({css:{display:"flex",alignItems:"center",gap:"8px",padding:"12px 16px",borderTop:"1px solid ".concat(_),backgroundColor:Z}},{children:[(0,r.tZ)("input",{type:"text",value:fe,onChange:function(e){return he(e.target.value)},onKeyDown:function(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),e.stopPropagation(),ct())},placeholder:"Type a message...",css:{flex:1,padding:"10px 14px",border:"1px solid ".concat(_),borderRadius:"8px",fontSize:"14px",outline:"none",transition:"border-color 0.2s",":focus":{borderColor:Oe.primary}}}),(0,r.tZ)("button",Fe({type:"button",onClick:ct,disabled:pt||!fe.trim(),css:{padding:"10px",backgroundColor:Oe.primary,color:"white",border:"none",borderRadius:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s",":hover:not(:disabled)":{backgroundColor:Oe.hover},":disabled":{backgroundColor:Oe.disabled,cursor:"not-allowed"}}},{children:(0,r.tZ)(d,{})}))]}))]}))}}}]);
|
|
1
|
+
"use strict";(this.webpackChunkFeathery=this.webpackChunkFeathery||[]).push([[917],{9649:(e,t,n)=>{n.r(t),n.d(t,{default:()=>et});var r=n(5944),o=n(7294),i=n(1247),a=n(4790),l=n(4438),u=function(){return u=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},u.apply(this,arguments)},s=function(e){return(0,r.tZ)("svg",u({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},e,{children:(0,r.tZ)("path",{d:"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})}))},c=function(e){return(0,r.tZ)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:(0,r.tZ)("path",{d:"m6 9 6 6 6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))},d=function(e){return(0,r.BX)("svg",u({width:"20",height:"20",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"m22 2-7 20-4-9-9-4 20-7z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"m22 2-11 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},p=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",style:{borderRadius:"50%"},viewBox:"0 0 50 50"},e,{children:[(0,r.tZ)("circle",{cx:25,cy:25,r:22.5,style:{fill:"none",stroke:"#f5cbcb",strokeWidth:3,opacity:1}}),(0,r.tZ)("circle",{cx:25,cy:25,r:22.5,style:{fill:"none",stroke:"#e2626e",strokeWidth:3,opacity:1,strokeLinecap:"round",transformOrigin:"50% 50%",transform:"rotate3d(0,0,1,0deg)",animation:"2156ms ease-in-out 0s infinite normal none running feathery-spinner-arc,1829ms linear 0s infinite normal none running feathery-spinner-rotate"}})]}))},f=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"M18 6 6 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"m6 6 12 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},h=function(e){return(0,r.tZ)("svg",u({width:"14",height:"14",viewBox:"0 0 24 24",fill:"none"},e,{children:(0,r.tZ)("polyline",{points:"20 6 9 17 4 12",stroke:"#10b981",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))},v=function(e){return(0,r.tZ)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:(0,r.tZ)("path",{d:"m6 9 6 6 6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))},y=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"2"}),(0,r.tZ)("rect",{x:"12",y:"12",width:"7",height:"7",rx:"1",stroke:"currentColor",strokeWidth:"2"})]}))},g=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"2"}),(0,r.tZ)("path",{d:"M9 3v18",stroke:"currentColor",strokeWidth:"2"})]}))},m=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"2"}),(0,r.tZ)("path",{d:"M15 3v18",stroke:"currentColor",strokeWidth:"2"})]}))},b=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"M4 9V5a1 1 0 0 1 1-1h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"M20 9V5a1 1 0 0 0-1-1h-4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"M4 15v4a1 1 0 0 0 1 1h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"M20 15v4a1 1 0 0 1-1 1h-4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},x=function(e){return(0,r.tZ)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:(0,r.tZ)("path",{d:"M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}))},k=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"m11 17-5-5 5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"m18 17-5-5 5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},w=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"m6 17 5-5-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"m13 17 5-5-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},S=function(e){return(0,r.BX)("svg",u({width:"12",height:"12",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},C="#6b7280",Z="#f9fafb",_="#e5e7eb",A="#9ca3af",L="#6b7280",j="#1f2937",B="#ef4444",T=function(e,t){var n=parseInt(e.replace("#",""),16),r=Math.min(255,Math.max(0,(n>>16)+Math.round(2.55*t))),o=Math.min(255,Math.max(0,(n>>8&255)+Math.round(2.55*t))),i=Math.min(255,Math.max(0,(255&n)+Math.round(2.55*t)));return"#".concat((r<<16|o<<8|i).toString(16).padStart(6,"0"))},I=function(){return I=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},I.apply(this,arguments)},W=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},z=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},R={searchDocuments:{running:"Searching documents...",done:"Searched the documents"},searchWeb:{running:"Searching the web...",done:"Searched the web"},scrapeUrl:{running:"Reading web page...",done:"Read the web page"},getPanelRuntime:{running:"Reading the page...",done:"Reviewed the page"},getPanelSnapshot:{running:"Reading the form...",done:"Reviewed the form"},getFuserSnapshot:{running:"Looking up your submission...",done:"Reviewed the submission"},listFormExtractions:{running:"Looking up extractions...",done:"Reviewed available extractions"},getExtractionSnapshot:{running:"Reading extraction setup...",done:"Reviewed the extraction setup"},getExtractionResults:{running:"Reading extraction results...",done:"Reviewed the extraction results"},setFieldValue:{running:"Updating form fields...",done:"Updated form fields"},clickElement:{running:"Just a moment...",done:"Triggered a form action"},getLogicRules:{running:"Reading form logic...",done:"Reviewed form logic"}},E=function(e){try{var t=new URL(e);return t.hostname+("/"!==t.pathname?t.pathname:"")}catch(t){return e}},O=function(e){if(!e||"object"!=typeof e)return[];var t=e,n=[],r=function(e){return e.map((function(e){return"object"==typeof e&&null!==e&&e.url||""})).filter(Boolean)};return Array.isArray(t.web)&&n.push.apply(n,z([],W(r(t.web)),!1)),Array.isArray(t.news)&&n.push.apply(n,z([],W(r(t.news)),!1)),Array.isArray(t.images)&&n.push.apply(n,z([],W(r(t.images)),!1)),"string"==typeof t.url&&t.url&&n.push(t.url),n.length>0?Array.from(new Set(n)):Array.isArray(e)?Array.from(new Set(r(e))):[]},M=function(e){return"input-streaming"===e||"input-available"===e},F=function(e){return"output-error"===e},X=function(e){var t,n=e.row,o=e.linkColor,i=e.indent,a=void 0===i?24:i,l=null===(t=n.input)||void 0===t?void 0:t.query,u=O(n.output);return l||u.length>0?(0,r.BX)("div",I({css:{display:"flex",flexDirection:"column",gap:"4px",paddingLeft:"".concat(a,"px"),marginTop:"2px",marginBottom:"4px"}},{children:[l&&(0,r.BX)("div",I({css:{color:A,fontSize:"12px",fontStyle:"italic"}},{children:['"',l.length>80?l.substring(0,80)+"...":l,'"']})),u.map((function(e,t){return(0,r.BX)("a",I({href:e,target:"_blank",rel:"noopener noreferrer",css:{fontSize:"12px",color:o,textDecoration:"none",display:"flex",alignItems:"center",gap:"4px",minWidth:0,":hover":{textDecoration:"underline"}}},{children:[(0,r.tZ)(S,{css:{flexShrink:0}}),(0,r.tZ)("span",I({css:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:E(e)}))]}),t)}))]})):null},K=function(e){var t;return!!(null===(t=e.input)||void 0===t?void 0:t.query)||O(e.output).length>0},D=function(e){var t,n,r=R[e.toolName]||{running:"Working...",done:"Done"};return M(e.state)?r.running:F(e.state)?null!==(t=r.done)&&void 0!==t?t:"Failed":null!==(n=r.done)&&void 0!==n?n:r.running},P={backgroundImage:"linear-gradient(90deg, ".concat(L," 25%, #d1d5db 50%, ").concat(L," 75%)"),backgroundSize:"220% 100%",backgroundClip:"text",WebkitBackgroundClip:"text",color:"transparent",animation:"feathery-tool-shimmer 1.6s linear infinite","@keyframes feathery-tool-shimmer":{from:{backgroundPosition:"160% 0"},to:{backgroundPosition:"-60% 0"}}},N=function(e){var t=e.rows,n=e.followedByText,i=e.turnFinished,a=e.linkColor,l=void 0===a?C:a,u=e.isFirstChunk,s=void 0!==u&&u,d=t.some((function(e){return M(e.state)})),p=!d&&(n||i),h=!(!d&&n),v=W((0,o.useState)(null),2),y=v[0],g=v[1],m=null!=y?y:h,b=function(){return g(!m)},x=I({display:"flex",flexDirection:"column",gap:"2px",fontSize:"13px",minWidth:0,paddingLeft:"".concat(14,"px")},s?{}:{animation:"feathery-chunk-fade-in 220ms ease-out both","@keyframes feathery-chunk-fade-in":{from:{opacity:0,transform:"translateY(4px)"},to:{opacity:1,transform:"translateY(0)"}}});if(p&&1===t.length){var k=t[0],w=F(k.state),S=K(k);return(0,r.BX)("div",I({css:x},{children:[(0,r.BX)("button",I({type:"button",onClick:S?b:void 0,css:{display:"inline-flex",alignItems:"center",gap:"6px",background:"none",border:"none",padding:"4px 0",cursor:S?"pointer":"default",color:L,textAlign:"left",font:"inherit",fontSize:"13px",alignSelf:"flex-start"}},{children:[w&&(0,r.tZ)(f,{css:{width:"12px",height:"12px",color:B}}),(0,r.tZ)("span",{children:D(k)}),S&&(0,r.tZ)(c,{css:{width:"12px",height:"12px",color:A,transform:m?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.2s ease",flexShrink:0}})]})),S&&m&&(0,r.tZ)(X,{row:k,linkColor:l,indent:6})]}))}var Z=p?"Finished working":"Working on it...";return(0,r.BX)("div",I({css:x},{children:[(0,r.BX)("button",I({type:"button",onClick:b,css:{display:"inline-flex",alignItems:"center",gap:"6px",background:"none",border:"none",padding:"4px 0",cursor:"pointer",color:L,textAlign:"left",font:"inherit",fontSize:"13px",alignSelf:"flex-start"}},{children:[(0,r.tZ)("span",I({css:p?void 0:P},{children:Z})),(0,r.tZ)(c,{css:{width:"12px",height:"12px",color:A,transform:m?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.2s ease",flexShrink:0}})]})),m&&(0,r.tZ)("div",I({css:{display:"flex",flexDirection:"column",gap:"2px",marginLeft:"5px",paddingLeft:"13px",borderLeft:"2px solid ".concat(_)}},{children:t.map((function(e){return(0,r.tZ)(V,{row:e,linkColor:l},e.key)}))}))]}))},V=function(e){var t=e.row,n=e.linkColor,i=K(t),a=M(t.state),l=F(t.state),u=W((0,o.useState)(null),2),s=u[0],d=u[1],v=null!=s?s:a,y=i?"button":"div";return(0,r.BX)("div",I({css:{display:"flex",flexDirection:"column",gap:"2px"}},{children:[(0,r.BX)(y,I({type:i?"button":void 0,onClick:i?function(){return d(!v)}:void 0,css:{display:"inline-flex",alignItems:"center",gap:"6px",color:l?B:L,background:"none",border:"none",padding:"2px 0",textAlign:"left",cursor:i?"pointer":"default",font:"inherit",fontSize:"13px",alignSelf:"flex-start"}},{children:[a?(0,r.tZ)(p,{css:{width:"12px",height:"12px"}}):l?(0,r.tZ)(f,{css:{width:"12px",height:"12px"}}):(0,r.tZ)(h,{css:{width:"12px",height:"12px"}}),(0,r.tZ)("span",I({css:a?P:void 0},{children:D(t)})),i&&(0,r.tZ)(c,{css:{width:"10px",height:"10px",color:A,transform:v?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.2s ease",flexShrink:0}})]})),i&&v&&(0,r.tZ)(X,{row:t,linkColor:n})]}))},q=function(){return(0,r.tZ)("div",I({css:{display:"flex",flexDirection:"column",gap:"2px",fontSize:"13px",minWidth:0,paddingLeft:"14px",animation:"feathery-chunk-fade-in 220ms ease-out both","@keyframes feathery-chunk-fade-in":{from:{opacity:0,transform:"translateY(4px)"},to:{opacity:1,transform:"translateY(0)"}}}},{children:(0,r.tZ)("div",I({css:{padding:"4px 0",color:L,fontSize:"13px",alignSelf:"flex-start"}},{children:(0,r.tZ)("span",I({css:P},{children:"Working on it..."}))}))}))},Y=n(917),H=n(4123),U=function(){return U=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},U.apply(this,arguments)},J=(0,Y.iv)({color:"#2563eb",fontWeight:400,textDecoration:"underline",textUnderlineOffset:"0.12em",textDecorationSkipInk:"auto",overflowWrap:"break-word","&:visited":{color:"#6d28d9"},"&:hover":{color:"#1d4ed8"}}),G=(0,Y.iv)('\n & p,\n & [data-streamdown="ordered-list"],\n & [data-streamdown="unordered-list"],\n & [data-streamdown="blockquote"],\n & [data-streamdown="code-block"],\n & [data-streamdown^="heading-"],\n & [data-streamdown="horizontal-rule"] {\n margin-top: 0 !important;\n margin-bottom: 0.6em !important;\n }\n & > *:last-child,\n & p:last-child,\n & [data-streamdown="ordered-list"]:last-child,\n & [data-streamdown="unordered-list"]:last-child,\n & [data-streamdown="blockquote"]:last-child,\n & [data-streamdown="code-block"]:last-child,\n & [data-streamdown^="heading-"]:last-child {\n margin-bottom: 0 !important;\n }\n\n & [data-streamdown="strong"],\n & strong,\n & b {\n font-weight: 600 !important;\n }\n & em,\n & i {\n font-style: italic !important;\n }\n\n & [data-streamdown="heading-1"] {\n font-size: 1.25em !important;\n font-weight: 600 !important;\n }\n & [data-streamdown="heading-2"] {\n font-size: 1.15em !important;\n font-weight: 600 !important;\n }\n & [data-streamdown="heading-3"] {\n font-size: 1.05em !important;\n font-weight: 600 !important;\n }\n & [data-streamdown="heading-4"],\n & [data-streamdown="heading-5"],\n & [data-streamdown="heading-6"] {\n font-size: 1em !important;\n font-weight: 600 !important;\n }\n\n & [data-streamdown="ordered-list"],\n & [data-streamdown="unordered-list"] {\n padding-left: 1.25em !important;\n }\n & [data-streamdown="ordered-list"] {\n list-style: decimal !important;\n }\n & [data-streamdown="unordered-list"] {\n list-style: disc !important;\n }\n & [data-streamdown="list-item"] {\n margin-bottom: 0.2em !important;\n }\n & [data-streamdown="list-item"]:last-child {\n margin-bottom: 0 !important;\n }\n\n & [data-streamdown="inline-code"] {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;\n font-size: 0.9em !important;\n padding: 0.1em 0.3em !important;\n border-radius: 4px !important;\n background-color: rgba(0, 0, 0, 0.06) !important;\n }\n & [data-streamdown="code-block"] {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;\n font-size: 0.9em !important;\n padding: 0.5em 0.75em !important;\n border-radius: 6px !important;\n background-color: rgba(0, 0, 0, 0.06) !important;\n overflow-x: auto !important;\n }\n\n & [data-streamdown="blockquote"] {\n padding-left: 0.75em !important;\n border-left: 3px solid rgba(0, 0, 0, 0.15) !important;\n color: rgba(0, 0, 0, 0.75) !important;\n }\n\n & [data-streamdown="horizontal-rule"] {\n border: 0 !important;\n border-top: 1px solid rgba(0, 0, 0, 0.12) !important;\n margin: 0.6em 0 !important;\n }\n'),Q={a:function(e){var t=e.href,n=e.children;return(0,r.tZ)("a",U({href:t,target:"_blank",rel:"noopener noreferrer",css:J},{children:n}))}},$=(0,o.memo)((function(e){var t=e.text,n=e.isStreaming,o=void 0!==n&&n;return(0,r.tZ)("div",U({css:G},{children:(0,r.tZ)(H.qI,U({components:Q,isAnimating:o,parseIncompleteMarkdown:o},{children:t}))}))}));$.displayName="MarkdownText";const ee=$;var te=function(){return te=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},te.apply(this,arguments)},ne=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function l(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}u((r=r.apply(e,t||[])).next())}))},re=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}},oe=function(e,t){return ne(void 0,void 0,void 0,(function(){var n;return re(this,(function(r){switch(r.label){case 0:return[4,fetch("".concat(e,"threads/"),{headers:t()})];case 1:return(n=r.sent()).ok?[2,n.json()]:[2,null]}}))}))},ie=function(e,t,n){return ne(void 0,void 0,void 0,(function(){var r;return re(this,(function(o){switch(o.label){case 0:return[4,fetch("".concat(e,"threads/").concat(n,"/"),{headers:t()})];case 1:return(r=o.sent()).ok?[2,r.json()]:[2,null]}}))}))},ae=function(e,t,n){return ne(void 0,void 0,void 0,(function(){return re(this,(function(r){switch(r.label){case 0:return[4,fetch("".concat(e,"threads/").concat(n,"/"),{method:"DELETE",headers:t()})];case 1:return r.sent(),[2]}}))}))},le=function(e,t){var n,r;if(!Array.isArray(e)||!Array.isArray(t)||0===t.length)return[];var o=[];try{for(var i=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(e),a=i.next();!a.done;a=i.next()){var l=a.value,u=Array.isArray(null==l?void 0:l.position)?l.position:[];if(!(u.length>=t.length)){for(var s=!0,c=0;c<u.length;c++)if(u[c]!==t[c]){s=!1;break}s&&o.push(l)}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return o.sort((function(e,t){return t.position.length-e.position.length})),o},ue=n(5710),se=n(9479),ce=n(4428),de=n(4665),pe=function(){return pe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},pe.apply(this,arguments)},fe=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},he=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},ve=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ye=function(e){var t=e.text;if("string"==typeof t&&t.trim())return t;var n=e.text_formatted,r=Array.isArray(n)?n:null==n?void 0:n.ops;return Array.isArray(r)?r.map((function(e){return"string"==typeof(null==e?void 0:e.insert)?e.insert:""})).join("").trim():""},ge=function(e,t){if(!e)return"";try{return(0,de.xf)(e,t)}catch(t){return e}},me=new Set(["submit","load"]),be=function(e,t,n,r){return(null!=e?e:[]).some((function(e){if((null==e?void 0:e.trigger_event)!==t)return!1;if(!1===e.enabled||!1===e.valid)return!1;var o=e.steps,i=e.elements;return!(Array.isArray(o)&&o.length>0&&!o.includes(n))&&(!!me.has(t)||Array.isArray(i)&&i.includes(r))}))},xe=function(e){var t,n,r,o,i,a,l,u,s,c,d,p,f,h,v,y,g,m,b,x,k=ce.Z[e];if(!k||!k.currentStep)return null;var w=k.currentStep,S=null!==(i=k.visiblePositions)&&void 0!==i?i:{},C=null!==(a=k.fields)&&void 0!==a?a:{},Z=null!==(l=k.inlineErrors)&&void 0!==l?l:{},_=k.logicRules,A=!(!(null===(u=k.formSettings)||void 0===u?void 0:u.readOnly)&&"readOnly"!==ue.Hi.collaboratorReview),L=(null!==(s=w.subgrids)&&void 0!==s?s:[]).filter((function(e){var t,n,r=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t.actions;return!!(Array.isArray(r)&&r.length>0)||be(_,"action",w.id,null!==(n=e.id)&&void 0!==n?n:"")})),j=function(e){return le(L,Array.isArray(null==e?void 0:e.position)?e.position:[]).map((function(e){var t;return null!==(t=e.id)&&void 0!==t?t:""}))},B=(null!==(c=w.servar_fields)&&void 0!==c?c:[]).map((function(e){var t,n,r,o,i,a,l,u=(null===(t=e.position)||void 0===t?void 0:t.join(","))||"root",s=S[u],c=!Array.isArray(s)||s.some(Boolean),d=C[e.servar.key],p=null!==(n=e.properties)&&void 0!==n?n:{},f="string"==typeof p.placeholder&&p.placeholder.trim()?ge(p.placeholder):void 0,h="string"==typeof p.tooltipText&&p.tooltipText.trim()?ge(p.tooltipText):void 0,v=null===(r=Z[e.servar.key])||void 0===r?void 0:r.message,y=null!==(o=e.servar)&&void 0!==o?o:{},g=null!==(i=y.metadata)&&void 0!==i?i:{},m=Array.isArray(g.options)?g.options:null,b=Array.isArray(g.labels)?g.labels:[],x=m?m.map((function(e,t){var n,r;return{value:String(null!=e?e:""),label:String(null!==(r=null!==(n=b[t])&&void 0!==n?n:e)&&void 0!==r?r:"")}})):void 0,k=Array.isArray(g.questions)?g.questions:null,L=k?k.map((function(e){var t,n;return{id:String(null!==(t=null==e?void 0:e.id)&&void 0!==t?t:""),label:String(null!==(n=null==e?void 0:e.label)&&void 0!==n?n:"")}})).filter((function(e){return e.id||e.label})):void 0,B=he(he([],fe(Array.isArray(g.file_types)?g.file_types:[]),!1),fe(Array.isArray(g.custom_file_types)?g.custom_file_types.map((function(e){return".".concat(e)})):[]),!1),T=g.min_val_label||g.max_val_label?pe(pe({},g.min_val_label?{min:String(g.min_val_label)}:{}),g.max_val_label?{max:String(g.max_val_label)}:{}):void 0,I=!(!p.disabled&&!A),W=be(_,"change",w.id,null!==(a=y.id)&&void 0!==a?a:""),z=j(e);return pe(pe(pe(pe(pe(pe(pe(pe(pe(pe(pe(pe(pe(pe(pe({key:y.key,type:y.type,value:null!==(l=null==d?void 0:d.value)&&void 0!==l?l:null,visible:c,disabled:I,required:!!y.required,repeated:!!y.repeated},W?{hasLogicRules:!0}:{}),z.length>0?{clickableAncestorIds:z}:{}),f?{placeholder:f}:{}),h?{tooltip:h}:{}),v?{error:v}:{}),x?{options:x}:{}),L?{questions:L}:{}),"number"==typeof y.min_length?{minLength:y.min_length}:{}),"number"==typeof y.max_length?{maxLength:y.max_length}:{}),y.format?{format:String(y.format)}:{}),B.length>0?{fileTypes:B}:{}),g.multiple?{multipleFiles:!0}:{}),"button_group"===y.type?{multiple:!!g.multiple}:{}),T?{sliderLabels:T}:{}),"number"==typeof g.step_size?{stepSize:g.step_size}:{})})),T=new Set;try{for(var I=ve(Object.keys(null!==(d=k.steps)&&void 0!==d?d:{})),W=I.next();!W.done;W=I.next()){var z=W.value,R=k.steps[z];(null!==(p=null==R?void 0:R.servar_fields)&&void 0!==p?p:[]).forEach((function(e){var t;(null===(t=null==e?void 0:e.servar)||void 0===t?void 0:t.key)&&T.add(e.servar.key)}))}}catch(e){t={error:e}}finally{try{W&&!W.done&&(n=I.return)&&n.call(I)}finally{if(t)throw t.error}}var E=function(e){return!(null==e||"string"==typeof e&&""===e||Array.isArray(e)&&0===e.length)},O={},M={};try{for(var F=ve(Object.keys(C)),X=F.next();!X.done;X=F.next()){var K=X.value,D=null!==(h=null===(f=C[K])||void 0===f?void 0:f.value)&&void 0!==h?h:null;T.has(K)?O[K]=D:E(D)&&(M[K]=D)}}catch(e){r={error:e}}finally{try{X&&!X.done&&(o=F.return)&&o.call(F)}finally{if(r)throw r.error}}var P=[],N=function(e){var t,n=(null===(t=e.position)||void 0===t?void 0:t.join(","))||"root",r=S[n];return!Array.isArray(r)||r.some(Boolean)};L.forEach((function(e){var t,n,r=e.properties.actions,o=be(_,"action",w.id,null!==(t=e.id)&&void 0!==t?t:""),i=j(e);P.push(pe(pe({type:"container",id:null!==(n=e.id)&&void 0!==n?n:"",visible:N(e),actions:r},o?{hasLogicRules:!0}:{}),i.length>0?{clickableAncestorIds:i}:{}))})),(null!==(v=w.texts)&&void 0!==v?v:[]).forEach((function(e){var t,n,r,o=ye(null!==(t=null==e?void 0:e.properties)&&void 0!==t?t:{});if(o){var i=ge(o),a=null!==(n=null==e?void 0:e.properties)&&void 0!==n?n:{},l=Array.isArray(a.actions)?a.actions:[],u=be(_,"action",w.id,null!==(r=e.id)&&void 0!==r?r:""),s=j(e);P.push(pe(pe(pe(pe(pe({type:"text",text:i,visible:N(e)},e.id?{id:e.id}:{}),o!==i?{templateText:o}:{}),l.length>0?{actions:l}:{}),u?{hasLogicRules:!0}:{}),s.length>0?{clickableAncestorIds:s}:{}))}})),(null!==(y=w.buttons)&&void 0!==y?y:[]).forEach((function(e){var t,n,r,o,i=ye(null!==(t=null==e?void 0:e.properties)&&void 0!==t?t:{});if(i){var a=null!==(n=null==e?void 0:e.properties)&&void 0!==n?n:{},l=Array.isArray(a.actions)?a.actions:[],u=be(_,"action",w.id,null!==(r=e.id)&&void 0!==r?r:"")||!!a.submit&&(be(_,"submit",w.id,"")||be(_,"form_complete",w.id,""));P.push(pe({type:"button",id:null!==(o=e.id)&&void 0!==o?o:"",text:ge(i),visible:N(e),submit:!!a.submit,actions:l},u?{hasLogicRules:!0}:{}))}})),(null!==(g=w.images)&&void 0!==g?g:[]).forEach((function(e){var t,n=null!==(t=null==e?void 0:e.properties)&&void 0!==t?t:{},r="string"==typeof n.alt_text&&n.alt_text||"string"==typeof n.caption&&n.caption||"";if(r){var o=j(e);P.push(pe({type:"image",text:ge(r),visible:N(e)},o.length>0?{clickableAncestorIds:o}:{}))}})),(null!==(m=w.progress_bars)&&void 0!==m?m:[]).forEach((function(e){var t,n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t.num_segments;P.push(pe(pe({type:"progress"},"number"==typeof n?{segments:n}:{}),{visible:N(e)}))}));var V=[];return(null!==(b=w.tables)&&void 0!==b?b:[]).forEach((function(e){var t,n,r=null!==(n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t.columns)&&void 0!==n?n:[];if(0!==r.length){var o=r.reduce((function(e,t){var n,r=t.field_key?null===(n=C[t.field_key])||void 0===n?void 0:n.value:void 0;return Array.isArray(r)?Math.max(e,r.length):e}),0),i=Array.from({length:o},(function(e,t){return r.map((function(e){var n,r,o=e.field_key?null===(n=C[e.field_key])||void 0===n?void 0:n.value:null;return Array.isArray(o)?null!==(r=o[t])&&void 0!==r?r:null:null!=o?o:null}))}));V.push({columns:r.map((function(e){var t,n,r;return{name:null!==(n=null!==(t=e.name)&&void 0!==t?t:e.field_key)&&void 0!==n?n:"",fieldKey:null!==(r=e.field_key)&&void 0!==r?r:""}})),rows:i,visible:N(e)})}})),{currentStep:{id:w.id,key:w.key},previousStepName:k.previousStepName||void 0,totalSteps:Object.keys(null!==(x=k.steps)&&void 0!==x?x:{}).length,currentStepFields:B,currentStepElements:P,currentStepTables:V,values:O,hiddenFieldValues:M}},ke=n(9234),we=n(1075),Se=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function l(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}u((r=r.apply(e,t||[])).next())}))},Ce=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}},Ze=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},_e=new Set(["file_upload","signature"]),Ae=new Set(["text_field","text_area","email","phone_number","url","password","ssn","ein","gmap_line_1","gmap_line_2","gmap_city","gmap_state","gmap_country","gmap_zip"]),Le=new Set(["integer_field","slider","rating"]),je=new Set(["dropdown","radio"]),Be=new Set(["dropdown_multi","multiselect","checkbox_group","button_group"]);function Te(e,t,n){var r,o=null!==(r=null==n?void 0:n.currentStepFields)&&void 0!==r?r:[],i=o.find((function(t){return t.key===e}));if(!i){var a=o.map((function(e){return e.key})).join(", ")||"(none)";return{ok:!1,errorType:"not_on_step",error:"Field '".concat(e,"' is not on the current step. Available field keys here: ").concat(a,".")}}if(!i.visible)return{ok:!1,errorType:"hidden",error:"Field '".concat(e,"' is on the current step but is hidden right now.")};if(i.disabled)return{ok:!1,errorType:"disabled",error:"Field '".concat(e,"' is disabled and cannot be written.")};if(_e.has(i.type))return{ok:!1,errorType:"unwriteable_type",error:"Field '".concat(e,"' (").concat(i.type,") cannot be filled by the assistant; the user has to provide this themselves.")};var l=t;"phone_number"===i.type&&"number"==typeof l&&Number.isFinite(l)&&(l=String(Math.trunc(l)));var u=function(e,t){var n,r;if("checkbox"===e.type)return"boolean"==typeof t?null:"Field '".concat(e.key,"' (checkbox) expects a boolean.");if(Le.has(e.type))return"number"==typeof t&&Number.isFinite(t)?"number"==typeof e.minLength&&t<e.minLength?"Value below minimum (".concat(e.minLength,")."):"number"==typeof e.maxLength&&t>e.maxLength?"Value above maximum (".concat(e.maxLength,")."):null:"Field '".concat(e.key,"' (").concat(e.type,") expects a number.");if("date_selector"===e.type)return"string"!=typeof t?"Field '".concat(e.key,"' (date_selector) expects a string."):/^\d{4}-\d{2}-\d{2}$/.test(t)?null:"Field '".concat(e.key,"' expects ISO date 'YYYY-MM-DD'.");if(je.has(e.type)){if("string"!=typeof t)return"Field '".concat(e.key,"' (").concat(e.type,") expects a single option value (string).");var o=(null!==(n=e.options)&&void 0!==n?n:[]).map((function(e){return e.value}));return o.length>0&&!o.includes(t)?"Value not in allowed options. Allowed: ".concat(o.join(", "),"."):null}if(Be.has(e.type)){if(!Array.isArray(t)||!t.every((function(e){return"string"==typeof e})))return"Field '".concat(e.key,"' (").concat(e.type,") expects an array of option-value strings.");if("button_group"===e.type&&!e.multiple&&t.length>1)return"Field '".concat(e.key,"' (button_group) is single-select; pass at most one option.");var i=new Set((null!==(r=e.options)&&void 0!==r?r:[]).map((function(e){return e.value})));if(i.size>0){var a=t.filter((function(e){return!i.has(e)}));if(a.length>0)return"Values not in allowed options: ".concat(a.join(", "),".")}return null}return Ae.has(e.type)?"string"!=typeof t?"Field '".concat(e.key,"' (").concat(e.type,") expects a string."):"number"==typeof e.minLength&&t.length<e.minLength?"Value shorter than minimum length (".concat(e.minLength,")."):"number"==typeof e.maxLength&&t.length>e.maxLength?"Value exceeds maximum length (".concat(e.maxLength,")."):null:null}(i,l);return u?{ok:!1,errorType:"shape_mismatch",error:u}:{ok:!0,value:l}}function Ie(e,t){return Se(this,void 0,void 0,(function(){var n,r,o,i,a,l,u,s,c,d,p,f;return Ce(this,(function(h){switch(h.label){case 0:if(!e||0===t.length)return[2];if(!(n=ce.Z[e]))return[2];r={},h.label=1;case 1:h.trys.push([1,8,9,10]),o=Ze(t),i=o.next(),h.label=2;case 2:return i.done?[3,7]:(a=i.value,l=a.fieldKey,u=a.value,s=function(e,t){var n,r,o,i,a,l=null!==(o=e.steps)&&void 0!==o?o:{};try{for(var u=Ze(Object.keys(l)),s=u.next();!s.done;s=u.next()){var c=(null!==(a=null===(i=l[s.value])||void 0===i?void 0:i.servar_fields)&&void 0!==a?a:[]).find((function(e){var n;return(null===(n=null==e?void 0:e.servar)||void 0===n?void 0:n.key)===t}));if(c)return c.servar}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}return null}(n,l),c=u,"gmap_state"!==(null==s?void 0:s.type)?[3,3]:(c=function(e,t){var n,r;if("string"!=typeof e||!e)return e;var o=!!(null===(n=t.metadata)||void 0===n?void 0:n.store_abbreviation),i=null===(r=t.metadata)||void 0===r?void 0:r.default_country,a=(i&&"auto"!==i?i:"us").toLowerCase(),l=we.P3[a];if(!l||0===l.length)return e;var u=e.toLowerCase(),s=l.find((function(e){return e.code.toLowerCase()===u||e.name.toLowerCase()===u}));return s?o?s.code:s.name:e}(u,s),[3,5]));case 3:return"phone_number"!==(null==s?void 0:s.type)?[3,5]:[4,We(u,s,n,l)];case 4:c=h.sent(),h.label=5;case 5:r[l]=c,h.label=6;case 6:return i=o.next(),[3,2];case 7:return[3,10];case 8:return d=h.sent(),p={error:d},[3,10];case 9:try{i&&!i.done&&(f=o.return)&&f.call(o)}finally{if(p)throw p.error}return[7];case 10:return(0,ue.Ax)(r,!0,!0),[2]}}))}))}function We(e,t,n,r){return Se(this,void 0,void 0,(function(){var o,i,a;return Ce(this,(function(l){switch(l.label){case 0:return(o="number"==typeof e?String(Math.trunc(e)):"string"==typeof e?e:"").replace(/\D/g,"")?(ke.BZ||(0,ke.bq)(),[4,ke.hV]):[2,e];case 1:return l.sent(),ke.BZ?(i=function(e,t,n){var r,o,i,a=null===(o=null===(r=e.fields)||void 0===r?void 0:r[t])||void 0===o?void 0:o.value;if(a&&"string"==typeof a&&ke.BZ)try{var l=ke.BZ.parsePhoneNumber("+".concat(a));if(null==l?void 0:l.country)return l.country}catch(e){}var u=null===(i=n.metadata)||void 0===i?void 0:i.default_country;return u&&"auto"!==u?u:"US"}(n,r,t),(null==(a=function(){try{return ke.BZ.parsePhoneNumber(o,i)}catch(e){return}}())?void 0:a.isValid())?[2,a.number.replace(/^\+/,"")]:[2,e]):[2,e]}}))}))}var ze=function(){return ze=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ze.apply(this,arguments)},Re=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ee=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},Oe=function(e){var t,n,r,o,i=null!==(r=null==e?void 0:e.inlineErrors)&&void 0!==r?r:{},a={};try{for(var l=Re(Object.keys(i)),u=l.next();!u.done;u=l.next()){var s=u.value,c=null===(o=i[s])||void 0===o?void 0:o.message;"string"==typeof c&&c.length>0&&(a[s]=c)}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}return a};function Me(e,t){var n,r,o,i,a,l,u;return i=this,a=void 0,u=function(){var i,a,l,u,s,c,d,p,f,h,v,y,g,m,b,x,k,w,S,C,Z,_,A;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,(function(L){switch(L.label){case 0:if(!e)return[2,{ok:!1,errorType:"no_form_state",error:"Form has not loaded yet."}];if(!(i=ce.Z[e])||!i.currentStep||!i.assistantClient)return[2,{ok:!1,errorType:"no_form_state",error:"Form has not loaded yet."}];if("string"!=typeof t||0===t.length)return[2,{ok:!1,errorType:"shape_mismatch",error:"elementId is required."}];if(a=function(e,t){var n,r,o,i=null==e?void 0:e.currentStep;if(!i)return null;var a=[[i.buttons,"button"],[i.texts,"text"],[i.subgrids,"container"]];try{for(var l=Re(a),u=l.next();!u.done;u=l.next()){var s=Ee(u.value,2),c=s[0],d=s[1],p=(null!=c?c:[]).find((function(e){return(null==e?void 0:e.id)===t}));if(p){var f=null===(o=null==p?void 0:p.properties)||void 0===o?void 0:o.actions;return{element:p,elementType:d,actions:Array.isArray(f)?f:[],position:Array.isArray(p.position)?p.position:[]}}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}return null}(i,t),!a)return[2,{ok:!1,errorType:"not_on_step",error:"Element '".concat(t,"' is not on the current step.")}];if(!function(e,t){var n,r=t.join(",")||"root",o=null===(n=e.visiblePositions)||void 0===n?void 0:n[r];return!Array.isArray(o)||o.some(Boolean)}(i,a.position))return[2,{ok:!1,errorType:"hidden",error:"Element '".concat(t,"' is on the current step but is hidden right now.")}];l=i.assistantClient,u=i.currentStep.key,s=Oe(i),L.label=1;case 1:return L.trys.push([1,13,,14]),"button"!==a.elementType?[3,3]:[4,l.click(a.element)];case 2:return L.sent(),[3,12];case 3:return c=le(i.currentStep.subgrids,a.position),[4,l.runActions({actions:a.actions,element:a.element,elementType:a.elementType})];case 4:L.sent(),L.label=5;case 5:L.trys.push([5,10,11,12]),d=Re(c),p=d.next(),L.label=6;case 6:return p.done?[3,9]:(f=p.value,h=null===(n=null==f?void 0:f.properties)||void 0===n?void 0:n.actions,[4,l.runActions({actions:Array.isArray(h)?h:[],element:f,elementType:"container"})]);case 7:L.sent(),L.label=8;case 8:return p=d.next(),[3,6];case 9:return[3,12];case 10:return v=L.sent(),C={error:v},[3,12];case 11:try{p&&!p.done&&(Z=d.return)&&Z.call(d)}finally{if(C)throw C.error}return[7];case 12:return[3,14];case 13:return[2,{ok:!1,errorType:"dispatch_failed",error:(y=L.sent())instanceof Error?y.message:String(y)}];case 14:g=null!==(o=null===(r=i.currentStep)||void 0===r?void 0:r.key)&&void 0!==o?o:u,m=Oe(i),b={};try{for(x=Re(Object.keys(m)),k=x.next();!k.done;k=x.next())w=k.value,m[w]!==s[w]&&(b[w]=m[w])}catch(e){_={error:e}}finally{try{k&&!k.done&&(A=x.return)&&A.call(x)}finally{if(_)throw _.error}}return S="button"===a.elementType?b[t]:void 0,delete b[t],[2,ze(ze({ok:!0,navigated:g!==u?{fromStepKey:u,toStepKey:g}:null},S?{buttonError:S}:{}),Object.keys(b).length>0?{fieldErrors:b}:{})]}}))},new((l=void 0)||(l=Promise))((function(e,t){function n(e){try{o(u.next(e))}catch(e){t(e)}}function r(e){try{o(u.throw(e))}catch(e){t(e)}}function o(t){var o;t.done?e(t.value):(o=t.value,o instanceof l?o:new l((function(e){e(o)}))).then(n,r)}o((u=u.apply(i,a||[])).next())}))}var Fe=function(){return Fe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Fe.apply(this,arguments)},Xe=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function l(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}u((r=r.apply(e,t||[])).next())}))},Ke=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}},De=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},Pe=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ne=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},Ve="feathery.assistant.mode",qe="current",Ye=function(){try{var e=(0,se.Kv)().localStorage.getItem(Ve);return"current"===(t=e)||"sidebar-left"===t||"sidebar-right"===t||"fullscreen"===t?e:qe}catch(e){return qe}var t},He="feathery.assistant.sidebarWidth",Ue=380,Je=function(e){var t=Math.max(280,function(){try{return Math.min(800,Math.floor(.6*(0,se.Kv)().innerWidth))}catch(e){return 800}}());return e<280?280:e>t?t:e},Ge=function(){try{var e=(0,se.Kv)().localStorage.getItem(He),t=e?parseInt(e,10):NaN;return Number.isFinite(t)&&t>0?Je(t):Ue}catch(e){return Ue}},Qe=function(e){try{(0,se.Kv)().localStorage.setItem(He,String(e))}catch(e){}},$e=["current","sidebar-left","sidebar-right","fullscreen"];const et=function(e){var t,n,u,c=e.instanceId,p=e.getTargets,h=e.getJwt,S=e.baseUrl,L=e.bottom,B=void 0===L?20:L,I=e.color,W=e.workflowActions,z=void 0===W?[]:W,R=e.allowedModes,E=void 0===R?$e:R,O=e.onLayoutChange,M=(0,o.useMemo)((function(){if(h)return function(){return{Authorization:"Bearer ".concat(h())}};var e=(0,ue.JQ)().sdkKey;return function(){var t={Authorization:"Token ".concat(e)},n=(0,se.ej)("feathery_session_token");return n&&(t["X-Feathery-Session"]=n),t}}),[h]),F=De((0,o.useState)(!1),2),X=F[0],K=F[1],D=De((0,o.useState)(Ye),2),P=D[0],V=D[1],Y=(0,o.useCallback)((function(e){V(e),function(e){try{(0,se.Kv)().localStorage.setItem(Ve,e)}catch(e){}}(e)}),[]),H=De((0,o.useState)(Ge),2),U=H[0],J=H[1],G=De((0,o.useState)(!1),2),Q=G[0],$=G[1];(0,o.useEffect)((function(){var e=function(){J((function(e){var t=Je(e);return t!==e&&Qe(t),t}))};return(0,se.Kv)().addEventListener("resize",e),function(){return(0,se.Kv)().removeEventListener("resize",e)}}),[]);var le=(0,o.useCallback)((function(e){return function(t){if(0===t.button){t.preventDefault(),$(!0);var n=(0,se.me)().body;n.style.cursor="col-resize",n.style.userSelect="none";var r=U,o=function(t){var n="right"===e?(0,se.Kv)().innerWidth-t.clientX:t.clientX;r=Je(n),J(r)},i=function(){(0,se.Kv)().removeEventListener("pointermove",o),(0,se.Kv)().removeEventListener("pointerup",i),(0,se.Kv)().removeEventListener("pointercancel",i),$(!1),n.style.cursor="",n.style.userSelect="",Qe(r)};(0,se.Kv)().addEventListener("pointermove",o),(0,se.Kv)().addEventListener("pointerup",i),(0,se.Kv)().addEventListener("pointercancel",i)}}}),[U]),de=(0,o.useCallback)((function(){J(Ue),Qe(Ue)}),[]),pe=De((0,o.useState)(""),2),fe=pe[0],he=pe[1],ve=De((0,o.useState)([]),2),ye=ve[0],ge=ve[1],me=De((0,o.useState)(null),2),be=me[0],ke=me[1],we=De((0,o.useState)(!1),2),Se=we[0],Ce=we[1],Ze=De((0,o.useState)(!1),2),_e=Ze[0],Ae=Ze[1],Le=De((0,o.useState)(null),2),je=Le[0],Be=Le[1],We=(0,o.useRef)(null),ze=(0,o.useRef)(null),Re=(0,o.useRef)(!0),Ee=(0,o.useCallback)((function(){var e=ze.current;if(e){var t=e.scrollHeight-e.scrollTop-e.clientHeight;Re.current=t<60}}),[]),Oe=(0,o.useMemo)((function(){return{primary:e=I||C,hover:T(e,-15),disabled:T(e,30),light:(t=e,90,n=parseInt(t.replace("#",""),16),r=n>>16&255,o=n>>8&255,i=255&n,.9,a=Math.round(r+.9*(255-r)),l=Math.round(o+.9*(255-o)),u=Math.round(i+.9*(255-i)),"#".concat((a<<16|l<<8|u).toString(16).padStart(6,"0")))};var e,t,n,r,o,i,a,l,u}),[I]),qe=function(e,t,n){void 0===t&&(t=[]);var r=e,o=!!n,i=new l.PD({api:S,headers:M,body:function(){return Fe(Fe({},function(){var e={},t=p();if(t.length>0&&(e.targets=t),c){var n=xe(c);n&&(e.panel_runtime=n)}return e}()),{thread_id:r||null})},fetch:function(e,t){return Xe(void 0,void 0,void 0,(function(){var n,i,a,l,s,d,f,h,v,y;return Ke(this,(function(g){switch(g.label){case 0:return[4,fetch(e,t)];case 1:return n=g.sent(),(i=n.headers.get("X-Thread-Id"))&&!r&&(r=i,ge((function(e){return e.map((function(e){return e.chat===u?Fe(Fe({},e),{id:i,isTemporary:!1}):e}))})),ke(i),ie(S,M,i).then((function(e){e&&ge((function(t){return t.map((function(t){return t.id===i?Fe(Fe({},e),{chat:u,title:t.title||e.title}):t}))}))}))),o||(a=null===(y=null===(v=null===(h=u.messages.find((function(e){return"user"===e.role})))||void 0===h?void 0:h.parts)||void 0===v?void 0:v[0])||void 0===y?void 0:y.text)&&(o=!0,l=r||i||null,s={},(d=p()).length>0&&(s.targets=d),c&&(f=function(e){var t,n;return null===(n=null===(t=ce.Z[e])||void 0===t?void 0:t.currentStep)||void 0===n?void 0:n.key}(c),f&&(s.current_step=f)),function(e,t,n,r,o){return ne(void 0,void 0,void 0,(function(){var i,a,l;return re(this,(function(u){switch(u.label){case 0:return[4,fetch("".concat(e,"threads/title/"),{method:"POST",headers:te(te({},t()),{"Content-Type":"application/json"}),body:JSON.stringify(te({message:r,thread_id:null!=n?n:void 0},null!=o?o:{}))})];case 1:return(i=u.sent()).ok?[4,i.json()]:[2,null];case 2:return a=u.sent(),[2,null!==(l=a.title)&&void 0!==l?l:null]}}))}))}(S,M,l,a,s).then((function(e){e&&ge(l?function(t){return t.map((function(t){return t.id===l?Fe(Fe({},t),{title:e}):t}))}:function(t){return t.map((function(t){return t.chat===u?Fe(Fe({},t),{title:e}):t}))})}))),[2,n]}}))}))}}),u=new a.en({transport:i,messages:t,sendAutomaticallyWhen:l.Qk,onToolCall:function(e){var t=e.toolCall;return Xe(void 0,void 0,void 0,(function(){var e,n,r,o,i,a,l,s,d,p,f,h,v,y,g,m,b,x,k,w,S,C,Z,_,A,L,j;return Ke(this,(function(B){switch(B.label){case 0:if(t.dynamic)return[2];if("setFieldValue"!==t.toolName)return[3,5];e=null!==(L=t.input)&&void 0!==L?L:{},n=Array.isArray(e.fields)?e.fields:[],r=c?xe(c):null,o=[],i=[];try{for(a=Pe(n),l=a.next();!l.done;l=a.next())s=l.value,(m="string"==typeof(null==s?void 0:s.fieldKey)?s.fieldKey:"")?(d=Te(m,s.value,r)).ok?i.push({fieldKey:m,value:d.value}):o.push({fieldKey:m,ok:!1,error:d.error,errorType:d.errorType}):o.push({fieldKey:m,ok:!1,errorType:"shape_mismatch",error:"fieldKey is required."})}catch(e){w={error:e}}finally{try{l&&!l.done&&(S=a.return)&&S.call(a)}finally{if(w)throw w.error}}B.label=1;case 1:return B.trys.push([1,3,,4]),[4,Ie(c,i)];case 2:B.sent();try{for(p=Pe(i),f=p.next();!f.done;f=p.next())m=f.value.fieldKey,o.push({fieldKey:m,ok:!0})}catch(e){C={error:e}}finally{try{f&&!f.done&&(Z=p.return)&&Z.call(p)}finally{if(C)throw C.error}}return[3,4];case 3:h=B.sent(),v=h instanceof Error?h.message:String(h);try{for(y=Pe(i),g=y.next();!g.done;g=y.next())m=g.value.fieldKey,o.push({fieldKey:m,ok:!1,errorType:"apply_failed",error:v})}catch(e){_={error:e}}finally{try{g&&!g.done&&(A=y.return)&&A.call(y)}finally{if(_)throw _.error}}return[3,4];case 4:return u.addToolOutput({tool:"setFieldValue",toolCallId:t.toolCallId,output:{results:o}}),[3,7];case 5:return"clickElement"!==t.toolName?[3,7]:(b=null!==(j=t.input)&&void 0!==j?j:{},x="string"==typeof b.elementId?b.elementId:"",[4,Me(c,x)]);case 6:k=B.sent(),u.addToolOutput({tool:"clickElement",toolCallId:t.toolCallId,output:k}),B.label=7;case 7:return[2]}}))}))},onFinish:function(e){var t=e.isAbort,n=e.isError;t||n||!r||ge((function(e){var t=e.find((function(e){return e.id===r}));return t?Ne([Fe(Fe({},t),{updated_at:(new Date).toISOString()})],De(e.filter((function(e){return e.id!==r}))),!1):e}))}});return u},He=(0,o.useMemo)((function(){return qe(null)}),[M,p,h]),et=ye.find((function(e){return e.id===be})),tt=null!==(u=null==et?void 0:et.chat)&&void 0!==u?u:He,nt=(0,a.RJ)({chat:tt}),rt=nt.messages,ot=nt.sendMessage,it=nt.status,at=nt.error,lt=(0,o.useMemo)((function(){var e,t,n,r,o=[];try{for(var i=Pe(rt),a=i.next();!a.done;a=i.next()){var l=a.value,u=o[o.length-1];u&&"assistant"===u.role&&"assistant"===l.role?o[o.length-1]=Fe(Fe({},u),{parts:Ne(Ne([],De(null!==(n=u.parts)&&void 0!==n?n:[]),!1),De(null!==(r=l.parts)&&void 0!==r?r:[]),!1)}):o.push(l)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return o}),[rt]);(0,o.useEffect)((function(){var e;Re.current&&(null===(e=We.current)||void 0===e||e.scrollIntoView({behavior:"smooth"}))}),[lt]),(0,o.useEffect)((function(){if("ready"===it&&Re.current){var e=(0,se.Kv)().requestAnimationFrame((function(){var e;null===(e=We.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"end"})}));return function(){return(0,se.Kv)().cancelAnimationFrame(e)}}}),[it]);var ut=(0,o.useCallback)((function(){return Xe(void 0,void 0,void 0,(function(){var e;return Ke(this,(function(t){switch(t.label){case 0:return[4,oe(S,M)];case 1:return(e=t.sent())?(ge((function(t){return Ne(Ne([],De(e.map((function(e){var n;return Fe(Fe({},e),{chat:null===(n=t.find((function(t){return t.id===e.id})))||void 0===n?void 0:n.chat})}))),!1),De(t.filter((function(t){return!e.find((function(e){return e.id===t.id}))}))),!1)})),[2]):[2]}}))}))}),[M,S]);(0,o.useEffect)((function(){X&&ut()}),[X,ut]);var st=function(){Re.current=!0;var e=(0,i.Z)(),t=(new Date).toISOString(),n=qe(null);ge((function(r){return Ne([{id:e,title:"",created_at:t,updated_at:t,isTemporary:!0,chat:n}],De(r.filter((function(e){return!e.isTemporary||e.title}))),!1)})),ke(e)},ct=function(){if(fe.trim()&&"ready"===it){Re.current=!0;var e=(new Date).toISOString();if(be)et&&!et.title&&ge((function(t){return Ne([Fe(Fe({},et),{title:"New Chat",updated_at:e})],De(t.filter((function(e){return e.id!==be}))),!1)}));else{var t=(0,i.Z)();ge((function(n){return Ne([{id:t,title:"New Chat",created_at:e,updated_at:e,isTemporary:!0,chat:tt}],De(n),!1)})),ke(t)}ot({text:fe}),he("")}},dt=ye.filter((function(e){return e.title})),pt="submitted"===it||"streaming"===it,ft="sidebar-left"===P?"left":"sidebar-right"===P?"right":null,ht=X&&ft?U:0,vt=(0,o.useRef)(O);vt.current=O,(0,o.useEffect)((function(){var e;null===(e=vt.current)||void 0===e||e.call(vt,{mode:P,isOpen:X,side:ft,width:ht,isResizing:Q})}),[P,X,ft,ht,Q]);var yt="sidebar-left"===P?k:"sidebar-right"===P?w:"fullscreen"===P?f:x,gt="sidebar-left"===P?g:"sidebar-right"===P?m:"fullscreen"===P?b:y,mt="sidebar-left"===P,bt=mt?{left:"20px"}:{right:"20px"},xt=mt?20:B;if(!X)return(0,r.tZ)("button",Fe({type:"button",onClick:function(){return K(!0)},css:Fe(Fe({position:"fixed",bottom:"".concat(xt,"px")},bt),{width:"".concat(56,"px"),height:"".concat(56,"px"),borderRadius:"50%",backgroundColor:Oe.primary,color:"white",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",transition:"transform 0.2s, box-shadow 0.2s, background-color 0.2s",zIndex:1e3,":hover":{backgroundColor:Oe.hover,transform:"scale(1.05)",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)"}})},{children:(0,r.tZ)(s,{})}));var kt="sidebar-left"===P?{top:0,left:0,width:"".concat(U,"px"),height:"100vh",borderRadius:0,boxShadow:"4px 0 24px rgba(0, 0, 0, 0.12)",borderRight:"1px solid ".concat(_)}:"sidebar-right"===P?{top:0,right:0,width:"".concat(U,"px"),height:"100vh",borderRadius:0,boxShadow:"-4px 0 24px rgba(0, 0, 0, 0.12)",borderLeft:"1px solid ".concat(_)}:"fullscreen"===P?{inset:0,borderRadius:0,boxShadow:"none",border:"none"}:{bottom:"".concat(B,"px"),right:"20px",width:"".concat(380,"px"),height:"".concat(500,"px"),borderRadius:"12px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.12)",border:"1px solid ".concat(_)};return(0,r.BX)("div",Fe({css:Fe({position:"fixed",backgroundColor:"white",display:"flex",flexDirection:"column",overflow:"hidden",zIndex:1e3},kt)},{children:[ft&&(0,r.tZ)("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize assistant panel",title:"Drag to resize, double-click to reset",onPointerDown:le(ft),onDoubleClick:de,css:(t={position:"absolute",top:0},t["right"===ft?"left":"right"]=0,t.width="6px",t.height="100%",t.cursor="col-resize",t.zIndex=2,t.touchAction="none",t.userSelect="none",t["::after"]=(n={content:'""',position:"absolute",top:0},n["right"===ft?"left":"right"]="2px",n.width="2px",n.height="100%",n.backgroundColor="transparent",n.transition="background-color 120ms ease",n),t[":hover::after"]={backgroundColor:"rgba(0, 0, 0, 0.15)"},t)}),(0,r.BX)("div",Fe({css:Fe({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"2px",padding:"12px 16px",backgroundColor:Oe.primary,color:"white",position:"relative"},ft?{minHeight:"var(--main-nav-height, 55px)",boxSizing:"border-box"}:{})},{children:[(0,r.BX)("div",Fe({css:{display:"flex",alignItems:"center",gap:"8px",minWidth:0,flex:1,overflow:"hidden"}},{children:[(0,r.tZ)(s,{}),(0,r.BX)("button",Fe({type:"button",onClick:function(){return Ce((function(e){return!e}))},css:{background:"none",border:"none",color:"white",cursor:"pointer",fontWeight:600,fontSize:"14px",padding:"4px",borderRadius:"4px",display:"flex",alignItems:"center",gap:"4px",minWidth:0,maxWidth:"100%",":hover":{backgroundColor:"rgba(255, 255, 255, 0.1)"}}},{children:[(0,r.tZ)("span",Fe({css:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0}},{children:(null==et?void 0:et.title)||"AI Assistant"})),(0,r.tZ)("span",Fe({css:{display:"flex",opacity:.8,flexShrink:0}},{children:(0,r.tZ)(v,{})}))]}))]})),(0,r.BX)("div",Fe({css:{display:"flex",alignItems:"center",gap:"2px",position:"relative",flexShrink:0}},{children:[(0,r.tZ)("button",Fe({type:"button",onClick:function(){return Ae((function(e){return!e}))},css:{background:"none",border:"none",color:"white",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",":hover":{backgroundColor:"rgba(255, 255, 255, 0.1)"}}},{children:(0,r.tZ)(gt,{})})),(0,r.tZ)("button",Fe({type:"button",onClick:function(){return K(!1)},css:{background:"none",border:"none",color:"white",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",":hover":{backgroundColor:"rgba(255, 255, 255, 0.1)"}}},{children:(0,r.tZ)(yt,{})})),_e&&(0,r.BX)(r.HY,{children:[(0,r.tZ)("div",{css:{position:"fixed",inset:0,zIndex:1e3},onClick:function(){return Ae(!1)}}),(0,r.tZ)("div",Fe({css:{position:"absolute",top:"100%",right:0,marginTop:"4px",minWidth:"180px",backgroundColor:"white",border:"1px solid ".concat(_),borderRadius:"8px",boxShadow:"0 8px 16px rgba(0,0,0,0.12)",zIndex:1001,overflow:"hidden"}},{children:[{value:"current",label:"Floating",Icon:y},{value:"sidebar-left",label:"Sidebar left",Icon:g},{value:"sidebar-right",label:"Sidebar right",Icon:m},{value:"fullscreen",label:"Fullscreen",Icon:b}].filter((function(e){var t=e.value;return E.includes(t)})).map((function(e){var t=e.value,n=e.label,o=e.Icon;return(0,r.BX)("button",Fe({type:"button",onClick:function(){Y(t),Ae(!1)},css:{width:"100%",padding:"10px 14px",background:t===P?Oe.light:"white",border:"none",cursor:"pointer",fontSize:"13px",color:j,textAlign:"left",display:"flex",alignItems:"center",gap:"10px",":hover":{backgroundColor:Z}}},{children:[(0,r.tZ)("span",Fe({css:{display:"flex",color:A,flexShrink:0}},{children:(0,r.tZ)(o,{})})),(0,r.tZ)("span",{children:n})]}),t)}))}))]})]})),Se&&(0,r.BX)(r.HY,{children:[(0,r.tZ)("div",{css:{position:"fixed",inset:0,zIndex:1e3},onClick:function(){return Ce(!1)}}),(0,r.BX)("div",Fe({css:{position:"absolute",top:"100%",left:0,width:"100%",backgroundColor:"white",border:"1px solid ".concat(_),borderTop:"none",borderRadius:"0 0 8px 8px",boxShadow:"0 8px 16px rgba(0,0,0,0.12)",zIndex:1001,maxHeight:"240px",overflowY:"scroll"}},{children:[(0,r.tZ)("button",Fe({type:"button",onClick:function(){st(),Ce(!1)},css:{width:"100%",padding:"10px 14px",background:"none",border:"none",borderBottom:"1px solid ".concat("#f3f4f6"),cursor:"pointer",fontSize:"13px",fontWeight:600,color:Oe.primary,textAlign:"left",":hover":{backgroundColor:Z}}},{children:"+ New Chat"})),0===dt.length&&(0,r.tZ)("div",Fe({css:{padding:"12px 14px",fontSize:"13px",color:A}},{children:"No chats yet"})),dt.map((function(e){return(0,r.BX)("div",Fe({onClick:function(){return t=e.id,Xe(void 0,void 0,void 0,(function(){var e,n,r,o;return Ke(this,(function(i){switch(i.label){case 0:return Re.current=!0,(null===(r=ye.find((function(e){return e.id===t})))||void 0===r?void 0:r.chat)?(ke(t),Ce(!1),[2]):[4,ie(S,M,t)];case 1:return(e=i.sent())?(n=qe(t,null!==(o=e.messages)&&void 0!==o?o:[],e.title),ge((function(r){return r.map((function(r){return r.id===t?Fe(Fe({},e),{chat:n}):r}))})),ke(t),Ce(!1),[2]):[2]}}))}));var t},css:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 14px",cursor:"pointer",backgroundColor:e.id===be?Oe.light:"white",":hover":{backgroundColor:Z}}},{children:[(0,r.BX)("div",Fe({css:{flex:1,minWidth:0}},{children:[(0,r.tZ)("div",Fe({css:{fontSize:"13px",fontWeight:500,color:j,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:e.title||"Untitled conversation"})),(0,r.tZ)("div",Fe({css:{fontSize:"11px",color:A,marginTop:"2px"}},{children:new Date(e.updated_at).toLocaleDateString()}))]})),(0,r.tZ)("button",Fe({type:"button",onClick:function(t){return function(e,t){return Xe(void 0,void 0,void 0,(function(){var n;return Ke(this,(function(r){switch(r.label){case 0:return t.stopPropagation(),(null==(n=ye.find((function(t){return t.id===e})))?void 0:n.isTemporary)?[3,2]:[4,ae(S,M,e)];case 1:r.sent(),r.label=2;case 2:return ge((function(t){return t.filter((function(t){return t.id!==e}))})),be===e&&st(),[2]}}))}))}(e.id,t)},css:{background:"none",border:"none",cursor:"pointer",color:A,fontSize:"16px",padding:"2px 6px",marginLeft:"8px",borderRadius:"4px",lineHeight:1,":hover":{color:"#dc2626",backgroundColor:"#fef2f2"}}},{children:"×"}))]}),e.id)}))]}))]})]})),(0,r.BX)("div",Fe({ref:ze,onScroll:Ee,css:{flex:1,overflowY:"auto",padding:"16px",display:"flex",flexDirection:"column",gap:"12px"}},{children:[0===lt.length&&(0,r.tZ)("div",Fe({css:{textAlign:"center",color:A,fontSize:"14px",marginTop:"40px"}},{children:"How can I help?"})),lt.map((function(e,t){return"user"===e.role?(0,r.tZ)("div",Fe({css:{display:"flex",justifyContent:"flex-end"}},{children:(0,r.tZ)("div",Fe({css:{maxWidth:"80%",padding:"10px 14px",borderRadius:"12px",fontSize:"14px",lineHeight:"1.5",backgroundColor:Oe.primary,color:"white",overflowWrap:"anywhere",wordBreak:"break-word"}},{children:e.parts.filter((function(e){return!e.hidden})).map((function(e,t){return"text"===e.type?(0,r.tZ)("span",{children:e.text},t):null}))}))}),e.id):(0,r.tZ)(o.Fragment,{children:(n=t===lt.length-1,i=function(e){var t=[];return e.forEach((function(e,n){if("text"===e.type&&e.text.trim()){var r=t[t.length-1];r&&"text"===r.kind?r.text="".concat(r.text,"\n\n").concat(e.text):t.push({kind:"text",key:"text-".concat(n),text:e.text})}else{var o=function(e){if("text"===(null==e?void 0:e.type))return{kind:"text"};var t="string"==typeof(null==e?void 0:e.type)&&e.type.startsWith("tool-"),n="dynamic-tool"===(null==e?void 0:e.type);return t||n?{kind:"tool",toolName:t?e.type.replace("tool-",""):e.toolName||"unknown"}:null}(e);if(o&&"tool"===o.kind&&o.toolName){var i={key:"tool-".concat(n),toolName:o.toolName,state:e.state,input:e.input,output:e.output},a=t[t.length-1];a&&"tools"===a.kind?a.rows.push(i):t.push({kind:"tools",key:"tools-".concat(n),rows:[i]})}}})),t}(e.parts),a=e.parts[e.parts.length-1],l=!n||"ready"===it&&"text"===(null==a?void 0:a.type),i.map((function(e,t){if("text"===e.kind)return(0,r.tZ)("div",Fe({css:{display:"flex",justifyContent:"flex-start"}},{children:(0,r.tZ)("div",Fe({css:{maxWidth:"80%",padding:"10px 14px",borderRadius:"12px",fontSize:"14px",lineHeight:"1.5",backgroundColor:Oe.light,color:j,overflowWrap:"anywhere",wordBreak:"break-word"}},{children:(0,r.tZ)(ee,{text:e.text,isStreaming:pt&&n&&t===i.length-1})}))}),e.key);var o=i.slice(t+1).some((function(e){return"text"===e.kind}));return(0,r.tZ)("div",Fe({css:{display:"flex",justifyContent:"flex-start",maxWidth:"80%",minWidth:0}},{children:(0,r.tZ)(N,{rows:e.rows,turnFinished:l,followedByText:o,linkColor:Oe.primary,isFirstChunk:0===t})}),e.key)})))},e.id);var n,i,a,l})),function(){if(!pt)return null;var e=lt[lt.length-1];if(!e)return null;if("user"!==e.role){var t=(e.parts||[]).some((function(e){var t;if("text"===(null==e?void 0:e.type))return(null!==(t=e.text)&&void 0!==t?t:"").trim().length>0;var n="string"==typeof(null==e?void 0:e.type)?e.type:"";return n.startsWith("tool-")||"dynamic-tool"===n}));if(t)return null}return(0,r.tZ)(q,{})}(),at&&(0,r.tZ)("div",Fe({css:{padding:"10px 14px",borderRadius:"8px",backgroundColor:"#fef2f2",color:"#dc2626",fontSize:"14px"}},{children:"Something went wrong. Please try again."})),(0,r.tZ)("div",{ref:We})]})),z.length>0&&(0,r.BX)("div",Fe({css:{position:"relative",zIndex:1,borderTop:"1px solid ".concat(_),backgroundColor:Z,padding:"8px 16px",display:"flex",gap:"6px",overflowX:"auto"}},{children:[z.map((function(e,t){return(0,r.tZ)("button",Fe({type:"button",disabled:pt,onClick:function(){return function(e){if("ready"===it){var t=(new Date).toISOString();if(be)et&&!et.title&&ge((function(e){return Ne([Fe(Fe({},et),{title:"New Chat",updated_at:t})],De(e.filter((function(e){return e.id!==be}))),!1)}));else{var n=(0,i.Z)();ge((function(e){return Ne([{id:n,title:"New Chat",created_at:t,updated_at:t,isTemporary:!0,chat:tt}],De(e),!1)})),ke(n)}ot({parts:[{type:"text",text:e.name},{type:"text",text:e.instructions,hidden:!0,interpolate:!0}]})}}(e)},onMouseEnter:function(t){if(e.description){var n=t.currentTarget.getBoundingClientRect();Be({text:e.description,x:n.left+n.width/2,y:n.top})}},onMouseLeave:function(){return Be(null)},css:{flexShrink:0,padding:"4px 10px",fontSize:"12px",border:"1px solid ".concat(Oe.primary),borderRadius:"12px",backgroundColor:"white",color:Oe.primary,cursor:"pointer",whiteSpace:"nowrap",":disabled":{opacity:.5,cursor:"not-allowed"},":hover:not(:disabled)":{backgroundColor:Oe.light},transition:"background-color 0.15s, color 0.15s"}},{children:e.name}),t)})),je&&(0,r.tZ)("div",Fe({css:{position:"fixed",top:je.y-34,left:je.x,transform:"translateX(-50%)",backgroundColor:"rgba(0,0,0,0.9)",color:"white",fontSize:"12px",padding:"4px 8px",borderRadius:"4px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:1e4}},{children:je.text}))]})),(0,r.BX)("div",Fe({css:{display:"flex",alignItems:"center",gap:"8px",padding:"12px 16px",borderTop:"1px solid ".concat(_),backgroundColor:Z}},{children:[(0,r.tZ)("input",{type:"text",value:fe,onChange:function(e){return he(e.target.value)},onKeyDown:function(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),e.stopPropagation(),ct())},placeholder:"Type a message...",css:{flex:1,padding:"10px 14px",border:"1px solid ".concat(_),borderRadius:"8px",fontSize:"14px",outline:"none",transition:"border-color 0.2s",":focus":{borderColor:Oe.primary}}}),(0,r.tZ)("button",Fe({type:"button",onClick:ct,disabled:pt||!fe.trim(),css:{padding:"10px",backgroundColor:Oe.primary,color:"white",border:"none",borderRadius:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s",":hover:not(:disabled)":{backgroundColor:Oe.hover},":disabled":{backgroundColor:Oe.disabled,cursor:"not-allowed"}}},{children:(0,r.tZ)(d,{})}))]}))]}))}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(this.webpackChunkFeathery=this.webpackChunkFeathery||[]).push([[937],{6610:(e,t,o)=>{o.r(t),o.d(t,{default:()=>b});var a,n=o(5944),r=o(1211),i=o(7294),l=o(1587),d=o(6867),s=o(5198),p=o(1075),c=o(917),u=o(9479),v=o(
|
|
1
|
+
"use strict";(this.webpackChunkFeathery=this.webpackChunkFeathery||[]).push([[937],{6610:(e,t,o)=>{o.r(t),o.d(t,{default:()=>b});var a,n=o(5944),r=o(1211),i=o(7294),l=o(1587),d=o(6867),s=o(5198),p=o(1075),c=o(917),u=o(9479),v=o(5710),f=o(5406),h=function(){return h=Object.assign||function(e){for(var t,o=1,a=arguments.length;o<a;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},h.apply(this,arguments)},g=function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var a,n,r=o.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(a=r.next()).done;)i.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(o=r.return)&&o.call(r)}finally{if(n)throw n.error}}return i};function b(e){var t,o,b,m,y,w=e.element,_=e.responsiveStyles,k=e.fieldLabel,T=e.inlineError,Z=e.required,x=void 0!==Z&&Z,S=e.disabled,L=void 0!==S&&S,B=e.fieldVal,C=void 0===B?"":B,O=e.repeatIndex,F=void 0===O?null:O,M=e.countryCode,P=void 0===M?"":M,E=e.editMode,R=e.rightToLeft,j=e.onChange,X=void 0===j?function(){}:j,q=e.setRef,A=void 0===q?function(){}:q,I=e.elementProps,W=void 0===I?{}:I,z=e.children,D=(0,d.Z)({element:w,error:T,breakpoint:_.getMobileBreakpoint()}),N=D.borderStyles,V=D.customBorder,G=g((0,i.useState)(!1),2),H=G[0],J=G[1],K=g((0,i.useState)(null),2),Q=K[0],U=K[1],Y=(0,i.useRef)(null),$=w.servar,ee=$.metadata.store_abbreviation,te=(0,f.Z)($.metadata.salesforce_sync,E),oe=te.dynamicOptions,ae=te.loadingDynamicOptions,ne=te.shouldSalesforceSync;if((0,i.useEffect)((function(){if("gmap_state"===$.type){var e=P.toLowerCase()||$.metadata.default_country;e&&C&&!(0,p.nM)(e,C,ee,!0)&&X({target:{value:C=""}}),U(e||"us")}}),[P,U]),ne)y=oe.map((function(e){return(0,n.tZ)("option",h({value:e.value},{children:e.label}),e.value)}));else if("gmap_state"===$.type)y=null===Q?[]:C&&!(0,p.nM)(Q,C,ee)?[(0,n.tZ)("option",h({value:C},{children:C}),C)]:(0,p.s7)(Q,ee,$.metadata.include_territories);else if("gmap_country"===$.type){var re=w.properties.translate||{};y=s.ZP.map((function(e){var t=e.countryCode,o=e.countryName,a=$.metadata.store_abbreviation?t:o,r=re[t]||o;return(0,n.tZ)("option",h({value:a},{children:r}),t)}))}else{var ie=$.metadata.option_labels,le=$.metadata.option_tooltips;y=null!==F&&(null===(m=$.metadata.repeat_options)||void 0===m?void 0:m[F])?$.metadata.repeat_options[F].map((function(e){var t,o,a,r=null!==(t=e.value)&&void 0!==t?t:e,i=null!==(o=e.label)&&void 0!==o?o:e,l=null!==(a=e.tooltip)&&void 0!==a?a:"";return(0,n.tZ)("option",h({value:r,title:l},{children:i}),r)})):$.metadata.options.map((function(e,t){var o,a,r=ie&&ie[t]?ie[t]:e,i=null!==(o=null==le?void 0:le[t])&&void 0!==o?o:"",l=null!==(a=v.u4[$.key])&&void 0!==a?a:[];return $.repeated&&$.metadata.unique_repeat_options&&e!==C&&l.includes(e)?null:(0,n.tZ)("option",h({value:e,title:i},{children:r}),"".concat(t).concat(e))}))}var de,se,pe=w.properties.tooltipText?30:10;return _.applyFontStyles("field",!C),(0,n.BX)("div",h({ref:Y,css:h({maxWidth:"100%",width:"100%",height:"100%",position:"relative",pointerEvents:E?"none":"auto"},_.getTarget("fc"))},W,{children:[z,k,(0,n.BX)("div",h({css:h(h(h({position:"relative",width:"100%",whiteSpace:"nowrap",overflowX:"clip"},_.getTarget("sub-fc")),L?_.getTarget("disabled"):{}),{"&:hover":(0,u.wL)(L?{}:h(h({},_.getTarget("hover")),N.hover)),"&&":H?h(h({},_.getTarget("active")),N.active):{}})},{children:[(0,n.tZ)(c.xB,{styles:(0,c.iv)(a||(de=["\n option {\n color: black;\n }\n "],se=["\n option {\n color: black;\n }\n "],Object.defineProperty?Object.defineProperty(de,"raw",{value:se}):de.raw=se,a=de))}),V,(0,n.BX)("select",h({css:h(h(h({},r.ET),_.getTarget("field")),(t={width:"100%",height:"100%",border:"none",margin:0,boxShadow:"none",backgroundColor:"transparent",appearance:"none",WebkitAppearance:"none",MozAppearance:"none",backgroundImage:"url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'><path d='M0 0.776454L0.970744 0L5 4.2094L9.02926 0L10 0.776454L5 6L0 0.776454Z' fill='%23".concat(w.styles.font_color,"'/></svg>\")"),backgroundRepeat:"no-repeat",backgroundPosition:"".concat(R?"left":"right"," ").concat(pe,"px center")},t[R?"paddingLeft":"paddingRight"]=30,t.position="relative",t)),id:$.key,value:null!=C?C:"",required:x,disabled:L||ae,"aria-label":w.properties.aria_label,onChange:X,onFocus:function(e){J(!0),(0,u.ms)(e)},onBlur:function(){return J(!1)},ref:A},{children:[(0,n.tZ)("option",{value:"",disabled:x},""),y]})),(0,n.tZ)("span",h({css:h(h(h((o={position:"absolute",pointerEvents:"none"},o[R?"right":"left"]="0.75rem",o.transition="0.2s ease all",o.top="50%",o),_.getTarget("placeholder")),C?_.getTarget("placeholderFocus"):{}),(b={},b["input:focus + &"]=h(h({},_.getTarget("placeholderFocus")),_.getTarget("placeholderActive")),b))},{children:w.properties.placeholder||""})),(0,n.tZ)(l.Z,{containerRef:Y,id:w.id,text:w.properties.tooltipText,responsiveStyles:_,repeat:w.repeat})]}))]}))}}}]);
|