import{j as t,ar as Z,z as J,ap as X,br as K,bs as Le,bt as Pe,bu as Te,_ as ve,bv as ze,I as he,bw as Be,bx as _e,an as ie,a4 as se,bg as $e}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b710.js";import{A as He,q as G,K as be,N as ye,b7 as Qe,p as Ue,b8 as qe,av as We,at as Se,s as Xe}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b723.js";import{u as V,a as Ke,b as k}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b788.js";import{u as T}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b719.js";import{u as re}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b735.js";import{a as S,d as Ge}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b74.js";import{a as Ve,g as Ye,e as Ze,i as le,m as Je,b as et,c as tt,d as nt,f as z,h as rt,j as at,k as je}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b7188.js";import{r as ee,g as ot,m as te,o as it,c as ae,d as Ee,e as q,a as st,b as Ce,s as we,f as ce}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b7189.js";import{_ as D,f as lt,r as ct}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b75.js";import{i as w}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b79.js";import{u as dt}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b7123.js";import{a as ut}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b7152.js";import{j as pt}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b721.js";function ft(){const{setActiveRender:e,setActiveCreateOrEdit:n}=V(),{variaveisWA:r}=He(),{close:u}=G(),{createScript:o}=Ke(),{language:m}=T();return t.jsx("div",{style:{position:"initial"},children:t.jsx("ul",{className:"overflow-hidden flex "+r.modalOptions.content2,children:t.jsx("div",{className:r.modalOptions.content3,children:t.jsxs("div",{className:r.listagem.content1,children:[t.jsx(Z,{content:m.respostaRapida,icon:t.jsx(J,{size:20,className:"text-[var(--icon)]"}),setFunction:()=>{u(),n({type:"create",model:"respostaRapida"})},stroke:"1"}),t.jsx(Z,{content:"Script",icon:t.jsx(X,{type:"script"}),setFunction:()=>{u(),o()},stroke:"1"}),t.jsx("div",{className:"xjm9jq1 xfw0ycb x7r5mf7 x12nagc"}),t.jsx(Z,{content:m.category,icon:t.jsx(K,{className:"w-5 h-5 text-[var(--panel-header-icon)]"}),setFunction:()=>{u(),e("categoria")},stroke:"1"})]})})})})}const de="flex gap-1 cursor-pointer items-center h-9 py-2 rounded-lg hover:bg-[var(--dropdown-background-hover)] px-2";function ue({model:e}){const{categories:n}=re(),{setFilter:r}=k(),{close:u}=G(),{language:o}=T(),d=["txt","image","video","audio","doc","contact","script","automation","pix","groupInvite","linkPreview","sticker"].map((l,f)=>t.jsxs("div",{className:de,onClick:()=>{u(),r("model",{id:"type",parm:l})},children:[t.jsx(X,{type:l}),t.jsx("span",{className:"truncate max-w-80",children:o[l]})]},f)),p=n.map((l,f)=>t.jsxs("div",{className:de,onClick:()=>{u(),r("model",{id:"cat",parm:l.id})},children:[t.jsx(K,{size:20,style:{color:l.hexColor}}),t.jsx("span",{className:"truncate max-w-80",children:l.name})]},f));return t.jsxs("div",{className:"px-2 min-w-60 overflow-auto",style:{maxHeight:"calc(100vh - 65px)"},children:[t.jsx("div",{className:"truncate max-w-80 font-bold text-lg first-letter:uppercase",children:e==="cat"?"Selecione uma Categoria":"Selecione um tipo"}),t.jsx("hr",{}),t.jsx("div",{className:"flex flex-col gap-1 mt-[2px]",children:e==="cat"?p:d})]})}function gt(){const{categories:e}=re(),{language:n}=T(),{open:r}=G(),{filter:u,setFilter:o}=k(),m=[{id:"all",name:n.tab_all,action:()=>o("model",{id:"all"})},{id:"type",name:n.filterQuickReplyPerType,action:i=>r(t.jsx(ue,{model:"type"}),{placement:"left-end"},i.target)},{id:"not_cat",name:n.filterQuickReplyNotPerCategorie,action:()=>o("model",{id:"not_cat"})},{id:"cat",name:n.filterQuickReplyPerCategorie,action:i=>r(t.jsx(ue,{model:"cat"}),{placement:"left-end"},i.target)},{id:"most_used",name:n.filterQuickReplyMostUsed,action:()=>o("model",{id:"most_used"})}],d=t.jsxs("div",{className:"flex justify-center gap-2",children:[t.jsx(Le,{value:u.search,setValue:i=>o("search",i),placeholder:n.searchQuickReply}),t.jsx("span",{className:"cursor-pointer pulse lg:tooltip lg:tooltip-left","data-tip":n.createQuickReply,onClick:i=>r(t.jsx(ft,{}),{placement:"bottom-end"},i.target,5),children:t.jsx(Pe,{className:"!w-[30px] !h-[30px] text-[var(--primaria)]"})})]}),p=t.jsx("div",{className:"flex gap-1 flex-wrap",children:m.map(i=>{var l;return t.jsxs("div",{className:`flex gap-1 badge border border-[var(--secundaria)] border-solid  font-medium rounded-lg shadow-lg text-nowrap pulse cursor-pointer 
                            ${u.model.id===i.id?"bg-label-gradient text-[var(--letra)]":"text-[var(--primaria)]"}`,onClick:f=>i.action(f),children:[i.id==="type"&&u.model.id===i.id&&t.jsx(X,{type:u.model.parm,style:"w-4 h-4 text-[var(--letra)]"}),i.id==="cat"&&u.model.id===i.id&&t.jsx(K,{size:18,color:(l=e.find(f=>f.id===u.model.parm))==null?void 0:l.hexColor}),t.jsx("span",{children:i.name}),(i.id==="type"||i.id==="cat")&&t.jsx("span",{children:t.jsx(Te,{size:15})})]})})});return t.jsxs("div",{className:"flex flex-col gap-2 p-2",children:[d,p]})}function mt(e){var n=e.list,r=e.startIndex,u=e.closestEdgeOfTarget,o=e.indexOfTarget,m=e.axis;return ee({list:n,startIndex:r,finishIndex:ot({closestEdgeOfTarget:u,startIndex:r,indexOfTarget:o,axis:m})})}function B(e){var n=e.axis,r=e.side;return function(o){var m,d,p=o.clientRect,i=o.overflow,l=o.config,f=Ve[n],a=f.mainAxis,c=f.crossAxis,g=a[r],x=i[g],s=Ye[g]({clientRect:p,config:l}),h=DOMRect.fromRect((m={},D(m,a.point,s[a.point]),D(m,a.size,s[a.size]),D(m,c.point,s[c.point]-x[c.start]),D(m,c.size,s[c.size]+x[c.start]+x[c.end]),m)),b=DOMRect.fromRect((d={},D(d,a.point,r==="start"?p[a.point]-x[a.start]:p[a.end]),D(d,c.point,p[c.point]-x[c.start]),D(d,a.size,r==="start"?x[a.start]:x[a.end]),D(d,c.size,x[c.start]+p[c.size]+x[c.end]),d));return{insideOfEdge:h,outsideOfEdge:b}}}var xt={top:B({axis:"vertical",side:"start"}),right:B({axis:"horizontal",side:"end"}),bottom:B({axis:"vertical",side:"end"}),left:B({axis:"horizontal",side:"start"})};function _(e){return e.type==="inside-of-edge"}function $(e){var n,r,u,o;return{top:(n=e==null?void 0:e.top)!==null&&n!==void 0?n:0,right:(r=e==null?void 0:e.right)!==null&&r!==void 0?r:0,bottom:(u=e==null?void 0:e.bottom)!==null&&u!==void 0?u:0,left:(o=e==null?void 0:e.left)!==null&&o!==void 0?o:0}}function vt(e){return{top:$(e.fromTopEdge),right:$(e.fromRightEdge),bottom:$(e.fromBottomEdge),left:$(e.fromLeftEdge)}}function ht(e){var n=e.entry,r=e.timeSinceLastFrame,u=e.input,o=e.config,m=e.allowedAxis,d={x:u.clientX,y:u.clientY},p=n.element.getBoundingClientRect(),i=vt(n.getOverflow()),l=Ze.map(function(s){var h=xt[s]({clientRect:p,overflow:i,config:o}),b=h.insideOfEdge,y=h.outsideOfEdge;return le({client:d,clientRect:y})?{edge:s,hitbox:y,type:"outside-of-edge"}:le({client:d,clientRect:b})?{edge:s,hitbox:b,type:"inside-of-edge"}:!1}).filter(function(s){return!!s});if(!l.length)return null;var f=Je(n.element),a=l.filter(function(s){return et(nt[s.edge],m)&&tt[s.edge](n.element)});if(!a.length)return null;var c=new Map(a.map(function(s){return[s.edge,s]})),g=(function(){var s="horizontal",h=c.get("left");if(h)return z({client:d,isDistanceDampeningEnabled:_(h),hitbox:h.hitbox,edge:"left",axis:s,timeSinceLastFrame:r,engagement:f,config:o});var b=c.get("right");return b?z({client:d,isDistanceDampeningEnabled:_(b),hitbox:b.hitbox,edge:"right",axis:s,timeSinceLastFrame:r,engagement:f,config:o}):0})(),x=(function(){var s="vertical",h=c.get("bottom");if(h)return z({client:d,isDistanceDampeningEnabled:_(h),hitbox:h.hitbox,edge:"bottom",axis:s,timeSinceLastFrame:r,engagement:f,config:o});var b=c.get("top");return b?z({client:d,isDistanceDampeningEnabled:_(b),hitbox:b.hitbox,edge:"top",axis:s,timeSinceLastFrame:r,engagement:f,config:o}):0})();return{left:g,top:x}}function bt(e,n){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=yt(e))||n){r&&(e=r);var u=0,o=function(){};return{s:o,n:function(){return u>=e.length?{done:!0}:{done:!1,value:e[u++]}},e:function(l){throw l},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var m=!0,d=!1,p;return{s:function(){r=r.call(e)},n:function(){var l=r.next();return m=l.done,l},e:function(l){d=!0,p=l},f:function(){try{!m&&r.return!=null&&r.return()}finally{if(d)throw p}}}}function yt(e,n){if(e){if(typeof e=="string")return pe(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return pe(e,n)}}function pe(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,u=new Array(n);r<n;r++)u[r]=e[r];return u}function St(e){var n=e.input,r=e.source,u=e.entries,o=e.timeSinceLastFrame,m=e.underUsersPointer,d=bt(u),p;try{for(d.s();!(p=d.n()).done;){var i,l,f,a=p.value;if(!a.element.contains(m)){var c={input:n,source:r,element:a.element};if(!(a.canScroll&&!a.canScroll(c))){var g=rt((i=a.getConfiguration)===null||i===void 0?void 0:i.call(a,c)),x=(l=(f=a.getAllowedAxis)===null||f===void 0?void 0:f.call(a,c))!==null&&l!==void 0?l:"all",s=ht({entry:a,input:n,timeSinceLastFrame:o,allowedAxis:x,config:g});s&&a.element.scrollBy(s)}}}}catch(h){d.e(h)}finally{d.f()}}function jt(e){var n=e.monitor,r=new Map;function u(m){return r.set(m.element,m),function(){return r.delete(m.element)}}function o(m){var d=m.latestArgs,p=m.underUsersPointer,i=m.timeSinceLastFrame;St({input:d.location.current.input,source:d.source,entries:Array.from(r).map(function(l){var f=lt(l,2);f[0];var a=f[1];return a}),underUsersPointer:p,timeSinceLastFrame:i})}return at(n).onFrame(o),{unsafeOverflowAutoScroll:u}}var Et=jt({monitor:te}),Oe=Et.unsafeOverflowAutoScroll;function Re(e){var n=e.element,r=e.input;return function(o){var m=o.container,d=n.getBoundingClientRect(),p=m.getBoundingClientRect(),i=Math.min(r.clientX-d.x,p.width),l=Math.min(r.clientY-d.y,p.height);return{x:i,y:l}}}const Ct=S.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b7186.js")),[]));function wt({card:e}){return t.jsx(S.Suspense,{fallback:t.jsx(t.Fragment,{}),children:t.jsx(Ct,{card:e})})}const Ot=S.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b7187.js")),[]));function Rt({card:e}){return t.jsx(S.Suspense,{fallback:t.jsx(t.Fragment,{}),children:t.jsx(Ot,{card:e})})}const Ae=it(function(){const{userAgent:n}=navigator;return n.includes("AppleWebKit")&&!n.includes("Chrome")}),At=Ge.div`
    -webkit-transform: perspective(1px) translateZ(0);
    transform: perspective(1px) translateZ(0);
    -webkit-transition-duration: 0.5s;
    transition-duration: 0.5s;
    -webkit-transition-property: color, background-color;
    transition-property: color, background-color;

    &:hover,
    &[activated] {
        background-color: ${e=>e.hexColor};
        border-radius: 4px;
    }
