PageSourceSearch

https://formapprovals.com/assets/FormBuilder-Bu8xiiYR.js

js formapprovals.com collected 2026-10-02 00:00:31 UTC 24,745 bytes, 1 lines download raw bytes

1import{Q as ot,R as Ge,U as Me,ao as it,j as e,V as rt,aK as nt,ax as ie,a0 as We,X as at,r as d,f as Ee,Z as lt,as as Pe,a1 as ct,a3 as pt,a2 as dt,am as mt,$ as ut,c as ht,S as _,G as k,g as X,B as O,T as j,a7 as gt,J as ft,t as xt,K as xe,s as jt,L as St,v as je,P as T,k as Re,aw as ce,a8 as oe,p as wt,a5 as yt,ac as Y}from"./index-B1JCX_-d.js";import{I as bt,u as pe}from"./IconTrash-DuNqvFOg.js";import{S as vt}from"./SEOHead-x5xN8jU_.js";import{e as de}from"./errors-j4AVLOck.js";import{h as Le,b as _t,d as kt,c as Ue,e as It,f as zt,g as Ct,I as Tt,i as De,R as Ft,G as At,W as Et,a as Pt,o as Rt,j as Lt,k as Dt}from"./GroupEditor-D9DrFozk.js";import{I as $e}from"./IconPlus-D2RMBsUF.js";import{T as v}from"./Table-FcL28oTk.js";import{T as ve}from"./TextInput-D-E7ywd3.js";import{C as qt,S as Nt}from"./Select-81cxwBve.js";import{C as Ot}from"./Checkbox-gp1teFeN.js";import{A as Se}from"./ActionIcon-BGKkh9bM.js";import{I as Bt}from"./IconArrowUp-U6Pz1ElF.js";import{f as Gt,h as Mt,i as Wt,u as Ut,j as $t}from"./settings-DW9MFVg0.js";import{S as Qt,M as $}from"./ScrollableExamples-DxL_St3f.js";import{B as Ht,I as Kt}from"./IconDownload-BbtUNNca.js";import{B as Vt}from"./Badge-BbXJu9l1.js";import{I as Yt}from"./IconLock-BFOO_JRv.js";import{g as Xt}from"./get-auto-contrast-value-Da6zqqWm.js";import{T as qe}from"./Textarea-S6TImZwF.js";import{T as we}from"./Tooltip-V1HmJPbW.js";import{I as Zt}from"./IconSparkles-C81NusBo.js";import{I as Jt}from"./IconSend-BnXFd0vC.js";import{S as es}from"./SegmentedControl-Ddrz7gA9.js";import{I as ts}from"./IconTable-U-GBBQPS.js";import{I as Ne}from"./IconExternalLink-q3eLzfJ1.js";import{A as ss}from"./Alert-rB0v6-kr.js";import{L as ye}from"./List-Bq6CPE7n.js";import"./InputBase-CWPbF_yb.js";import"./IconInfoCircle-BUY0Ko0n.js";import"./IconUsers-B8HJdmU4.js";import"./IconTableOptions-B3NH1SD9.js";import"./IconMessageCircle-BPYND8wQ.js";import"./IconFilter-C5DCHx_x.js";import"./IconUsersGroup-0JjYJwmZ.js";import"./IconChevronLeft-CnCMsgHu.js";import"./IconChevronRight-DPVk6pOM.js";import"./get-env-uyVen0u2.js";import"./get-style-object-DUJZA7T_.js";const[os,is]=ot("Stepper component was not found in tree");var _e={root:"m_cbb4ea7e",steps:"m_aaf89d0b",separator:"m_2a371ac9",content:"m_78da155d",step:"m_cbb57068","step--horizontal":"m_f56b1e2c","step--vertical":"m_833edb7e",verticalSeparator:"m_6496b3f3",stepWrapper:"m_818e70b",stepIcon:"m_1959ad01",stepCompletedIcon:"m_a79331dc",stepBody:"m_1956aa2a",stepLabel:"m_12051f6c",stepDescription:"m_164eea74"};const ue=()=>null;ue.displayName="@mantine/core/StepperCompleted";const me=(n,l)=>typeof n=="function"?e.jsx(n,{step:l||0}):n,rs={withIcon:!0,allowStepClick:!0,iconPosition:"left"},ke=Ge((n,l)=>{const{classNames:p,className:S,style:h,styles:x,vars:i,step:o,state:r,color:c,icon:F,completedIcon:D,progressIcon:Z,label:B,description:Q,withIcon:y,iconSize:J,loading:A,allowStepClick:I,allowStepSelect:U,iconPosition:G,orientation:ee,mod:E,...K}=Me("StepperStep",rs,n),a=is(),z=it(),g={classNames:p,styles:x},q=r==="stepCompleted"?null:r==="stepProgress"?Z:F,P={"data-progress":r==="stepProgress"||void 0,"data-completed":r==="stepCompleted"||void 0};return e.jsxs(rt,{...a.getStyles("step",{className:S,style:h,variant:a.orientation,...g}),mod:[{"icon-position":G||a.iconPosition,"allow-click":I},E],ref:l,...P,...K,__vars:{"--step-color":c?We(c,z):void 0},tabIndex:I?0:-1,children:[y&&e.jsxs("span",{...a.getStyles("stepWrapper",g),children:[e.jsxs("span",{...a.getStyles("stepIcon",g),...P,children:[e.jsx(nt,{mounted:r==="stepCompleted",transition:"pop",duration:200,children:R=>e.jsx("span",{...a.getStyles("stepCompletedIcon",{style:R,...g}),children:A?e.jsx(ie,{color:"var(--mantine-color-white)",size:"calc(var(--stepper-icon-size) / 2)",...a.getStyles("stepLoader",g)}):me(D,o)||e.jsx(qt,{size:"60%"})})}),r!=="stepCompleted"?e.jsx("span",{children:A?e.jsx(ie,{...a.getStyles("stepLoader",g),size:"calc(var(--stepper-icon-size) / 2)",color:c}):me(q||F,o)}):null]}),ee==="vertical"&&e.jsx("span",{...a.getStyles("verticalSeparator",g),"data-active":r==="stepCompleted"||void 0})]}),(B||Q)&&e.jsxs("span",{...a.getStyles("stepBody",g),"data-orientation":a.orientation,"data-icon-position":G||a.iconPosition,children:[B&&e.jsx("span",{...a.getStyles("stepLabel",g),children:me(B,o)}),Q&&e.jsx("span",{...a.getStyles("stepDescription",g),children:me(Q,o)})]})]})});ke.classes=_e;ke.displayName="@mantine/core/StepperStep";const ns={orientation:"horizontal",iconPosition:"left",allowNextStepsSelect:!0,wrap:!0},as=lt((n,{color:l,iconSize:p,size:S,contentPadding:h,radius:x,autoContrast:i})=>({root:{"--stepper-color":l?We(l,n):void 0,"--stepper-icon-color":Xt(i,n)?ut({color:l,theme:n,autoContrast:i}):void 0,"--stepper-icon-size":p===void 0?dt(S,"stepper-icon-size"):mt(p),"--stepper-content-padding":Pe(h),"--stepper-radius":x===void 0?void 0:pt(x),"--stepper-fz":ct(S),"--stepper-spacing":Pe(S)}})),W=Ge((n,l)=>
1{const p=Me("Stepper",ns,n),{classNames:S,className:h,style:x,styles:i,unstyled:o,vars:r,children:c,onStepClick:F,active:D,icon:Z,completedIcon:B,progressIcon:Q,color:y,iconSize:J,contentPadding:A,orientation:I,iconPosition:U,size:G,radius:ee,allowNextStepsSelect:E,wrap:K,autoContrast:a,attributes:z,...g}=p,q=at({name:"Stepper",classes:_e,props:p,className:h,style:x,classNames:S,styles:i,unstyled:o,attributes:z,vars:r,varsResolver:as}),P=d.Children.toArray(c),R=P.filter(M=>M.type!==ue),b=P.find(M=>M.type===ue),he=R.reduce((M,w,L)=>{const te=D===L?"stepProgress":D>L?"stepCompleted":"stepInactive",ne=typeof F!="function"?!1:typeof w.props.allowStepSelect=="boolean"?w.props.allowStepSelect:te==="stepCompleted"||E;return M.push(d.cloneElement(w,{icon:w.props.icon||Z||L+1,key:L,step:L,state:te,onClick:()=>ne&&F?.(L),allowStepClick:ne,completedIcon:w.props.completedIcon||B,progressIcon:w.props.progressIcon||Q,color:w.props.color||y,iconSize:J,iconPosition:w.props.iconPosition||U,orientation:I})),I==="horizontal"&&L!==R.length-1&&M.push(d.createElement("div",{...q("separator"),"data-active":L<D||void 0,"data-orientation":I,key:`separator-${L}`})),M},[]),V=R[D]?.props?.children,H=b?.props?.children,re=D>R.length-1?H:V;return e.jsx(os,{value:{getStyles:q,orientation:I,iconPosition:U},children:e.jsxs(Ee,{...q("root"),ref:l,size:G,...g,children:[e.jsx(Ee,{...q("steps"),mod:{orientation:I,"icon-position":U,wrap:K&&I!=="vertical"},children:he}),re&&e.jsx("div",{...q("content"),children:re})]})})});W.classes=_e;W.displayName="@mantine/core/Stepper";W.Completed=ue;W.Step=ke;const ls=[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M18 13l-6 6",key:"svg-1"}],["path",{d:"M6 13l6 6",key:"svg-2"}]],cs=ht("outline","arrow-down","ArrowDown",ls),ps=[{value:"SHORT_ANSWER",label:"Short Answer"},{value:"PARAGRAPH",label:"Paragraph"},{value:"MULTIPLE_CHOICE",label:"Multiple Choice"},{value:"DROPDOWN",label:"Dropdown"},{value:"CHECKBOX",label:"Checkboxes"},{value:"DATE",label:"Date"},{value:"TIME",label:"Time"},{value:"SCALE",label:"Linear Scale"},{value:"FILE_UPLOAD",label:"File Upload"}];function ds({fields:n,onChange:l}){const p=(i,o,r)=>{const c=[...n];c[i]={...c[i],[o]:r},l(c)},S=()=>{l([...n,{label:"",question_type:"SHORT_ANSWER",required:!1}])},h=i=>{l(n.filter((o,r)=>r!==i))},x=(i,o)=>{const r=i+o;if(r<0||r>=n.length)return;const c=[...n];[c[i],c[r]]=[c[r],c[i]],l(c)};return e.jsxs(_,{gap:"sm",children:[e.jsxs(k,{justify:"space-between",children:[e.jsx(X,{order:4,children:"Form Fields"}),e.jsx(O,{size:"xs",variant:"light",leftSection:e.jsx($e,{size:14}),onClick:S,children:"Add Field"})]}),n.length===0?e.jsx(j,{c:"dimmed",size:"sm",ta:"center",py:"md",children:"No fields yet. Generate a form or add fields manually."}):e.jsx(v.ScrollContainer,{minWidth:500,children:e.jsxs(v,{verticalSpacing:"xs",highlightOnHover:!0,children:[e.jsx(v.Thead,{children:e.jsxs(v.Tr,{children:[e.jsx(v.Th,{children:"Question"}),e.jsx(v.Th,{w:200,children:"Type"}),e.jsx(v.Th,{w:100,ta:"center",children:"Required"}),e.jsx(v.Th,{w:80})]})}),e.jsx(v.Tbody,{children:n.map((i,o)=>e.jsxs(v.Tr,{children:[e.jsx(v.Td,{children:e.jsx(ve,{value:i.label,onChange:r=>p(o,"label",r.currentTarget.value),placeholder:"Question text",size:"xs"})}
1),e.jsx(v.Td,{children:e.jsx(Nt,{value:i.question_type,onChange:r=>p(o,"question_type",r||"SHORT_ANSWER"),data:ps,size:"xs"})}),e.jsx(v.Td,{ta:"center",children:e.jsx(Ot,{checked:i.required,onChange:r=>p(o,"required",r.currentTarget.checked),size:"xs"})}),e.jsx(v.Td,{children:e.jsxs(k,{gap:2,wrap:"nowrap",children:[e.jsx(Se,{variant:"subtle",size:"sm",onClick:()=>x(o,-1),disabled:o===0,children:e.jsx(Bt,{size:14})}),e.jsx(Se,{variant:"subtle",size:"sm",onClick:()=>x(o,1),disabled:o===n.length-1,children:e.jsx(cs,{size:14})}),e.jsx(Se,{variant:"subtle",color:"red",size:"sm",onClick:()=>h(o),children:e.jsx(bt,{size:14})})]})})]},o))})]})})]})}function Oe(n,l){return Ue(n.map(p=>{let S=p.recipient,h=p.logic;if(p.is_dynamic&&l[p.recipient]&&(S=l[p.recipient]),h?.items?.length){const x=h.items.map(i=>({...i,question:l[i.question]??i.question}));h={...h,items:x}}return S!==p.recipient||h!==p.logic?{...p,recipient:S,logic:h}:p}))}function be(n){return n.toLowerCase().endsWith("@example.com")}function Be(n,l,p,S,h){const x=[];if(n==="form"){const i=l.filter(o=>o.question_type==="FILE_UPLOAD");for(const o of i)x.push(`"${o.label}" was created as a text field because Google Forms does not support creating file upload questions via its API. Open the form in Google Forms and change it to a File Upload question.`)}if(n==="workflow"){for(const i of p)if(i.recipient&&i.recipient.includes("@")&&(i.recipient.toLowerCase().includes("changeme")||be(i.recipient))&&x.push(`Recipient "${i.recipient}" is a placeholder — change it to a real email address.`),i.lookup_entries&&i.lookup_entries.length>0){const o=i.lookup_entries.filter(r=>r.value.includes("@")&&be(r.value));if(o.length>0){const r=h&&h.get(i.recipient)||i.recipient;x.push(`${o.length} lookup ${o.length===1?"entry":"entries"} for "${r}" ${o.length===1?"has a":"have"} placeholder email${o.length===1?"":"s"} — update with real addresses.`)}}for(const[i,o]of Object.entries(S)){const r=o.recipients.filter(be);r.length>0&&x.push(`Group "${i}" has ${r.length} placeholder ${r.length===1?"member":"members"} — update with real email addresses.`)}}return x}function Ys(){const n=gt(),{user:l}=ft(),[p,S]=xt(),h=l?.user_name?l.user_name.split(" ").map(t=>t[0]).join("").toUpperCase():l?.user_email?.[0]?.toUpperCase()||"?",{data:x}=xe({queryKey:["builderAuth"],queryFn:$t,staleTime:300*1e3}),i=x?.authorized??!0,[o,r]=d.useState(0),[c,F]=d.useState(""),[D,Z]=d.useState(""),[B,Q]=d.useState("table"),[y,J]=d.useState([]),[A,I]=d.useState(""),U=d.useRef(!1),[G,ee]=d.useState(""),[E,K]=d.useState([]),[a,z]=d.useState([]),[g,q]=d.useState({}),[P,R]=d.useState(0),[b,he]=d.useState(""),[V,H]=d.useState(!1);d.useEffect(()=>{const t=p.get("prompt_key");if(t){S(m=>(m.delete("prompt_key"),m),{replace:!0}),Gt(t).then(({description:m})=>{m?.trim()&&(localStorage.removeItem("fa-builder-description"),F(m),H(!0))}).catch(()=>{const m=localStorage.getItem("fa-builder-description");m?.trim()&&(F(m),H(!0))});return}const s=localStorage.getItem("fa-builder-description");s?.trim()&&(F(s),H(!0))},[]);function re(t){ee(t.title),K(t.fields),z(m=>{const u=[...m];return t.workflow.recipients.map(f=>{const C={recipient:f.recipient,order:f.order,role:f.role,notification_type:f.notification_type||"Email",private_message:f.private_message||"",logic:typeof f.logic=="object"?f.logic:{},is_dynamic:!!f.recipient&&!Rt(f.recipient),lookup_entries:f.lookup_entries,lookup_label:f.lookup_label},le=u.findIndex(N=>N.recipient===f.recipient);if(le!==-1){const[N]=u.splice(le,1);!C.lookup_entries?.length&&N.lookup_entries?.length&&(C.lookup_entries=N.lookup_entries),!C.lookup_label&&N.lookup_label&&(C.lookup_label=N.lookup_label)}return C})});const s={};for(const[m,u]of Object.entries(t.workflow.groups))s[m]={recipients:u.recipients,quorum:u.quorum,type:u.type};q(s)}const M=t=>!!t&&t.toLowerCase()!=="null"&&t.toLowerCase()!=="none",w=pe({mutationFn:t=>Mt(c,t),onSuccess:t=>{H(!1),re(t),M(t.clarifying_question)?J(s=>[...s,{role:"assistant",content:t.clarifying_question}]):(R(s=>Math.max(s,1)),r(1))},onError:t=>{H(!1);const s=de(t,"Failed to generate form.");Y.show({title:"Generation failed",message:s.error,color:"red"})}});d.useEffect(()=>{V&&c&&i&&!w.isPending&&(localStorage.removeItem("fa-builder-description"),w.mutate(void 0))},[V,c,i]);function L(){A.trim()&&(J(t=>[...t,{role:"user",content:A.trim()}]),I(""),U.current=!0)}d.useEffect(()=>{U.current&&y.length>0&&y[y.length-1].role==="user"&&(U.current=!1,w.mutate(y))},[y]);const te=pe({mutationFn:()=>Wt({title:G,fields:E,workflow:{recipients:a.map(t=>({recipient:t.recipient,order:t.order,role:t.role,logic:"",notification_type:t.notification_type||"Email",lookup_entries:t.lookup_entries,lookup_label:t.lookup_label})),groups:Object.fromEntries(Object.entries(g).map(([t,s])=>[t,{recipients:s.recipients,quorum:s.quorum,type:s.type}]))},clarifying_question:null},D||void 0),onSuccess:t=>{he(t.form_id),t.field_id_map&&z(s=>Oe(s,t.field_id_map)),t.lookup_configs&&z(s=>s.map((m,u)=>{const f=t.lookup_configs?.[String(u)];
1return f?{...m,lookup:{sheet_id:f.sheet_id,column:f.column}}:m})),R(s=>Math.max(s,2)),r(2),n.invalidateQueries({queryKey:["myForms"]})},onError:t=>{const s=de(t,"Failed to create form.");if(s.error_code==="NEEDS_AUTHORIZATION"){Y.show({title:"Authorization required",message:"You need to authorize your account before creating forms. Please contact the form administrator or authorize via the Google Forms add-on.",color:"orange",autoClose:!1});return}Y.show({title:"Creation failed",message:s.error,color:"red"})}}),ge=pe({mutationFn:()=>Ut(b,G,E),onSuccess:t=>{t.field_id_map&&z(s=>Oe(s,t.field_id_map)),ae.current=!1,R(s=>Math.max(s,2)),r(2)},onError:t=>{const s=de(t,"Failed to update form.");if(s.error_code==="NEEDS_AUTHORIZATION"){Y.show({title:"Authorization required",message:"You need to authorize your account before updating forms. Please contact the form administrator or authorize via the Google Forms add-on.",color:"orange",autoClose:!1});return}Y.show({title:"Update failed",message:s.error,color:"red"})}}),ne=!!b;function Qe(t){t>P||(t<=1&&(ae.current=!1),r(t))}const{data:He,isPending:Ke}=xe({queryKey:["formItems",b],queryFn:()=>Lt(b),enabled:o===2&&!!b}),Ie=(He?.items??[]).map(t=>({...t,id:Le(t.id)})),{data:ze,isPending:Ve}=xe({queryKey:["formQuestions",b],queryFn:()=>Dt(b),enabled:o===2&&!!b}),se=ze?.questions??[],Ye=ze?.collects_email??!1,Ce=_t(se,Ye),Xe=kt(se),Ze=o===2&&(Ke||Ve),ae=d.useRef(!1);d.useEffect(()=>{if(ae.current||se.length===0||o!==2)return;ae.current=!0;const t=new Map(se.map(s=>[s.title,s.item_id?Le(s.item_id):s.title]));z(s=>{const m=s.map(u=>{let f=u.recipient,C=u.logic;if(u.is_dynamic&&t.has(u.recipient)&&(f=t.get(u.recipient)||u.recipient),C?.items?.length){const le=C.items.map(N=>({...N,question:t.get(N.question)??N.question}));C={...C,items:le}}return f!==u.recipient||C!==u.logic?{...u,recipient:f,logic:C}:u});return Ue(m)})},[se,o]);const Je=It(a),et=zt(a),Te=pe({mutationFn:()=>Pt(b,{recipients:Je,groups:g}),onSuccess:()=>{R(t=>Math.max(t,3)),r(3)},onError:t=>{const s=de(t,"Failed to save workflow.");Y.show({title:"Save failed",message:s.error,color:"red"})}}),fe=new Map(Ce.map(t=>[t.value,t.label])),tt=new Map(Ie.map(t=>[t.id,t.title])),st=a.map(t=>({recipient:t.is_dynamic&&fe.get(t.recipient)||t.recipient,order:t.order,role:t.role,logic:Ct(t.logic,tt),notification_type:t.notification_type})),Fe={};for(const[t,s]of Object.entries(g))Fe[t]={recipients:s.recipients,quorum:s.quorum,type:s.type};const Ae=Object.entries(g);return e.jsxs(e.Fragment,{children:[e.jsx(vt,{title:"My Forms | AI Form + Workflow Builder",description:"Create a Google Form with an approval workflow using AI.",n
1oIndex:!0}),e.jsxs(_,{gap:"md",children:[e.jsxs(Ht,{style:{rowGap:8},children:[e.jsx(jt,{component:St,to:"/my-forms/",size:"md",children:"My Forms"}),e.jsx(j,{size:"md",children:"AI Form + Workflow Builder"})]}),e.jsxs(k,{gap:"sm",align:"center",children:[e.jsx(X,{order:2,children:"Create Google Form + Approvals with AI"}),e.jsx(Vt,{variant:"light",color:"grape",size:"lg",children:"Beta"})]}),i?e.jsxs(e.Fragment,{children:[e.jsxs(W,{active:o===3?4:o,onStepClick:Qe,size:"sm",children:[e.jsx(W.Step,{label:"Describe",allowStepSelect:P>=0}),e.jsx(W.Step,{label:"Review Form",allowStepSelect:P>=1}),e.jsx(W.Step,{label:"Review Workflow",allowStepSelect:P>=2}),e.jsx(W.Step,{label:"Complete",allowStepSelect:P>=3})]}),o===0&&V&&e.jsx(je,{py:"xl",children:e.jsxs(_,{align:"center",gap:"md",children:[e.jsx(ie,{size:"lg"}),e.jsx(j,{size:"lg",fw:500,children:"Generating your form..."}),e.jsx(j,{size:"sm",c:"dimmed",children:"This usually takes a few seconds."})]})}),o===0&&!V&&e.jsxs(_,{gap:"lg",children:[e.jsx(Qt,{onSelect:F,disabled:y.length>0}),y.length===0?e.jsx(T,{withBorder:!0,radius:"md",p:"lg",children:e.jsxs(_,{gap:"md",children:[e.jsx(j,{size:"sm",c:"dimmed",children:"Describe the form you want to create and the approval workflow it should follow. Be as specific as you like — include field names, approver roles, and any conditions."}),e.jsxs("div",{style:{position:"relative"},children:[e.jsx(qe,{placeholder:"Describe your form and approval workflow...",value:c,onChange:t=>F(t.currentTarget.value),autosize:!0,minRows:4,maxRows:8,maxLength:$,styles:{input:{paddingBottom:28}}}),e.jsxs(j,{size:"xs",c:c.length>=$?"red":c.length>=$*.9?"yellow.8":"dimmed",style:{position:"absolute",bottom:8,right:12,pointerEvents:"none"},children:[c.length.toLocaleString()," / ",$.toLocaleString()]})]}),e.jsx(ve,{label:"Google Drive™ folder ID (optional)",description:"The form will be created in this folder. Leave blank for My Drive root.",placeholder:"e.g., 1a2b3c4d5e6f...",value:D,onChange:t=>Z(t.currentTarget.value)}),e.jsx(we,{label:"Describe your form and workflow above, or select an example to get started",disabled:!!c.trim(),fz:"xs",children:e.jsx(O,{leftSection:e.jsx(Zt,{size:16}),onClick:()=>w.mutate(void 0),loading:w.isPending,disabled:!c.trim(),className:"gradient-cta","data-disabled":!c.trim()||void 0,children:"Build my form"})})]})}):e.jsx(T,{withBorder:!0,radius:"md",p:"lg",children:e.jsxs(_,{gap:"sm",children:[e.jsxs(k,{gap:"xs",align:"flex-start",wrap:"nowrap",style:{alignSelf:"flex-end",maxWidth:"90%"}
1,children:[e.jsx(T,{p:"sm",radius:"md",bg:"blue.0",children:e.jsx(j,{size:"sm",style:{whiteSpace:"pre-wrap"},children:c})}),e.jsx(ce,{src:l?.user_picture,size:"sm",radius:"xl",color:"pink",variant:"filled",style:{flexShrink:0},children:h})]}),y.map((t,s)=>t.role==="assistant"?e.jsxs(k,{gap:"xs",align:"flex-start",wrap:"nowrap",style:{maxWidth:"90%"},children:[e.jsx(ce,{size:"sm",radius:"xl",color:"gray",variant:"filled",style:{flexShrink:0},children:"AI"}),e.jsx(T,{p:"sm",radius:"md",bg:"gray.0",children:e.jsx(j,{size:"sm",fw:500,style:{whiteSpace:"pre-wrap"},children:t.content})})]},s):e.jsxs(k,{gap:"xs",align:"flex-start",wrap:"nowrap",style:{alignSelf:"flex-end",maxWidth:"90%"},children:[e.jsx(T,{p:"sm",radius:"md",bg:"blue.0",children:e.jsx(j,{size:"sm",style:{whiteSpace:"pre-wrap"},children:t.content})}),e.jsx(ce,{src:l?.user_picture,size:"sm",radius:"xl",color:"pink",variant:"filled",style:{flexShrink:0},children:h})]},s)),w.isPending&&y[y.length-1]?.role==="user"&&e.jsxs(k,{gap:"xs",align:"center",wrap:"nowrap",style:{maxWidth:"90%"},children:[e.jsx(ce,{size:"sm",radius:"xl",color:"gray",variant:"filled",style:{flexShrink:0},children:"AI"}
1),e.jsx(T,{p:"sm",radius:"md",bg:"gray.0",children:e.jsxs(k,{gap:"xs",children:[e.jsx(ie,{size:"xs",type:"dots"}),e.jsx(j,{size:"sm",c:"dimmed",children:"Thinking..."})]})})]}),y[y.length-1]?.role==="assistant"&&e.jsxs(_,{gap:"xs",children:[e.jsxs("div",{style:{position:"relative"},children:[e.jsx(qe,{placeholder:"Type your reply...",value:A,onChange:t=>I(t.currentTarget.value),autosize:!0,minRows:2,maxRows:4,maxLength:$,disabled:w.isPending,styles:{input:{paddingBottom:28}}}),e.jsxs(j,{size:"xs",c:A.length>=$?"red":A.length>=$*.9?"yellow.8":"dimmed",style:{position:"absolute",bottom:8,right:12,pointerEvents:"none"},children:[A.length.toLocaleString()," / ",$.toLocaleString()]})]}),e.jsx(O,{leftSection:e.jsx(Jt,{size:16}),onClick:L,disabled:!A.trim(),loading:w.isPending,className:"gradient-cta",children:"Reply"})]})]})})]}),o===1&&e.jsxs(_,{gap:"md",children:[e.jsx(ve,{label:"Form Title",value:G,onChange:t=>ee(t.currentTarget.value),size:"md",maw:500}),e.jsx(T,{withBorder:!0,radius:"md",p:"md",children:e.jsx(ds,{fields:E,onChange:K})}),ne?e.jsx(O,{onClick:()=>ge.mutate(),loading:ge.isPending,className:"gradient-cta",children:"Update Form"}):e.jsx(O,{onClick:()=>te.mutate(),loading:te.isPending,className:"gradient-cta",children:"Create Form"})]}),o===2&&e.jsx(e.Fragment,{children:Ze?e.jsx(je,{py:"xl",children:e.jsxs(_,{align:"center",gap:"md",children:[e.jsx(ie,{size:"md"}),e.jsx(j,{size:"sm",c:"dimmed",children:"Loading form data..."})]})}):e.jsxs(_,{gap:"md",children:[e.jsx(j,{size:"sm",c:"dimmed",children:"Your form has been created. Now configure the approval workflow below."}),e.jsxs(k,{justify:"space-between",children:[e.jsxs(k,{gap:"sm",children:[e.jsx(X,{order:4,children:"Recipients"}),e.jsx(es,{value:B,onChange:Q,data:[{value:"table",label:e.jsx(we,{label:"Table view",fz:"xs",children:e.jsxs(k,{gap:4,children:[e.jsx(ts,{size:14}),e.jsx(j,{size:"xs",children:"Table"})]})})},{value:"diagram",label:e.jsx(we,{label:"Flowchart view",fz:"xs",children:e.jsxs(k,{gap:4,children:[e.jsx(Tt,{size:14}),e.jsx(j,{size:"xs",children:"Flowchart"})]})})}],size:"xs",style:{minWidth:190}})]}),e.jsxs(oe,{position:"bottom-end",children:[e.jsx(oe.Target,{children:e.jsx(O,{size:"xs",variant:"light",leftSection:e.jsx($e,{size:14}),rightSection:e.jsx(Kt,{size:12}),children:"Add recipient"})}),e.jsxs(oe.Dropdown,{children:[e.jsx(oe.Item,{onClick:()=>z([...a,De(a,!1)]),children:"Static recipient"}),e.jsx(oe.Item,{onClick:()=>z([...a,De(a,!0)]),children:"Dynamic recipient"})]})]})]}),B==="table"&&e.jsxs(e.Fragment,{children:[e.jsx(Ft,{recipients:a,groups:g,onRecipientsChange:z,formItems:Ie,questionOptions:Ce,questionTypes:Xe,formId:b,enableDragDrop:!0}),Ae.length>0&&e.jsxs(T,{withBorder:!0,radius:"md",p:"md",children:[e.jsx(X,{order:4,mb:"sm",children:"Groups"}),Ae.map(([t,s])=>
1e.jsxs(T,{withBorder:!0,p:"sm",radius:"md",mb:"xs",children:[e.jsx(j,{size:"sm",fw:500,mb:"xs",children:t}),e.jsx(At,{group:s,groupName:t,onChange:m=>q(u=>({...u,[t]:m}))})]},t))]})]}),B==="diagram"&&e.jsx(T,{withBorder:!0,radius:"md",style:{height:400},children:e.jsx(Et,{recipients:st,groups:Fe,formTitle:G})}),e.jsx(O,{onClick:()=>Te.mutate(),loading:Te.isPending,disabled:et,className:"gradient-cta",children:"Save Workflow"})]})}),o===3&&e.jsxs(_,{gap:"md",maw:600,mx:"auto",children:[e.jsx(T,{withBorder:!0,radius:"md",p:"xl",children:e.jsxs(_,{align:"center",gap:"md",children:[e.jsx(Re,{size:80,radius:"xl",variant:"light",color:"brand",className:"stroke-draw",children:e.jsx(wt,{size:40})}),e.jsx(X,{order:3,children:"Form Created"}),e.jsxs(j,{size:"sm",c:"dimmed",ta:"center",children:["Your Google Form has been created with ",E.length," field",E.length!==1?"s":""," and ",a.length," recipient",a.length!==1?"s":"","."]}),e.jsxs(k,{children:[e.jsx(O,{component:"a",href:`https://docs.google.com/forms/d/${b}/edit`,target:"_blank",leftSection:e.jsx(Ne,{size:16}),children:"Open Form"}),e.jsx(O,{component:"a",href:`/my-forms/${b}/settings/`,target:"_blank",leftSection:e.jsx(Ne,{size:16}),variant:"light",children:"Edit Settings"})]})]})}),(()=>{const t=[...Be("form",E,a,g,fe),...Be("workflow",E,a,g,fe)];return e.jsx(ss,{icon:e.jsx(yt,{size:16}),title:"Steps to finalize your workflow",color:"yellow",variant:"light",children:e.jsxs(ye,{size:"sm",spacing:4,children:[t.map((s,m)=>e.jsx(ye.Item,{children:s},m)),e.jsx(ye.Item,{children:"Activate the workflow by opening your Google Form, opening the add-on, clicking Settings > Account > and toggling the add-on ON."})]})})})()]})]}):e.jsx(je,{py:"xl",children:e.jsx(T,{withBorder:!0,radius:"md",p:"xl",maw:500,children:e.jsxs(_,{align:"center",gap:"md",children:[e.jsx(Re,{size:80,radius:"xl",variant:"light",color:"orange",children:e.jsx(Yt,{size:40})}),e.jsx(X,{order:3,children:"Authorization Required"}),e.jsx(j,{size:"sm",c:"dimmed",ta:"center",children:"To create Google Forms on your behalf, Form Approvals needs your authorization. This is a one-time step."}),e.jsx(O,{component:"a",href:`/authorize/builder/?return_to=/my-forms/builder/${l?.user_email?`&user=${encodeURIComponent(l.user_email)}`:""}`,size:"md",children:"Authorize Google Account"})]})})})]})]})}export{Ys as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.