1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6675],{6675:function(e,t,s){s.r(t),s.d(t,{default:function(){return o}});var a=s(57437),l=s(2265),i=s(47051);let n="search",r=e=>{let{t:t}=(0,i.w)(),[s,r]=(0,l.useState)(""),[c,o]=(0,l.useState)(0),[d,p]=(0,l.useState)(""),{isOpenDialog:m,setIsOpenDialog:h}=e,[x,u]=(0,l.useState)(!1),[f,g]=(0,l.useState)(""),[j,y]=(0,l.useState)(n),b=async(e,t)=>{if(x)return;u(!0),g("");let s=await fetch("/api/integrations/giphy/search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({keyword:e,offset:t})}),a=await s.json();return s.ok?(r(a.image||""),o(a.nextOffset),a.image||g("No Result found")):g((null==a?void 0:a.message)||"Something went wrong"),u(!1),null},v=async e=>{var t;if(x)return;u(!0),g("");let s=await fetch("/api/integrations/giphy/get",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e})}),a=await s.json();return s.ok?(r(a.image||""),a.image||g("No Result found")):g((null==a?void 0:a.message)||(null==(t=null==a?void 0:a[0])?void 0:t.message)||"Something went wrong"),u(!1),null},N=(e,t,s)=>(0,a.jsxs)("div",{className:(0,i.r)("flex cursor-pointer items-center border-b-2 p-2 text-sm ",j===s?"text-default border-emphasis":"text-subtle border-transparent"),onClick:()=>{p(""),r(""),y(s)},children:[(0,a.jsx)(i.R,{name:e,className:"h-4 w-4 ltr:mr-2 rtl:ml-2"}),t]}),w=async e=>{e.stopPropagation(),e.preventDefault(),j===n?b(d,0):"url"===j&&v(d)};return(0,a.jsx)(i.ad,{open:m,onOpenChange:h,children:(0,a.jsxs)(i.ae,{children:[(0,a.jsx)("h3",{className:"leading-16 font-cal text-emphasis text-xl",id:"modal-title",children:t("add_gif_to_confirmation")}),(0,a.jsx)("p",{className:"text-subtle mb-3 text-sm font-light",children:t("find_gif_spice_confirmation")}),(0,a.jsxs)("div",{className:"border-emphasis flex items-center border-b border-solid",children:[N("search",t("search_giphy"),n),N("link",t("add_link_from_giphy"),"url")]}),(0,a.jsxs)("form",{className:"flex w-full justify-center space-x-2 space-y-2 rtl:space-x-reverse",onSubmit:w,children:[(0,a.jsx)("div",{className:"relative block w-full pt-2",children:(0,a.jsx)(i.e,{type:"text",placeholder:j===n?t("search_giphy"):"https://media.giphy.com/media/some-id/giphy.gif",value:d,onChange:e=>{p(e.target.value)}})}),(0,a.jsx)(i.B,{type:"submit",tabIndex:-1,color:"secondary",loading:x,children:t("search")})]}),s&&(0,a.jsx)("div",{className:"flex flex-col items-center space-x-2 space-y-2 pt-3 rtl:space-x-reverse",children:(0,a.jsx)("div",{className:"bg-subtle flex w-full items-center justify-center",children:x?(0,a.jsx)("div",{className:"flex h-[200px] w-full items-center justify-center bg-gray-400 pb-3 pt-3",children:(0,a.jsxs)("svg",{className:(0,i.r)("mx-4 h-5 w-5 animate-spin","text-inverted dark:text-emphasis"),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,a.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,a.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}):(0,a.jsx)("img",{className:"h-[200px] pb-3 pt-3",src:s,alt:`Gif from Giphy for ${d}`})})}),f&&(0,a.jsx)(i.J,{severity:"error",title:f,className:"my-4"}),s&&j===n&&(0,a.jsxs)("div",{className:"mt-4 flex items-center justify-between space-x-2 rtl:space-x-reverse",children:[(0,a.jsx)("div",{className:"text-subtle text-sm font-light",children:"Not the perfect GIF?"}),(0,a.jsx)(i.B,{size:"sm",color:"secondary",type:"button",loading:x,onClick:()=>b(d,c),children:"Shuffle"})]}),(0,a.jsxs)(i.af,{noSticky:!0,children:[(0,a.jsx)(i.ag,{color:"minimal",tabIndex:-1,onClick:()=>{e.setIsOpenDialog(!1)},children:t("cancel")}),(0,a.jsx)(i.B,{type:"button",disabled:!s,onClick:()=>(e.setIsOpenDialog(!1),e.onSave(s),o(0),r(""),p(""),!1),children:t("add_gif")})]})]})})};function c(e){let{t:t}=(0,i.w)(),[s,n]=(0,l.useState)(e.defaultValue),[c,o]=(0,l.useState)(!1);return(0,a.jsxs)("div",{className:"flex flex-col items-start space-x-2 space-y-2 rtl:space-x-reverse",children:[s&&(0,a.jsx)("div",{className:"min-h-[200px]",children:(0,a.jsx)("img",{alt:"Selected Gif Image",src:s})}),(0,a.jsxs)("div",{className:"flex",children:[s?(0,a.jsx)(i.B,{color:"minimal",type:"button",StartIcon:"pencil",onClick:()=>o(!0),disabled:e.disabled,children:"Change"}):(0,a.jsx)(i.B,{color:"minimal",type:"button",StartIcon:"plus",onClick:()=>o(!0),disabled:e.disabled,children:"Add from Giphy"}),s&&(0,a.jsx)(i.B,{color:"destructive",type:"button",StartIcon:"x",onClick:()=>{n(""),e.onChange("")},disabled:e.disabled,children:t("remove")})]}),(0,a.jsx)(r,{isOpenDialog:c,setIsOpenDialog:o,onSave:t=>{n(t),e.onChange(t)}
1})]})}let o=({getAppData:e,setAppData:t,disabled:s})=>{let l=e("thankYouPage");return(0,a.jsx)(c,{defaultValue:l,disabled:s,onChange:e=>{t("thankYouPage",e)}})}}}]);
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.