`;function W({dragging:e,hexColor:n}){return t.jsx("div",{className:"flex-shrink-0 skeleton rounded-md ",style:{height:e.height,backgroundColor:n+"40"}})}const fe=async(e,n)=>{e.stopPropagation();const{setUsedRespostaRapida:r}=V.getState(),{sendAction:u}=ye.getState(),{setAcaoEnvioEmMassa:o}=dt.getState(),{setQuickReplyAction:m}=pt.getState(),d=!!document.querySelector('[data-id="eem-old"]'),p=!!document.querySelector('[data-id="eem-new"]');await We("respostasRapidas")!==!0&&(r(n.id),d?o(n):p?m(n):u(n))};function ge({card:e,state:n,outerRef:r,innerRef:u,hexColor:o}){const{menuContent:m}=be(),{open:d}=G(),{getAction:p}=ye(),{setAcao:i}=Qe(),{open:l}=Ue(),f=!!document.querySelector('[data-id="eem-old"], [data-id="eem-new"]'),a=g=>{g.stopPropagation(),close(),i(p(e.id)),l(t.jsx(Rt,{card:e}))},c=g=>{g.stopPropagation(),d(t.jsx(wt,{card:e}),{placement:"left-end"},r.current,25,{mounted:()=>{var x,s;return(s=(x=r.current)==null?void 0:x.parentNode)==null?void 0:s.setAttribute("activated","")},desmouted:()=>{var x,s;return(s=(x=r.current)==null?void 0:x.parentNode)==null?void 0:s.removeAttribute("activated","")}})};return t.jsx(At,{hexColor:o+"70",children:t.jsxs("div",{ref:r,className:"flex flex-shrink-0 flex-col gap-2 ",onClick:g=>fe(g,e),children:[n.type==="is-over"&&n.closestEdge==="top"?t.jsx(W,{dragging:n.dragging,hexColor:o}):null,t.jsx("div",{className:"px-1 py-[5px] border-t border-solid",ref:u,style:{borderColor:`${o}60`,...n.type==="preview"&&{width:n.dragging.width,height:n.dragging.height,transform:Ae()?void 0:"rotate(4deg)",backgroundColor:`${o}60`,borderRadius:"4px"}},children:t.jsxs("div",{className:"flex justify-between",children:[t.jsxs("div",{className:"flex gap-1 items-center",children:[t.jsx("div",{children:t.jsx(X,{type:e.type})}),t.jsx("div",{className:"truncate",style:{maxWidth:`calc(${m.width}px - 139px)`},children:e.titulo})]}),t.jsxs("div",{className:"flex gap-1 items-center",children:[t.jsx("span",{className:"text-[var(--icon)] cursor-pointer pulse",onClick:c,children:t.jsx(ze,{size:18})}),!f&&t.jsx("span",{className:"text-[var(--icon)] cursor-pointer pulse",onClick:a,children:t.jsx(qe,{size:20})}),t.jsx("span",{className:"text-[var(--icon)] cursor-pointer pulse",onClick:g=>fe(g,e),children:t.jsx(ut,{size:18})})]})]})}),n.type==="is-over"&&n.closestEdge==="bottom"?t.jsx(W,{dragging:n.dragging,hexColor:o}):null]})})}const ke=Symbol("card");function kt({card:e,rect:n,columnId:r}){return{[ke]:!0,rect:n,card:e,columnId:r}}function A(e){return!!e[ke]}function I({source:e}){return!k.getState().activeFilter&&A(e.data)}const De=Symbol("card-drop-target");function Ne(e){return!!e[De]}function Dt({card:e,columnId:n}){return{[De]:!0,card:e,columnId:n}}const Fe=Symbol("column");function Nt({column:e}){return{[Fe]:!0,column:e}}function M(e){return!!e[Fe]}function U({source:e}){var n;return!k.getState().activeFilter&&((n=e.data.column)==null?void 0:n.id)!=="not_cat"&&M(e.data)}function Ie(e,n){const r=Object.keys(e),u=Object.keys(n);return r.length!==u.length?!1:r.every(o=>Object.is(e[o],n[o]))}const H={type:"idle"};function Ft({card:e,columnId:n,hexColor:r}){const{activeFilter:u}=k(),{language:o}=T(),m=S.useRef(null),d=S.useRef(null),[p,i]=S.useState(H);return S.useEffect(()=>{const l=m.current,f=d.current;return w(l&&f),ae(Ce({element:f,getInitialData:({element:a})=>kt({card:e,columnId:n,rect:a.getBoundingClientRect()}),onGenerateDragPreview({nativeSetDragImage:a,location:c,source:g}){const x=g.data;w(A(x)),we({nativeSetDragImage:a,getOffset:Re({element:f,input:c.current.input}),render({container:s}){i({type:"preview",container:s,dragging:f.getBoundingClientRect()})}})},onDragStart(){u&&he({type:"Info",message:o.dragAndDropNotMoveInActiveFilter,position:"top-right"}),i({type:"is-dragging"})},onDrop(){i(H)}}),Ee({element:l,getIsSticky:()=>!0,canDrop:I,getData:({element:a,input:c})=>{const g=Dt({card:e,columnId:n});return st(g,{element:a,input:c,allowedEdges:["top","bottom"]})},onDragEnter({source:a,self:c}){if(!A(a.data)||a.data.card.id===e.id)return;const g=q(c.data);g&&i({type:"is-over",dragging:a.data.rect,closestEdge:g})},onDrag({source:a,self:c}){if(!A(a.data)||a.data.card.id===e.id)return;const g=q(c.data);if(!g)return;const x={type:"is-over",dragging:a.data.rect,closestEdge:g};i(s=>Ie(x,s)?s:x)},onDragLeave({source:a}){if(A(a.data)){if(a.data.card.id===e.id){i({type:"is-dragging-and-left-self"});return}i(H)}},onDrop(){i(H)}}))},[e,n,u]),t.jsxs(t.Fragment,{children:[t.jsx(ge,{outerRef:m,innerRef:d,state:p,card:e,hexColor:r}),p.type==="preview"?ct.createPortal(t.jsx(ge,{state:p,card:e,hexColor:r}),p.container):null]})}const ne="data-block-board-panning",It={isBoardMoreObvious:{type:"boolean",title:"Make board more obvious",description:"Add extra spacing and borders to the board scroll container to make it easier to see and play with"},isFPSPanelEnabled:{type:"boolean",title:"FPS Panel",description:"Display a panel with Frame Per Second (FPS) information"},isCPUBurnEnabled:{type:"boolean",title:"Drop FPS 🔥",description:"Start heavy process that will cause the frame rate on the page to drop"},isOverElementAutoScrollEnabled:{type:"boolean",title:"Over element auto scrolling",description:"Should elements automatically scroll when over them"},isOverflowScrollingEnabled:{type:"boolean",title:"Overflow scrolling",description:"Should overflow scrolling be enabled"},boardScrollSpeed:{type:"select",title:"Board auto scroll speed",description:"What should the max horizontal scroll speed the board be?",options:["fast","standard"]},columnScrollSpeed:{type:"select",title:"Column auto scroll speed",description:"What should the max vertical scroll speed for columns be?",options:["fast","standard"]}},Mt={isBoardMoreObvious:!1,isOverElementAutoScrollEnabled:!0,boardScrollSpeed:"fast",columnScrollSpeed:"standard",isFPSPanelEnabled:!1,isCPUBurnEnabled:!1,isOverflowScrollingEnabled:!0},Me=S.createContext({fields:It,settings:Mt,update:()=>{},reset:()=>{}}),Lt={idle:"","is-card-over":"","is-dragging":"","is-column-over":"skeleton"},Q={type:"idle"},me=S.memo(function({column:n}){return n.cards.map(r=>t.jsx(Ft,{card:r,columnId:n.id,hexColor:n.hexColor},r.id))});function Pt({column:e}){const{categoriaOpen:n,setCategoriaOpen:r}=V(),{menuContent:u}=be(),{activeFilter:o}=k(),{language:m}=T(),d=S.useRef(null),p=S.useRef(null),i=S.useRef(null),l=S.useRef(null),{settings:f}=S.useContext(Me),[a,c]=S.useState(Q),g=!o&&n.includes(e.id);S.useEffect(()=>{const h=p.current,b=d.current,y=i.current,O=l.current;w(h),w(b),w(y),w(O);const L=Nt({column:e});function R({data:v,location:E}){const C=E.current.dropTargets[0],j=!!(C&&Ne(C.data)),P={type:"is-card-over",dragging:v.rect,isOverChildCard:j};c(N=>Ie(P,N)?N:P)}return ae(Ce({element:y,getInitialData:()=>L,onGenerateDragPreview({source:v,location:E,nativeSetDragImage:C}){const j=v.data;w(M(j)),we({nativeSetDragImage:C,getOffset:Re({element:y,input:E.current.input}),render({container:P}){const N=O.getBoundingClientRect(),F=O.cloneNode(!0);w(F instanceof HTMLElement),F.style.width=`${N.width}px`,F.style.height=`${N.height}px`,Ae()||(F.style.transform="rotate(4deg)"),P.appendChild(F)}})},onDragStart(){o&&he({type:"Info",message:m.dragAndDropNotMoveInActiveFilter,position:"top-right"}),c({type:"is-dragging"})},onDrop(){c(Q)}}),Ee({element:h,getData:()=>L,canDrop({source:v}){return I({source:v})||U({source:v})},getIsSticky:()=>!0,onDragStart({source:v,location:E}){A(v.data)&&R({data:v.data,location:E})},onDragEnter({source:v,location:E}){if(A(v.data)){R({data:v.data,location:E});return}M(v.data)&&v.data.column.id!==e.id&&c({type:"is-column-over"})},onDropTargetChange({source:v,location:E}){if(A(v.data)){R({data:v.data,location:E});return}},onDragLeave({source:v}){M(v.data)&&v.data.column.id===e.id||c(Q)},onDrop(){c(Q)}}),je({canScroll({source:v}){return f.isOverElementAutoScrollEnabled?I({source:v}):!1},getConfiguration:()=>({maxScrollSpeed:f.columnScrollSpeed}),element:b}),Oe({element:b,getConfiguration:()=>({maxScrollSpeed:f.columnScrollSpeed}),canScroll({source:v}){return!f.isOverElementAutoScrollEnabled||!f.isOverflowScrollingEnabled?!1:I({source:v})},getOverflow(){return{forTopEdge:{top:1e3},forBottomEdge:{bottom:1e3}}}}))},[e,f]);const x=t.jsx("div",{ref:p,children:t.jsx("div",{ref:l,[ne]:!0,children:t.jsx("div",{className:`flex max-h-full flex-col ${a.type==="is-column-over"?"invisible":""}`,children:t.jsx("div",{ref:i,children:t.jsx("div",{className:`flex flex-col overflow-y-auto min-h-9 cursor-default
              ${!g&&e.cards.length!==0?"pb-2":""}  
            `,ref:d,children:t.jsxs(t.Fragment,{children:[t.jsx(me,{column:e}),a.type==="is-card-over"&&!a.isOverChildCard&&t.jsx("div",{className:"flex-shrink-0 px-3 py-1",children:t.jsx(W,{dragging:a.dragging,hexColor:e.hexColor})})]})})})})})}),s=t.jsx("div",{className:"flex w-full flex-shrink-0 select-none flex-col",ref:p,children:t.jsx("div",{className:`flex max-h-full flex-col rounded-lg border border-solid border-[var(--conversation-header-border)] ${Lt[a.type]}`,ref:l,style:!g||a.type==="is-column-over"?{backgroundColor:`${e.hexColor}30`,borderColor:`${e.hexColor}60`}:{},[ne]:!0,children:t.jsxs("div",{className:`flex max-h-full flex-col ${a.type==="is-column-over"?"invisible":""}`,children:[t.jsxs("div",{className:"flex flex-row items-center justify-between p-1 gap-1",ref:i,onClick:()=>r(e.id),children:[t.jsxs("div",{className:"flex gap-1 items-center",children:[t.jsx("div",{children:t.jsx(K,{size:20,style:{color:e.hexColor}})}),t.jsx("span",{className:"truncate font-semibold",style:{maxWidth:`calc(${u.width}px - 90px)`},children:e.name})]}),t.jsx("div",{children:t.jsx("span",{className:"text-[var(--icon)]",children:g?t.jsx(Be,{size:22,stroke:"0.3"}):t.jsx(_e,{size:22,stroke:"0.3"})})})]}),t.jsx("div",{className:`flex flex-col overflow-y-auto px-1 ml-4 
              ${!g&&e.cards.length!==0?"pb-2":""}  
            `,ref:d,children:!g&&t.jsxs(t.Fragment,{children:[t.jsx(me,{column:e}),a.type==="is-card-over"&&!a.isOverChildCard&&t.jsx("div",{className:"flex-shrink-0 px-3 py-1",children:t.jsx(W,{dragging:a.dragging,hexColor:e.hexColor})})]})})]})})});return e.id==="not_cat"?x:s}function xe(){const{sortCategories:e,categories:n}=re(),{sortQuickReply:r,quickReplies:u}=Se(),{list:o,updateFilter:m}=k();S.useEffect(m,[n,u]);const d=S.useRef(null),{settings:p}=S.useContext(Me);return S.useEffect(()=>{const i=d.current;return w(i),ae(te({canMonitor:I,onDrop({source:l,location:f}){const a=l.data;if(!A(a))return;const c=f.current.dropTargets[0];if(!c)return;const g=c.data,x=o.columns.findIndex(b=>b.id===a.columnId),s=o.columns[x];if(!s)return;const h=s.cards.findIndex(b=>b.id===a.card.id);if(Ne(g)){const b=o.columns.findIndex(j=>j.id===g.columnId),y=o.columns[b];if(s===y){const j=s.cards.findIndex(Y=>Y.id===g.card.id);if(h===-1||j===-1||h===j)return;const P=q(g),N=mt({axis:"vertical",list:s.cards,startIndex:h,indexOfTarget:j,closestEdgeOfTarget:P}),F={...s,cards:N},oe=Array.from(o.columns);oe[x]=F,r(oe.flatMap(Y=>Y.cards));return}if(!y)return;const O=y.cards.findIndex(j=>j.id===g.card.id),R=q(g)==="bottom"?O+1:O,v=Array.from(s.cards);v.splice(h,1),y.id==="not_cat"?delete a.card.categoria:a.card.categoria=y.id;const E=Array.from(y.cards);E.splice(R,0,a.card);const C=Array.from(o.columns);C[x]={...s,cards:v},C[b]={...y,cards:E},r(C.flatMap(j=>j.cards));return}if(M(g)){const b=o.columns.findIndex(v=>v.id===g.column.id),y=o.columns[b];if(!y)return;if(s===y){const v=ee({list:s.cards,startIndex:h,finishIndex:s.cards.length-1}),E={...s,cards:v},C=Array.from(o.columns);C[x]=E,r(C.flatMap(j=>j.cards));return}const O=Array.from(s.cards);O.splice(h,1),y.id==="not_cat"?delete a.card.categoria:a.card.categoria=y.id;const L=Array.from(y.cards);L.splice(y.cards.length,0,a.card);const R=Array.from(o.columns);R[x]={...s,cards:O},R[b]={...y,cards:L},r(R.flatMap(v=>v.cards));return}}}),te({canMonitor:U,onDrop({source:l,location:f}){const a=l.data;if(!M(a))return;const c=f.current.dropTargets[0];if(!c||c.data.column.id==="not_cat")return;const g=c.data;if(!M(g))return;const x=o.columns.findIndex(h=>h.id===a.column.id),s=o.columns.findIndex(h=>h.id===g.column.id);x===-1||s===-1||x!==s&&(ee({list:o.columns,startIndex:x,finishIndex:s}),e({oldIndex:x,newIndex:s}))}}),je({canScroll({source:l}){return p.isOverElementAutoScrollEnabled?I({source:l})||U({source:l}):!1},getConfiguration:()=>({maxScrollSpeed:p.boardScrollSpeed}),element:i}),Oe({element:i,getConfiguration:()=>({maxScrollSpeed:p.boardScrollSpeed}),canScroll({source:l}){return!p.isOverElementAutoScrollEnabled||!p.isOverflowScrollingEnabled?!1:I({source:l})||U({source:l})},getOverflow(){return{forLeftEdge:{top:1e3,left:1e3,bottom:1e3},forRightEdge:{top:1e3,right:1e3,bottom:1e3}}}}))},[o,p]),S.useEffect(()=>{let i=null;const l=d.current;w(l);function f({startX:c}){let g=c;const x=ce.bindAll(window,[{type:"pointermove",listener(s){const h=s.clientX,b=g-h;g=h,l==null||l.scrollBy({left:b})}},...["pointercancel","pointerup","pointerdown","keydown","resize","click","visibilitychange"].map(s=>({type:s,listener:()=>x()}))],{capture:!0});i=x}const a=ce.bindAll(l,[{type:"pointerdown",listener(c){c.target instanceof HTMLElement&&(c.target.closest(`[${ne}]`)||f({startX:c.clientX}))}}]);return function(){a(),i==null||i()}},[]),t.jsx("div",{className:`flex h-full flex-col ${p.isBoardMoreObvious?"px-32 py-20":""}`,children:t.jsx("div",{className:`flex h-full flex-col gap-2 overflow-x-auto ${p.isBoardMoreObvious?"rounded border-2 border-dashed":""}`,ref:d,children:o.columns.map(i=>t.jsx(Pt,{column:i},i.id))})})}function Tt({listSize:e}){var l,f;const{quickReplies:n}=Se(),{list:r,activeFilter:u}=k(),{language:o}=T(),{setActiveCreateOrEdit:m}=V(),d=Xe(a=>a.label),p=t.jsxs("div",{className:"flex flex-col items-center justify-center content-center gap-2 mb-2 pb-4",children:[t.jsx(ie,{icon:t.jsx(J,{size:26,className:"text-[var(--primaria)]"}),title:o.quickRepltEmpty,description:o.quickReplyEmptyDes}),t.jsx(se,{name:o.createQuickReply,funcao:()=>m({type:"create",model:"respostaRapida"})}),((f=(l=d.videos_tutoriais)==null?void 0:l.resposta_rapida)==null?void 0:f.length)>0&&t.jsx($e,{funcao:()=>window.open(d.videos_tutoriais.resposta_rapida,"_blank")})]}),i=t.jsxs("div",{className:"grid gap-2 mb-2 pb-4",children:[t.jsx(ie,{icon:t.jsx(J,{size:26,className:"text-[var(--primaria)]"}),title:o.noQuickReply,description:o.searchQuickReplyNotFilter}),t.jsx(se,{name:o.clear_filter,funcao:()=>k.setState({activeFilter:!1,filter:{search:"",model:{id:"all",parm:""}}})})]});return t.jsxs("div",{children:[t.jsx(gt,{}),t.jsx("div",{className:"overflow-auto pl-2 pr-1",style:{maxHeight:`calc(100vh - ${e}px)`},children:u?r.columns.length===0?i:t.jsx(xe,{}):n.length===0?p:t.jsx(xe,{})})]})}const Yt=Object.freeze(Object.defineProperty({__proto__:null,default:Tt},Symbol.toStringTag,{value:"Module"}));export{Rt as E,Yt as i};

