1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2168],{52168:(e,l,n)=>{n.r(l),n.d(l,{default:()=>r});var s=n(95155),a=n(5780),t=n(12115),i=n(10639);function r(e){var l,n,r,u,o;let{rule:d,index:c,communityId:v,onChange:p}=e,h=(0,i.Kg)(),{workspaceId:x}=(0,i.y$)(),[y,m]=(0,t.useState)([]),[b,j]=(0,t.useState)(null),[w,g]=(0,t.useState)(""),[f,N]=(0,t.useState)(!1),q=(0,t.useRef)(0),C="rounded-lg border border-white/10 bg-white/5 p-2 text-sm text-t1 min-w-0",k=async e=>{let l=++q.current;N(!0),g("");try{let n=await h("surveyList",{...e?{cursor:e}:{}});if(l!==q.current)return;m(l=>[...e?l:[],...n.surveys]),j(n.nextCursor)}catch(e){l===q.current&&g((0,a.Q)(e))}finally{l===q.current&&N(!1)}};(0,t.useEffect)(()=>(k(),()=>{q.current++}),[x]);let I=y.filter(e=>{var l;return"published"===e.status&&((null==(l=e.published)?void 0:l.communityId)||e.draft.communityId||null)===(v||null)}),S=I.find(e=>e.id===d.surveyId),A=((null==S?void 0:S.questionCatalog)||(null==S||null==(l=S.published)?void 0:l.questions)||[]).filter(e=>"text"!==e.type),E=A.find(e=>e.id===d.questionId);return(0,s.jsxs)("div",{className:"space-y-3 basis-full",children:[(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsxs)("select",{"aria-label":"Survey ".concat(c+1),className:C,value:d.surveyId||"",onChange:e=>p({surveyId:e.target.value||void 0,questionId:void 0,op:"eq",value:"surveyAnswered"===d.field?1:void 0}),children:[(0,s.jsx)("option",{value:"",children:"Choose a survey"}),d.surveyId&&!I.some(e=>e.id===d.surveyId)&&(0,s.jsx)("option",{value:d.surveyId,children:"Selected survey \xb7 load more or choose another"}),I.map(e=>(0,s.jsx)("option",{value:e.id,children:e.draft.name},e.id))]}),"surveyAnswer"===d.field&&(0,s.jsxs)("select",{"aria-label":"Survey question ".concat(c+1),className:C,value:d.questionId||"",onChange:e=>{var l;let n=A.find(l=>l.id===e.target.value);p({questionId:null==n?void 0:n.id,op:(null==n?void 0:n.type)==="multiSelect"?"contains":"eq",value:(null==n?void 0:n.type)==="number"?0:null==n||null==(l=n.options)?void 0:l[0]})},children:[(0,s.jsx)("option",{value:"",children:"Choose a question"}),d.questionId&&!E&&(0,s.jsx)("option",{value:d.questionId,children:"Earlier question \xb7 choose a current question"}),A.map(e=>(0,s.jsx)("option",{value:e.id,children:e.label},e.id))]}),(0,s.jsxs)("select",{"aria-label":"Comparison ".concat(c+1),className:C,value:d.op,onChange:e=>p({op:e.target.value}),children:[(null==E?void 0:E.type)!=="multiSelect"&&(0,s.jsx)("option",{value:"eq",children:"is"}),(null==E?void 0:E.type)==="multiSelect"&&(0,s.jsx)("option",{value:"contains",children:"includes"}),(null==E?void 0:E.type)==="number"&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("option",{value:"gte",children:"at least"}),(0,s.jsx)("option",{value:"lte",children:"at most"})]}),(0,s.jsx)("option",{value:"known",children:"is known"}),(0,s.jsx)("option",{value:"unknown",children:"is unknown"})]}),!["known","unknown"].includes(d.op)&&("surveyAnswered"===d.field?(0,s.jsxs)("select",{"aria-label":"Survey response ".concat(c+1),className:C,value:null!=(r=d.value)?r:1,onChange:e=>p({value:Number(e.target.value)}),children:[(0,s.jsx)("option",{value:1,children:"Answered"}),(0,s.jsx)("option",{value:0,children:"No response yet"})]}):(null==E?void 0:E.type)==="number"?(0,s.jsx)("input",{"aria-label":"Survey answer ".concat(c+1),type:"number",step:"any",className:"".concat(C," w-28"),value:null!=(u=d.value)?u:0,onChange:e=>p({value:Number(e.target.value)})}):E&&(0,s.jsx)("select",{"aria-label":"Survey answer ".concat(c+1),className:C,value:null!=(o=d.value)?o:"",onChange:e=>p({value:e.target.value}),children:null==(n=E.options)?void 0:n.map(e=>(0,s.jsx)("option",{value:e,children:e},e))}))]}),(0,s.jsx)("p",{className:"text-xs text-t2",children:"Uses the latest answers shared for personalization. Missing answers stay unknown. People who withdraw personalization permission are excluded from survey-based targeting. Written answers are available in results but cannot be used for targeting."}),w&&(0,s.jsxs)("p",{role:"alert",className:"text-xs text-negative-ink",children:[w," ",(0,s.jsx)("button",{className:"underline",onClick:()=>void k(),children:"Retry surveys"})]}),f&&(0,s.jsx)("p",{role:"status",className:"text-xs",children:"Loading surveysâ¦"}),!!b&&(0,s.jsx)("button",{className:"text-xs underline",disabled:f,onClick:()=>void k(b),children:"Load more surveys"})]})}}}]);
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.