PageSourceSearch

https://zapdata.co/_releases/admin/assets/App-B-9YH1AD.js

js zapdata.co collected 2026-10-02 01:22:17 UTC 1,000,042 bytes, 524 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/InboxDashboard-g6UgcGCE.js","assets/react-vendor-CQjOo-Vj.js","assets/index-DdOu1uvL.js","assets/supabase-zVFFtMAE.js","assets/index--TP5WPvv.css","assets/ProChannelUpgradeDialog-CCBc7fpe.js","assets/useBillingAccess-gkNde9k_.js","assets/flowAIStaging-C96-JHzp.js","assets/collapsible-CbT61Lp0.js","assets/index-CiQgiGdC.js","assets/calendar-BW3-9hq3.js","assets/isSameDay-DjT64o2N.js","assets/format-COLlrU_E.js","assets/subDays-CesO43j9.js","assets/chevron-left-DcVcXqlN.js","assets/zernioPopup-BqWuxn6F.js","assets/ExpiringInstancesAlert-B0O33-VK.js","assets/sheet-Bz8Wt6SO.js","assets/tabs-DlSaFjxQ.js","assets/index-iX9gdQ-5.js","assets/scroll-area-DEdEFgx-.js","assets/inboxContactsCache-VVWPjpYa.js","assets/useInboxTags-B7MHsIq6.js","assets/TagColorSwatch-B80O2pFA.js","assets/phoneFormatter-Cv-TSM1Y.js","assets/countryDdi-BvyH1gQc.js","assets/tag-CXFwU2q3.js","assets/plus-B8uP4sl6.js","assets/refresh-cw-ClHeqbQi.js","assets/FreeTrialPixGateModal-CiOwnHaf.js","assets/puzzle-Bq9R7IRo.js","assets/youtube-C4SE9BOu.js","assets/hash-BF7VUWHd.js","assets/UpgradePlanDialog-BxTAbhNr.js","assets/alert-D_b75SbC.js","assets/shopping-cart-epj7pjJ7.js","assets/map-pin-BUGz0ftd.js","assets/globe-DtdDj9iB.js","assets/pencil-CU32j5zN.js","assets/wifi-DavK7w4N.js","assets/colored-switch-BI66-AzR.js","assets/pause-ByF1w4nE.js","assets/ChannelIcon-DyOd65nZ.js","assets/instagram-D27geWIB.js","assets/messages-square-DXyzdOa_.js","assets/settings-2-DLPuCrou.js","assets/collaboratorInstances-DwCVJy0o.js","assets/message-square-Cl-dNZix.js","assets/filter-ChT5gAeL.js","assets/calendar-CGdGfFin.js","assets/generateCategoricalChart-Cub-Pl06.js","assets/value-3LWPH8SZ.js","assets/AreaChart-B7NrC6WS.js","assets/phone-CoTQvLVp.js","assets/at-sign-DvxmM27C.js","assets/phone-off-VIS31GFH.js","assets/circle-x-BG6TUh-B.js","assets/InboxPage-DpBKhAcl.js","assets/useAIFlows-BdhrmiwT.js","assets/storageBuckets-D3dx_NSd.js","assets/icon-wait-DiYNrDN4.js","assets/zenith-FFPiCJ69.js","assets/image-CdgvC4Rd.js","assets/mic-DFlcyoKy.js","assets/video-DqeOOziu.js","assets/file-text-B6orxXER.js","assets/shuffle-C5GsaVnN.js","assets/inboxChannelFilter-BZx2XfKe.js","assets/radio-group-BgXDAa4o.js","assets/circle-CGvVakyY.js","assets/eye-off-Du4WpEqy.js","assets/InboxChannelFilter-xVDPfCxO.js","assets/activity-Cl8gY0i8.js","assets/dropdown-menu-qtqEh_2n.js","assets/rotate-cw-D5O4PCT1.js","assets/useWhatsAppGroups-D5bL-iVS.js","assets/flow-translate-languages-Ch7OHR5I.js","assets/play-CIawygai.js","assets/languages-C0SLD3Yt.js","assets/audioAI-models-QmjUlLSR.js","assets/useFreeTierUsage-DfxBQKgy.js","assets/user-plus-fVWnLV6n.js","assets/inboxVariables-BNurjk3-.js","assets/useGlobalVariables-Chji121v.js","assets/folder-DcS5m2OO.js","assets/list-DrfwfSnR.js","assets/link-fXrCfF8s.js","assets/assignedInstances-CTcP76Bw.js","assets/dollar-sign-DugP5-P9.js","assets/paperclip-CzQLVeY9.js","assets/square-BcW_R8J-.js","assets/ban-4XvGIteJ.js","assets/useTiktokPixels-DmkoDc6w.js","assets/separator-sC6412Pd.js","assets/history-Bwb_U72q.js","assets/pen-pfxWHdE6.js","assets/useGroupFlows-CfIvY3R-.js","assets/log-in-7WP7Cb85.js","assets/index-2TvPEaGF.js","assets/useGroupFlowSchedules-CzOVZ4DS.js","assets/square-pen-fpsWs1fA.js","assets/ellipsis-_V6AK4Ow.js","assets/FlowListPage-nmjHVJ28.js","assets/sortable.esm-D4NcRUUX.js","assets/useIsFreeTrialUser-D1waZIQd.js","assets/MiniFlowBuilder-BWVSKPIG.js","assets/style-C7svRoLj.js","assets/style-BZV40eAE.css","assets/iaGenerator-models-D0JNlnOh.js","assets/image-batch-BLYOaSct.js","assets/variable-WJ4E7IFU.js","assets/bot-DI4zu_bY.js","assets/tiktok-logo-BK4YLpVG.js","assets/minus-CRFMK6_G.js","assets/catalog-resolver-BHQJLUOx.js","assets/TiktokPixelSettings-BvKz7ni2.js","assets/chart-column-CaaAIcGj.js","assets/usePixGatewayCredentials-s9BFTChV.js","assets/grip-vertical-CU5_Uzbe.js","assets/package-BJG3NviU.js","assets/folder-plus-D3LN_NbX.js","assets/folder-input-B1iayfjk.js","assets/link-2-DrnQEGj6.js","assets/InboxKanbanPage-BGnfpkkS.js","assets/Trans-BycSz5EP.js","assets/QuickRepliesPage-Cy3r10GL.js","assets/Settings-q4f9W6Qt.js","assets/accordion-CHiUnYZo.js","assets/table-DzVtV_6U.js","assets/shopping-bag-LejHjwp2.js","assets/SubscriptionPage-Dwu2ifi4.js","assets/Marketplace-D78o23VJ.js","assets/animated-search-bar-B-LPy4I1.js","assets/smmLink-DpkcSHov.js","assets/server-OJmMoarc.js","assets/palette-CHCIoi0p.js","assets/AffiliateDashboard-CL-8D5-L.js","assets/parseISO-C8LfBMJ7.js","assets/Index-DhF0PcXn.js","assets/storage-gAO-Skpf.js","assets/percent-DiUIWC4s.js","assets/BarChart-PH9PuwNB.js","assets/MessageBlaster-CoIIHH6n.js","assets/contactPublicId-BIWmPPl6.js","assets/index-BWAbpX3
1E.js","assets/wifi-off-DcAQGh4u.js","assets/CreativeCanvasProjects-DRQyhhCQ.js","assets/ImportShareDialog-DXJmuDg3.js","assets/AdsLayout-DgBfBFkA.js","assets/subMonths-BnOyuFGW.js","assets/circle-help-BmVr-d8Z.js","assets/facebook-DMVwsIO0.js","assets/Tutoriais-DUxKfNh3.js","assets/tutorial-cover-Ka8B4DUc.js","assets/AudioGenerator-CakVOZlF.js","assets/AudioTranscriber-Bv6wgYdK.js","assets/VideoDownloader-CJ_4NRjr.js","assets/music-BSIKf1-W.js","assets/ZapdataConverter-CZhuiF-F.js","assets/TrackOfertas-CJ2yeVRn.js","assets/maximize-2-DniM6ZUQ.js","assets/LineChart-CXZWL2Fl.js","assets/Redirects-TYESJMlX.js","assets/ExtensaoAdsWhatsApp-1J8QGz5e.js","assets/GroupFlowsPage-CjYDfQit.js","assets/FlowCanvas-BlIOyG27.js","assets/FlowAIImagePanel-DUPeOncp.js","assets/CatalogResolverNode-KQiRiNxD.js","assets/arrow-up-DUzAgb3u.js","assets/arrow-down--YH9bf2Z.js","assets/useFlowAnalytics-BnSpFD0j.js","assets/PassageMetricsDialog-Dd1vHeZb.js","assets/LandingPage-C16mDOVc.js","assets/ProductMetrics-CjNHAtw9.js","assets/arrow-up-down-Cf3hlJ3A.js","assets/GeradorPalavrasChaves-Dh9Q9_bk.js","assets/useQualifiedPlanAccess-DFexBiiN.js","assets/PlanRequiredModal-CDGw1Qv4.js","assets/key-DeN_7D3p.js","assets/ProductAnalysis-Dmjfgsj2.js","assets/safeHtml-C6FlPkxq.js","assets/NumberOrganizer-BO418ZSv.js","assets/SMSBot-BdUAQ-Cc.js","assets/SMMPanel-CXivRfFz.js","assets/AdminPanelNew-Be37mx-A.js","assets/DisparaZapOficial-CKdd-qXb.js","assets/SiteCloner-CuPdFX52.js","assets/ZernioCallback-DsvkdsN0.js","assets/PaymentThankYou-Bj43uTCm.js","assets/PaymentCancelled-CMLhKge6.js","assets/ZernioBroadcast-BQiupzYx.js","assets/NotifyAdminPage-zQqybgve.js","assets/NotifyAdminAddNumber-Uqy33bdU.js","assets/GlobalSettingsPage-ChYvfpFc.js","assets/ContactsPage-qCSGZszF.js","assets/SaleNotificationSettings-BQfTaI0m.js","assets/Item-DnnfdpVq.js","assets/LogzzNotificationSettings-CyOUxiFB.js","assets/IntegrationsPage-C52-DIiN.js","assets/mcpScopes-DgeEp3lq.js","assets/FlowPreviewPage-CBe2ZXsM.js","assets/CreativeCanvas-D9a1W7xN.js","assets/CreativeShareImport-YS7eJt-X.js","assets/TutorialPublic-BWEJthCV.js","assets/AdminProviders-C9kARjI8.js","assets/PrivacyPolicy-c-mnT2cg.js","assets/McpMediaReview-0FMsVNm5.js","assets/McpAuthorize-CfAsW7Rb.js","assets/ZenithOAuthConnect-DcmL_JKR.js","assets/ZenithOAuthCallback-Bd5BEx6G.js","assets/TermsOfService-BcxxGOBu.js","assets/DataDeletion-HD7Ss6LO.js","assets/Ferramentas-bo1TIR8c.js"])))=>i.map(i=>d[i]);
2var ip=e=>{throw TypeError(e)};var dc=(e,t,n)=>t.has(e)||ip("Cannot "+n);var Z=(e,t,n)=>(dc(e,t,"read from private field"),n?n.call(e):t.get(e)),Ae=(e,t,n)=>t.has(e)?ip("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),je=(e,t,n,r)=>(dc(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Ge=(e,t,n)=>(dc(e,t,"access private method"),n);var oi=(e,t,n,r)=>({set _(s){je(e,t,s,n)},get _(){return Z(e,t,r)}});import{_ as be,a as Nr,b as Cv,d as F2,c as z2}from"./supabase-zVFFtMAE.js";import{r as m,j as a,u as or,a as yl,R as jv,b as kv,L as _a,N as ta,$ as oe,d as Rt,e as Ev,f as ii,h as Nv,i as Pv,k as B2,B as V2,l as Wu,m as ve}from"./react-vendor-CQjOo-Vj.js";import{c as we,L as st,C as Vo,T as Jn,i as $2}from"./zernioPopup-BqWuxn6F.js";import{g as U2,a as W2,s as he,b as uc,h as H2,c as fc,r as q2,d as hc,e as lp,f as G2,S as cp,i as ud,j as K2,k as fd,l as Gi,m as hd,n as Y2,o as dp,p as Mt,q as rr,t as up,C as pc,u as X2,v as Z2,w as Q2,x as J2,y as eC,z as tC,A as Av,B as Fe,D as Tv,E as nC,F as rC,L as sC,U as mc,G as aC,H as oC,I as iC,J as lC,K as cC,M as fp,N as dC}from"./index-DdOu1uvL.js";const uC=(e,t,n,r)=>{var o,i,l,c;const s=[n,{code:t,...r||{}}];if((i=(o=e==null?void 0:e.services)==null?void 0:o.logger)!=null&&i.forward)return e.services.logger.forward(s,"warn","react-i18next::",!0);js(s[0])&&(s[0]=`react-i18next:: ${s[0]}`),(c=(l=e==null?void 0:e.services)==null?void 0:l.logger)!=null&&c.warn?e.services.logger.warn(...s):console!=null&&console.warn&&console.warn(...s)},hp={},Ti=(e,t,n,r)=>{js(n)&&hp[n]||(js(n)&&(hp[n]=new Date),uC(e,t,n,r))},Iv=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}},pd=(e,t,n)=>{e.loadNamespaces(t,Iv(e,n))},pp=(e,t,n,r)=>{if(js(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return pd(e,n,r);
2n.forEach(s=>{e.options.ns.indexOf(s)<0&&e.options.ns.push(s)}),e.loadLanguages(t,Iv(e,r))},fC=(e,t,n={})=>!t.languages||!t.languages.length?(Ti(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:n.lng,precheck:(r,s)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!s(r.isLanguageChangingTo,e))return!1}}),js=e=>typeof e=="string",hC=e=>typeof e=="object"&&e!==null,pC=m.createContext();class mC{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var Mv={exports:{}},Rv={};/**
3 * @license React
4 * use-sync-external-store-shim.production.js
5 *
6 * Copyright (c) Meta Platforms, Inc. and affiliates.
7 *
8 * This source code is licensed under the MIT license found in the
9 * LICENSE file in the root directory of this source tree.
10 */var Sa=m;function gC(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var xC=typeof Object.is=="function"?Object.is:gC,vC=Sa.useState,yC=Sa.useEffect,bC=Sa.useLayoutEffect,wC=Sa.useDebugValue;function _C(e,t){var n=t(),r=vC({inst:{value:n,getSnapshot:t}}),s=r[0].inst,o=r[1];return bC(function(){s.value=n,s.getSnapshot=t,gc(s)&&o({inst:s})},[e,n,t]),yC(function(){return gc(s)&&o({inst:s}),e(function(){gc(s)&&o({inst:s})})},[e]),wC(n),n}function gc(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!xC(e,n)}catch{return!0}}function SC(e,t){return t()}var CC=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?SC:_C;Rv.useSyncExternalStore=Sa.useSyncExternalStore!==void 0?Sa.useSyncExternalStore:CC;Mv.exports=Rv;var Dv=Mv.exports;const jC=(e,t)=>{if(js(t))return t;if(hC(t)&&js(t.defaultValue))return t.defaultValue;if(typeof e=="function")return"";if(Array.isArray(e)){const n=e[e.length-1];return typeof n=="function"?"":n}return e},kC={t:jC,ready:!1},EC=()=>()=>{},Qe=(e,t={})=>{var A,T,D;const{i18n:n}=t,{i18n:r,defaultNS:s}=m.useContext(pC)||{},o=n||r||W2();o&&!o.reportNamespaces&&(o.reportNamespaces=new mC),o||Ti(o,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next or by passing it via props or context. In monorepo setups, make sure there is only one instance of react-i18next.");const i=m.useMemo(()=>{var E;return{...U2(),...(E=o==null?void 0:o.options)==null?void 0:E.react,...t}},[o,t]),{useSuspense:l,keyPrefix:c}=i,d=e||s||((A=o==null?void 0:o.options)==null?void 0:A.defaultNS),u=js(d)?[d]:d||["translation"],f=m.useMemo(()=>u,u);(D=(T=o==null?void 0:o.reportNamespaces)==null?void 0:T.addUsedNamespaces)==null||D.call(T,f);const h=m.useRef(0),p=m.useCallback(E=>{if(!o)return EC;const{bindI18n:I,bindI18nStore:S}=i,L=()=>{h.current+=1,E()};return I&&o.on(I,L),S&&o.store.on(S,L),()=>{I&&I.split(" ").forEach(Y=>o.off(Y,L)),S&&S.split(" ").forEach(Y=>o.store.off(Y,L))}},[o,i]),y=m.useRef(),g=m.useCallback(()=>{if(!o)return kC;const E=!!(o.isInitialized||o.initializedStoreOnce)&&f.every(q=>fC(q,o,i)),I=t.lng||o.language,S=h.current,L=y.current;if(L&&L.ready===E&&L.lng===I&&L.keyPrefix===c&&L.revision===S)return L;const B={t:o.getFixedT(I,i.nsMode==="fallback"?f:f[0],c,{scopeNs:f}),ready:E,lng:I,keyPrefix:c,revision:S};return y.current=B,B},[o,f,c,i,t.lng]),[x,v]=m.useState(0),{t:b,ready:w}=Dv.useSyncExternalStore(p,g,g);m.useEffect(()=>{if(o&&!w&&!l){const E=()=>v(I=>I+1);t.lng?pp(o,t.lng,f,E):pd(o,f,E)}},[o,t.lng,f,w,l,x]);const _=o||{},C=m.useRef(null),N=m.useRef(),k=E=>{const I=Object.getOwnPropertyDescriptors(E);I.__original&&delete I.__original;const S=Object.create(Object.getPrototypeOf(E),I);if(!Object.prototype.hasOwnProperty.call(S,"__original"))try{Object.defineProperty(S,"__original",{value:E,writable:!1,enumerable:!1,configurable:!1})}catch{}return S},P=m.useMemo(()=>{const E=_,I=E==null?void 0:E.language;let S=E;E&&(C.current&&C.current.__original===E?N.current!==I?(S=k(E),C.current=S,N.current=I):S=C.current:(S=k(E),C.current=S,N.current=I));const L=!w&&!l?(...B)=>(Ti(o,"USE_T_BEFORE_READY","useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t."),b(...B)):b,Y=[L,S,w];return Y.t=L,Y.i18n=S,Y.ready=w,Y},[b,_,w,_.resolvedLanguage,_.language,_.languages]);if(o&&l&&!w){let E=!1;try{E=!1}catch{}throw E&&Ti(o,"SUSPENDED_WHILE_LOADING","useTranslation: suspended while translations are loading (useSuspense is true by default). Add a <Suspense> boundary above this component, or set react.useSuspense: false in the i18next init options. https://react.
10i18next.com/latest/usetranslation-hook"),new Promise(I=>{const S=()=>I();t.lng?pp(o,t.lng,f,S):pd(o,f,S)})}return P};/**
11 * @license lucide-react v0.462.0 - ISC
12 *
13 * This source code is licensed under the ISC license.
14 * See the LICENSE file in the root directory of this source tree.
15 */const NC=we("ArrowDownRight",[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]]);/**
16 * @license lucide-react v0.462.0 - ISC
17 *
18 * This source code is licensed under the ISC license.
19 * See the LICENSE file in the root directory of this source tree.
20 */const ks=we("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
21 * @license lucide-react v0.462.0 - ISC
22 *
23 * This source code is licensed under the ISC license.
24 * See the LICENSE file in the root directory of this source tree.
25 */const Ca=we("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
26 * @license lucide-react v0.462.0 - ISC
27 *
28 * This source code is licensed under the ISC license.
29 * See the LICENSE file in the root directory of this source tree.
30 */const PC=we("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/**
31 * @license lucide-react v0.462.0 - ISC
32 *
33 * This source code is licensed under the ISC license.
34 * See the LICENSE file in the root directory of this source tree.
35 */const AC=we("BellRing",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}]]);/**
36 * @license lucide-react v0.462.0 - ISC
37 *
38 * This source code is licensed under the ISC license.
39 * See the LICENSE file in the root directory of this source tree.
40 */const TC=we("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/**
41 * @license lucide-react v0.462.0 - ISC
42 *
43 * This source code is licensed under the ISC license.
44 * See the LICENSE file in the root directory of this source tree.
45 */const Ov=we("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/**
46 * @license lucide-react v0.462.0 - ISC
47 *
48 * This source code is licensed under the ISC license.
49 * See the LICENSE file in the root directory of this source tree.
50 */const IC=we("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);/**
51 * @license lucide-react v0.462.0 - ISC
52 *
53 * This source code is licensed under the ISC license.
54 * See the LICENSE file in the root directory of this source tree.
55 */const MC=we("CalendarX",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m14 14-4 4",key:"rymu2i"}],["path",{d:"m10 14 4 4",key:"3sz06r"}]]);/**
56 * @license lucide-react v0.462.0 - ISC
57 *
58 * This source code is licensed under the ISC license.
59 * See the LICENSE file in the root directory of this source tree.
60 */const RC=we("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/**
61 * @license lucide-react v0.462.0 - ISC
62 *
63 * This source code is licensed under the ISC license.
64 * See the LICENSE file in the root directory of this source tree.
65 */const Lr=we("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
66 * @license lucide-react v0.462.0 - ISC
67 *
68 * This source code is licensed under the ISC license.
69 * See the LICENSE file in the root directory of this source tree.
70 */const Lv=we("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
71 * @license lucide-react v0.462.0 - ISC
72 *
73 * This source code is licensed under the ISC license.
74 * See the LICENSE file in the root directory of this source tree.
75 */const DC=we("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
76 * @license lucide-react v0.462.0 - ISC
77 *
78 * This source code is licensed under the ISC license.
79 * See the LICENSE file in the root directory of this source tree.
80 */const OC=we("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
81 * @license lucide-react v0.462.0 - ISC
82 *
83 * This source code is licensed under the ISC license.
84 * See the LICENSE file in the root directory of this source tree.
85 */const LC=we("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/**
86 * @license lucide-react v0.462.0 - ISC
87 *
88 * This source code is licensed under the ISC license.
89 * See the LICENSE file in the root directory of this source tree.
90 */const FC=we("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
91 * @license lucide-react v0.462.0 - ISC
92 *
93 * This source code is licensed under the ISC license.
94 * See the LICENSE file in the root directory of this source tree.
95 */const zC=we("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
96 * @license lucide-react v0.462.0 - ISC
97 *
98 * This source code is licensed under the ISC license.
99 * See the LICENSE file in the root directory of this source tree.
100 */const BC=we("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/**
101 * @license lucide-react v0.462.0 - ISC
102 *
103 * This source code is licensed under the ISC license.
104 * See the LICENSE file in the root directory of this source tree.
105 */const VC=we("CircleUser",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);/**
106 * @license lucide-react v0.462.0 - ISC
107 *
108 * This source code is licensed under the ISC license.
109 * See the LICENSE file in the root directory of this source tree.
110 */const $C=we("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
111 * @license lucide-react v0.462.0 - ISC
112 *
113 * This source code is licensed under the ISC license.
114 * See the LICENSE file in the root directory of this source tree.
115 */const UC=we("Cookie",[["path",{d:"M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5",key:"laymnq"}],["path",{d:"M8.5 8.5v.01",key:"ue8clq"}],["path",{d:"M16 15.5v.01",key:"14dtrp"}],["path",{d:"M12 12v.01",key:"u5ubse"}],["path",{d:"M11 17v.01",key:"1hyl5a"}],["path",{d:"M7 14v.01",key:"uct60s"}]]);/**
116 * @license lucide-react v0.462.0 - ISC
117 *
118 * This source code is licensed under the ISC license.
119 * See the LICENSE file in the root directory of this source tree.
120 */const Fv=we("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
121 * @license lucide-react v0.462.0 - ISC
122 *
123 * This source code is licensed under the ISC license.
124 * See the LICENSE file in the root directory of this source tree.
125 */const Aa=we("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);/**
126 * @license lucide-react v0.462.0 - ISC
127 *
128 * This source code is licensed under the ISC license.
129 * See the LICENSE file in the root directory of this source tree.
130 */const Ki=we("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/**
131 * @license lucide-react v0.462.0 - ISC
132 *
133 * This source code is licensed under the ISC license.
134 * See the LICENSE file in the root directory of this source tree.
135 */const WC=we("Dot",[["circle",{cx:"12.1",cy:"12.1",r:"1",key:"18d7e5"}]]);/**
136 * @license lucide-react v0.462.0 - ISC
137 *
138 * This source code is licensed under the ISC license.
139 * See the LICENSE file in the root directory of this source tree.
140 */const mp=we("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
141 * @license lucide-react v0.462.0 - ISC
142 *
143 * This source code is licensed under the ISC license.
144 * See the LICENSE file in the root directory of this source tree.
145 */const HC=we("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
146 * @license lucide-react v0.462.0 - ISC
147 *
148 * This source code is licensed under the ISC license.
149 * See the LICENSE file in the root directory of this source tree.
150 */const md=we("EyeClosed",[["path",{d:"m15 18-.722-3.25",key:"1j64jw"}],["path",{d:"M2 8a10.645 10.645 0 0 0 20 0",key:"1e7gxb"}],["path",{d:"m20 15-1.726-2.05",key:"1cnuld"}],["path",{d:"m4 15 1.726-2.05",key:"1dsqqd"}],["path",{d:"m9 18 .722-3.25",key:"ypw2yx"}]]);/**
151 * @license lucide-react v0.462.0 - ISC
152 *
153 * This source code is licensed under the ISC license.
154 * See the LICENSE file in the root directory of this source tree.
155 */const gd=we("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
156 * @license lucide-react v0.462.0 - ISC
157 *
158 * This source code is licensed under the ISC license.
159 * See the LICENSE file in the root directory of this source tree.
160 */const qC=we("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/**
161 * @license lucide-react v0.462.0 - ISC
162 *
163 * This source code is licensed under the ISC license.
164 * See the LICENSE file in the root directory of this source tree.
165 */const GC=we("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
166 * @license lucide-react v0.462.0 - ISC
167 *
168 * This source code is licensed under the ISC license.
169 * See the LICENSE file in the root directory of this source tree.
170 */const KC=we("Footprints",[["path",{d:"M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 1 1-4 0Z",key:"1dudjm"}],["path",{d:"M20 20v-2.38c0-2.12 1.03-3.12 1-5.62-.03-2.72-1.49-6-4.5-6C14.63 6 14 7.8 14 9.5c0 3.11 2 5.66 2 8.68V20a2 2 0 1 0 4 0Z",key:"l2t8xc"}],["path",{d:"M16 17h4",key:"1dejxt"}],["path",{d:"M4 13h4",key:"1bwh8b"}]]);/**
171 * @license lucide-react v0.462.0 - ISC
172 *
173 * This source code is licensed under the ISC license.
174 * See the LICENSE file in the root directory of this source tree.
175 */const YC=we("Gem",[["path",{d:"M6 3h12l4 6-10 13L2 9Z",key:"1pcd5k"}],["path",{d:"M11 3 8 9l4 13 4-13-3-6",key:"1fcu3u"}],["path",{d:"M2 9h20",key:"16fsjt"}]]);/**
176 * @license lucide-react v0.462.0 - ISC
177 *
178 * This source code is licensed under the ISC license.
179 * See the LICENSE file in the root directory of this source tree.
180 */const zv=we("Gift",[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]]);/**
181 * @license lucide-react v0.462.0 - ISC
182 *
183 * This source code is licensed under the ISC license.
184 * See the LICENSE file in the root directory of this source tree.
185 */const XC=we("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/**
186 * @license lucide-react v0.462.0 - ISC
187 *
188 * This source code is licensed under the ISC license.
189 * See the LICENSE file in the root directory of this source tree.
190 */const Hu=we("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
191 * @license lucide-react v0.462.0 - ISC
192 *
193 * This source code is licensed under the ISC license.
194 * See the LICENSE file in the root directory of this source tree.
195 */const ZC=we("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
196 * @license lucide-react v0.462.0 - ISC
197 *
198 * This source code is licensed under the ISC license.
199 * See the LICENSE file in the root directory of this source tree.
200 */const fo=we("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
201 * @license lucide-react v0.462.0 - ISC
202 *
203 * This source code is licensed under the ISC license.
204 * See the LICENSE file in the root directory of this source tree.
205 */const qu=we("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
206 * @license lucide-react v0.462.0 - ISC
207 *
208 * This source code is licensed under the ISC license.
209 * See the LICENSE file in the root directory of this source tree.
210 */const li=we("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/**
211 * @license lucide-react v0.462.0 - ISC
212 *
213 * This source code is licensed under the ISC license.
214 * See the LICENSE file in the root directory of this source tree.
215 */const QC=we("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);/**
216 * @license lucide-react v0.462.0 - ISC
217 *
218 * This source code is licensed under the ISC license.
219 * See the LICENSE file in the root directory of this source tree.
220 */const gp=we("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
221 * @license lucide-react v0.462.0 - ISC
222 *
223 * This source code is licensed under the ISC license.
224 * See the LICENSE file in the root directory of this source tree.
225 */const JC=we("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
226 * @license lucide-react v0.462.0 - ISC
227 *
228 * This source code is licensed under the ISC license.
229 * See the LICENSE file in the root directory of this source tree.
230 */const ej=we("MessageSquareText",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M13 8H7",key:"14i4kc"}],["path",{d:"M17 12H7",key:"16if0g"}]]);/**
231 * @license lucide-react v0.462.0 - ISC
232 *
233 * This source code is licensed under the ISC license.
234 * See the LICENSE file in the root directory of this source tree.
235 */const Gu=we("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
236 * @license lucide-react v0.462.0 - ISC
237 *
238 * This source code is licensed under the ISC license.
239 * See the LICENSE file in the root directory of this source tree.
240 */const Bv=we("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/**
241 * @license lucide-react v0.462.0 - ISC
242 *
243 * This source code is licensed under the ISC license.
244 * See the LICENSE file in the root directory of this source tree.
245 */const tj=we("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/**
246 * @license lucide-react v0.462.0 - ISC
247 *
248 * This source code is licensed under the ISC license.
249 * See the LICENSE file in the root directory of this source tree.
250 */const nj=we("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]);/**
251 * @license lucide-react v0.462.0 - ISC
252 *
253 * This source code is licensed under the ISC license.
254 * See the LICENSE file in the root directory of this source tree.
255 */const Vv=we("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/**
256 * @license lucide-react v0.462.0 - ISC
257 *
258 * This source code is licensed under the ISC license.
259 * See the LICENSE file in the root directory of this source tree.
260 */const rj=we("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3
260kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);/**
261 * @license lucide-react v0.462.0 - ISC
262 *
263 * This source code is licensed under the ISC license.
264 * See the LICENSE file in the root directory of this source tree.
265 */const xc=we("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
266 * @license lucide-react v0.462.0 - ISC
267 *
268 * This source code is licensed under the ISC license.
269 * See the LICENSE file in the root directory of this source tree.
270 */const sj=we("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
271 * @license lucide-react v0.462.0 - ISC
272 *
273 * This source code is licensed under the ISC license.
274 * See the LICENSE file in the root directory of this source tree.
275 */const aj=we("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
276 * @license lucide-react v0.462.0 - ISC
277 *
278 * This source code is licensed under the ISC license.
279 * See the LICENSE file in the root directory of this source tree.
280 */const oj=we("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
281 * @license lucide-react v0.462.0 - ISC
282 *
283 * This source code is licensed under the ISC license.
284 * See the LICENSE file in the root directory of this source tree.
285 */const Ku=we("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
286 * @license lucide-react v0.462.0 - ISC
287 *
288 * This source code is licensed under the ISC license.
289 * See the LICENSE file in the root directory of this source tree.
290 */const Yi=we("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/**
291 * @license lucide-react v0.462.0 - ISC
292 *
293 * This source code is licensed under the ISC license.
294 * See the LICENSE file in the root directory of this source tree.
295 */const xp=we("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
296 * @license lucide-react v0.462.0 - ISC
297 *
298 * This source code is licensed under the ISC license.
299 * See the LICENSE file in the root directory of this source tree.
300 */const Yu=we("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
301 * @license lucide-react v0.462.0 - ISC
302 *
303 * This source code is licensed under the ISC license.
304 * See the LICENSE file in the root directory of this source tree.
305 */const ij=we("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
306 * @license lucide-react v0.462.0 - ISC
307 *
308 * This source code is licensed under the ISC license.
309 * See the LICENSE file in the root directory of this source tree.
310 */const bl=we("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
311 * @license lucide-react v0.462.0 - ISC
312 *
313 * This source code is licensed under the ISC license.
314 * See the LICENSE file in the root directory of this source tree.
315 */const lj=we("Sprout",[["path",{d:"M7 20h10",key:"e6iznv"}],["path",{d:"M10 20c5.5-2.5.8-6.4 3-10",key:"161w41"}],["path",{d:"M9.5 9.4c1.1.8 1.8 2.2 2.3 3.7-2 .4-3.5.4-4.8-.3-1.2-.6-2.3-1.9-3-4.2 2.8-.5 4.4 0 5.5.8z",key:"9gtqwd"}],["path",{d:"M14.1 6a7 7 0 0 0-1.1 4c1.9-.1 3.3-.6 4.3-1.4 1-1 1.6-2.3 1.7-4.6-2.7.1-4 1-4.9 2z",key:"bkxnd2"}]]);/**
316 * @license lucide-react v0.462.0 - ISC
317 *
318 * This source code is licensed under the ISC license.
319 * See the LICENSE file in the root directory of this source tree.
320 */const cj=we("SquareKanban",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 7v7",key:"1x2jlm"}],["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M16 7v9",key:"1hp2iy"}]]);/**
321 * @license lucide-react v0.462.0 - ISC
322 *
323 * This source code is licensed under the ISC license.
324 * See the LICENSE file in the root directory of this source tree.
325 */const dj=we("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/**
326 * @license lucide-react v0.462.0 - ISC
327 *
328 * This source code is licensed under the ISC license.
329 * See the LICENSE file in the root directory of this source tree.
330 */const $v=we("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
331 * @license lucide-react v0.462.0 - ISC
332 *
333 * This source code is licensed under the ISC license.
334 * See the LICENSE file in the root directory of this source tree.
335 */const uj=we("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
336 * @license lucide-react v0.462.0 - ISC
337 *
338 * This source code is licensed under the ISC license.
339 * See the LICENSE file in the root directory of this source tree.
340 */const _o=we("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
341 * @license lucide-react v0.462.0 - ISC
342 *
343 * This source code is licensed under the ISC license.
344 * See the LICENSE file in the root directory of this source tree.
345 */const fj=we("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]);/**
346 * @license lucide-react v0.462.0 - ISC
347 *
348 * This source code is licensed under the ISC license.
349 * See the LICENSE file in the root directory of this source tree.
350 */const hj=we("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
351 * @license lucide-react v0.462.0 - ISC
352 *
353 * This source code is licensed under the ISC license.
354 * See the LICENSE file in the root directory of this source tree.
355 */const pj=we("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/**
356 * @license lucide-react v0.462.0 - ISC
357 *
358 * This source code is licensed under the ISC license.
359 * See the LICENSE file in the root directory of this source tree.
360 */const vp=we("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
361 * @license lucide-react v0.462.0 - ISC
362 *
363 * This source code is licensed under the ISC license.
364 * See the LICENSE file in the root directory of this source tree.
365 */const mj=we("UserMinus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/**
366 * @license lucide-react v0.462.0 - ISC
367 *
368 * This source code is licensed under the ISC license.
369 * See the LICENSE file in the root directory of this source tree.
370 */const gj=we("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
371 * @license lucide-react v0.462.0 - ISC
372 *
373 * This source code is licensed under the ISC license.
374 * See the LICENSE file in the root directory of this source tree.
375 */const Uv=we("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
376 * @license lucide-react v0.462.0 - ISC
377 *
378 * This source code is licensed under the ISC license.
379 * See the LICENSE file in the root directory of this source tree.
380 */const yp=we("Wallet",[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]]);/**
381 * @license lucide-react v0.462.0 - ISC
382 *
383 * This source code is licensed under the ISC license.
384 * See the LICENSE file in the root directory of this source tree.
385 */const xj=we("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/**
386 * @license lucide-react v0.462.0 - ISC
387 *
388 * This source code is licensed under the ISC license.
389 * See the LICENSE file in the root directory of this source tree.
390 */const vj=we("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/**
391 * @license lucide-react v0.462.0 - ISC
392 *
393 * This source code is licensed under the ISC license.
394 * See the LICENSE file in the root directory of this source tree.
395 */const Wv=we("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
396 * @license lucide-react v0.462.0 - ISC
397 *
398 * This source code is licensed under the ISC license.
399 * See the LICENSE file in the root directory of this source tree.
400 */const sr=we("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
401 * @license lucide-react v0.462.0 - ISC
402 *
403 * This source code is licensed under the ISC license.
404 * See the LICENSE file in the root directory of this source tree.
405 */const Hv=we("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),qv="zapdata-theme",Gv=m.createContext(void 0),yj=()=>{if(typeof window<"u"){const e=localStorage.getItem(qv);if(e==="light"||e==="dark")return e}return"light"},bj=({children:e})=>{const[t,n]=m.useState(yj);m.useEffect(()=>{const o=window.document.documentElement;o.classList.remove("light","dark"),o.classList.add(t),localStorage.setItem(qv,t)},[t]);const r=m.useCallback(o=>{n(o)},[]),s=m.useCallback(()=>{n(o=>o==="dark"?"light":"dark")},[]);return a.jsx(Gv.Provider,{value:{theme:t,setTheme:r,toggleTheme:s},children:e})},Xu=()=>{const e=m.useContext(Gv);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e},Zu=()=>a.jsxs("aside",{className:"hidden md:flex w-60 shrink-0 flex-col border-r border-border/40 bg-card/30",children:[a.jsx("div",{className:"h-14 border-b border-border/40"}),a.jsx("div",{className:"flex-1 p-3 space-y-2",children:Array.from({length:10}).map((e,t)=>a.jsx("div",{className:"h-8 w-full rounded-md bg-muted/30 animate-pulse",style:{animationDelay:`${t*40}ms`}},t))})]}),$o=()=>a.jsxs("div",{className:"h-14 w-full border-b border-border/40 bg-card/40 flex items-center px-4 gap-3",children:[a.jsx("div",{className:"h-6 w-40 rounded bg-muted/40 animate-pulse"}),a.jsx("div",{className:"ml-auto h-8 w-8 rounded-full bg-muted/40 animate-pulse"})]}),wj=()=>a.jsxs("div",{className:"flex h-screen w-full bg-background",children:[a.jsx(Zu,{}),a.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[a.jsx($o,{}),a.jsxs("div",{className:"flex-1 flex min-h-0",children:[a.jsx("div",{className:"w-80 border-r border-border/40 p-3 space-y-2",children:Array.from({length:8}).map((e,t)=>a.jsx("div",{className:"h-16 rounded-lg bg-muted/30 animate-pulse",style:{animationDelay:`${t*60}ms`}},t))}),a.jsxs("div",{className:"flex-1 p-6 space-y-3",children:[a.jsx("div",{className:"h-5 w-48 rounded bg-muted/40 animate-pulse"}),a.jsx("div",{className:"h-4 w-72 rounded bg-muted/30 animate-pulse"}),a.jsx("div",{className:"mt-8 space-y-3",children:[0,1,2,3].map(e=>a.jsx("div",{className:`h-12 rounded-xl bg-muted/30 animate-pulse ${e%2?"ml-auto w-2/3":"w-2/3"}`,style:{animationDelay:`${e*80}ms`}},e))})]})]})]})]}),vc=({cols:e=3,rows:t=2})=>a.jsxs("div",{className:"flex h-screen w-full bg-background",children:[a.jsx(Zu,{}),a.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[a.jsx($o,{}),a.jsxs("div",{className:"p-6 space-y-4",children:[a.jsx("div",{className:"h-6 w-56 rounded bg-muted/50 animate-pulse"}),a.jsx("div",{className:"h-4 w-80 rounded bg-muted/30 animate-pulse"}),a.jsx("div",{className:"mt-4 grid gap-3",style:{gridTemplateColumns:`repeat(${e}, minmax(0, 1fr))`},children:Array.from({length:e*t}).map((n,r)=>a.jsx("div",{className:"h-32 rounded-lg bg-muted/30 animate-pulse",style:{animationDelay:`${r*50}ms`}},r))})]})]})]}),bp=()=>a.jsxs("div",{className:"flex h-screen w-full bg-background",children:[a.jsx(Zu,{}),a.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[a.jsx($o,{}),a.jsxs("div",{className:"p-6 space-y-3",children:[a.jsx("div",{className:"h-6 w-48 rounded bg-muted/50 animate-pulse"}),Array.from({length:8}).map((e,t)=>
405a.jsx("div",{className:"h-14 rounded-lg bg-muted/30 animate-pulse",style:{animationDelay:`${t*50}ms`}},t))]})]})]}),Kv=({label:e="Carregando sistema..."})=>a.jsx("div",{className:"pointer-events-none fixed inset-0 z-[80] flex items-center justify-center",children:a.jsx(st,{className:"h-10 w-10 animate-spin text-accent","aria-label":e})}),_j=()=>a.jsxs("div",{className:"min-h-screen w-full bg-background relative",children:[a.jsx($o,{}),a.jsx("div",{className:"px-6 py-8",children:a.jsxs("div",{className:"max-w-5xl mx-auto space-y-4",children:[a.jsx("div",{className:"h-6 w-48 rounded bg-muted/60 animate-pulse"}),a.jsx("div",{className:"h-4 w-72 rounded bg-muted/40 animate-pulse"}),a.jsx("div",{className:"mt-6 grid grid-cols-1 md:grid-cols-3 gap-3",children:[0,1,2].map(e=>a.jsx("div",{className:"h-24 rounded-lg bg-muted/30 animate-pulse",style:{animationDelay:`${e*80}ms`}},e))})]})}),a.jsx(Kv,{label:"Carregando..."})]}),Sj=()=>a.jsxs("div",{className:"min-h-screen w-full bg-background relative",children:[a.jsx($o,{}),a.jsx("div",{className:"px-6 py-8",children:a.jsxs("div",{className:"max-w-5xl mx-auto space-y-4",children:[a.jsx("div",{className:"h-6 w-56 rounded bg-muted/60 animate-pulse"}),a.jsx("div",{className:"h-4 w-80 rounded bg-muted/40 animate-pulse"}),a.jsx("div",{className:"mt-6 grid grid-cols-1 md:grid-cols-3 gap-3",children:[0,1,2].map(e=>a.jsx("div",{className:"h-24 rounded-lg bg-muted/30 animate-pulse",style:{animationDelay:`${e*80}ms`}},e))})]})}),a.jsx(Kv,{})]}),Cj=e=>e.startsWith("/inbox")?a.jsx(wj,{}):e.startsWith("/marketplace")?a.jsx(vc,{cols:3,rows:3}):e.startsWith("/ads")||e.startsWith("/facebook-ads")?a.jsx(vc,{cols:4,rows:2}):e.startsWith("/groups")||e.startsWith("/grupos")?a.jsx(bp,{}):e.startsWith("/ia-studio")||e.startsWith("/ai-studio")?a.jsx(vc,{cols:2,rows:3}):e.startsWith("/gerador-audio")||e.startsWith("/transcricao-audio")||e.startsWith("/video-downloader")||e.startsWith("/zap-converter")||e.startsWith("/track-ofertas")||e.startsWith("/extensao-ads")?a.jsx(Sj,{}):e.startsWith("/disparazap")||e.startsWith("/automatizap")?a.jsx(bp,{}):a.jsx(_j,{}),wl=()=>{const e=or();return Cj(e.pathname)},jj={"/inbox":()=>be(()=>import("./InboxDashboard-g6UgcGCE.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56])),"/inbox/chat":()=>be(()=>import("./InboxPage-DpBKhAcl.js"),__vite__mapDeps([57,1,2,3,4,58,15,59,20,22,23,45,27,60,61,47,62,63,64,65,66,26,67,21,46,68,19,69,16,17,18,24,25,28,42,43,44,70,71,48,14,72,12,56,73,11,74,13,75,34,76,41,77,78,36,53,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,49,94,95,96,38,97,98,99,100,101])),"/inbox/flows":()=>be(()=>import("./FlowListPage-nmjHVJ28.js"),__vite__mapDeps([102,1,2,3,4,5,6,73,19,69,15,103,21,104,105,106,51,107,108,47,60,62,63,41,77,79,61,64,65,90,28,45,27,91,109,25,110,26,37,66,111,112,113,38,114,59,20,22,23,8,9,67,74,18,92,115,116,117,34,75,46,86,118,119,42,43,44,58,84,70,88,95,96,48,120,121,101,122])),"/inbox/flows/_editor":()=>be(()=>Promise.resolve().then(()=>OV),void 0),"/inbox/kanban":()=>be(()=>import("./InboxKanbanPage-BGnfpkkS.js"),__vite__mapDeps([123,1,2,3,4,20,73,19,69,15,24,25,22,23,67,71,42,43,44,103,49,28,27,53,118,70,26,32,47,124,119])),"/inbox/quick-replies":()=>be(()=>import("./QuickRepliesPage-Cy3r10GL.js"),__vite__mapDeps([125,1,2,3,4,82,15,87,83,27,47,95])),"/settings":()=>be(()=>import("./Settings-q4f9W6Qt.js"),__vite__mapDeps([126,1,2,3,4,20,40,127,9,15,27,8,70,83,54,38,128,34,28,129,119,110,14])),"/subscription":()=>be(()=>import("./SubscriptionPage-Dwu2ifi4.js"),__vite__mapDeps([130,1,6,2,3,4,104,33,34,18,19,15,12,49])),"/marketplace":()=>be(()=>import("./Marketplace-D78o23VJ.js"),__vite__mapDeps([131,1,132,2,3,4,15,18,19,34,133,8,9,37,28,38,39,134,65,135,129,27,116,113])),"/affiliate":()=>be(()=>import("./AffiliateDashboard-CL-8D5-L.js"),__vite__mapDeps([136,1,2,3,4,15,128,10,11,12,13,14,50,51,137,116,88,86,49,81,72,52])),"/metricas":()=>be(()=>import("./Index-DhF0PcXn.js"),__vite__mapDeps([138,1,18,19,139,2,3,4,10,11,12,13,14,15,49,140,88,35,128,27,38,50,51,141,52])),"/disparador":()=>be(()=>import("./MessageBlaster-CoIIHH6n.js"),__vite__mapDeps([142,1,18,19,2,3,4,22,42,43,15,44,143,67,10,11,12,13,14,96,99,144,98,75,46,27,47,48,124,56,145,77,90,28,41])
405),"/criativos":()=>be(()=>import("./CreativeCanvasProjects-DRQyhhCQ.js"),__vite__mapDeps([146,1,2,3,4,18,19,15,62,64,12,73,69,147,122,120,27,84,101,38])),"/ads":()=>be(()=>import("./AdsLayout-DgBfBFkA.js"),__vite__mapDeps([148,1,2,3,4,19,10,11,12,13,14,15,149,93,27,38,128,47,144,98,49,50,51,52,141,103,118,77,41,88,53,55,56,28,150,8,9,151])),"/tutoriais":()=>be(()=>import("./Tutoriais-DUxKfNh3.js"),__vite__mapDeps([152,1,153,122,15,3,2,4])),"/gerador-audio":()=>be(()=>import("./AudioGenerator-CakVOZlF.js"),__vite__mapDeps([154,1,2,3,4,79,15,80,63,27,124,41,77])),"/transcricao-audio":()=>be(()=>import("./AudioTranscriber-Bv6wgYdK.js"),__vite__mapDeps([155,1,2,3,4,15])),"/video-downloader":()=>be(()=>import("./VideoDownloader-CJ_4NRjr.js"),__vite__mapDeps([156,1,2,3,4,112,64,15,157])),"/zap-converter":()=>be(()=>import("./ZapdataConverter-CZhuiF-F.js"),__vite__mapDeps([158,1,28,15,3,2,4])),"/track-ofertas":()=>be(()=>import("./TrackOfertas-CJ2yeVRn.js"),__vite__mapDeps([159,1,2,3,4,27,15,100,160,28,50,51,161,113,12,13])),"/redirects":()=>be(()=>import("./Redirects-TYESJMlX.js"),__vite__mapDeps([162,1,2,3,4,115,92,42,43,15,44,10,11,12,13,14,50,51,52,49,122,28,84,27,116,121,38])),"/extensao-ads":()=>be(()=>import("./ExtensaoAdsWhatsApp-1J8QGz5e.js"),__vite__mapDeps([163,1,18,19,127,9,48,15,122,124,2,3,4])),"/inbox/flows/groups":()=>be(()=>import("./GroupFlowsPage-CjYDfQit.js"),__vite__mapDeps([164,1,96,2,3,4,27,15]))},yc=new Set;function Yv(e){if(typeof window>"u")return;const t=[e];/^\/inbox\/flows\/[^/]+$/.test(e)&&e!=="/inbox/flows/groups"&&t.unshift("/inbox/flows/_editor");const n=e.lastIndexOf("/");n>0&&t.push(e.slice(0,n));for(const r of t){if(yc.has(r))return;const s=jj[r];if(s){yc.add(r);const o=()=>s().catch(()=>yc.delete(r)),i=window.requestIdleCallback;i?i(o,{timeout:1500}):setTimeout(o,50);return}}}function kj(){if(typeof window<"u"){const t=window.location.pathname||"/";if(t.startsWith("/flow-preview")||t.startsWith("/lp")||t.startsWith("/s/")||t.startsWith("/tutorial"))return}["/inbox","/inbox/chat","/inbox/flows","/inbox/flows/groups","/marketplace","/gerador-audio","/ads","/criativos","/disparador","/affiliate","/settings","/subscription"].forEach((t,n)=>{setTimeout(()=>Yv(t),1200+n*300)})}function ze(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function wp(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Es(...e){return t=>{let n=!1;const r=e.map(s=>{const o=wp(s,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let s=0;s<r.length;s++){const o=r[s];typeof o=="function"?o():wp(e[s],null)}}}}function Ze(...e){return m.useCallback(Es(...e),e)}function Ej(e,t){const n=m.createContext(t),r=o=>{const{children:i,...l}=o,c=m.useMemo(()=>l,Object.values(l));return a.jsx(n.Provider,{value:c,children:i})};r.displayName=e+"Provider";function s(o){const i=m.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[r,s]}function Vn(e,t=[]){let n=[];function r(o,i){const l=m.createContext(i),c=n.length;n=[...n,i];const d=f=>{var v;const{scope:h,children:p,...y}=f,g=((v=h==null?void 0:h[e])==null?void 0:v[c])||l,x=m.useMemo(()=>y,Object.values(y));return a.jsx(g.Provider,{value:x,children:p})};d.displayName=o+"Provider";function u(f,h){var g;const p=((g=h==null?void 0:h[e])==null?void 0:g[c])||l,y=m.useContext(p);if(y)return y;if(i!==void 0)return i;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[d,u]}const s=()=>{const o=n.map(i=>m.createContext(i));return function(l){const c=(l==null?void 0:l[e])||o;return m.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[r,Nj(s,...t)]}function Nj(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const i=r.reduce((l,{useScope:c,scopeName:d})=>{const f=c(o)[`__scope${d}`];return{...l,...f}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function Ns(e){const t=Aj(e),n=m.forwardRef((r,s)=>{const{children:o,...i}=r,l=m.Children.toArray(o),c=l.find(Tj);if(c){const d=c.props.children,u=l.map(f=>f===c?m.Children.count(d)>1?m.Children.only(null):m.isValidElement(d)?d.props.children:null:f);return a.jsx(t,{...i,ref:s,children:m.isValidElement(d)?m.cloneElement(d,void 0,u):null})}return a.jsx(t,{...i,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}var Pj=Ns("Slot");function Aj(e){const t=m.forwardRef((n,r)=>{const{children:s,...o}=n;if(m.isValidElement(s)){const i=Mj(s),l=Ij(o,s.props);return s.type!==m.Fragment&&(l.ref=r?Es(r,i):i),m.cloneElement(s,l)}return m.Children.count(s)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Xv=Symbol("radix.slottable");function Zv(e){const t=({children:n})=>a.jsx(a.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Xv,t}function Tj(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Xv}function Ij(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...l)=>{const c=o(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}
vendor: 24,304 bytes, line 405
405:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function Mj(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Rj=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ie=Rj.reduce((e,t)=>{const n=Ns(`Primitive.${t}`),r=m.forwardRef((s,o)=>{const{asChild:i,...l}=s,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Dj(e,t){e&&yl.flushSync(()=>e.dispatchEvent(t))}function $r(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Oj(e,t=globalThis==null?void 0:globalThis.document){const n=$r(e);m.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var Lj="DismissableLayer",xd="dismissableLayer.update",Fj="dismissableLayer.pointerDownOutside",zj="dismissableLayer.focusOutside",_p,Qv=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Uo=m.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:i,onDismiss:l,...c}=e,d=m.useContext(Qv),[u,f]=m.useState(null),h=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=m.useState({}),y=Ze(t,k=>f(k)),g=Array.from(d.layers),[x]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),v=g.indexOf(x),b=u?g.indexOf(u):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,_=b>=v,C=$j(k=>{const P=k.target,A=[...d.branches].some(T=>T.contains(P));!_||A||(s==null||s(k),i==null||i(k),k.defaultPrevented||l==null||l())},h),N=Uj(k=>{const P=k.target;[...d.branches].some(T=>T.contains(P))||(o==null||o(k),i==null||i(k),k.defaultPrevented||l==null||l())},h);return Oj(k=>{b===d.layers.size-1&&(r==null||r(k),!k.defaultPrevented&&l&&(k.preventDefault(),l()))},h),m.useEffect(()=>{if(u)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(_p=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(u)),d.layers.add(u),Sp(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=_p)}},[u,h,n,d]),m.useEffect(()=>()=>{u&&(d.layers.delete(u),d.layersWithOutsidePointerEventsDisabled.delete(u),Sp())},[u,d]),m.useEffect(()=>{const k=()=>p({});return document.addEventListener(xd,k),()=>document.removeEventListener(xd,k)},[]),a.jsx(Ie.div,{...c,ref:y,style:{pointerEvents:w?_?"auto":"none":void 0,...e.style},onFocusCapture:ze(e.onFocusCapture,N.onFocusCapture),onBlurCapture:ze(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:ze(e.onPointerDownCapture,C.onPointerDownCapture)})});Uo.displayName=Lj;var Bj="DismissableLayerBranch",Vj=m.forwardRef((e,t)=>{const n=m.useContext(Qv),r=m.useRef(null),s=Ze(t,r);return m.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),a.jsx(Ie.div,{...e,ref:s})});Vj.displayName=Bj;function $j(e,t=globalThis==null?void 0:globalThis.document){const n=$r(e),r=m.useRef(!1),s=m.useRef(()=>{});return m.useEffect(()=>{const o=l=>{if(l.target&&!r.current){let c=function(){Jv(Fj,n,d,{discrete:!0})};const d={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=c,t.addEventListener("click",s.current,{once:!0})):c()}else t.removeEventListener("click",s.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",o),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Uj(e,t=globalThis==null?void 0:globalThis.document){const n=$r(e),r=m.useRef(!1);return m.useEffect(()=>{const s=o=>{o.target&&!r.current&&Jv(zj,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Sp(){const e=new CustomEvent(xd);document.dispatchEvent(e)}function Jv(e,t,n,{discrete:r}){const s=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?Dj(s,o):s.dispatchEvent(o)}var Pt=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},Wj=jv[" useId ".trim().toString()]||(()=>{}),Hj=0;function ln(e){const[t,n]=m.useState(Wj());return Pt(()=>{n(r=>r??String(Hj++))},[e]),t?`radix-${t}`:""}const qj=["top","right","bottom","left"],Ur=Math.min,gn=Math.max,Xi=Math.round,ci=Math.floor,er=e=>({x:e,y:e}),Gj={left:"right",right:"left",bottom:"top",top:"bottom"},Kj={start:"end",end:"start"};function vd(e,t,n){return gn(e,Ur(t,n))}function mr(e,t){return typeof e=="function"?e(t):e}function gr(e){return e.split("-")[0]}function Ta(e){return e.split("-")[1]}function Qu(e){return e==="x"?"y":"x"}function Ju(e){return e==="y"?"height":"width"}const Yj=new Set(["top","bottom"]);function Qn(e){return Yj.has(gr(e))?"y":"x"}function ef(e){return Qu(Qn(e))}function Xj(e,t,n){n===void 0&&(n=!1);const r=Ta(e),s=ef(e),o=Ju(s);let i=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=Zi(i)),[i,Zi(i)]}function Zj(e){const t=Zi(e);return[yd(e),t,yd(t)]}function yd(e){return e.replace(/start|end/g,t=>Kj[t])}const Cp=["left","right"],jp=["right","left"],Qj=["top","bottom"],Jj=["bottom","top"];function ek(e,t,n){switch(e){case"top":case"bottom":return n?t?jp:Cp:t?Cp:jp;case"left":case"right":return t?Qj:Jj;default:return[]}}function tk(e,t,n,r){const s=Ta(e);let o=ek(gr(e),n==="start",r);return s&&(o=o.map(i=>i+"-"+s),t&&(o=o.concat(o.map(yd)))),o}function Zi(e){return e.replace(/left|right|bottom|top/g,t=>Gj[t])}function nk(e){return{top:0,right:0,bottom:0,left:0,...e}}function ey(e){return typeof e!="number"?nk(e):{top:e,right:e,bottom:e,left:e}}function Qi(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function kp(e,t,n){let{reference:r,floating:s}=e;const o=Qn(t),i=ef(t),l=Ju(i),c=gr(t),d=o==="y",u=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,h=r[l]/2-s[l]/2;let p;switch(c){case"top":p={x:u,y:r.y-s.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-s.width,y:f};break;default:p={x:r.x,y:r.y}}switch(Ta(t)){case"start":p[i]-=h*(n&&d?-1:1);break;case"end":p[i]+=h*(n&&d?-1:1);break}return p}const rk=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:i}=n,l=o.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:s}),{x:u,y:f}=kp(d,r,c),h=r,p={},y=0;for(let g=0;g<l.length;g++){const{name:x,fn:v}=l[g],{x:b,y:w,data:_,reset:C}=await v({x:u,y:f,initialPlacement:r,placement:h,strategy:s,middlewareData:p,rects:d,platform:i,elements:{reference:e,floating:t}});u=b??u,f=w??f,p={...p,[x]:{...p[x],..._}},C&&y<=50&&(y++,typeof C=="object"&&(C.placement&&(h=C.placement),C.rects&&(d=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:s}):C.rects),{x:u,y:f}=kp(d,h,c)),g=-1)}return{x:u,y:f,placement:h,strategy:s,middlewareData:p}};async function So(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:o,rects:i,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=mr(t,e),y=ey(p),x=l[h?f==="floating"?"reference":"floating":f],v=Qi(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(x)))==null||n?x:x.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(l.floating)),boundary:d,rootBoundary:u,strategy:c})),b=f==="floating"?{x:r,y:s,width:i.floating.width,height:i.floating.height}:i.reference,w=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l.floating)),_=await(o.isElement==null?void 0:o.isElement(w))?await(o.getScale==null?void 0:o.getScale(w))||{x:1,y:1}:{x:1,y:1},C=Qi(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:b,offsetParent:w,strategy:c}):b);return{top:(v.top-C.top+y.top)/_.y,bottom:(C.bottom-v.bottom+y.bottom)/_.y,left:(v.left-C.left+y.left)/_.x,right:(C.right-v.right+y.right)/_.x}}const sk=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:o,platform:i,elements:l,middlewareData:c}=t,{element:d,padding:u=0}=mr(e,t)||{};if(d==null)return{};const f=ey(u),h={x:n,y:r},p=ef(s),y=Ju(p),g=await i.getDimensions(d),x=p==="y",v=x?"top":"left",b=x?"bottom":"right",w=x?"clientHeight":"clientWidth",_=o.reference[y]+o.reference[p]-h[p]-o.floating[y],C=h[p]-o.reference[p],N=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let k=N?N[w]:0;(!k||!await(i.isElement==null?void 0:i.isElement(N)))&&(k=l.floating[w]||o.floating[y]);const P=_/2-C/2,A=k/2-g[y]/2-1,T=Ur(f[v],A),D=Ur(f[b],A),E=T,I=k-g[y]-D,S=k/2-g[y]/2+P,L=vd(E,S,I),Y=!c.arrow&&Ta(s)!=null&&S!==L&&o.reference[y]/2-(S<E?T:D)-g[y]/2<0,B=Y?S<E?S-E:S-I:0;return{[p]:h[p]+B,data:{[p]:L,centerOffset:S-L-B,...Y&&{alignmentOffset:B}},reset:Y}}}),ak=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:o,rects:i,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:g=!0,...x}=mr(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const v=gr(s),b=Qn(l),w=gr(l)===l,_=await(c.isRTL==null?void 0:c.isRTL(d.floating)),C=h||(w||!g?[Zi(l)]:Zj(l)),N=y!=="none";!h&&N&&C.push(...tk(l,g,y,_));const k=[l,...C],P=await So(t,x),A=[];let T=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&A.push(P[v]),f){const S=Xj(s,i,_);A.push(P[S[0]],P[S[1]])}if(T=[...T,{placement:s,overflows:A}],!A.every(S=>S<=0)){var D,E;const S=(((D=o.flip)==null?void 0:D.index)||0)+1,L=k[S];if(L&&(!(f==="alignment"?b!==Qn(L):!1)||T.every(q=>q.overflows[0]>0&&Qn(q.placement)===b)))return{data:{index:S,overflows:T},reset:{placement:L}};let Y=(E=T.filter(B=>B.overflows[0]<=0).sort((B,q)=>B.overflows[1]-q.overflows[1])[0])==null?void 0:E.placement;if(!Y)switch(p){case"bestFit":{var I;const B=(I=T.filter(q=>{if(N){const F=Qn(q.placement);return F===b||F==="y"}return!0}).map(q=>[q.placement,q.overflows.filter(F=>F>0).reduce((F,ee)=>F+ee,0)]).sort((q,F)=>q[1]-F[1])[0])==null?void 0:I[0];B&&(Y=B);break}case"initialPlacement":Y=l;break}if(s!==Y)return{reset:{placement:Y}}}return{}}}};function Ep(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Np(e){return qj.some(t=>e[t]>=0)}const ok=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...s}=mr(e,t);switch(r){case"referenceHidden":{const o=await So(t,{...s,elementContext:"reference"}),i=Ep(o,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Np(i)}}}case"escaped":{const o=await So(t,{...s,altBoundary:!0}),i=Ep(o,n.floating);return{data:{escapedOffsets:i,escaped:Np(i)}}}default:return{}}}}},ty=new Set(["left","top"]);async function ik(e,t){const{placement:n,platform:r,elements:s}=e,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),i=gr(n),l=Ta(n),c=Qn(n)==="y",d=ty.has(i)?-1:1,u=o&&c?-1:1,f=mr(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:y}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof y=="number"&&(p=l==="end"?y*-1:y),c?{x:p*u,y:h*d}:{x:h*d,y:p*u}}const lk=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:o,placement:i,middlewareData:l}=t,c=await ik(t,e);return i===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:o+c.y,data:{...c,placement:i}}}}},ck=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s}=t,{mainAxis:o=!0,crossAxis:i=!1,limiter:l={fn:x=>{let{x:v,y:b}=x;return{x:v,y:b}}},...c}=mr(e,t),d={x:n,y:r},u=await So(t,c),f=Qn(gr(s)),h=Qu(f);let p=d[h],y=d[f];if(o){const x=h==="y"?"top":"left",v=h==="y"?"bottom":"right",b=p+u[x],w=p-u[v];p=vd(b,p,w)}if(i){const x=f==="y"?"top":"left",v=f==="y"?"bottom":"right",b=y+u[x],w=y-u[v];y=vd(b,y,w)}const g=l.fn({...t,[h]:p,[f]:y});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[h]:o,[f]:i}}}}}},dk=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:o,middlewareData:i}=t,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=mr(e,t),u={x:n,y:r},f=Qn(s),h=Qu(f);let p=u[h],y=u[f];const g=mr(l,t),x=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){const w=h==="y"?"height":"width",_=o.reference[h]-o.floating[w]+x.mainAxis,C=o.reference[h]+o.reference[w]-x.mainAxis;p<_?p=_:p>C&&(p=C)}if(d){var v,b;const w=h==="y"?"width":"height",_=ty.has(gr(s)),C=o.reference[f]-o.floating[w]+(_&&((v=i.offset)==null?void 0:v[f])||0)+(_?0:x.crossAxis),N=o.reference[f]+o.reference[w]+(_?0:((b=i.offset)==null?void 0:b[f])||0)-(_?x.crossAxis:0);y<C?y=C:y>N&&(y=N)}return{[h]:p,[f]:y}}}},uk=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:o,platform:i,elements:l}=t,{apply:c=()=>{},...d}=mr(e,t),u=await So(t,d),f=gr(s),h=Ta(s),p=Qn(s)==="y",{width:y,height:g}=o.floating;let x,v;f==="top"||f==="bottom"?(x=f,v=h===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(v=f,x=h==="end"?"top":"bottom");const b=g-u.top-u.bottom,w=y-u.left-u.right,_=Ur(g-u[x],b),C=Ur(y-u[v],w),N=!t.middlewareData.shift;let k=_,P=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(k=b),N&&!h){const T=gn(u.left,0),D=gn(u.right,0),E=gn(u.top,0),I=gn(u.bottom,0);p?P=y-2*(T!==0||D!==0?T+D:gn(u.left,u.right)):k=g-2*(E!==0||I!==0?E+I:gn(u.top,u.bottom))}await c({...t,availableWidth:P,availableHeight:k});const A=await i.getDimensions(l.floating);return y!==A.width||g!==A.height?{reset:{rects:!0}}:{}}}};function _l(){return typeof window<"u"}function Ia(e){return ny(e)?(e.nodeName||"").toLowerCase():"#document"}function xn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ir(e){var t;return(t=(ny(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ny(e){return _l()?e instanceof Node||e instanceof xn(e).Node:!1}function zn(e){return _l()?e instanceof Element||e instanceof xn(e).Element:!1}function ar(e){return _l()?e instanceof HTMLElement||e instanceof xn(e).HTMLElement:!1}function Pp(e){return!_l()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof xn(e).ShadowRoot}const fk=new Set(["inline","contents"]);function Wo(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=Bn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!fk.has(s)}const hk=new Set(["table","td","th"]);function pk(e){return hk.has(Ia(e))}const mk=[":popover-open",":modal"];function Sl(e){return mk.some(t=>{try{return e.matches(t)}catch{return!1}})}const gk=["transform","translate","scale","rotate","perspective"],xk=["transform","translate","scale","rotate","perspective","filter"],vk=["paint","layout","strict","content"];function tf(e){const t=nf(),n=zn(e)?Bn(e):e;return gk.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||xk.some(r=>(n.willChange||"").includes(r))||vk.some(r=>(n.contain||"").includes(r))}function yk(e){let t=Wr(e);for(;ar(t)&&!ja(t);){if(tf(t))return t;if(Sl(t))return null;t=Wr(t)}return null}function nf(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const bk=new Set(["html","body","#document"]);function ja(e){return bk.has(Ia(e))}function Bn(e){return xn(e).getComputedStyle(e)}function Cl(e){return zn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Wr(e){if(Ia(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Pp(e)&&e.host||ir(e);return Pp(t)?t.host:t}function ry(e){const t=Wr(e);return ja(t)?e.ownerDocument?e.ownerDocument.body:e.body:ar(t)&&Wo(t)?t:ry(t)}function Co(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=ry(e),o=s===((r=e.ownerDocument)==null?void 0:r.body),i=xn(s);if(o){const l=bd(i);return t.concat(i,i.visualViewport||[],Wo(s)?s:[],l&&n?Co(l):[])}return t.concat(s,Co(s,[],n))}function bd(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function sy(e){const t=Bn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=ar(e),o=s?e.offsetWidth:n,i=s?e.offsetHeight:r,l=Xi(n)!==o||Xi(r)!==i;return l&&(n=o,r=i),{width:n,height:r,$:l}}function rf(e){return zn(e)?e:e.contextElement}function na(e){const t=rf(e);if(!ar(t))return er(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=sy(t);let i=(o?Xi(n.width):n.width)/r,l=(o?Xi(n.height):n.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const wk=er(0);function ay(e){const t=xn(e);return!nf()||!t.visualViewport?wk:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function _k(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==xn(e)?!1:t}function Ps(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=rf(e);let i=er(1);t&&(r?zn(r)&&(i=na(r)):i=na(e));const l=_k(o,n,r)?ay(o):er(0);let c=(s.left+l.x)/i.x,d=(s.top+l.y)/i.y,u=s.width/i.x,f=s.height/i.y;if(o){const h=xn(o),p=r&&zn(r)?xn(r):r;let y=h,g=bd(y);for(;g&&r&&p!==y;){const x=na(g),v=g.getBoundingClientRect(),b=Bn(g),w=v.left+(g.clientLeft+parseFloat(b.paddingLeft))*x.x,_=v.top+(g.clientTop+parseFloat(b.paddingTop))*x.y;c*=x.x,d*=x.y,u*=x.x,f*=x.y,c+=w,d+=_,y=xn(g),g=bd(y)}}return Qi({width:u,height:f,x:c,y:d})}function sf(e,t){const n=Cl(e).scrollLeft;return t?t.left+n:Ps(ir(e)).left+n}function oy(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=r.left+t.scrollLeft-(n?0:sf(e,r)),o=r.top+t.scrollTop;return{x:s,y:o}}function Sk(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const o=s==="fixed",i=ir(r),l=t?Sl(t.floating):!1;if(r===i||l&&o)return n;let c={scrollLeft:0,scrollTop:0},d=er(1);const u=er(0),f=ar(r);if((f||!f&&!o)&&((Ia(r)!=="body"||Wo(i))&&(c=Cl(r)),ar(r))){const p=Ps(r);d=na(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}const h=i&&!f&&!o?oy(i,c,!0):er(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+u.x+h.x,y:n.y*d.y-c.scrollTop*d.y+u.y+h.y}}function Ck(e){return Array.from(e.getClientRects())}function jk(e){const t=ir(e),n=Cl(e),r=e.ownerDocument.body,s=gn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=gn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+sf(e);const l=-n.scrollTop;return Bn(r).direction==="rtl"&&(i+=gn(t.clientWidth,r.clientWidth)-s),{width:s,height:o,x:i,y:l}}function kk(e,t){const n=xn(e),r=ir(e),s=n.visualViewport;let o=r.clientWidth,i=r.clientHeight,l=0,c=0;if(s){o=s.width,i=s.height;const d=nf();(!d||d&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}return{width:o,height:i,x:l,y:c}}const Ek=new Set(["absolute","fixed"]);function Nk(e,t){const n=Ps(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,o=ar(e)?na(e):er(1),i=e.clientWidth*o.x,l=e.clientHeight*o.y,c=s*o.x,d=r*o.y;return{width:i,height:l,x:c,y:d}}function Ap(e,t,n){let r;if(t==="viewport")r=kk(e,n);else if(t==="document")r=jk(ir(e));else if(zn(t))r=Nk(t,n);else{const s=ay(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Qi(r)}function iy(e,t){const n=Wr(e);return n===t||!zn(n)||ja(n)?!1:Bn(n).position==="fixed"||iy(n,t)}function Pk(e,t){const n=t.get(e);if(n)return n;let r=Co(e,[],!1).filter(l=>zn(l)&&Ia(l)!=="body"),s=null;const o=Bn(e).position==="fixed";let i=o?Wr(e):e;for(;zn(i)&&!ja(i);){const l=Bn(i),c=tf(i);!c&&l.position==="fixed"&&(s=null),(o?!c&&!s:!c&&l.position==="static"&&!!s&&Ek.has(s.position)||Wo(i)&&!c&&iy(e,i))?r=r.filter(u=>u!==i):s=l,i=Wr(i)}return t.set(e,r),r}function Ak(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const i=[...n==="clippingAncestors"?Sl(t)?[]:Pk(t,this._c):[].concat(n),r],l=i[0],c=i.reduce((d,u)=>{const f=Ap(t,u,s);return d.top=gn(f.top,d.top),d.right=Ur(f.right,d.right),d.bottom=Ur(f.bottom,d.bottom),d.left=gn(f.left,d.left),d},Ap(t,l,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Tk(e){const{width:t,height:n}=sy(e);return{width:t,height:n}}function Ik(e,t,n){const r=ar(t),s=ir(t),o=n==="fixed",i=Ps(e,!0,o,t);let l={scrollLeft:0,scrollTop:0};const c=er(0);function d(){c.x=sf(s)}if(r||!r&&!o)if((Ia(t)!=="body"||Wo(s))&&(l=Cl(t)),r){const p=Ps(t,!0,o,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else s&&d();o&&!r&&s&&d();const u=s&&!r&&!o?oy(s,l):er(0),f=i.left+l.scrollLeft-c.x-u.x,h=i.top+l.scrollTop-c.y-u.y;return{x:f,y:h,width:i.width,height:i.height}}function bc(e){return Bn(e).position==="static"}function Tp(e,t){if(!ar(e)||Bn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ir(e)===n&&(n=n.ownerDocument.body),n}function ly(e,t){const n=xn(e);if(Sl(e))return n;if(!ar(e)){let s=Wr(e);for(;s&&!ja(s);){if(zn(s)&&!bc(s))return s;s=Wr(s)}return n}let r=Tp(e,t);for(;r&&pk(r)&&bc(r);)r=Tp(r,t);return r&&ja(r)&&bc(r)&&!tf(r)?n:r||yk(e)||n}const Mk=async function(e){const t=this.getOffsetParent||ly,n=this.getDimensions,r=await n(e.floating);return{reference:Ik(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Rk(e){return Bn(e).direction==="rtl"}const Dk={convertOffsetParentRelativeRectToViewportRelativeRect:Sk,getDocumentElement:ir,getClippingRect:Ak,getOffsetParent:ly,getElementRects:Mk,getClientRects:Ck,getDimensions:Tk,getScale:na,isElement:zn,isRTL:Rk};function cy(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ok(e,t){let n=null,r;const s=ir(e);function o(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function i(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),o();const d=e.getBoundingClientRect(),{left:u,top:f,width:h,height:p}=d;if(l||t(),!h||!p)return;const y=ci(f),g=ci(s.clientWidth-(u+h)),x=ci(s.clientHeight-(f+p)),v=ci(u),w={rootMargin:-y+"px "+-g+"px "+-x+"px "+-v+"px",threshold:gn(0,Ur(1,c))||1};let _=!0;function C(N){const k=N[0].intersectionRatio;if(k!==c){if(!_)return i();k?i(!1,k):r=setTimeout(()=>{i(!1,1e-7)},1e3)}k===1&&!cy(d,e.getBoundingClientRect())&&i(),_=!1}try{n=new IntersectionObserver(C,{...w,root:s.ownerDocument})}catch{n=new IntersectionObserver(C,w)}n.observe(e)}return i(!0),o}function Lk(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=rf(e),u=s||o?[...d?Co(d):[],...Co(t)]:[];u.forEach(v=>{s&&v.addEventListener("scroll",n,{passive:!0}),o&&v.addEventListener("resize",n)});const f=d&&l?Ok(d,n):null;let h=-1,p=null;i&&(p=new ResizeObserver(v=>{let[b]=v;b&&b.target===d&&p&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(t)})),n()}),d&&!c&&p.observe(d),p.observe(t));let y,g=c?Ps(e):null;c&&x();function x(){const v=Ps(e);g&&!cy(g,v)&&n(),g=v,y=requestAnimationFrame(x)}return n(),()=>{var v;u.forEach(b=>{s&&b.removeEventListener("scroll",n),o&&b.removeEventListener("resize",n)}),f==null||f(),(v=p)==null||v.disconnect(),p=null,c&&cancelAnimationFrame(y)}}const Fk=lk,zk=ck,Bk=ak,Vk=uk,$k=ok,Ip=sk,Uk=dk,Wk=(e,t,n)=>{const r=new Map,s={platform:Dk,...n},o={...s.platform,_c:r};return rk(e,t,{...s,platform:o})};var Hk=typeof document<"u",qk=function(){},Ii=Hk?m.useLayoutEffect:qk;function Ji(e,t){if(e===t)return!0;
vendor: 4,150 bytes, line 405
405if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ji(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const o=s[r];if(!(o==="_owner"&&e.$$typeof)&&!Ji(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function dy(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Mp(e,t){const n=dy(e);return Math.round(t*n)/n}function wc(e){const t=m.useRef(e);return Ii(()=>{t.current=e}),t}function Gk(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:o,floating:i}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[u,f]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=m.useState(r);Ji(h,r)||p(r);const[y,g]=m.useState(null),[x,v]=m.useState(null),b=m.useCallback(q=>{q!==N.current&&(N.current=q,g(q))},[]),w=m.useCallback(q=>{q!==k.current&&(k.current=q,v(q))},[]),_=o||y,C=i||x,N=m.useRef(null),k=m.useRef(null),P=m.useRef(u),A=c!=null,T=wc(c),D=wc(s),E=wc(d),I=m.useCallback(()=>{if(!N.current||!k.current)return;const q={placement:t,strategy:n,middleware:h};D.current&&(q.platform=D.current),Wk(N.current,k.current,q).then(F=>{const ee={...F,isPositioned:E.current!==!1};S.current&&!Ji(P.current,ee)&&(P.current=ee,yl.flushSync(()=>{f(ee)}))})},[h,t,n,D,E]);Ii(()=>{d===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,f(q=>({...q,isPositioned:!1})))},[d]);const S=m.useRef(!1);Ii(()=>(S.current=!0,()=>{S.current=!1}),[]),Ii(()=>{if(_&&(N.current=_),C&&(k.current=C),_&&C){if(T.current)return T.current(_,C,I);I()}},[_,C,I,T,A]);const L=m.useMemo(()=>({reference:N,floating:k,setReference:b,setFloating:w}),[b,w]),Y=m.useMemo(()=>({reference:_,floating:C}),[_,C]),B=m.useMemo(()=>{const q={position:n,left:0,top:0};if(!Y.floating)return q;const F=Mp(Y.floating,u.x),ee=Mp(Y.floating,u.y);return l?{...q,transform:"translate("+F+"px, "+ee+"px)",...dy(Y.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:ee}},[n,l,Y.floating,u.x,u.y]);return m.useMemo(()=>({...u,update:I,refs:L,elements:Y,floatingStyles:B}),[u,I,L,Y,B])}const Kk=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Ip({element:r.current,padding:s}).fn(n):{}:r?Ip({element:r,padding:s}).fn(n):{}}}},Yk=(e,t)=>({...Fk(e),options:[e,t]}),Xk=(e,t)=>({...zk(e),options:[e,t]}),Zk=(e,t)=>({...Uk(e),options:[e,t]}),Qk=(e,t)=>({...Bk(e),options:[e,t]}),Jk=(e,t)=>({...Vk(e),options:[e,t]}),eE=(e,t)=>({...$k(e),options:[e,t]}),tE=(e,t)=>({...Kk(e),options:[e,t]});var nE="Arrow",uy=m.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...o}=e;return a.jsx(Ie.svg,{...o,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});uy.displayName=nE;var rE=uy;function af(e){const[t,n]=m.useState(void 0);return Pt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let i,l;if("borderBoxSize"in o){const c=o.borderBoxSize,d=Array.isArray(c)?c[0]:c;i=d.inlineSize,l=d.blockSize}else i=e.offsetWidth,l=e.offsetHeight;n({width:i,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var of="Popper",[fy,Ma]=Vn(of),[sE,hy]=fy(of),py=e=>{const{__scopePopper:t,children:n}=e,[r,s]=m.useState(null);return a.jsx(sE,{scope:t,anchor:r,onAnchorChange:s,children:n})};py.displayName=of;var my="PopperAnchor",gy=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,o=hy(my,n),i=m.useRef(null),l=Ze(t,i);return m.useEffect(()=>{o.onAnchorChange((r==null?void 0:r.current)||i.current)}),r?null:a.jsx(Ie.div,{...s,ref:l})});gy.displayName=my;var lf="PopperContent",[aE,oE]=fy(lf),xy=m.forwardRef((e,t)=>
vendor: 7,123 bytes, line 405
405{var te,ae,re,le,ue,z;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:o="center",alignOffset:i=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:u=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:y,...g}=e,x=hy(lf,n),[v,b]=m.useState(null),w=Ze(t,ie=>b(ie)),[_,C]=m.useState(null),N=af(_),k=(N==null?void 0:N.width)??0,P=(N==null?void 0:N.height)??0,A=r+(o!=="center"?"-"+o:""),T=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(d)?d:[d],E=D.length>0,I={padding:T,boundary:D.filter(lE),altBoundary:E},{refs:S,floatingStyles:L,placement:Y,isPositioned:B,middlewareData:q}=Gk({strategy:"fixed",placement:A,whileElementsMounted:(...ie)=>Lk(...ie,{animationFrame:p==="always"}),elements:{reference:x.anchor},middleware:[Yk({mainAxis:s+P,alignmentAxis:i}),c&&Xk({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?Zk():void 0,...I}),c&&Qk({...I}),Jk({...I,apply:({elements:ie,rects:j,availableWidth:H,availableHeight:G})=>{const{width:O,height:R}=j.reference,U=ie.floating.style;U.setProperty("--radix-popper-available-width",`${H}px`),U.setProperty("--radix-popper-available-height",`${G}px`),U.setProperty("--radix-popper-anchor-width",`${O}px`),U.setProperty("--radix-popper-anchor-height",`${R}px`)}}),_&&tE({element:_,padding:l}),cE({arrowWidth:k,arrowHeight:P}),h&&eE({strategy:"referenceHidden",...I})]}),[F,ee]=by(Y),$=$r(y);Pt(()=>{B&&($==null||$())},[B,$]);const M=(te=q.arrow)==null?void 0:te.x,J=(ae=q.arrow)==null?void 0:ae.y,K=((re=q.arrow)==null?void 0:re.centerOffset)!==0,[X,de]=m.useState();return Pt(()=>{v&&de(window.getComputedStyle(v).zIndex)},[v]),a.jsx("div",{ref:S.setFloating,"data-radix-popper-content-wrapper":"",style:{...L,transform:B?L.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:X,"--radix-popper-transform-origin":[(le=q.transformOrigin)==null?void 0:le.x,(ue=q.transformOrigin)==null?void 0:ue.y].join(" "),...((z=q.hide)==null?void 0:z.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx(aE,{scope:n,placedSide:F,onArrowChange:C,arrowX:M,arrowY:J,shouldHideArrow:K,children:a.jsx(Ie.div,{"data-side":F,"data-align":ee,...g,ref:w,style:{...g.style,animation:B?void 0:"none"}})})})});xy.displayName=lf;var vy="PopperArrow",iE={top:"bottom",right:"left",bottom:"top",left:"right"},yy=m.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,o=oE(vy,r),i=iE[o.placedSide];return a.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:a.jsx(rE,{...s,ref:n,style:{...s.style,display:"block"}})})});yy.displayName=vy;function lE(e){return e!==null}var cE=e=>({name:"transformOrigin",options:e,fn(t){var x,v,b;const{placement:n,rects:r,middlewareData:s}=t,i=((x=s.arrow)==null?void 0:x.centerOffset)!==0,l=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[d,u]=by(n),f={start:"0%",center:"50%",end:"100%"}[u],h=(((v=s.arrow)==null?void 0:v.x)??0)+l/2,p=(((b=s.arrow)==null?void 0:b.y)??0)+c/2;let y="",g="";return d==="bottom"?(y=i?f:`${h}px`,g=`${-c}px`):d==="top"?(y=i?f:`${h}px`,g=`${r.floating.height+c}px`):d==="right"?(y=`${-c}px`,g=i?f:`${p}px`):d==="left"&&(y=`${r.floating.width+c}px`,g=i?f:`${p}px`),{data:{x:y,y:g}}}});function by(e){const[t,n="center"]=e.split("-");return[t,n]}var cf=py,jl=gy,df=xy,uf=yy,dE="Portal",kl=m.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[s,o]=m.useState(!1);Pt(()=>o(!0),[]);const i=n||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return i?kv.createPortal(a.jsx(Ie.div,{...r,ref:t}),i):null});kl.displayName=dE;function uE(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}var Kr=e=>{const{present:t,children:n}=e,r=fE(t),s=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),o=Ze(r.ref,hE(s));return typeof n=="function"||r.isPresent?m.cloneElement(s,{ref:o}):null};Kr.displayName="Presence";function fE(e){const[t,n]=m.useState(),r=m.useRef(null),s=m.useRef(e),o=m.useRef("none"),i=e?"mounted":"unmounted",[l,c]=uE(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const d=di(r.current);o.current=l==="mounted"?d:"none"},[l]),Pt(()=>{const d=r.current,u=s.current;if(u!==e){const h=o.current,p=di(d);e?c("MOUNT"):p==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(u&&h!==p?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),Pt(()=>{if(t){let d;const u=t.ownerDocument.defaultView??window,f=p=>{const g=di(r.current).includes(p.animationName);if(p.target===t&&g&&(c("ANIMATION_END"),!s.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",d=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},h=p=>{p.target===t&&(o.current=di(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{u.clearTimeout(d),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:m.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function di(e){return(e==null?void 0:e.animationName)||"none"}function hE(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var pE=jv[" useInsertionEffect ".trim().toString()]||Pt;function As({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,o,i]=mE({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:s;{const u=m.useRef(e!==void 0);m.useEffect(()=>{const f=u.current;f!==l&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=l},[l,r])}const d=m.useCallback(u=>{var f;if(l){const h=gE(u)?u(e):u;h!==e&&((f=i.current)==null||f.call(i,h))}else o(u)},[l,e,o,i]);return[c,d]}function mE({defaultProp:e,onChange:t}){const[n,r]=m.useState(e),s=m.useRef(n),o=m.useRef(t);return pE(()=>{o.current=t},[t]),m.useEffect(()=>{var i;s.current!==n&&((i=o.current)==null||i.call(o,n),s.current=n)},[n,s]),[n,r,o]}function gE(e){return typeof e=="function"}var wy=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),xE="VisuallyHidden",_y=m.forwardRef((e,t)=>
vendor: 8,700 bytes, line 405
405a.jsx(Ie.span,{...e,ref:t,style:{...wy,...e.style}}));_y.displayName=xE;var vE=_y,[El,U$]=Vn("Tooltip",[Ma]),Nl=Ma(),Sy="TooltipProvider",yE=700,wd="tooltip.open",[bE,ff]=El(Sy),Cy=e=>{const{__scopeTooltip:t,delayDuration:n=yE,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:o}=e,i=m.useRef(!0),l=m.useRef(!1),c=m.useRef(0);return m.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),a.jsx(bE,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:m.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:m.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:m.useCallback(d=>{l.current=d},[]),disableHoverableContent:s,children:o})};Cy.displayName=Sy;var jo="Tooltip",[wE,Pl]=El(jo),jy=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:o,disableHoverableContent:i,delayDuration:l}=e,c=ff(jo,e.__scopeTooltip),d=Nl(t),[u,f]=m.useState(null),h=ln(),p=m.useRef(0),y=i??c.disableHoverableContent,g=l??c.delayDuration,x=m.useRef(!1),[v,b]=As({prop:r,defaultProp:s??!1,onChange:k=>{k?(c.onOpen(),document.dispatchEvent(new CustomEvent(wd))):c.onClose(),o==null||o(k)},caller:jo}),w=m.useMemo(()=>v?x.current?"delayed-open":"instant-open":"closed",[v]),_=m.useCallback(()=>{window.clearTimeout(p.current),p.current=0,x.current=!1,b(!0)},[b]),C=m.useCallback(()=>{window.clearTimeout(p.current),p.current=0,b(!1)},[b]),N=m.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{x.current=!0,b(!0),p.current=0},g)},[g,b]);return m.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),a.jsx(cf,{...d,children:a.jsx(wE,{scope:t,contentId:h,open:v,stateAttribute:w,trigger:u,onTriggerChange:f,onTriggerEnter:m.useCallback(()=>{c.isOpenDelayedRef.current?N():_()},[c.isOpenDelayedRef,N,_]),onTriggerLeave:m.useCallback(()=>{y?C():(window.clearTimeout(p.current),p.current=0)},[C,y]),onOpen:_,onClose:C,disableHoverableContent:y,children:n})})};jy.displayName=jo;var _d="TooltipTrigger",ky=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Pl(_d,n),o=ff(_d,n),i=Nl(n),l=m.useRef(null),c=Ze(t,l,s.onTriggerChange),d=m.useRef(!1),u=m.useRef(!1),f=m.useCallback(()=>d.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),a.jsx(jl,{asChild:!0,...i,children:a.jsx(Ie.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:c,onPointerMove:ze(e.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),u.current=!0)}),onPointerLeave:ze(e.onPointerLeave,()=>{s.onTriggerLeave(),u.current=!1}),onPointerDown:ze(e.onPointerDown,()=>{s.open&&s.onClose(),d.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:ze(e.onFocus,()=>{d.current||s.onOpen()}),onBlur:ze(e.onBlur,s.onClose),onClick:ze(e.onClick,s.onClose)})})});ky.displayName=_d;var _E="TooltipPortal",[W$,SE]=El(_E,{forceMount:void 0}),ka="TooltipContent",Ey=m.forwardRef((e,t)=>{const n=SE(ka,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...o}=e,i=Pl(ka,e.__scopeTooltip);return a.jsx(Kr,{present:r||i.open,children:i.disableHoverableContent?a.jsx(Ny,{side:s,...o,ref:t}):a.jsx(CE,{side:s,...o,ref:t})})}),CE=m.forwardRef((e,t)=>{const n=Pl(ka,e.__scopeTooltip),r=ff(ka,e.__scopeTooltip),s=m.useRef(null),o=Ze(t,s),[i,l]=m.useState(null),{trigger:c,onClose:d}=n,u=s.current,{onPointerInTransitChange:f}=r,h=m.useCallback(()=>{l(null),f(!1)},[f]),p=m.useCallback((y,g)=>{const x=y.currentTarget,v={x:y.clientX,y:y.clientY},b=PE(v,x.getBoundingClientRect()),w=AE(v,b),_=TE(g.getBoundingClientRect()),C=ME([...w,..._]);l(C),f(!0)},[f]);return m.useEffect(()=>()=>h(),[h]),m.useEffect(()=>{if(c&&u){const y=x=>p(x,u),g=x=>p(x,c);return c.addEventListener("pointerleave",y),u.addEventListener("pointerleave",g),()=>{c.removeEventListener("pointerleave",y),u.removeEventListener("pointerleave",g)}}},[c,u,p,h]),m.useEffect(()=>{if(i){const y=g=>{const x=g.target,v={x:g.clientX,y:g.clientY},b=(c==null?void 0:c.contains(x))||(u==null?void 0:u.contains(x)),w=!IE(v,i);b?h():w&&(h(),d())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,u,i,d,h]),a.jsx(Ny,{...e,ref:o})}),[jE,kE]=El(jo,{isInside:!1}),EE=Zv("TooltipContent"),Ny=m.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:i,...l}=e,c=Pl(ka,n),d=Nl(n),{onClose:u}=c;return m.useEffect(()=>(document.addEventListener(wd,u),()=>document.removeEventListener(wd,u)),[u]),m.useEffect(()=>{if(c.trigger){const f=h=>{const p=h.target;p!=null&&p.contains(c.trigger)&&u()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,u]),a.jsx(Uo,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:f=>f.preventDefault(),onDismiss:u,children:a.jsxs(df,{"data-state":c.stateAttribute,...d,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[a.jsx(EE,{children:r}),a.jsx(jE,{scope:n,isInside:!0,children:a.jsx(vE,{id:c.contentId,role:"tooltip",children:s||r})})]})})});Ey.displayName=ka;var Py="TooltipArrow",NE=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Nl(n);return kE(Py,n).isInside?null:a.jsx(uf,{...s,...r,ref:t})});NE.displayName=Py;function PE(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,s,o)){case o:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function AE(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function TE(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}function IE(e,t){const{x:n,y:r}=e;let s=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){const l=t[o],c=t[i],d=l.x,u=l.y,f=c.x,h=c.y;u>r!=h>r&&n<(f-d)*(r-u)/(h-u)+d&&(s=!s)}return s}function ME(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),RE(t)}function RE(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const s=e[r];for(;t.length>=2;){const o=t[t.length-1],i=t[t.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const o=n[n.length-1],i=n[n.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))n.pop();else break}n.push(s)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var DE=Cy,OE=jy,LE=ky,Ay=Ey;function Ty(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=Ty(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Iy(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=Ty(e))&&(r&&(r+=" "),r+=t);return r}const hf="-",FE=e=>{const t=BE(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const l=i.split(hf);return l[0]===""&&l.length!==1&&l.shift(),My(l,t)||zE(i)},getConflictingClassGroupIds:(i,l)=>{const c=n[i]||[];return l&&r[i]?[...c,...r[i]]:c}}},My=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),s=r?My(e.slice(1),r):void 0;if(s)return s;if(t.validators.length===0)return;const o=e.join(hf);return(i=t.validators.find(({validator:l})=>l(o)))==null?void 0:i.classGroupId},Rp=/^\[(.+)\]$/,zE=e=>{if(Rp.test(e)){const t=Rp.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},BE=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return $E(Object.entries(e.classGroups),n).forEach(([o,i])=>{Sd(i,r,o,t)}),r},Sd=(e,t,n,r)=>{e.forEach(s=>{if(typeof s=="string"){const o=s===""?t:Dp(t,s);o.classGroupId=n;return}if(typeof s=="function"){if(VE(s)){Sd(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}
vendor: 4,830 bytes, line 405
405Object.entries(s).forEach(([o,i])=>{Sd(i,Dp(t,o),n,r)})})},Dp=(e,t)=>{let n=e;return t.split(hf).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},VE=e=>e.isThemeGetter,$E=(e,t)=>t?e.map(([n,r])=>{const s=r.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([i,l])=>[t+i,l])):o);return[n,s]}):e,UE=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const s=(o,i)=>{n.set(o,i),t++,t>e&&(t=0,r=n,n=new Map)};return{get(o){let i=n.get(o);if(i!==void 0)return i;if((i=r.get(o))!==void 0)return s(o,i),i},set(o,i){n.has(o)?n.set(o,i):s(o,i)}}},Ry="!",WE=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,s=t[0],o=t.length,i=l=>{const c=[];let d=0,u=0,f;for(let x=0;x<l.length;x++){let v=l[x];if(d===0){if(v===s&&(r||l.slice(x,x+o)===t)){c.push(l.slice(u,x)),u=x+o;continue}if(v==="/"){f=x;continue}}v==="["?d++:v==="]"&&d--}const h=c.length===0?l:l.substring(u),p=h.startsWith(Ry),y=p?h.substring(1):h,g=f&&f>u?f-u:void 0;return{modifiers:c,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:g}};return n?l=>n({className:l,parseClassName:i}):i},HE=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},qE=e=>({cache:UE(e.cacheSize),parseClassName:WE(e),...FE(e)}),GE=/\s+/,KE=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=t,o=[],i=e.trim().split(GE);let l="";for(let c=i.length-1;c>=0;c-=1){const d=i[c],{modifiers:u,hasImportantModifier:f,baseClassName:h,maybePostfixModifierPosition:p}=n(d);let y=!!p,g=r(y?h.substring(0,p):h);if(!g){if(!y){l=d+(l.length>0?" "+l:l);continue}if(g=r(h),!g){l=d+(l.length>0?" "+l:l);continue}y=!1}const x=HE(u).join(":"),v=f?x+Ry:x,b=v+g;if(o.includes(b))continue;o.push(b);const w=s(g,y);for(let _=0;_<w.length;++_){const C=w[_];o.push(v+C)}l=d+(l.length>0?" "+l:l)}return l};function YE(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Dy(t))&&(r&&(r+=" "),r+=n);return r}const Dy=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Dy(e[r]))&&(n&&(n+=" "),n+=t);return n};function XE(e,...t){let n,r,s,o=i;function i(c){const d=t.reduce((u,f)=>f(u),e());return n=qE(d),r=n.cache.get,s=n.cache.set,o=l,l(c)}function l(c){const d=r(c);if(d)return d;const u=KE(c,n);return s(c,u),u}return function(){return o(YE.apply(null,arguments))}}const ut=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Oy=/^\[(?:([a-z-]+):)?(.+)\]$/i,ZE=/^\d+\/\d+$/,QE=new Set(["px","full","screen"]),JE=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,eN=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,tN=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,nN=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,rN=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,lr=e=>ra(e)||QE.has(e)||ZE.test(e),_r=e=>Ra(e,"length",uN),ra=e=>!!e&&!Number.isNaN(Number(e)),_c=e=>Ra(e,"number",ra),$a=e=>!!e&&Number.isInteger(Number(e)),sN=e=>e.endsWith("%")&&ra(e.slice(0,-1)),Le=e=>Oy.test(e),Sr=e=>JE.test(e),aN=new Set(["length","size","percentage"]),oN=e=>Ra(e,aN,Ly),iN=e=>Ra(e,"position",Ly),lN=new Set(["image","url"]),cN=e=>Ra(e,lN,hN),dN=e=>Ra(e,"",fN),Ua=()=>!0,Ra=(e,t,n)=>{const r=Oy.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},uN=e=>eN.test(e)&&!tN.test(e),Ly=()=>!1,fN=e=>nN.test(e),hN=e=>rN.test(e),pN=()=>{const e=ut("colors"),t=ut("spacing"),n=ut("blur"),r=ut("brightness"),s=ut("borderColor"),o=ut("borderRadius"),i=ut("borderSpacing"),l=ut("borderWidth"),c=ut("contrast"),d=ut("grayscale"),u=ut("hueRotate"),f=ut("invert"),h=ut("gap"),p=ut("gradientColorStops"),y=ut("gradientColorStopPositions"),g=ut("inset"),x=ut("margin"),v=ut("opacity"),b=ut("padding"),w=ut("saturate"),_=ut("scale"),C=ut("sepia"),N=ut("skew"),k=ut("space"),P=ut("translate"),A=()=>["auto","contain","none"],T=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto",Le,t],E=()=>[Le,t],I=()=>["",lr,_r],S=()=>["auto",ra,Le],L=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Y=()=>["solid","dashed","dotted","double","none"],B=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],q=()=>["start","end","center","between","around","evenly","stretch"],F=()=>["","0",Le],ee=()=>["auto","avoid","all","avoid-page","page","left","right","column"],$=()=>[ra,Le];return{cacheSize:500,separator:":",theme:{colors:[Ua],spacing:[lr,_r],blur:["none","",Sr,Le],brightness:$(),borderColor:[e],borderRadius:["n
405one","","full",Sr,Le],borderSpacing:E(),borderWidth:I(),contrast:$(),grayscale:F(),hueRotate:$(),invert:F(),gap:E(),gradientColorStops:[e],gradientColorStopPositions:[sN,_r],inset:D(),margin:D(),opacity:$(),padding:E(),saturate:$(),scale:$(),sepia:F(),skew:$(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",Le]}],container:["container"],columns:[{columns:[Sr]}],"break-after":[{"break-after":ee()}],"break-before":[{"break-before":ee()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...L(),Le]}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",$a,Le]}],basis:[{basis:D()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Le]}],grow:[{grow:F()}],shrink:[{shrink:F()}],order:[{order:["first","last","none",$a,Le]}],"grid-cols":[{"grid-cols":[Ua]}],"col-start-end":[{col:["auto",{span:["full",$a,Le]},Le]}],"col-start":[{"col-start":S()}],"col-end":[{"col-end":S()}],"grid-rows":[{"grid-rows":[Ua]}],"row-start-end":[{row:["auto",{span:[$a,Le]},Le]}],"row-start":[{"row-start":S()}],"row-end":[{"row-end":S()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Le]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Le]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...q()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...q(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...q(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[b]}],px:[{px:[b]}],py:[{py:[b]}],ps:[{ps:[b]}],pe:[{pe:[b]}],pt:[{pt:[b]}],pr:[{pr:[b]}],pb:[{pb:[b]}],pl:[{pl:[b]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[k]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[k]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Le,t]}],"min-w":[{"min-w":[Le,t,"min","max","fit"]}],"max-w":[{"max-w":[Le,t,"none","full","min","max","fit","prose",{screen:[Sr]},Sr]}],h:[{h:[Le,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Le,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Le,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Le,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Sr,_r]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",_c]}],"font-family":[{font:[Ua]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Le]}],"line-clamp":[{"line-clamp":["none",ra,_c]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",lr,Le]}],"list-image":[{"list-image":["none",Le]}],"list-style-type":[{list:["none","disc","decimal",Le]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[v]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[v]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Y(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",lr,_r]}],"underline-offset":[{"underline-offset":["auto",lr,Le]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Le]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Le]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[v]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...L(),iN]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}
vendor: 4,110 bytes, line 405
405],"bg-size":[{bg:["auto","cover","contain",oN]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},cN]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[y]}],"gradient-via-pos":[{via:[y]}],"gradient-to-pos":[{to:[y]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[v]}],"border-style":[{border:[...Y(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[v]}],"divide-style":[{divide:Y()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...Y()]}],"outline-offset":[{"outline-offset":[lr,Le]}],"outline-w":[{outline:[lr,_r]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[v]}],"ring-offset-w":[{"ring-offset":[lr,_r]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Sr,dN]}],"shadow-color":[{shadow:[Ua]}],opacity:[{opacity:[v]}],"mix-blend":[{"mix-blend":[...B(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":B()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Sr,Le]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[v]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Le]}],duration:[{duration:$()}],ease:[{ease:["linear","in","out","in-out",Le]}],delay:[{delay:$()}],animate:[{animate:["none","spin","ping","pulse","bounce",Le]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[_]}],"scale-x":[{"scale-x":[_]}],"scale-y":[{"scale-y":[_]}],rotate:[{rotate:[$a,Le]}],"translate-x":[{"translate-x":[P]}],"translate-y":[{"translate-y":[P]}],"skew-x":[{"skew-x":[N]}],"skew-y":[{"skew-y":[N]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Le]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","
405none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Le]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Le]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[lr,_r,_c]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},mN=XE(pN);function xe(...e){return mN(Iy(e))}const pf=DE,Fy=OE,zy=LE,mf=m.forwardRef(({className:e,sideOffset:t=4,...n},r)=>a.jsx(Ay,{ref:r,sideOffset:t,className:xe("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
405de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}));mf.displayName=Ay.displayName;var Ho=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Ts=typeof window>"u"||"Deno"in globalThis;function an(){}function gN(e,t){return typeof e=="function"?e(t):e}function Cd(e){return typeof e=="number"&&e>=0&&e!==1/0}function By(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Br(e,t){return typeof e=="function"?e(t):e}function _n(e,t){return typeof e=="function"?e(t):e}function Op(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:o,queryKey:i,stale:l}=e;if(i){if(r){if(t.queryHash!==gf(i,t.options))return!1}else if(!Eo(t.queryKey,i))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||s&&s!==t.state.fetchStatus||o&&!o(t))}function Lp(e,t){const{exact:n,status:r,predicate:s,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(ko(t.options.mutationKey)!==ko(o))return!1}else if(!Eo(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function gf(e,t){return((t==null?void 0:t.queryKeyHashFn)||ko)(e)}function ko(e){return JSON.stringify(e,(t,n)=>kd(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Eo(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Eo(e[n],t[n])):!1}function Vy(e,t){if(e===t)return e;const n=Fp(e)&&Fp(t);if(n||kd(e)&&kd(t)){const r=n?e:Object.keys(e),s=r.length,o=n?t:Object.keys(t),i=o.length,l=n?[]:{},c=new Set(r);let d=0;for(let u=0;u<i;u++){const f=n?u:o[u];(!n&&c.has(f)||n)&&e[f]===void 0&&t[f]===void 0?(l[f]=void 0,d++):(l[f]=Vy(e[f],t[f]),l[f]===e[f]&&e[f]!==void 0&&d++)}return s===i&&d===s?e:l}return t}function jd(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Fp(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function kd(e){if(!zp(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!zp(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function zp(e){return Object.prototype.toString.call(e)==="[object Object]"}function xN(e){return new Promise(t=>{setTimeout(t,e)})}function Ed(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Vy(e,t):t}function vN(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function yN(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var xf=Symbol();function $y(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===xf?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function bN(e,t){return typeof e=="function"?e(...t):!!e}var hs,Pr,da,mv,wN=(mv=class extends Ho{constructor(){super();Ae(this,hs);Ae(this,Pr);Ae(this,da);je(this,da,t=>{if(!Ts&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){Z(this,Pr)||this.setEventListener(Z(this,da))}onUnsubscribe(){var t;this.hasListeners()||((t=Z(this,Pr))==null||t.call(this),je(this,Pr,void 0))}setEventListener(t){var n;je(this,da,t),(n=Z(this,Pr))==null||n.call(this),je(this,Pr,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){Z(this,hs)!==t&&(je(this,hs,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof Z(this,hs)=="boolean"?Z(this,hs):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},hs=new WeakMap,Pr=new WeakMap,da=new WeakMap,mv),vf=new wN,ua,Ar,fa,gv,_N=(gv=class extends Ho{constructor(){super();Ae(this,ua,!0);Ae(this,Ar);Ae(this,fa);je(this,fa,t=>{if(!Ts&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){Z(this,Ar)||this.setEventListener(Z(this,fa))}onUnsubscribe(){var t;this.hasListeners()||((t=Z(this,Ar))==null||t.call(this),je(this,Ar,void 0))}setEventListener(t){var n;je(this,fa,t),(n=Z(this,Ar))==null||n.call(this),je(this,Ar,t(this.setOnline.bind(this)))}setOnline(t){Z(this,ua)!==t&&(je(this,ua,t),this.listeners.forEac
vendor: 29,064 bytes, line 405
405h(r=>{r(t)}))}isOnline(){return Z(this,ua)}},ua=new WeakMap,Ar=new WeakMap,fa=new WeakMap,gv),el=new _N;function Nd(){let e,t;const n=new Promise((s,o)=>{e=s,t=o});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}function SN(e){return Math.min(1e3*2**e,3e4)}function Uy(e){return(e??"online")==="online"?el.isOnline():!0}var Wy=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Sc(e){return e instanceof Wy}function Hy(e){let t=!1,n=0,r=!1,s;const o=Nd(),i=g=>{var x;r||(h(new Wy(g)),(x=e.abort)==null||x.call(e))},l=()=>{t=!0},c=()=>{t=!1},d=()=>vf.isFocused()&&(e.networkMode==="always"||el.isOnline())&&e.canRun(),u=()=>Uy(e.networkMode)&&e.canRun(),f=g=>{var x;r||(r=!0,(x=e.onSuccess)==null||x.call(e,g),s==null||s(),o.resolve(g))},h=g=>{var x;r||(r=!0,(x=e.onError)==null||x.call(e,g),s==null||s(),o.reject(g))},p=()=>new Promise(g=>{var x;s=v=>{(r||d())&&g(v)},(x=e.onPause)==null||x.call(e)}).then(()=>{var g;s=void 0,r||(g=e.onContinue)==null||g.call(e)}),y=()=>{if(r)return;let g;const x=n===0?e.initialPromise:void 0;try{g=x??e.fn()}catch(v){g=Promise.reject(v)}Promise.resolve(g).then(f).catch(v=>{var N;if(r)return;const b=e.retry??(Ts?0:3),w=e.retryDelay??SN,_=typeof w=="function"?w(n,v):w,C=b===!0||typeof b=="number"&&n<b||typeof b=="function"&&b(n,v);if(t||!C){h(v);return}n++,(N=e.onFail)==null||N.call(e,n,v),xN(_).then(()=>d()?void 0:p()).then(()=>{t?h(v):y()})})};return{promise:o,cancel:i,continue:()=>(s==null||s(),o),cancelRetry:l,continueRetry:c,canStart:u,start:()=>(u()?y():p().then(y),o)}}var CN=e=>setTimeout(e,0);function jN(){let e=[],t=0,n=l=>{l()},r=l=>{l()},s=CN;const o=l=>{t?e.push(l):s(()=>{n(l)})},i=()=>{const l=e;e=[],l.length&&s(()=>{r(()=>{l.forEach(c=>{n(c)})})})};return{batch:l=>{let c;t++;try{c=l()}finally{t--,t||i()}return c},batchCalls:l=>(...c)=>{o(()=>{l(...c)})},schedule:o,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{s=l}}}var Ft=jN(),ps,xv,qy=(xv=class{constructor(){Ae(this,ps)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Cd(this.gcTime)&&je(this,ps,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ts?1/0:5*60*1e3))}clearGcTimeout(){Z(this,ps)&&(clearTimeout(Z(this,ps)),je(this,ps,void 0))}},ps=new WeakMap,xv),ha,ms,wn,gs,$t,Lo,xs,Rn,cr,vv,kN=(vv=class extends qy{constructor(t){super();Ae(this,Rn);Ae(this,ha);Ae(this,ms);Ae(this,wn);Ae(this,gs);Ae(this,$t);Ae(this,Lo);Ae(this,xs);je(this,xs,!1),je(this,Lo,t.defaultOptions),this.setOptions(t.options),this.observers=[],je(this,gs,t.client),je(this,wn,Z(this,gs).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,je(this,ha,EN(this.options)),this.state=t.state??Z(this,ha),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=Z(this,$t))==null?void 0:t.promise}setOptions(t){this.options={...Z(this,Lo),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Z(this,wn).remove(this)}setData(t,n){const r=Ed(this.state.data,t,this.options);return Ge(this,Rn,cr).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Ge(this,Rn,cr).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,s;const n=(r=Z(this,$t))==null?void 0:r.promise;return(s=Z(this,$t))==null||s.cancel(t),n?n.then(an).catch(an):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(Z(this,ha))}isActive(){return this.observers.some(t=>_n(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===xf||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Br(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!By(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=Z(this,$t))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=Z(this,$t))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),Z(this,wn).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(Z(this,$t)&&(Z(this,xs)?Z(this,$t).cancel({revert:!0}):Z(this,$t).cancelRetry()),this.scheduleGc()),Z(this,wn).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ge(this,Rn,cr).call(this,{type:"invalidate"})}fetch(t,n){var d,u,f;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(Z(this,$t))return Z(this,$t).continueRetry(),Z(this,$t).promise}if(t&&this.setOptions(t),!this.options.queryFn){const h=this.observers.find(p=>p.options.queryFn);h&&this.setOptions(h.options)}const r=new AbortController,s=h=>{Object.defineProperty(h,"signal",{enumerable:!0,get:()=>(je(this,xs,!0),r.signal)})},o=()=>{const h=$y(this.options,n),y=(()=>{const g={client:Z(this,gs),queryKey:this.queryKey,meta:this.meta};return s(g),g})();return je(this,xs,!1),this.options.persister?this.options.persister(h,y,this):h(y)},l=(()=>{const h={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:Z(this,gs),state:this.state,fetchFn:o};return s(h),h})();(d=this.options.behavior)==null||d.onFetch(l,this),je(this,ms,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=l.fetchOptions)==null?void 0:u.meta))&&Ge(this,Rn,cr).call(this,{type:"fetch",meta:(f=l.fetchOptions)==null?void 0:f.meta});const c=h=>{var p,y,g,x;Sc(h)&&h.silent||Ge(this,Rn,cr).call(this,{type:"error",error:h}),Sc(h)||((y=(p=Z(this,wn).config).onError)==null||y.call(p,h,this),(x=(g=Z(this,wn).config).onSettled)==null||x.call(g,this.state.data,h,this)),this.scheduleGc()};return je(this,$t,Hy({initialPromise:n==null?void 0:n.initialPromise,fn:l.fetchFn,abort:r.abort.bind(r),onSuccess:h=>{var p,y,g,x;if(h===void 0){c(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(h)}catch(v){c(v);return}(y=(p=Z(this,wn).config).onSuccess)==null||y.call(p,h,this),(x=(g=Z(this,wn).config).onSettled)==null||x.call(g,h,this.state.error,this),this.scheduleGc()},onError:c,onFail:(h,p)=>{Ge(this,Rn,cr).call(this,{type:"failed",failureCount:h,error:p})},onPause:()=>{Ge(this,Rn,cr).call(this,{type:"pause"})},onContinue:()=>{Ge(this,Rn,cr).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0})),Z(this,$t).start()}},ha=new WeakMap,ms=new WeakMap,wn=new WeakMap,gs=new WeakMap,$t=new WeakMap,Lo=new WeakMap,xs=new WeakMap,Rn=new WeakSet,cr=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Gy(r.data,this.options),fetchMeta:t.meta??null};case"success":return je(this,ms,void 0),{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const s=t.error;return Sc(s)&&s.revert&&Z(this,ms)?{...Z(this,ms),fetchStatus:"idle"}:{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Ft.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),Z(this,wn).notify({query:this,type:"updated",action:t})})},vv);function Gy(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Uy(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function EN(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var qn,yv,NN=(yv=class extends Ho{constructor(t={}){super();Ae(this,qn);this.config=t,je(this,qn,new Map)}build(t,n,r){const s=n.queryKey,o=n.queryHash??gf(s,n);let i=this.get(o);return i||(i=new kN({client:t,queryKey:s,queryHash:o,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(i)),i}add(t){Z(this,qn).has(t.queryHash)||(Z(this,qn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=Z(this,qn).get(t.queryHash);n&&(t.destroy(),n===t&&Z(this,qn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ft.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return Z(this,qn).get(t)}getAll(){return[...Z(this,qn).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Op(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Op(t,r)):n}notify(t){Ft.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Ft.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ft.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},qn=new WeakMap,yv),Gn,Yt,vs,Kn,jr,bv,PN=(bv=class extends qy{constructor(t){super();Ae(this,Kn);Ae(this,Gn);Ae(this,Yt);Ae(this,vs);this.mutationId=t.mutationId,je(this,Yt,t.mutationCache),je(this,Gn,[]),this.state=t.state||AN(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){Z(this,Gn).includes(t)||(Z(this,Gn).push(t),this.clearGcTimeout(),Z(this,Yt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){je(this,Gn,Z(this,Gn).filter(n=>n!==t)),this.scheduleGc(),Z(this,Yt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){Z(this,Gn).length||(this.state.status==="pending"?this.scheduleGc():Z(this,Yt).remove(this))}continue(){var t;return((t=Z(this,vs))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,l,c,d,u,f,h,p,y,g,x,v,b,w,_,C,N,k,P;const n=()=>{Ge(this,Kn,jr).call(this,{type:"continue"})};je(this,vs,Hy({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(A,T)=>{Ge(this,Kn,jr).call(this,{type:"failed",failureCount:A,error:T})},onPause:()=>{Ge(this,Kn,jr).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Z(this,Yt).canRun(this)}));const r=this.state.status==="pending",s=!Z(this,vs).canStart();try{if(r)n();else{Ge(this,Kn,jr).call(this,{type:"pending",variables:t,isPaused:s}),await((i=(o=Z(this,Yt).config).onMutate)==null?void 0:i.call(o,t,this));const T=await((c=(l=this.options).onMutate)==null?void 0:c.call(l,t));T!==this.state.context&&Ge(this,Kn,jr).call(this,{type:"pending",context:T,variables:t,isPaused:s})}const A=await Z(this,vs).start();return await((u=(d=Z(this,Yt).config).onSuccess)==null?void 0:u.call(d,A,t,this.state.context,this)),await((h=(f=this.options).onSuccess)==null?void 0:h.call(f,A,t,this.state.context)),await((y=(p=Z(this,Yt).config).onSettled)==null?void 0:y.call(p,A,null,this.state.variables,this.state.context,this)),await((x=(g=this.options).onSettled)==null?void 0:x.call(g,A,null,t,this.state.context)),Ge(this,Kn,jr).call(this,{type:"success",data:A}),A}catch(A){try{throw await((b=(v=Z(this,Yt).config).onError)==null?void 0:b.call(v,A,t,this.state.context,this)),await((_=(w=this.options).onError)==null?void 0:_.call(w,A,t,this.state.context)),await((N=(C=Z(this,Yt).config).onSettled)==null?void 0:N.call(C,void 0,A,this.state.variables,this.state.context,this)),await((P=(k=this.options).onSettled)==null?void 0:P.call(k,void 0,A,t,this.state.context)),A}finally{Ge(this,Kn,jr).call(this,{type:"error",error:A})}}finally{Z(this,Yt).runNext(this)}}},Gn=new WeakMap,Yt=new WeakMap,vs=new WeakMap,Kn=new WeakSet,jr=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Ft.batch(()=>{Z(this,Gn).forEach(r=>{r.onMutationUpdate(t)}),Z(this,Yt).notify({mutation:this,type:"updated",action:t})})},bv);function AN(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var dr,Dn,Fo,wv,TN=(wv=class extends Ho{constructor(t={}){super();Ae(this,dr);Ae(this,Dn);Ae(this,Fo);this.config=t,je(this,dr,new Set),je(this,Dn,new Map),je(this,Fo,0)}build(t,n,r){const s=new PN({mutationCache:this,mutationId:++oi(this,Fo)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){Z(this,dr).add(t);const n=ui(t);if(typeof n=="string"){const r=Z(this,Dn).get(n);r?r.push(t):Z(this,Dn).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(Z(this,dr).delete(t)){const n=ui(t);if(typeof n=="string"){const r=Z(this,Dn).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&Z(this,Dn).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=ui(t);if(typeof n=="string"){const r=Z(this,Dn).get(n),s=r==null?void 0:r.find(o=>o.state.status==="pending");return!s||s===t}else return!0}runNext(t){var r;const n=ui(t);if(typeof n=="string"){const s=(r=Z(this,Dn).get(n))==null?void 0:r.find(o=>o!==t&&o.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Ft.batch(()=>{Z(this,dr).forEach(t=>{this.notify({type:"removed",mutation:t})}),Z(this,dr).clear(),Z(this,Dn).clear()})}getAll(){return Array.from(Z(this,dr))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Lp(n,r))}findAll(t={}){return this.getAll().filter(n=>Lp(t,n))}notify(t){Ft.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Ft.batch(()=>Promise.all(t.map(n=>n.continue().catch(an))))}},dr=new WeakMap,Dn=new WeakMap,Fo=new WeakMap,wv);function ui(e){var t;return(t=e.options.scope)==null?void 0:t.id}function Bp(e){return{onFetch:(t,n)=>{var u,f,h,p,y;const r=t.options,s=(h=(f=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:f.fetchMore)==null?void 0:h.direction,o=((p=t.state.data)==null?void 0:p.pages)||[],i=((y=t.state.data)==null?void 0:y.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const d=async()=>{let g=!1;const x=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(t.signal.aborted?g=!0:t.signal.addEventListener("abort",()=>{g=!0}),t.signal)})},v=$y(t.options,t.fetchOptions),b=async(w,_,C)=>{if(g)return Promise.reject();if(_==null&&w.pages.length)return Promise.resolve(w);const k=(()=>{const D={client:t.client,queryKey:t.queryKey,pageParam:_,direction:C?"backward":"forward",meta:t.options.meta};return x(D),D})(),P=await v(k),{maxPages:A}=t.options,T=C?yN:vN;return{pages:T(w.pages,P,A),pageParams:T(w.pageParams,_,A)}};if(s&&o.length){const w=s==="backward",_=w?IN:Vp,C={pages:o,pageParams:i},N=_(r,C);l=await b(C,N,w)}else{const w=e??o.length;do{const _=c===0?i[0]??r.initialPageParam:Vp(r,l);if(c>0&&_==null)break;l=await b(l,_),c++}while(c<w)}return l};t.options.persister?t.fetchFn=()=>{var g,x;return(x=(g=t.options).persister)==null?void 0:x.call(g,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function Vp(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function IN(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var wt,Tr,Ir,pa,ma,Mr,ga,xa,_v,MN=(_v=class{constructor(e={}){Ae(this,wt);Ae(this,Tr);Ae(this,Ir);Ae(this,pa);Ae(this,ma);Ae(this,Mr);Ae(this,ga);Ae(this,xa);je(this,wt,e.queryCache||new NN),je(this,Tr,e.mutationCache||new TN),je(this,Ir,e.defaultOptions||{}),je(this,pa,new Map),je(this,ma,new Map),je(this,Mr,0)}mount(){oi(this,Mr)._++,Z(this,Mr)===1&&(je(this,ga,vf.subscribe(async e=>{e&&(await this.resumePausedMutations(),Z(this,wt).onFocus())})),je(this,xa,el.subscribe(async e=>{e&&(await this.resumePausedMutations(),Z(this,wt).onOnline())})))}unmount(){var e,t;oi(this,Mr)._--,Z(this,Mr)===0&&((e=Z(this,ga))==null||e.call(this),je(this,ga,void 0),(t=Z(this,xa))==null||t.call(this),je(this,xa,void 0))}isFetching(e){return Z(this,wt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return Z(this,Tr).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=Z(this,wt).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=Z(this,wt).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Br(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return Z(this,wt).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=Z(this,wt).get(r.queryHash),o=s==null?void 0:s.state.data,i=gN(t,o);if(i!==void 0)return Z(this,wt).build(this,r).setData(i,{...n,manual:!0})}setQueriesData(e,t,n){return Ft.batch(()=>Z(this,wt).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=Z(this,wt).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=Z(this,wt);Ft.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=Z(this,wt);return Ft.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Ft.batch(()=>Z(this,wt).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(an).catch(an)}invalidateQueries(e,t={}){return Ft.batch(()=>(Z(this,wt).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Ft.batch(()=>Z(this,wt).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let o=s.fetch(void 0,n);return n.throwOnError||(o=o.catch(an)),s.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(an)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=Z(this,wt).build(this,t);return n.isStaleByTime(Br(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(an).catch(an)}fetchInfiniteQuery(e){return e.behavior=Bp(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(an).catch(an)}ensureInfiniteQueryData(e){return e.behavior=Bp(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return el.isOnline()?Z(this,Tr).resumePausedMutations():Promise.resolve()}getQueryCache(){return Z(this,wt)}getMutationCache(){return Z(this,Tr)}getDefaultOptions(){return Z(this,Ir)}setDefaultOptions(e){je(this,Ir,e)}setQueryDefaults(e,t){Z(this,pa).set(ko(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...Z(this,pa).values()],n={};return t.forEach(r=>{Eo(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){Z(this,ma).set(ko(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...Z(this,ma).values()],n={};return t.forEach(r=>{Eo(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...Z(this,Ir).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=gf(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===xf&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...Z(this,Ir).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){Z(this,wt).clear(),Z(this,Tr).clear()}},wt=new WeakMap,Tr=new WeakMap,Ir=new WeakMap,pa=new WeakMap,ma=new WeakMap,Mr=new WeakMap,ga=new WeakMap,xa=new WeakMap,_v),rn,Ke,zo,Xt,ys,va,Rr,Dr,Bo,ya,ba,bs,ws,Or,wa,tt,no,Pd,Ad,Td,Id,Md,Rd,Dd,Ky,Sv,RN=(Sv=class extends Ho{constructor(t,n){super();Ae(this,tt);Ae(this,rn);Ae(this,Ke);Ae(this,zo);Ae(this,Xt);Ae(this,ys);Ae(this,va);Ae(this,Rr);Ae(this,Dr);Ae(this,Bo);Ae(this,ya);Ae(this,ba);Ae(this,bs);Ae(this,ws);Ae(this,Or);Ae(this,wa,new Set);this.options=n,je(this,rn,t),je(this,Dr,null),je(this,Rr,Nd()),this.options.experimental_prefetchInRender||Z(this,Rr).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(Z(this,Ke).addObserver(this),$p(Z(this,Ke),this.options)?Ge(this,tt,no).call(this):this.updateResult(),Ge(this,tt,Id).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Od(Z(this,Ke),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Od(Z(this,Ke),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ge(this,tt,Md).call(this),Ge(this,tt,Rd).call(this),Z(this,Ke).removeObserver(this)}setOptions(t){const n=this.options,r=Z(this,Ke);if(this.options=Z(this,rn).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof _n(this.options.enabled,Z(this,Ke))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ge(this,tt,Dd).call(this),Z(this,Ke).setOptions(this.options),n._defaulted&&!jd(this.options,n)&&Z(this,rn).getQueryCache().notify({type:"observerOptionsUpdated",query:Z(this,Ke),observer:this});const s=this.hasListeners();s&&Up(Z(this,Ke),r,this.options,n)&&Ge(this,tt,no).call(this),this.updateResult(),s&&(Z(this,Ke)!==r||_n(this.options.enabled,Z(this,Ke))!==_n(n.enabled,Z(this,Ke))||Br(this.options.staleTime,Z(this,Ke))!==Br(n.staleTime,Z(this,Ke)))&&Ge(this,tt,Pd).call(this);const o=Ge(this,tt,Ad).call(this);s&&(Z(this,Ke)!==r||_n(this.options.enabled,Z(this,Ke))!==_n(n.enabled,Z(this,Ke))||o!==Z(this,Or))&&Ge(this,tt,Td).call(this,o)}getOptimisticResult(t){const n=Z(this,rn).getQueryCache().build(Z(this,rn),t),r=this.createResult(n,t);return ON(this,r)&&(je(this,Xt,r),je(this,va,this.options),je(this,ys,Z(this,Ke).state)),r}getCurrentResult(){return Z(this,Xt)}trackResult(t,n){return new Proxy(t,{get:(r,s)=>(this.trackProp(s),n==null||n(s),Reflect.get(r,s))})}trackProp(t){Z(this,wa).add(t)}getCurrentQuery(){return Z(this,Ke)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=Z(this,rn).defaultQueryOptions(t),r=Z(this,rn).getQueryCache().build(Z(this,rn),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return Ge(this,tt,no).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),Z(this,Xt)))}createResult(t,n){var A;const r=Z(this,Ke),s=this.options,o=Z(this,Xt),i=Z(this,ys),l=Z(this,va),d=t!==r?t.state:Z(this,zo),{state:u}=t;let f={...u},h=!1,p;if(n._optimisticResults){const T=this.hasListeners(),D=!T&&$p(t,n),E=T&&Up(t,r,n,s);(D||E)&&(f={...f,...Gy(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:y,errorUpdatedAt:g,status:x}=f;p=f.data;let v=!1;if(n.placeholderData!==void 0&&p===void 0&&x==="pending"){let T;o!=null&&o.isPlaceholderData&&n.placeholderData===(l==null?void 0:l.placeholderData)?(T=o.data,v=!0):T=typeof n.placeholderData=="function"?n.placeholderData((A=Z(this,ba))==null?void 0:A.state.data,Z(this,ba)):n.placeholderData,T!==void 0&&(x="success",p=Ed(o==null?void 0:o.data,T,n),h=!0)}if(n.select&&p!==void 0&&!v)if(o&&p===(i==null?void 0:i.data)&&n.select===Z(this,Bo))p=Z(this,ya);else try{je(this,Bo,n.select),p=n.select(p),p=Ed(o==null?void 0:o.data,p,n),je(this,ya,p),je(this,Dr,null)}catch(T){je(this,Dr,T)}Z(this,Dr)&&(y=Z(this,Dr),p=Z(this,ya),g=Date.now(),x="error");const b=f.fetchStatus==="fetching",w=x==="pending",_=x==="error",C=w&&b,N=p!==void 0,P={status:x,fetchStatus:f.fetchStatus,isPending:w,isSuccess:x==="success",isError:_,isInitialLoading:C,isLoading:C,data:p,dataUpdatedAt:f.dataUpdatedAt,error:y,errorUpdatedAt:g,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>d.dataUpdateCount||f.errorUpdateCount>d.errorUpdateCount,isFetching:b,isRefetching:b&&!w,isLoadingError:_&&!N,isPaused:f.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:_&&N,isStale:yf(t,n),refetch:this.refetch,promise:Z(this,Rr),isEnabled:_n(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const T=I=>{P.status==="error"?I.reject(P.error):P.data!==void 0&&I.resolve(P.data)},D=()=>{const I=je(this,Rr,P.promise=Nd());T(I)},E=Z(this,Rr);switch(E.status){case"pending":t.queryHash===r.queryHash&&T(E);break;case"fulfilled":(P.status==="error"||P.data!==E.value)&&D();break;case"rejected":(P.status!=="error"||P.error!==E.reason)&&D();break}}return P}updateResult(){const t=Z(this,Xt),n=this.createResult(Z(this,Ke),this.options);if(je(this,ys,Z(this,Ke).state),je(this,va,this.options),Z(this,ys).data!==void 0&&je(this,ba,Z(this,Ke)),jd(n,t))return;je(this,Xt,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,o=typeof s=="function"?s():s;if(o==="all"||!o&&!Z(this,wa).size)return!0;const i=new Set(o??Z(this,wa));return this.options.throwOnError&&i.add("error"),Object.keys(Z(this,Xt)).some(l=>{const c=l;return Z(this,Xt)[c]!==t[c]&&i.has(c)})};Ge(this,tt,Ky).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ge(this,tt,Id).call(this)}},rn=new WeakMap,Ke=new WeakMap,zo=new WeakMap,Xt=new WeakMap,ys=new WeakMap,va=new WeakMap,Rr=new WeakMap,Dr=new WeakMap,Bo=new WeakMap,ya=new WeakMap,ba=new WeakMap,bs=new WeakMap,ws=new WeakMap,Or=new WeakMap,wa=new WeakMap,tt=new WeakSet,no=function(t){Ge(this,tt,Dd).call(this);let n=Z(this,Ke).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(an)),n},Pd=function(){Ge(this,tt,Md).call(this);const t=Br(this.options.staleTime,Z(this,Ke));if(Ts||Z(this,Xt).isStale||!Cd(t))return;const r=By(Z(this,Xt).dataUpdatedAt,t)+1;je(this,bs,setTimeout(()=>{Z(this,Xt).isStale||this.updateResult()},r))},Ad=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(Z(this,Ke)):this.options.refetchInterval)??!1},Td=function(t){Ge(this,tt,Rd).call(this),je(this,Or,t),!(Ts||_n(this.options.enabled,Z(this,Ke))===!1||!Cd(Z(this,Or))||Z(this,Or)===0)&&je(this,ws,setInterval(()=>{(this.options.refetchIntervalInBackground||vf.isFocused())&&Ge(this,tt,no).call(this)},Z(this,Or)))},Id=function(){Ge(this,tt,Pd).call(this),Ge(this,tt,Td).call(this,Ge(this,tt,Ad).call(this))},Md=function(){Z(this,bs)&&(clearTimeout(Z(this,bs)),je(this,bs,void 0))},Rd=function(){Z(this,ws)&&(clearInterval(Z(this,ws)),je(this,ws,void 0))},Dd=function(){const t=Z(this,rn).getQueryCache().build(Z(this,rn),this.options);if(t===Z(this,Ke))return;const n=Z(this,Ke);je(this,Ke,t),je(this,zo,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Ky=function(t){Ft.batch(()=>
405{t.listeners&&this.listeners.forEach(n=>{n(Z(this,Xt))}),Z(this,rn).getQueryCache().notify({query:Z(this,Ke),type:"observerResultsUpdated"})})},Sv);function DN(e,t){return _n(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function $p(e,t){return DN(e,t)||e.state.data!==void 0&&Od(e,t,t.refetchOnMount)}function Od(e,t,n){if(_n(t.enabled,e)!==!1&&Br(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&yf(e,t)}return!1}function Up(e,t,n,r){return(e!==t||_n(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&yf(e,n)}function yf(e,t){return _n(t.enabled,e)!==!1&&e.isStaleByTime(Br(t.staleTime,e))}function ON(e,t){return!jd(e.getCurrentResult(),t)}var Yy=m.createContext(void 0),Xy=e=>{const t=m.useContext(Yy);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},LN=({client:e,children:t})=>(m.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),a.jsx(Yy.Provider,{value:e,children:t})),Zy=m.createContext(!1),FN=()=>m.useContext(Zy);Zy.Provider;function zN(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var BN=m.createContext(zN()),VN=()=>m.useContext(BN),$N=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},UN=e=>{m.useEffect(()=>{e.clearReset()},[e])},WN=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||bN(n,[e.error,r])),HN=e=>{if(e.suspense){const t=r=>r==="static"?r:Math.max(r??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...r)=>t(n(...r)):t(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},qN=(e,t)=>e.isLoading&&e.isFetching&&!t,GN=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Wp=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function KN(e,t,n){var f,h,p,y,g;const r=FN(),s=VN(),o=Xy(),i=o.defaultQueryOptions(e);(h=(f=o.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||h.call(f,i),i._optimisticResults=r?"isRestoring":"optimistic",HN(i),$N(i,s),UN(s);const l=!o.getQueryCache().get(i.queryHash),[c]=m.useState(()=>new t(o,i)),d=c.getOptimisticResult(i),u=!r&&e.subscribed!==!1;if(m.useSyncExternalStore(m.useCallback(x=>{const v=u?c.subscribe(Ft.batchCalls(x)):an;return c.updateResult(),v},[c,u]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),m.useEffect(()=>{c.setOptions(i)},[i,c]),GN(i,d))throw Wp(i,c,s);if(WN({result:d,errorResetBoundary:s,throwOnError:i.throwOnError,query:o.getQueryCache().get(i.queryHash),suspense:i.suspense}))throw d.error;if((y=(p=o.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||y.call(p,i,d),i.experimental_prefetchInRender&&!Ts&&qN(d,r)){const x=l?Wp(i,c,s):(g=o.getQueryCache().get(i.queryHash))==null?void 0:g.promise;x==null||x.catch(an).finally(()=>{c.updateResult()})}return i.notifyOnChangeProps?d:c.trackResult(d)}function bf(e,t){return KN(e,RN)}const YN="2026-07-15",Qy=m.createContext(void 0),XN=({children:e})=>{const[t,n]=m.useState(null),[r,s]=m.useState(null),[o,i]=m.useState(!0);m.useEffect(()=>{const u=async p=>{if(window.dispatchEvent(new Event("zapdata:release-session")),!(p!=null&&p.user)){s(null),n(null),i(!1);return}try{he.realtime.setAuth().catch(()=>{})}catch{}s(y=>{var g;return((g=y==null?void 0:y.user)==null?void 0:g.id)===p.user.id&&(y==null?void 0:y.access_token)===p.access_token?y:p}),n(y=>(y==null?void 0:y.id)===p.user.id&&(y==null?void 0:y.updated_at)===p.user.updated_at?y:p.user),i(!1)},{data:{subscription:f}}=he.auth.onAuthStateChange((p,y)=>{if(p==="TOKEN_REFRESH_FAILED"){console.warn("Token refresh failed — signing out user."),s(null),n(null),i(!1);try{he.auth.signOut()}catch{}window.location.pathname.includes("/auth")||window.location.assign("/auth");return}u(y)}),h=setTimeout(()=>{i(!1)},1e4);return(async()=>{try{const{data:{session:p}}=await he.auth.getSession();await u(p)}catch(p){console.warn("getSession failed:",p),i(!1)}finally{clearTimeout(h)}})(),()=>{clearTimeout(h),f.unsubscribe()}},[]);const l=async(u,f,h,p)=>{var y,g,x;try{if(!(u.includes("@")&&u.includes(".")))return{error:{message:"Por favor, use um email válido para se cadastrar"}};const b=u.toLowerCase().trim(),w=`${window.location.origin}/`,{data:_,error:C}=await he.auth.signUp({email:b,password:f,options:{data:{username:b,terms_accepted_at:new Date().toISOString(),terms_version:YN,...p?{affiliate_ref:p.ref,affiliate_free_trial:p.isFreeTrial===!0,...p.linkId?{affiliate_flow_link:p.linkId}:{}}:{}},emailRedirectTo:w,captchaToken:h}});return C?(y=C.message)!=null&&y.includes("leaked")||(g=C.message)!=null&&g.includes("compromised")?{error:{message:"Esta senha foi encontrada em vazamentos de dados. Por favor, escolha uma senha diferente e única."}}:(x=C.message)!=null&&x.includes("already registered")?{error:{message:"Este email já está cadastrado"}}:/database error|unique|already exists|já está cadastrado/i.test(C.message??"")?{error:{message:"Este email já está cadastrado"}}:/captcha/i.test(C.message??"")?{error:{message:"Verificação de segurança falhou. Recarregue a página e tente novamente."}}:{error:C}:{error:null,data:_}}catch(v){return{error:v}}},c=async(u,f,h)=>{try{const y=u.includes("@")&&u.includes(".")?u.toLowerCase().trim():`${u.toLowerCase().trim()}@metricas.local`,{data:g,error:x}=await he.auth.signInWithPassword({email:y,password:f,options:{captchaToken:h}});return x?{error:{message:"Usuário ou senha incorretos"},data:null}:{error:null,data:g}}catch(p){return{error:p,data:null}}},d=async()=>{n(null),s(null);try{localStorage.removeItem("zapdata-impersonation"),Object.keys(localStorage).forEach(u=>{(u.startsWith("sb-")||u.startsWith("zapdata-"))&&localStorage.removeItem(u)})}catch(u){console.warn("Failed to clear local caches:",u)}try{await Promise.race([he.auth.signOut({scope:"local"}),new Promise(u=>setTimeout(u,1500))])}catch(u){console.error("Error signing out:",u)}window.location.replace("/auth")};return a.jsx(Qy.Provider,{value:{user:t,session:r,signUp:l,signIn:c,signOut:d,loading:o},children:e})},at=()=>{const e=m.useContext(Qy);if(e===void 0)throw new Error("useAuth must be used within an AuthProvider");return e},ZN=new Set(["owner","admin","member"]);function QN(e){const t=e;if(!t||typeof t.enabled!="boolean"||!(t.default_company_id===null||typeof t.default_company_id=="string")||!Array.isArray(t.companies)||t.companies.some(n=>!n||typeof n.id!="string"||!n.id||typeof n.owner_user_id!="string"||!n.owner_user_id||typeof n.is_default!="boolean"||typeof n.name!="string"||!(n.description===null||typeof n.description=="str
405ing")||typeof n.time_zone!="string"||!ZN.has(n.role))||new Set(t.companies.map(n=>n.id)).size!==t.companies.length||!t.enabled&&!(t.companies.length===0&&t.default_company_id===null)&&!(t.companies.length===1&&t.companies[0].is_default&&t.companies[0].id===t.default_company_id))throw new Error("Resposta de empresas inválida.");return t}function JN(e){const t=e;return!!t&&["PGRST202","42883"].includes(t.code??"")&&/\bcompany_list\b/.test(t.message??"")}async function Wa(e,t,n){const{data:r,error:s}=await he.rpc(e,t).abortSignal(n);if(s)throw s;return r}const eP={operations:(e,t)=>Wa("company_operation_context",{p_company_id:e},t),list:async e=>QN(await Wa("company_list",{},e)),resolve:async(e,t)=>await Wa("company_resolve_context",{p_company_id:e},t),create:(e,t,n)=>Wa("company_create",{p_name:e.name,p_description:e.description,p_time_zone:e.time_zone,p_idempotency_key:t},n),update:(e,t,n)=>Wa("company_update",{p_company_id:e,p_name:t.name,p_description:t.description,p_time_zone:t.time_zone},n)};function tP(e,t){const n=e;if(!n||n.version!==1||typeof n.ready!="boolean"||n.company_id!==t.company_id||n.actor_user_id!==t.actor_user_id||n.owner_user_id!==t.owner_user_id||n.role!==t.role||!n.permissions||typeof n.permissions!="object"||Array.isArray(n.permissions)||Object.values(n.permissions).some(r=>typeof r!="boolean")||!(n.allowed_instance_ids===null||Array.isArray(n.allowed_instance_ids)&&n.allowed_instance_ids.every(r=>typeof r=="string")))throw new Error("Contrato operacional da empresa inválido.");return Object.freeze({...n,permissions:Object.freeze({...n.permissions}),allowed_instance_ids:n.allowed_instance_ids===null?null:[...n.allowed_instance_ids]})}const Cr={actorId:null,status:"loading",enabled:!1,companies:[],defaultCompanyId:null,selectedCompanyId:null,scope:null,error:null,generation:0,operationContext:null,operationError:null},wf=m.createContext(null),$n=()=>m.useContext(wf),Yr=()=>{const e=m.useContext(wf);if(!e)throw new Error("useCompany requires CompanyProvider");return e};function nP({children:e,api:t=eP}){const{user:n,loading:r}=at(),s=(n==null?void 0:n.id)??null,o=m.useRef(s);o.current=s;const i=Xy(),[l,c]=m.useState(Cr),d=m.useRef(Cr),u=m.useRef(0),f=m.useRef(new Set),h=m.useRef(new AbortController),p=m.useRef(Promise.resolve()),y=m.useRef(!1),g=m.useRef(new Set),x=m.useCallback(k=>{uc(k.status==="legacy"||k.status==="signed-out"?{mode:"legacy"}:k.scope?{mode:"company",scope:k.scope}:{mode:"blocked"}),d.current=k,c(k)},[]),v=m.useCallback(async k=>{const P=s;if(H2()){h.current.abort(),uc({mode:"blocked"}),P&&k&&fc(P,k),window.location.reload();return}const A=++u.current;h.current.abort();const T=new AbortController;h.current=T;const D=d.current,E=k??(D.actorId===P?D.selectedCompanyId:null)??(P?q2(P):null),I=D.actorId!==P||k!==void 0&&k!==D.selectedCompanyId;x({...Cr,actorId:P,generation:A,status:D.status==="legacy"&&!I?"legacy":"loading",companies:D.actorId===P?D.companies:[],selectedCompanyId:E});const S=()=>{he.getChannels().forEach(B=>g.current.add(B));const Y=i.cancelQueries();return i.clear(),p.current=p.current.catch(()=>{}).then(async()=>{await Y;const q=(await Promise.allSettled([...g.current].map(async F=>{const ee=await he.removeChannel(F);if(ee==="error"||ee==="timed out")throw new Error("Falha ao encerrar atualizações da empresa anterior.");g.current.delete(F)}))).find(F=>F.status==="rejected");if((q==null?void 0:q.status)==="rejected")throw q.reason;y.current=!1}).catch(B=>{throw y.current=!0,B}),p.current};(I||y.current)&&S();const L=()=>u.current===A&&o.current===P&&!T.signal.aborted;try{if(await p.current,!L())return;if(!P){x({...Cr,status:"signed-out",generation:A});return}let Y;try{Y=await hc(t.list(T.signal),T.signal)}catch(K){if(L()&&JN(K)){if(E||f.current.has(P)||lp(P))throw new Error("A API de empresas não está disponível para validar a seleção.");x({...Cr,actorId:P,status:"legacy",generation:A});return}throw K}if(!L())return;if(!Y.enabled&&Y.companies.length===0){if(E||f.current.has(P)||lp(P))throw new Error("A seleção de empresa não pode ser validada enquanto a gestão de empresas está desativada.");x({...Cr,actorId:P,status:"legacy",generation:A});return}f.current.add(P),G2(P);const B=E??Y.default_company_id,q={...Cr,actorId:P,enabled:Y.enabled,companies:Y.companies,defaultCompanyId:Y.default_company_id,selectedCompanyId:B,generation:A};if(x(q),D.status==="legacy"&&!I&&(await S(),!L()))return;const F=Y.companies.find(K=>K.id===B);if(!F)throw fc(P,null),new Error("A empresa selecionada não está disponível. Escolha uma empresa autorizada.");const ee=await hc(t.resolve(F.id,T.signal),T.signal);if(!L())return;if(!ee||ee.company_id!==F.id||ee.actor_user_id!==P||ee.owner_user_id!==F.owner_user_id||!["owner","admin","member"].includes(ee.role))throw new Error("Não foi possível validar o acesso à empresa.");let $=null,M=null;if(t.operations)try{$=tP(await hc(t.operations(F.id,T.signal),T.signal),ee)}catch{M="As operações por empresa ainda não estão disponíveis."}if(!L())return;const J=Object.freeze({...ee,generation:A,signal:T.signal,is_default:F.is_default});fc(P,F.id),x({...q,status:"ready",scope:J,operationContext:$,operationError:M,companies:Y.companies.map(K=>K.id===F.id?{...K,role:ee.role}:K)})}catch(Y){L()&&(x({...d.current,status:"error",scope:null,error:Y instanceof Error?Y.message:"Não foi possível validar as empresas. Tente novamente."}),T.abort())}},[s,t,x,i]);m.useEffect(()=>
405(r||v(),()=>{++u.current,h.current.abort(),uc({mode:"blocked"})}),[r,v]);const b=m.useCallback(async k=>{const P=d.current.scope;if(!P||P.actor_user_id!==o.current||P.signal.aborted)throw new cp;const A=await k(P);if(d.current.scope!==P||P.signal.aborted||P.actor_user_id!==o.current)throw new cp;return A},[]),w=l.actorId===s&&!r?l:{...Cr,actorId:s},_=w.status==="ready"&&w.enabled&&w.companies.some(k=>k.owner_user_id===s&&k.role==="owner"),C=async(k,P)=>{await b(A=>{const T=d.current;if(!T.enabled||!T.companies.some(D=>D.owner_user_id===A.actor_user_id&&D.role==="owner"))throw new Error("Somente o titular pode criar empresas.");return t.create(k,P,A.signal)}),await v()},N=async k=>{await b(P=>{if(!d.current.enabled||P.role!=="owner")throw new Error("Sem permissão para editar esta empresa.");return t.update(P.company_id,k,P.signal)}),await v()};return a.jsx(wf.Provider,{value:{...w,canCreate:_,refresh:()=>v(),selectCompany:k=>v(k),createCompany:C,updateCompany:N,runScoped:b},children:e})}let Ld=null,Mi=[];const os=e=>{if(Ld){Ld.show(e);return}console.warn("[useSplashedToast] Toaster ainda não montado — enfileirando toast:",e.title||e.message),Mi.push(e)},Hp=e=>{if(Ld=e,e&&Mi.length>0){const t=Mi;Mi=[],t.forEach(n=>e.show(n))}},Ye={success:(e,t="")=>{os({title:e,message:t,variant:"success",highlightTitle:!0})},error:(e,t="")=>{os({title:e,message:t,variant:"error",highlightTitle:!0})},warning:(e,t="")=>{os({title:e,message:t,variant:"warning",highlightTitle:!0})},info:(e,t="")=>{os({title:e,message:t,variant:"default"})},show:e=>{os(e)}},Xe=e=>{if(typeof e=="string"){os({message:e,variant:"success"});return}const{title:t="",description:n="",variant:r}=e;os({title:t,message:n,variant:r==="destructive"?"error":"success",highlightTitle:!0})},rP=()=>({toast:Xe,toasts:[],dismiss:()=>{}});function _f(e){if(e.pathname!=="/")return!1;const t=e.hash.split("?")[0];return t===""||t==="#"||t==="#_=_"||t==="#/"||t==="#/ads/settings"}async function sP(e,t){let n;try{n=await fetch("https://jevbzxxgwsbbxzwwszag.supabase.co/functions/v1/facebook-oauth",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"omit",body:JSON.stringify({action:"exchange_code",code:e,state:t})})}catch{throw new Error("Não foi possível acessar o servidor. Verifique sua conexão e tente novamente com um novo link.")}const r=await n.json().catch(()=>null);if(!(n.ok&&(r!=null&&r.success)))throw(r==null?void 0:r.error)==="Authorization link expired or already used"?new Error("Este link expirou ou já foi usado. Gere um novo link na aba Ads."):new Error(typeof(r==null?void 0:r.error)=="string"?`Não foi possível conectar: ${r.error}`:`Não foi possível concluir a conexão (erro ${n.status}). Gere um novo link na aba Ads.`)}const aP="https://zapdata.co/";function oP(){if(!_f(window.location))return null;const t=new URLSearchParams(window.location.search).get("code");if(t)return{code:t};const n=window.location.hash||"",r=n.indexOf("?");if(r===-1)return null;const s=n.slice(r+1),i=new URLSearchParams(s).get("code");return i?{code:i,cleanHash:n.slice(0,r)}:null}function Fd(){const{session:e,loading:t}=at(),n=m.useRef(!1),[r,s]=m.useState(null);return m.useEffect(()=>{if(!_f(window.location))return;const o=new URLSearchParams(window.location.search),i=o.get("state");if(!(i!=null&&i.startsWith("fb_"))||n.current)return;if(n.current=!0,window.history.replaceState({},document.title,window.location.pathname),o.has("error")){s("Autorização cancelada. Volte à aba Ads para gerar um novo link.");return}const l=o.get("code");if(!l){s("Link inválido. Volte à aba Ads para gerar um novo link.");return}s("Conectando sua conta do Facebook..."),sP(l,i).then(()=>{var c;s("Conta do Facebook conectada! Você já pode fechar esta janela e voltar à aba Ads no computador de origem.");try{(c=window.opener)==null||c.postMessage({type:"facebook-connected"},window.location.origin),window.opener&&window.close()}catch{}}).catch(c=>{s(c instanceof Error?c.message:"Não foi possível conectar. Gere um novo link na aba Ads e tente novamente.")})},[]),m.useEffect(()=>{const o=oP();o&&(n.current||t||e&&(n.current=!0,window.history.replaceState({},document.title,window.location.pathname),(async()=>{let i=!0;try{const{data:l,error:c}=await he.auth.refreshSession();if(c||!l.session){console.error("Session refresh failed before FB exchange:",c),Ye.error("Sessão expirada","Faça login novamente e tente conectar o Facebook."),i=!1,window.location.assign("/auth");return}const{data:d,error:u}=await he.functions.invoke("facebook-oauth",{body:{action:"exchange_code",code:o.code,redirect_uri:aP},headers:{Authorization:`Bearer ${l.session.access_token}`}});if(u){const f=d??null,h=f==null?void 0:f.error;if(h==="session_expired"){Ye.error("Sessão expirada","Faça login novamente e tente conectar o Facebook."),i=!1,window.location.assign("/auth");return}
405if(typeof h=="string"&&/code|expired|used|invalid/i.test(h)){Ye.error("Link de autorização expirado","Clique em Conectar Facebook novamente.");return}throw u}Ye.success("Conta do Facebook conectada!")}catch(l){console.error("Facebook OAuth callback error:",l);const c=l instanceof Error?l.message:"Tente novamente em alguns instantes.";Ye.error("Erro ao conectar com Facebook",c)}finally{i&&window.location.assign("/ads/settings")}})()))},[e,t]),r?a.jsx("div",{role:"status",className:"fixed inset-0 z-[1000] flex items-center justify-center bg-background p-6",children:a.jsxs("div",{className:"max-w-md rounded-xl border bg-card p-8 text-center space-y-4",children:[a.jsx("h1",{className:"text-xl font-semibold",children:"Conexão com o Facebook"}),a.jsx("p",{className:"text-muted-foreground",children:r})]})}):null}function iP(){const{scope:e,runScoped:t}=Yr(),[n,r]=m.useState("10"),[s,o]=m.useState(!1),[i,l]=m.useState(null);if((e==null?void 0:e.role)!=="owner")return null;const c=async()=>{if(!s){o(!0),l(null);try{const d=await t(async u=>{var y,g,x,v;const f=K2(Number(n)),h=await fd(Gi()).functions.invoke("stripe-create-wallet-checkout",{body:f});if(h.error||(y=h.data)!=null&&y.error)throw new Error(((g=h.data)==null?void 0:g.error)??"Não foi possível iniciar a recarga. Tente novamente.");if(((x=h.data)==null?void 0:x.company_id)!==u.company_id||typeof((v=h.data)==null?void 0:v.url)!="string")throw new Error("O servidor não confirmou a recarga desta empresa.");const p=new URL(h.data.url);if(p.protocol!=="https:")throw new Error("Link de pagamento inválido.");return p.href});window.location.assign(d)}catch(d){e.signal.aborted||l(d instanceof Error?d.message:"Recarga indisponível.")}finally{e.signal.aborted||o(!1)}}};return a.jsxs("section",{className:"space-y-3 rounded border p-4","aria-label":"Recarregar saldo da empresa",children:[a.jsx("h2",{className:"font-medium",children:"Recarregar saldo desta empresa"}),a.jsx("p",{children:"O crédito será adicionado somente a esta empresa após a confirmação do pagamento."}),a.jsxs("label",{className:"block",children:["Valor em reais",a.jsx("input",{type:"number",min:"5",max:"5000",step:"0.01",className:"ml-2 rounded border bg-background p-2",disabled:s,value:n,onChange:d=>{r(d.target.value),ud()}})]}),i&&a.jsx("p",{role:"alert",children:i}),a.jsx("button",{className:"rounded border px-4 py-2",disabled:s,onClick:()=>void c(),children:s?"Preparando pagamento...":"Continuar recarga"}),a.jsx("button",{className:"ml-3 underline",disabled:s,onClick:()=>{ud(),l(null)},children:"Iniciar uma nova recarga"})]})}function lP(){const e=Yr(),{scope:t,runScoped:n}=e,[r,s]=m.useState(null),[o,i]=m.useState(null),[l,c]=m.useState([]),[d,u]=m.useState(""),[f,h]=m.useState(null),[p,y]=m.useState(null),[g,x]=m.useState(!0),[v,b]=m.useState(!1),[w,_]=m.useState(!1),[C,N]=m.useState(0),k=(t==null?void 0:t.role)==="owner";m.useEffect(()=>{t&&new URLSearchParams(window.location.search).get("plan_success")==="true"&&hd(),t&&new URLSearchParams(window.location.search).get("wallet_payment")==="success"&&(ud(),y("Pagamento enviado. O saldo será atualizado após a confirmação."))},[t]),m.useEffect(()=>{let D=!0;if(!t){x(!1);return}return x(!0),s(null),i(null),c([]),h(null),n(async()=>{var B;const E=fd(Gi()),I=await E.rpc("company_billing_status",{p_company_id:t.company_id});if(I.error)throw I.error;const S=I.data;if((S==null?void 0:S.company_id)!==t.company_id)throw new Error("Empresa inválida.");let L=null,Y=[];if(k){const q=await E.from("sms_user_wallets").select("balance").maybeSingle();if(q.error)throw q.error;L=((B=q.data)==null?void 0:B.balance)??null;const F=await E.from("subscription_plans").select("id,name,price_brl").eq("is_active",!0).order("sort_order");if(F.error)throw F.error;Y=F.data??[]}return{subscription:S.subscription,balance:L,plans:Y}}).then(E=>{D&&(s(E.subscription),i(E.balance),c(E.plans))}).catch(()=>{D&&h("Não foi possível carregar o financeiro desta empresa. Tente novamente.")}).finally(()=>{D&&x(!1)}),()=>{D=!1}},[t,n,k,C]);const P=async D=>
405{if(!(!k||!t||v||D==="checkout"&&!d||D==="cancel"&&!w)){b(!0),h(null),y(null);try{const E=await n(async()=>{var Y,B,q,F,ee;const I=fd(Gi()),S=D==="checkout"?"create-plan-checkout":D==="pay"?"stripe-pay-now":(r==null?void 0:r.gateway)==="efi"?"efi-cancel-plan-subscription":"cancel-plan-subscription",L=await I.functions.invoke(S,{body:D==="checkout"?{plan_id:d}:{}});if(L.error||(Y=L.data)!=null&&Y.error)throw new Error(((B=L.data)==null?void 0:B.error)??"Não foi possível concluir a operação.");if(!((q=L.data)!=null&&q.url)&&((F=L.data)==null?void 0:F.success)!==!0&&((ee=L.data)==null?void 0:ee.ok)!==!0)throw new Error("O servidor não confirmou a operação.");return L.data});if(E.url){const I=new URL(E.url);if(I.protocol!=="https:")throw new Error("Link de pagamento inválido.");window.location.assign(I.href)}else y(D==="cancel"?"Cancelamento confirmado.":"Operação confirmada."),_(!1),N(I=>I+1)}catch(E){t.signal.aborted||h(E instanceof Error?E.message:"Operação indisponível.")}finally{t.signal.aborted||b(!1)}}},A=e.companies.find(D=>D.id===e.selectedCompanyId),T=D=>new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(D);return a.jsx("main",{className:"min-h-screen p-6 pb-48",children:a.jsxs("div",{className:"mx-auto max-w-2xl space-y-4",children:[a.jsx("h1",{className:"text-2xl font-semibold",children:"Assinatura e saldo"}),a.jsx("p",{children:(A==null?void 0:A.name)??"Selecione uma empresa"}),g&&a.jsx("p",{role:"status",children:"Carregando financeiro..."}),(f||e.error)&&a.jsx("p",{role:"alert",children:f??e.error}),p&&a.jsx("p",{role:"status",children:p}),!g&&!f&&t&&a.jsxs(a.Fragment,{children:[a.jsxs("p",{children:["Plano: ",(r==null?void 0:r.plan_id)??"Sem assinatura"]}),r&&a.jsxs("p",{children:["Status: ",r.status]}),(r==null?void 0:r.suspension_reason)&&a.jsx("p",{role:"alert",children:r.suspension_reason}),(r==null?void 0:r.current_period_end)&&a.jsxs("p",{children:["Fim do período: ",new Date(r.current_period_end).toLocaleDateString("pt-BR")]}),o!==null&&a.jsxs("p",{children:["Saldo: ",T(o)]}),k&&!f&&a.jsxs("fieldset",{disabled:v,className:"space-y-4 rounded border p-4",children:[a.jsx("legend",{children:"Gerenciar assinatura desta empresa"}),a.jsxs("label",{className:"block",children:["Plano",a.jsxs("select",{className:"ml-2 rounded border bg-background p-2",value:d,onChange:D=>u(D.target.value),children:[a.jsx("option",{value:"",children:"Selecione um plano"}),l.map(D=>a.jsxs("option",{value:D.id,children:[D.name," — ",T(D.price_brl)]},D.id))]})]}),a.jsx("button",{disabled:!d||v,className:"rounded border px-4 py-2",onClick:()=>void P("checkout"),children:"Continuar para pagamento"}),(r==null?void 0:r.gateway)==="stripe"&&r.status==="past_due"&&a.jsx("button",{className:"block rounded border px-4 py-2",onClick:()=>void P("pay"),children:"Pagar fatura pendente"}),r&&!r.cancel_at_period_end&&r.plan_id!=="free"&&a.jsxs("div",{children:[a.jsxs("label",{children:[a.jsx("input",{type:"checkbox",checked:w,onChange:D=>_(D.target.checked)})," Confirmo o cancelamento da assinatura de ",A==null?void 0:A.name,"."]}),a.jsx("button",{disabled:!w||v,className:"mt-2 block rounded border px-4 py-2",onClick:()=>void P("cancel"),children:"Cancelar assinatura"})]}),(r==null?void 0:r.cancel_at_period_end)&&a.jsx("p",{children:"Cancelamento agendado para o fim do período."})]}),k&&!f&&a.jsx(iP,{}),!k&&a.jsx("p",{children:"Somente o titular pode alterar a assinatura ou realizar pagamentos."})]}),a.jsx("button",{className:"rounded border px-4 py-2",disabled:v,onClick:()=>N(D=>D+1),children:"Atualizar"}),a.jsx("a",{href:"/settings?section=companies",className:"block underline",children:"Gerenciar empresas"})]})})}function cP(){const e=Yr(),t=m.useId();return e.status==="loading"||e.status==="legacy"||e.status==="signed-out"||!e.actorId?null:a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{htmlFor:t,className:"block text-xs font-medium",children:"Empresa"}),a.jsxs("select",{id:t,className:"w-full rounded-md border bg-background p-2 text-sm",value:e.selectedCompanyId??"",onChange:n=>void e.selectCompany(n.target.value),children:[a.jsx("option",{value:"",disabled:!0,children:"Selecione uma empresa"}),e.companies.map(n=>a.jsxs("option",{value:n.id,disabled:!e.enabled&&n.id!==e.defaultCompanyId,children:[n.name,n.id===e.defaultCompanyId?" (inicial)":""]},n.id))]}),a.jsx(_a,{to:"/settings?section=companies",className:"block text-xs underline",children:"Gerenciar empresas"}),a.jsx(_a,{to:"/subscription",className:"block text-xs underline",children:"Assinatura e saldo da empresa"})]})}function Cc(){const{actorId:e,status:t}=Yr(),{signOut:n}=at(),[r,s]=m.useState(!1);return!e||t==="loading"||t==="legacy"||t==="signed-out"?null:a.jsxs("aside",{"aria-label":"Sele
405ção de empresa",className:"pointer-events-auto fixed bottom-0 left-0 z-[10000] w-64 max-w-[75vw] rounded-tr-lg border bg-card p-3 shadow-lg",children:[a.jsx(cP,{}),a.jsx("button",{className:"mt-2 text-xs underline",onClick:()=>{s(!1),n().catch(()=>s(!0))},children:"Sair"}),r&&a.jsx("p",{role:"alert",className:"text-xs",children:"Não foi possível sair. Tente novamente."})]})}function zd(){return a.jsx("div",{role:"status","aria-label":"Carregando sistema","aria-busy":"true",children:a.jsx(wl,{})})}function qp({message:e}){const{refresh:t}=Yr();return a.jsx("main",{className:"min-h-screen bg-background p-8 pb-40",children:a.jsxs("div",{className:"mx-auto max-w-lg space-y-4",children:[a.jsx("h1",{className:"text-xl font-semibold",children:"Acesso à empresa"}),a.jsx("p",{role:"alert",children:e}),a.jsx("button",{className:"rounded border px-4 py-2",onClick:()=>void t(),children:"Tentar novamente"})]})})}function dP({children:e}){var n;const t=Yr();return t.status==="legacy"||t.status==="signed-out"?a.jsx(a.Fragment,{children:e}):t.status==="loading"?a.jsx(zd,{}):t.status==="error"?a.jsx(qp,{message:t.error??"Acesso indisponível."}):((n=t.operationContext)==null?void 0:n.ready)===!0&&t.operationContext.version===1?a.jsx("div",{children:e},`${t.actorId}:${t.selectedCompanyId}:${t.generation}`):a.jsx(qp,{message:"As operações por empresa ainda não estão disponíveis. Acesse Configurações → Empresas para gerenciar os dados da empresa."})}const uP=new Set(["/auth","/tutorial","/privacidade","/termos","/exclusao-de-dados","/data-deletion","/unsubscribe","/pagamento/obrigado","/pagamento/cancelado","/reset-password"]),fP=new Set(["/authorize","/lp","/flow-preview","/zernio/callback","/integrations/zenith/connect","/integrations/zenith/callback"]);function hP({children:e,management:t,publicContent:n}){const r=or(),{user:s,loading:o}
405=at(),i=Yr(),l=new URLSearchParams(r.search).get("state");if(r.pathname==="/"&&(l!=null&&l.startsWith("fb_")))return a.jsx(Fd,{});const c=r.pathname==="/settings/companies"||r.pathname==="/settings"&&new URLSearchParams(r.search).get("section")==="companies";return(r.pathname==="/subscription"||r.pathname==="/settings"&&new URLSearchParams(r.search).get("section")==="billing")&&i.status!=="legacy"?o||i.status==="loading"?a.jsx(zd,{}):s?a.jsxs(a.Fragment,{children:[a.jsx(lP,{}),a.jsx(Cc,{})]}):a.jsx(ta,{to:"/auth",replace:!0}):c?o||i.status==="loading"?a.jsx(zd,{}):s?a.jsxs(a.Fragment,{children:[t,a.jsx(Cc,{})]}):a.jsx(ta,{to:"/auth",replace:!0}):uP.has(r.pathname)?a.jsx(a.Fragment,{children:i.status==="legacy"?e:n}):!o&&!s&&fP.has(r.pathname)?a.jsx(a.Fragment,{children:e}):a.jsxs(a.Fragment,{children:[a.jsx(dP,{children:e}),a.jsx(Cc,{})]})}function pP(){const[e,t]=m.useState(Y2);return m.useEffect(()=>{const n=()=>t(!0);return window.addEventListener(dp,n),()=>window.removeEventListener(dp,n)},[]),e?a.jsxs("aside",{role:"alert",className:"fixed left-3 right-3 top-3 z-[10000] mx-auto max-w-xl rounded-lg border bg-background p-4 shadow-lg",children:[a.jsx("p",{className:"font-semibold",children:"Atualize a página para continuar"}),a.jsx("p",{className:"mt-1 text-sm",children:"O sistema foi atualizado. Copie as informações ainda não salvas antes de recarregar. Nenhuma operação será repetida automaticamente."}),a.jsx("button",{type:"button",className:"mt-3 rounded bg-primary px-3 py-2 text-sm text-primary-foreground",onClick:()=>window.location.reload(),children:"Recarregar página"})]}):null}var mP=e=>{switch(e){case"success":return vP;case"info":return bP;case"warning":return yP;case"error":return wP;default:return null}},gP=Array(12).fill(0),xP=({visible:e,className:t})=>oe.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},oe.createElement("div",{className:"sonner-spinner"},gP.map((n,r)=>oe.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),vP=oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},oe.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),yP=oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},oe.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),bP=oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},oe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),wP=oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},oe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),_P=oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},oe.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),oe.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),SP=()=>{let[e,t]=oe.useState(document.hidden);return oe.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},Bd=1,CP=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>
vendor: 1,050 bytes, line 405
405{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...r}=e,s=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:Bd++,o=this.toasts.find(l=>l.id===s),i=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),o?this.toasts=this.toasts.map(l=>l.id===s?(this.publish({...l,...e,id:s,title:n}),{...l,...e,id:s,dismissible:i,title:n}):l):this.addToast({title:n,...r,dismissible:i,id:s}),s},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(n=>n({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>
405this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let r=e instanceof Promise?e:e(),s=n!==void 0,o,i=r.then(async c=>{if(o=["resolve",c],oe.isValidElement(c))s=!1,this.create({id:n,type:"default",message:c});else if(kP(c)&&!c.ok){s=!1;let d=typeof t.error=="function"?await t.error(`HTTP error! status: ${c.status}`):t.error,u=typeof t.description=="function"?await t.description(`HTTP error! status: ${c.status}`):t.description;this.create({id:n,type:"error",message:d,description:u})}else if(t.success!==void 0){s=!1;let d=typeof t.success=="function"?await t.success(c):t.success,u=typeof t.description=="function"?await t.description(c):t.description;this.create({id:n,type:"success",message:d,description:u})}}).catch(async c=>{if(o=["reject",c],t.error!==void 0){s=!1;let d=typeof t.error=="function"?await t.error(c):t.error,u=typeof t.description=="function"?await t.description(c):t.description;this.create({id:n,type:"error",message:d,description:u})}}).finally(()=>{var c;s&&(this.dismiss(n),n=void 0),(c=t.finally)==null||c.call(t)}),l=()=>new Promise((c,d)=>i.then(()=>o[0]==="reject"?d(o[1]):c(o[1])).catch(d));return typeof n!="string"&&typeof n!="number"?{unwrap:l}:Object.assign(n,{unwrap:l})},this.custom=(e,t)=>{let n=(t==null?void 0:t.id)||Bd++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},sn=new CP,jP=(e,t)=>{let n=(t==null?void 0:t.id)||Bd++;return sn.addToast({title:e,...t,id:n}),n},kP=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",EP=jP,NP=()=>sn.toasts,PP=()=>sn.getActiveToasts(),rt=Object.assign(EP,{success:sn.success,info:sn.info,warning:sn.warning,error:sn.error,custom:sn.custom,message:sn.message,promise:sn.promise,dismiss:sn.dismiss,loading:sn.loading},{getHistory:NP,getToasts:PP});function AP(e,{insertAt:t}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}AP(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;
405left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}
405:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);
405--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
406`);function fi(e){return e.label!==void 0}var TP=3,IP="32px",MP="16px",Gp=4e3,RP=356,DP=14,OP=20,LP=200;function An(...e){return e.filter(Boolean).join(" ")}function FP(e){let[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}var zP=e=>{var t,n,r,s,o,i,l,c,d,u,f;let{invert:h,toast:p,unstyled:y,interacting:g,setHeights:x,visibleToasts:v,heights:b,index:w,toasts:_,expanded:C,removeToast:N,defaultRichColors:k,closeButton:P,style:A,cancelButtonStyle:T,actionButtonStyle:D,className:E="",descriptionClassName:I="",duration:S,position:L,gap:Y,loadingIcon:B,expandByDefault:q,classNames:F,icons:ee,closeButtonAriaLabel:$="Close toast",pauseWhenPageIsHidden:M}=e,[J,K]=oe.useState(null),[X,de]=oe.useState(null),[te,ae]=oe.useState(!1),[re,le]=oe.useState(!1),[ue,z]=oe.useState(!1),[ie,j]=oe.useState(!1),[H,G]=oe.useState(!1),[O,R]=oe.useState(0),[U,V]=oe.useState(0),Q=oe.useRef(p.duration||S||Gp),W=oe.useRef(null),se=oe.useRef(null),fe=w===0,ce=w+1<=v,me=p.type,ke=p.dismissible!==!1,Ne=p.className||"",Je=p.descriptionClassName||"",ct=oe.useMemo(()=>b.findIndex(Pe=>Pe.toastId===p.id)||0,[b,p.id]),ye=oe.useMemo(()=>{var Pe;return(Pe=p.closeButton)!=null?Pe:P},[p.closeButton,P]),Re=oe.useMemo(()=>p.duration||S||Gp,[p.duration,S]),Ce=oe.useRef(0),De=oe.useRef(0),Ue=oe.useRef(0),Ve=oe.useRef(null),[pt,At]=L.split("-"),jt=oe.useMemo(()=>b.reduce((Pe,He,nt)=>nt>=ct?Pe:Pe+He.height,0),[b,ct]),Bt=SP(),hn=p.invert||h,Vt=me==="loading";De.current=oe.useMemo(()=>ct*Y+jt,[ct,jt]),oe.useEffect(()=>{Q.current=Re},[Re]),oe.useEffect(()=>{ae(!0)},[]),oe.useEffect(()=>{let Pe=se.current;if(Pe){let He=Pe.getBoundingClientRect().height;return V(He),x(nt=>[{toastId:p.id,height:He,position:p.position},...nt]),()=>x(nt=>nt.filter(Dt=>Dt.toastId!==p.id))}},[x,p.id]),oe.useLayoutEffect(()=>{if(!te)return;let Pe=se.current,He=Pe.style.height;Pe.style.height="auto";let nt=Pe.getBoundingClientRect().height;Pe.style.height=He,V(nt),x(Dt=>Dt.find(Jt=>Jt.toastId===p.id)?Dt.map(Jt=>Jt.toastId===p.id?{...Jt,height:nt}:Jt):[{toastId:p.id,height:nt,position:p.position},...Dt])},[te,p.title,p.description,x,p.id]);let St=oe.useCallback(()=>{le(!0),R(De.current),x(Pe=>Pe.filter(He=>He.toastId!==p.id)),setTimeout(()=>{N(p)},LP)},[p,N,x,De]);oe.useEffect(()=>{if(p.promise&&me==="loading"||p.duration===1/0||p.type==="loading")return;let Pe;return C||g||M&&Bt?(()=>{if(Ue.current<Ce.current){let He=new Date().getTime()-Ce.current;Q.current=Q.current-He}
406Ue.current=new Date().getTime()})():Q.current!==1/0&&(Ce.current=new Date().getTime(),Pe=setTimeout(()=>{var He;(He=p.onAutoClose)==null||He.call(p,p),St()},Q.current)),()=>clearTimeout(Pe)},[C,g,p,me,M,Bt,St]),oe.useEffect(()=>{p.delete&&St()},[St,p.delete]);function zs(){var Pe,He,nt;return ee!=null&&ee.loading?oe.createElement("div",{className:An(F==null?void 0:F.loader,(Pe=p==null?void 0:p.classNames)==null?void 0:Pe.loader,"sonner-loader"),"data-visible":me==="loading"},ee.loading):B?oe.createElement("div",{className:An(F==null?void 0:F.loader,(He=p==null?void 0:p.classNames)==null?void 0:He.loader,"sonner-loader"),"data-visible":me==="loading"},B):oe.createElement(xP,{className:An(F==null?void 0:F.loader,(nt=p==null?void 0:p.classNames)==null?void 0:nt.loader),visible:me==="loading"})}return oe.createElement("li",{tabIndex:0,ref:se,className:An(E,Ne,F==null?void 0:F.toast,(t=p==null?void 0:p.classNames)==null?void 0:t.toast,F==null?void 0:F.default,F==null?void 0:F[me],(n=p==null?void 0:p.classNames)==null?void 0:n[me]),"data-sonner-toast":"","data-rich-colors":(r=p.richColors)!=null?r:k,"data-styled":!(p.jsx||p.unstyled||y),"data-mounted":te,"data-promise":!!p.promise,"data-swiped":H,"data-removed":re,"data-visible":ce,"data-y-position":pt,"data-x-position":At,"data-index":w,"data-front":fe,"data-swiping":ue,"data-dismissible":ke,"data-type":me,"data-invert":hn,"data-swipe-out":ie,"data-swipe-direction":X,"data-expanded":!!(C||q&&te),style:{"--index":w,"--toasts-before":w,"--z-index":_.length-w,"--offset":`${re?O:De.current}px`,"--initial-height":q?"auto":`${U}px`,...A,...p.style},onDragEnd:()=>{z(!1),K(null),Ve.current=null},onPointerDown:Pe=>{Vt||!ke||(W.current=new Date,R(De.current),Pe.target.setPointerCapture(Pe.pointerId),Pe.target.tagName!=="BUTTON"&&(z(!0),Ve.current={x:Pe.clientX,y:Pe.clientY}))},onPointerUp:()=>{var Pe,He,nt,Dt;if(ie||!ke)return;Ve.current=null;let Jt=Number(((Pe=se.current)==null?void 0:Pe.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Tt=Number(((He=se.current)==null?void 0:He.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Nn=new Date().getTime()-((nt=W.current)==null?void 0:nt.getTime()),en=J==="x"?Jt:Tt,Pn=Math.abs(en)/Nn;if(Math.abs(en)>=OP||Pn>.11){R(De.current),(Dt=p.onDismiss)==null||Dt.call(p,p),de(J==="x"?Jt>0?"right":"left":Tt>0?"down":"up"),St(),j(!0),G(!1);return}z(!1),K(null)},onPointerMove:Pe=>{var He,nt,Dt,Jt;if(!Ve.current||!ke||((He=window.getSelection())==null?void 0:He.toString().length)>0)return;let Tt=Pe.clientY-Ve.current.y,Nn=Pe.clientX-Ve.current.x,en=(nt=e.swipeDirections)!=null?nt:FP(L);!J&&(Math.abs(Nn)>1||Math.abs(Tt)>1)&&K(Math.abs(Nn)>Math.abs(Tt)?"x":"y");let Pn={x:0,y:0};J==="y"?(en.includes("top")||en.includes("bottom"))&&(en.includes("top")&&Tt<0||en.includes("bottom")&&Tt>0)&&(Pn.y=Tt):J==="x"&&(en.includes("left")||en.includes("right"))&&(en.includes("left")&&Nn<0||en.includes("right")&&Nn>0)&&(Pn.x=Nn),(Math.abs(Pn.x)>0||Math.abs(Pn.y)>0)&&G(!0),(Dt=se.current)==null||Dt.style.setProperty("--swipe-amount-x",`${Pn.x}px`),(Jt=se.current)==null||Jt.style.setProperty("--swipe-amount-y",`${Pn.y}px`)}},ye&&!p.jsx?oe.createElement("button",{"aria-label":$,"data-disabled":Vt,"data-close-button":!0,onClick:Vt||!ke?()=>{}:()=>{var Pe;St(),(Pe=p.onDismiss)==null||Pe.call(p,p)},className:An(F==null?void 0:F.closeButton,(s=p==null?void 0:p.classNames)==null?void 0:s.closeButton)},(o=ee==null?void 0:ee.close)!=null?o:_P):null,p.jsx||m.isValidElement(p.title)?p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title:oe.createElement(oe.Fragment,null,me||p.icon||p.promise?oe.createElement("div",{"data-icon":"",className:An(F==null?void 0:F.icon,(i=p==null?void 0:p.classNames)==null?void 0:i.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||zs():null,p.type!=="loading"?p.icon||(ee==null?void 0:ee[me])||mP(me):null):null,oe.createElement("div",{"data-content":"",className:An(F==null?void 0:F.content,(l=p==null?void 0:p.classNames)==null?void 0:l.content)},oe.createElement("div",{"data-title":"",className:An(F==null?void 0:F.title,(c=p==null?void 0:p.classNames)==null?void 0:c.title)},typeof p.title=="function"?p.title():p.title),p.description?oe.createElement("div",{"data-description":"",className:An(I,Je,F==null?void 0:F.description,(d=p==null?void 0:p.classNames)==null?void 0:d.description)},typeof p.description=="function"?p.description():p.description):null),m.isValidElement(p.cancel)?p.cancel:p.cancel&&fi(p.cancel)?oe.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||T,onClick:Pe=>{var He,nt;fi(p.cancel)&&ke&&((nt=(He=p.cancel).onClick)==null||nt.call(He,Pe),St())},className:An(F==null?void 0:F.cancelButton,(u=p==null?void 0:p.classNames)==null?void 0:u.cancelButton)},p.cancel.label):null,m.isValidElement(p.action)?p.action:p.action&&fi(p.action)?oe.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||D,onClick:Pe=>{var He,nt;fi(p.action)&&((nt=(He=p.action).onClick)==null||nt.call(He,Pe),!Pe.defaultPrevented&&St
406())},className:An(F==null?void 0:F.actionButton,(f=p==null?void 0:p.classNames)==null?void 0:f.actionButton)},p.action.label):null))};function Kp(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function BP(e,t){let n={};return[e,t].forEach((r,s)=>{let o=s===1,i=o?"--mobile-offset":"--offset",l=o?MP:IP;function c(d){["top","right","bottom","left"].forEach(u=>{n[`${i}-${u}`]=typeof d=="number"?`${d}px`:d})}typeof r=="number"||typeof r=="string"?c(r):typeof r=="object"?["top","right","bottom","left"].forEach(d=>{r[d]===void 0?n[`${i}-${d}`]=l:n[`${i}-${d}`]=typeof r[d]=="number"?`${r[d]}px`:r[d]}):c(l)}),n}var VP=m.forwardRef(function(e,t){let{invert:n,position:r="bottom-right",hotkey:s=["altKey","KeyT"],expand:o,closeButton:i,className:l,offset:c,mobileOffset:d,theme:u="light",richColors:f,duration:h,style:p,visibleToasts:y=TP,toastOptions:g,dir:x=Kp(),gap:v=DP,loadingIcon:b,icons:w,containerAriaLabel:_="Notifications",pauseWhenPageIsHidden:C}=e,[N,k]=oe.useState([]),P=oe.useMemo(()=>Array.from(new Set([r].concat(N.filter(M=>M.position).map(M=>M.position)))),[N,r]),[A,T]=oe.useState([]),[D,E]=oe.useState(!1),[I,S]=oe.useState(!1),[L,Y]=oe.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),B=oe.useRef(null),q=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),F=oe.useRef(null),ee=oe.useRef(!1),$=oe.useCallback(M=>{k(J=>{var K;return(K=J.find(X=>X.id===M.id))!=null&&K.delete||sn.dismiss(M.id),J.filter(({id:X})=>X!==M.id)})},[]);return oe.useEffect(()=>sn.subscribe(M=>{if(M.dismiss){k(J=>J.map(K=>K.id===M.id?{...K,delete:!0}:K));return}setTimeout(()=>{kv.flushSync(()=>{k(J=>{let K=J.findIndex(X=>X.id===M.id);return K!==-1?[...J.slice(0,K),{...J[K],...M},...J.slice(K+1)]:[M,...J]})})})}),[]),oe.useEffect(()=>{if(u!=="system"){Y(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Y("dark"):Y("light")),typeof window>"u")return;let M=window.matchMedia("(prefers-color-scheme: dark)");try{M.addEventListener("change",({matches:J})=>{Y(J?"dark":"light")})}catch{M.addListener(({matches:K})=>{try{Y(K?"dark":"light")}catch(X){console.error(X)}})}},[u]),oe.useEffect(()=>{N.length<=1&&E(!1)},[N]),oe.useEffect(()=>{let M=J=>{var K,X;s.every(de=>J[de]||J.code===de)&&(E(!0),(K=B.current)==null||K.focus()),J.code==="Escape"&&(document.activeElement===B.current||(X=B.current)!=null&&X.contains(document.activeElement))&&E(!1)};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[s]),oe.useEffect(()=>{if(B.current)return()=>{F.current&&(F.current.focus({preventScroll:!0}),F.current=null,ee.current=!1)}},[B.current]),oe.createElement("section",{ref:t,"aria-label":`${_} ${q}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},P.map((M,J)=>{var K;let[X,de]=M.split("-");return N.length?oe.createElement("ol",{key:M,dir:x==="auto"?Kp():x,tabIndex:-1,ref:B,className:l,"data-sonner-toaster":!0,"data-theme":L,"data-y-position":X,"data-lifted":D&&N.length>1&&!o,"data-x-position":de,style:{"--front-toast-height":`${((K=A[0])==null?void 0:K.height)||0}px`,"--width":`${RP}px`,"--gap":`${v}px`,...p,...BP(c,d)},onBlur:te=>{ee.current&&!te.currentTarget.contains(te.relatedTarget)&&(ee.current=!1,F.current&&(F.current.focus({preventScroll:!0}),F.current=null))},onFocus:te=>{te.target instanceof HTMLElement&&te.target.dataset.dismissible==="false"||ee.current||(ee.current=!0,F.current=te.relatedTarget)},onMouseEnter:()=>E(!0),onMouseMove:()=>E(!0),onMouseLeave:()=>{I||E(!1)},onDragEnd:()=>E(!1),onPointerDown:te=>{te.target instanceof HTMLElement&&te.target.dataset.dismissible==="false"||S(!0)},onPointerUp:()=>S(!1)},N.filter(te=>!te.position&&J===0||te.position===M).map((te,ae)=>{var re,le;return oe.createElement(zP,{key:te.id,icons:w,index:ae,toast:te,defaultRichColors:f,duration:(re=g==null?void 0:g.duration)!=null?re:h,className:g==null?void 0:g.className,descriptionClassName:g==null?void 0:g.descriptionClassName,invert:n,visibleToasts:y,closeButton:(le=g==null?void 0:g.closeButton)!=null?le:i,interacting:I,position:M,style:g==null?void 0:g.style,unstyled:g==null?void 0:g.unstyled,classNames:g==null?void 0:g.classNames,cancelButtonStyle:g==null?void 0:g.cancelButtonStyle,actionButtonStyle:g==null?void 0:g.actionButtonStyle,removeToast:$,toasts:N.filter(ue=>ue.position==te.position),heights:A.filter(ue=>ue.position==te.position),setHeights:T,expandByDefault:o,gap:v,loadingIcon:b,expanded:D,pauseWhenPageIsHidden:C,swipeDirections:e.swipeDirections})})):null}))});const Jy=m.createContext(null),hi="zapdata-impersonation",$P=({children:e})=>{const t=Rt(),n=$n(),r=!!n&&n.status!=="legacy"&&n.status!=="signed-out",[s,o]=m.useState(()=>{const c=r?null:localStorage.getItem(hi);if(c)try{return JSON.parse(c)}catch{return{isImpersonating:!1,impersonatedEmail:null,impersonatedUserId:null,originalAdminId:null,accessLogId:null}}return{isImpersonating:!1,impersonatedEmail:null,impersonatedUserId:null,originalAdminId:null,accessLogId:null}});m.useEffect(()=>{s.isImpersonating?localStorage.setItem(hi,JSON.stringify(s)):localStorage.removeItem(hi)},[s]);const i=async(c,d)=>
406{if(r)throw new Error("Use uma empresa autorizada no seletor para acessar seus dados.");try{const{data:{user:u}}=await he.auth.getUser();if(!u){rt.error("Você não está logado");return}let f=null;try{const{data:p,error:y}=await he.rpc("log_admin_data_access",{p_target_user_id:c,p_target_email:d,p_access_type:"impersonation"});if(y)throw y;f=p}catch(p){console.warn("Falha ao registrar log de auditoria de impersonação (não bloqueante):",p)}const h={isImpersonating:!0,impersonatedEmail:d,impersonatedUserId:c,originalAdminId:u.id,accessLogId:f};localStorage.setItem(hi,JSON.stringify(h)),o(h),rt.success(`Agora você está visualizando como ${d}`),t("/")}catch(u){console.error("Error starting impersonation:",u),rt.error("Erro ao iniciar impersonação")}},l=()=>{s.accessLogId&&he.rpc("end_admin_data_access",{p_log_id:s.accessLogId}).then(({error:c})=>{c&&console.warn("Falha ao encerrar log de auditoria de impersonação (não bloqueante):",c)}),o({isImpersonating:!1,impersonatedEmail:null,impersonatedUserId:null,originalAdminId:null,accessLogId:null}),rt.success("Voltou para a conta de admin"),t("/admin-panel")};return a.jsx(Jy.Provider,{value:{...s,startImpersonation:i,stopImpersonation:l},children:e})},qo=()=>{const e=m.useContext(Jy);if(!e)throw new Error("useImpersonation must be used within ImpersonationProvider");return e},Gs={automati_zap:!0,metricas:!0,organizador_numeros:!0,track_ofertas:!1,automati_zap_flows:!1,automati_zap_edit_flows:!1,automati_zap_delete_contacts:!1},Sf=m.createContext({isCollaborator:!1,parentUserId:null,permissions:Gs,loading:!0,effectiveUserId:null,canAccessSystem:()=>!0,canManageInstances:!0,collaboratorName:null,collabHideInstances:!1,collabMessageSigning:!1,allowedInstanceIds:null}),Da=()=>m.useContext(Sf),sa={"/inbox":"automati_zap","/metricas":"metricas","/organizador-numeros":"organizador_numeros","/track-ofertas":"track_ofertas",automatizap:"automati_zap","automatizap-x1":"automati_zap",metricas:"metricas",organizador:"organizador_numeros","track-ofertas":"track_ofertas"},eb=new Set(["funil","criativos-imagem","criativos-video","entregavel-site","audio-criacao","transcricao","limpa-hash","extensao-ads","gerador-palavras","disparazap","tiktok","zap-converter","settings-sidebar","subscription-sidebar","sms-bot","smm-panel","track-ofertas"]),tb=new Set(["/marketplace","/affiliate","/subscription","/settings","/ads","/gerador-audio","/transcricao-audio","/disparador","/video-downloader","/zap-converter","/limpa-hash","/fabrica-criativos","/gerador-palavras-chaves","/extensao-ads","/sms-bot","/smm-panel","/track-ofertas","/criativos"]),Cf="collaborator_status_cache_v1",UP=5*60*1e3,WP=e=>{try{const t=Mt.getItem(Cf);if(!t)return null;const n=JSON.parse(t);return n.userId!==e||Date.now()-n.ts>UP?null:n}catch{return null}},Yp=e=>{try{Mt.setItem(Cf,JSON.stringify({...e,ts:Date.now()}))}catch{}},HP=()=>{try{Mt.removeItem(Cf)}catch{}},qP=({children:e})=>{const{user:t}=at(),n=t?WP(t.id):null,[r,s]=m.useState((n==null?void 0:n.isCollaborator)??!1),[o,i]=m.useState((n==null?void 0:n.parentUserId)??null),[l,c]=m.useState((n==null?void 0:n.permissions)??Gs),[d,u]=m.useState(!n),[f,h]=m.useState((n==null?void 0:n.collaboratorName)??null),[p,y]=m.useState((n==null?void 0:n.collabHideInstances)??!1),[g,x]=m.useState((n==null?void 0:n.collabMessageSigning)??!1),[v,b]=m.useState((n==null?void 0:n.allowedInstanceIds)??null),w=m.useRef(!!n);m.useEffect(()=>{const N=async()=>{if(!t){s(!1),i(null),c(Gs),h(null),y(!1),x(!1),b(null),u(!1),HP();return}w.current||u(!0);try{const P=await Promise.race([he.from("collaborators").select("parent_user_id, permissions, is_active, name, allowed_instance_ids").eq("collaborator_user_id",t.id).eq("is_active",!0).maybeSingle(),new Promise(T=>setTimeout(()=>T({data:null,error:"timeout"}),8e3))]);if(typeof P.error=="string"&&P.error==="timeout"){console.warn("[COLLAB] Query timed out, defaulting to non-collaborator"),s(!1),u(!1);return}if(P.error&&typeof P.error!="string"){console.error("[COLLAB] Error checking collaborator status:",P.error),s(!1),u(!1);return}const A=P.data;if(A){const T={...Gs,...A.permissions},D=A.allowed_instance_ids||null;
406s(!0),i(A.parent_user_id),h(A.name||null),b(D),c(T);const{data:E}=await he.from("profiles").select("collab_hide_instances, collab_message_signing").eq("id",A.parent_user_id).single(),I=(E==null?void 0:E.collab_hide_instances)||!1,S=(E==null?void 0:E.collab_message_signing)||!1;E&&(y(I),x(S)),Yp({userId:t.id,isCollaborator:!0,parentUserId:A.parent_user_id,permissions:T,collaboratorName:A.name||null,collabHideInstances:I,collabMessageSigning:S,allowedInstanceIds:D})}else s(!1),i(null),h(null),b(null),Yp({userId:t.id,isCollaborator:!1,parentUserId:null,permissions:Gs,collaboratorName:null,collabHideInstances:!1,collabMessageSigning:!1,allowedInstanceIds:null})}catch(P){console.error("[COLLAB] Error:",P),s(!1)}finally{u(!1),w.current=!0}},k=setTimeout(()=>{u(!1)},1e4);return N().finally(()=>clearTimeout(k)),()=>clearTimeout(k)},[t]);const _=m.useCallback(N=>{if(!r)return!0;if(eb.has(N))return!1;const k=N.startsWith("/")?N:`/${N}`;for(const A of tb)if(k===A||k.startsWith(A+"/"))return!1;const P=sa[N]||sa[k];if(P)return l[P]===!0;for(const[A,T]of Object.entries(sa))if(A.startsWith("/")&&k.startsWith(A))return l[T]===!0;return!1},[r,l]),C=r&&o?o:(t==null?void 0:t.id)||null;return a.jsx(Sf.Provider,{value:{isCollaborator:r,parentUserId:o,permissions:l,loading:d,effectiveUserId:C,canAccessSystem:_,canManageInstances:!r,collaboratorName:f,collabHideInstances:p,collabMessageSigning:g,allowedInstanceIds:v},children:e})},GP=({children:e})=>{const t=$n();return!t||t.status==="legacy"||t.status==="signed-out"?a.jsx(qP,{children:e}):a.jsx(KP,{children:e})};function KP({children:e}){var d,u;const t=$n(),{scope:n,runScoped:r}=t,[s,o]=m.useState({hide:!0,signing:!1,name:null});m.useEffect(()=>{let f=!0;if(o({hide:!0,signing:!1,name:null}),!!n)return r(async()=>{var y,g,x;const h=await he.from("profiles").select("collab_hide_instances,collab_message_signing").eq("id",n.owner_user_id).single();if(h.error)throw h.error;const p=await he.from("profiles").select("username").eq("id",n.actor_user_id).single();if(p.error)throw p.error;return{hide:((y=h.data)==null?void 0:y.collab_hide_instances)===!0,signing:((g=h.data)==null?void 0:g.collab_message_signing)===!0,name:((x=p.data)==null?void 0:x.username)??null}}).then(h=>{f&&o(h)}).catch(()=>{}),()=>{f=!1}},[n,r]);const i=t.operationContext,l=(i==null?void 0:i.role)==="owner"||(i==null?void 0:i.role)==="admin",c=Object.fromEntries(Object.keys(Gs).map(f=>[f,l||(i==null?void 0:i.permissions[f])===!0]));return a.jsx(Sf.Provider,{value:{isCollaborator:!l,parentUserId:((d=t.scope)==null?void 0:d.owner_user_id)??null,effectiveUserId:((u=t.scope)==null?void 0:u.owner_user_id)??null,permissions:c,loading:t.status==="loading",canAccessSystem:f=>{var y;if(!i||!t.scope)return!1;if(l)return!0;const h=f.startsWith("/")?f:`/${f}`;if(eb.has(f)||[...tb].some(g=>h===g||h.startsWith(`${g}/`)))return!1;const p=sa[f]??sa[h]??((y=Object.entries(sa).find(([g])=>g.startsWith("/")&&h.startsWith(`${g}/`)))==null?void 0:y[1]);return p?c[p]:!1},canManageInstances:!!l,collaboratorName:l?null:s.name,collabHideInstances:!l&&s.hide,collabMessageSigning:s.signing,allowedInstanceIds:l?null:(i==null?void 0:i.allowed_instance_ids)??[]},children:e})}const nb=m.createContext({isAdmin:!1,isSupport:!1,hasAdminAccess:!1,loading:!0}),jf=()=>m.useContext(nb),kf="admin_status_cache";function Xp(e){try{const t=sessionStorage.getItem(kf);if(!t)return null;const n=JSON.parse(t);return n.userId!==e||Date.now()-n.timestamp>=3e5?null:n}catch{return null}}function YP(e,t,n){try{sessionStorage.setItem(kf,JSON.stringify({userId:e,isAdmin:t,isSupport:n,timestamp:Date.now()}))}catch{}}function Vd(){try{sessionStorage.removeItem(kf)}catch{}}const XP=({children:e})=>{const{user:t,loading:n}=at(),r=t?Xp(t.id):null,[s,o]=m.useState((r==null?void 0:r.isAdmin)??!1),[i,l]=m.useState((r==null?void 0:r.isSupport)??!1),[c,d]=m.useState(!r);m.useEffect(()=>{if(n)return;if(!t){o(!1),l(!1),d(!1),Vd();return}const f=Xp(t.id);f&&(o(f.isAdmin),l(f.isSupport),d(!1)),(async()=>{try{const{data:p,error:y}=await he.from("user_roles").select("role").eq("user_id",t.id).in("role",["admin","support"]),g=!y&&p?p.map(b=>b.role):[],x=g.includes("admin"),v=g.includes("support");o(x),l(v),YP(t.id,x,v),!x&&!v&&Vd()}catch{o(!1),l(!1)}finally{d(!1)}})()},[t,n]);const u=s||i;return a.jsx(nb.Provider,{value:{isAdmin:s,isSupport:i,hasAdminAccess:u,loading:c},children:e})},Go=()=>jf(),rb=m.createContext(null),sb="credits_system_status_cache",ZP=5*60*1e3,Zp={status:"inactive",activated_at:null},Qp=()=>{try{const e=rr.getItem(sb);if(!e)return null;const t=JSON.parse(e);return Date.now()-t.timestamp>ZP?null:t.config}catch{return null}},QP=e=>{try{const t={config:e,timestamp:Date.now()};rr.setItem(sb,JSON.stringify(t))}catch{}},ab="credits_system_user_flags_cache_v1",JP=5*60*1e3,eA=e=>{try{const t=Mt.getItem(ab);if(!t)return null;const n=JSON.parse(t);return n.userId!==e||Date.now()-n.ts>JP?null:n}catch{return null}},tA=e=>{try{Mt.setItem(ab,JSON.stringify(e))}catch{}},nA=({children:e})=>{const{user:t}=at(),n=$n(),{isAdmin:r}=Go(),[s,o]=m.useState(()=>Qp()??{status:"inactive",activated_at:null}),[i,l]=m.useState(!1),[c,d]=m.useState(!1),[u,f]=m.useState(()=>!Qp()),[h,p]=m.useState(!1),y=m.useCallback(async()=>
406{if(!t){l(!1),d(!1),p(!0);return}if(n!=null&&n.scope){l(!1),d(!1),p(!0);return}const N=eA(t.id);N&&(l(N.isTestUser),d(N.isSemiFullMember),p(!0));try{const{data:k,error:P}=await he.from("profiles").select("credits_system_test_user, is_semi_full_member").eq("id",t.id).maybeSingle();if(P){console.error("Error checking user flags:",P),p(!0);return}const A=(k==null?void 0:k.credits_system_test_user)??!1,T=(k==null?void 0:k.is_semi_full_member)??!1;l(A),d(T),tA({userId:t.id,isTestUser:A,isSemiFullMember:T,ts:Date.now()})}catch(k){console.error("Error:",k)}finally{p(!0)}},[t,n==null?void 0:n.scope]),g=m.useCallback(async(N=!1)=>{o(Zp),QP(Zp),f(!1)},[]);m.useEffect(()=>{(async()=>{f(!0),p(!1),await Promise.all([g(),y()])})()},[g,y]);const x=m.useCallback(async N=>!1,[]),v=(()=>{if(!h)return!1;if(i||c)return!0;switch(s.status){case"inactive":return!1;case"admin_test":case"admin_partial_simulation":return r;case"active":return!0;default:return!1}})(),b=s.status==="admin_test"&&r,w=s.status==="admin_partial_simulation"&&r,_=u||!h,C={isActive:v,isAdminTesting:b,isSimulatingPartial:w,isTestUser:i,isSemiFullMember:c,systemStatus:s.status,activatedAt:s.activated_at,loading:_,refresh:()=>g(!0),updateStatus:x};return a.jsx(rb.Provider,{value:C,children:e})},rA=()=>{const e=m.useContext(rb);if(!e)throw new Error("useCreditsSystemContext must be used within a CreditsSystemProvider");return e};function Ko(e){if(typeof e!="string")return null;const t=/^(basic|pro)_v2_([1-9]\d*)$/.exec(e);if(!t)return null;const n=Number(t[2]);return!Number.isSafeInteger(n)||n>1e4?null:{family:t[1],connections:n}}function Jp(e,t){const n=`${e}_v2_${t}`;if(!Ko(n))throw new RangeError("Escolha de 1 a 10.000 conexões.");return n}function jc(e){return typeof e=="string"&&!e.startsWith("pro_v2_")}function sA(e){if(!(e!=null&&e.trial_ends_at))return!1;const t=Date.parse(e.trial_ends_at),n=Date.parse(e.current_period_end??"");return Number.isFinite(t)&&(!Number.isFinite(n)||n<=t)}const kc=[[1,59],[3,119],[5,169],[8,219],[12,319],[20,519]],em=500,aA=5;function No(e,t,n){if(!Number.isSafeInteger(e)||e<t)throw new RangeError(`${n} must be a safe integer >= ${t}`);return e}function Ef(e){return No(e,0,"amount_cents")}function oA(e){No(e,1,"connections");for(let t=1;t<kc.length;t++){const[n,r]=kc[t];if(e<=n){const[s,o]=kc[t-1];return Math.round(o+(e-s)*(r-o)/(n-s))}}return No(519+(e-20)*25,0,"monthly_brl")}function Nf(e,t,n){if(e!=="basic"&&e!=="pro")throw new RangeError("Invalid plan family");const r=oA(t),s=e==="basic"?r:t===1?97:Math.ceil(r*165/100);let o;switch(n){case"monthly":o=s;break;case"quarterly":o=Math.round(s*24/10);break;case"yearly":o=Math.round(s*84/10);break;default:throw new RangeError("Invalid billing period")}return Ef(o*100)}function tm(e){return No(e,em,"telegram_capacity"),e===em?0:Ef(e*aA)}function H$(e,t,n){No(n,0,"active_admitted_leads");const r=tm(e),s=tm(t),o=t>e?"upgrade":t<e?"downgrade":"unchanged";return{change:o,effective:o==="upgrade"?"after_payment":o==="downgrade"?"next_renewal":"unchanged",currentCapacity:e,targetCapacity:t,chargeNowCents:o==="upgrade"?Ef(s-r):0,targetMonthlyCents:s,leadsToDelete:o==="downgrade"?Math.max(0,n-t):0}}async function iA(e,t){const{data:n,error:r}=await he.functions.invoke("plan-catalog-quote",{body:{family:e,connections:t}});if(r||!(n!=null&&n.plan))throw new Error((n==null?void 0:n.message)??"Não foi possível preparar o plano. Tente novamente.");return n.plan}const ro="enterprise",_s=21,ob=100,lA=20,cA=519,dA=25;function ib(e){return e===ro}function uA(e){const t=typeof e=="number"?e:typeof e=="string"?Number(e):NaN;return!Number.isInteger(t)||t<_s||t>ob?null:t}function Pf(e){return cA+(e-lA)*dA}function ur(e,t){const n=Pf(e);return t==="quarterly"?Math.round(n*2.4):t==="yearly"?Math.round(n*8.4):n}function fA(e,t){const n=ur(e,t);return t==="quarterly"?Math.round(n/3):t==="yearly"?Math.round(n/12):n}function hA(e=_s){const t=Math.max(_s,e),n=[];for(let r=t;r<=ob;r++)n.push(r);return n}function pA(e,t){if(!e||!ib(e.id))return e;const n=uA(t)??_s;return{...e,name:`${e.name} (${n} números)`,max_instances:n,price_brl:Pf(n),price_brl_quarterly:ur(n,"quarterly"),price_brl_yearly:ur(n,"yearly")}}const lb=m.createContext(null),nm=e=>he.rpc("company_billing_status",{p_company_id:e}),cb="subscription_plans_cache_v2",mA=10*60*1e3,Af="user_subscription_cache_v1",gA=2*60*1e3,xA=()=>{try{const e=rr.getItem(cb);if(!e)return null;const t=JSON.parse(e);return Date.now()-t.ts>mA?null:t.data}catch{return null}},vA=e=>{try{rr.setItem(cb,JSON.stringify({ts:Date.now(),data:e}))}catch{}},yA=e=>{try{const t=Mt.getItem(Af);if(!t)return null;const n=JSON.parse(t);return n.userId!==e||Date.now()-n.ts>gA?null:n.data}catch{return null}},bA=(e,t)=>
406{try{Mt.setItem(Af,JSON.stringify({ts:Date.now(),userId:e,data:t}))}catch{}},wA=({children:e})=>{var U;const{user:t}=at(),n=$n(),r=!!(n!=null&&n.scope),[s,o]=m.useState(null),[i,l]=m.useState(()=>xA()??[]),[c,d]=m.useState(null),[u,f]=m.useState(!1),[h,p]=m.useState({allExpired:!1,latestExpiry:null}),[y,g]=m.useState(!0),[x,v]=m.useState(!1),b=m.useCallback(async()=>{if(!t){v(!1);return}try{const{data:V,error:Q}=n!=null&&n.scope?await nm(n.scope.company_id):await he.rpc("get_my_block_status").maybeSingle();if(Q)throw Q;const W=V;v(r?!!(W!=null&&W.identity_blocked)||!!(W!=null&&W.financial_suspended):!!(V!=null&&V.is_blocked))}catch{r&&v(!0)}},[t,r]);m.useEffect(()=>{b()},[b]),m.useEffect(()=>{const V=()=>b();return window.addEventListener("subscription-changed",V),()=>window.removeEventListener("subscription-changed",V)},[b]);const w=m.useCallback(async()=>{if(!t){o(null);return}try{if(n!=null&&n.scope){const{data:Q,error:W}=await nm(n.scope.company_id);if(W||(Q==null?void 0:Q.company_id)!==n.scope.company_id)throw W??new Error("Invalid billing company");o(Q.subscription??null),v(!!Q.identity_blocked||!!Q.financial_suspended);return}const{data:V}=await he.from("user_subscriptions").select("*").eq("user_id",t.id).maybeSingle();o(V),bA(t.id,V)}catch(V){r&&(o(null),v(!0)),console.error("Error fetching subscription:",V)}},[t]),_=m.useCallback(async()=>{try{const{data:V}=await he.from("subscription_plans").select("*").eq("is_active",!0).or("id.not.like.%_v2_%,max_instances.lte.20").order("sort_order");V&&(l(V),vA(V))}catch(V){console.error("Error fetching plans:",V)}},[]),C=m.useCallback(async()=>{var V,Q;if(!t){f(!1),p({allExpired:!1,latestExpiry:null});return}if(((V=n==null?void 0:n.scope)==null?void 0:V.role)!=="member")try{const{count:W}=await he.from("instance_subscriptions").select("*",{count:"exact",head:!0}).eq("user_id",t.id).eq("is_free",!1).or(`expires_at.gt.${new Date().toISOString()},expires_at.is.null`),{count:se}=await he.from("instance_credit_slots").select("*",{count:"exact",head:!0}).eq("user_id",t.id).gt("expires_at",new Date().toISOString());f((W??0)>0||(se??0)>0);const{data:fe}=await he.from("instance_credit_slots").select("expires_at").eq("user_id",t.id).order("expires_at",{ascending:!1}).limit(1),ce=(fe==null?void 0:fe.length)??0,me=(W??0)>0||(se??0)>0;if(ce>0&&!me){const ke=(Q=fe==null?void 0:fe[0])!=null&&Q.expires_at?new Date(fe[0].expires_at):null;p({allExpired:!0,latestExpiry:ke})}else p({allExpired:!1,latestExpiry:null})}catch(W){console.error("Error fetching avulsa instances:",W)}},[t]),N=m.useRef(void 0);m.useEffect(()=>{(async()=>{const Q=(t==null?void 0:t.id)??null;if(Q&&N.current!==Q){const W=yA(Q);if(W!==null||Mt.getItem(Af)){o(W),g(!1),N.current=Q,Promise.all([w(),_()]).catch(()=>{});return}g(!0)}await Promise.all([w(),_()]),N.current=Q,g(!1)})()},[t,w,_]),m.useEffect(()=>{C()},[C]),m.useEffect(()=>{let V=0;const Q=5*60*1e3,W=()=>{const fe=Date.now();fe-V>Q&&(V=fe,w(),b())},se=()=>{w(),b()};return window.addEventListener("focus",W),window.addEventListener("subscription-changed",se),()=>{window.removeEventListener("focus",W),window.removeEventListener("subscription-changed",se)}},[w,b]),m.useEffect(()=>{const V=s==null?void 0:s.plan_id;if(!V||!/^(basic|pro)_v2_[1-9]\d*$/.test(V)){d(null);return}let Q=!1;return he.from("subscription_plans").select("*").eq("id",V).maybeSingle().then(({data:W})=>{Q||d(W)}),()=>{Q=!0}},[s==null?void 0:s.plan_id]);const k=i.find(V=>V.id===(s==null?void 0:s.plan_id))??((c==null?void 0:c.id)===(s==null?void 0:s.plan_id)?c:null),P=s==null?void 0:s.custom_max_instances,A=pA(k,P),T=P??(A==null?void 0:A.max_instances)??0,D=((U=Ko(s==null?void 0:s.plan_id))==null?void 0:U.family)==="pro"&&(sA(s)||["pending_authorization","authorized_pending_charge","trialing"].includes((s==null?void 0:s.status)??"")),E=!!s&&!D&&s.plan_id!=="free"&&(s.status==="active"||s.status==="authorized_pending_charge"&&!!s.current_period_end&&new Date(s.current_period_end)>new Date||s.status==="pending_authorization"&&!!s.current_period_end&&new Date(s.current_period_end)>new Date),I=(s==null?void 0:s.plan_id)==="free",S=!!(s!=null&&s.trial_ends_at)&&new Date(s.tri
406al_ends_at)>new Date,L=s!=null&&s.trial_ends_at?new Date(s.trial_ends_at):null,Y=!!t&&(!s||s.status==="pending_authorization"&&!E||s.status==="pending"),B=I&&!!(s!=null&&s.trial_ends_at)&&new Date(s.trial_ends_at)<=new Date,q=(s==null?void 0:s.status)==="past_due",F=!!s&&["expired","canceled","suspended"].includes(s.status)&&s.plan_id!=="free"&&s.status!=="incomplete",ee=s!=null&&s.grace_period_end?new Date(s.grace_period_end):null,$=!!s&&s.plan_id!=="free"&&!!s.current_period_end&&new Date(s.current_period_end)>new Date,M=E||!!s&&s.status==="expired"&&s.plan_id!=="free"&&!!ee&&ee>new Date,J=!E&&!$&&(q||F)&&!!ee&&ee>new Date,K=!E&&!$&&(q||F)&&!!ee&&ee<=new Date,X=!!s&&s.status==="active"&&s.cancel_at_period_end,de=s!=null&&s.current_period_end?new Date(s.current_period_end):null,te=F&&!ee,ae=h.allExpired&&I,re=h.latestExpiry?new Date(h.latestExpiry.getTime()+3*24*60*60*1e3):null,le=ae&&!!re&&re>new Date,ue=ae&&!!re&&re<=new Date,z=h.allExpired&&E,ie=z&&h.latestExpiry?new Date(h.latestExpiry.getTime()+3*24*60*60*1e3):null,j=z&&!!ie&&ie>new Date,H=z&&!!ie&&ie<=new Date,G=m.useCallback(async V=>{if(t)try{const{data:Q,error:W}=await he.functions.invoke("create-plan-checkout",{body:{plan_id:V}});if(W)throw W;Q!=null&&Q.url&&window.open(Q.url,"_blank"),Q!=null&&Q.success&&V==="free"&&(await w(),window.dispatchEvent(new Event("subscription-changed")))}catch(Q){throw console.error("Checkout error:",Q),Q}},[t,w]),O=m.useCallback(async()=>{try{const Q=(s==null?void 0:s.gateway)==="efi"?"efi-cancel-plan-subscription":"cancel-plan-subscription",{data:W,error:se}=await he.functions.invoke(Q);if(se)throw se;return await w(),W==null?void 0:W.success}catch(V){return console.error("Cancel error:",V),!1}},[w,s]),R={subscription:s,plans:i,currentPlan:A,effectiveMaxInstances:T,hasActivePlan:E,hasUsablePlan:M,isFreePlan:I,isTrialActive:S,trialEndsAt:L,needsPlanSelection:Y,isTrialExpired:B,isPastDue:q,isSubscriptionExpired:F,isInGracePeriod:J,isGraceExpired:K,gracePeriodEnd:ee,isCancelScheduled:X,periodEndDate:de,isImmediateBlock:te,suspensionReason:(s==null?void 0:s.suspension_reason)??null,isPaymentFailure:te&&(s==null?void 0:s.suspension_reason)==="payment_failure",isAdminBlocked:x,hasAvulsaInstances:u,hasCreditSlotsExpired:ae,creditSlotGraceEnd:re,isCreditSlotGracePeriod:le,isCreditSlotGraceExpired:ue,hasExpiredAvulsaSlots:z,avulsaSlotGraceEnd:ie,isAvulsaSlotGracePeriod:j,isAvulsaSlotGraceExpired:H,loading:y,startCheckout:G,cancelSubscription:O,refresh:w};return a.jsx(lb.Provider,{value:R,children:e})},Al=()=>{const e=m.useContext(lb);if(!e)throw new Error("useUserSubscriptionContext must be used within a UserSubscriptionProvider");return e},rm=["marketplace","metricas","organizador-numeros","track-ofertas"],sm=["gerador-audio","transcricao-audio"],db=m.createContext(null),_A=({children:e})=>{const t=$n(),{isAdmin:n,loading:r}=jf(),s=!(t!=null&&t.scope)&&n,{subscription:o,loading:i,refresh:l}=Al(),c=(o==null?void 0:o.status)??"",d=o!=null&&o.grace_period_end?new Date(o.grace_period_end).getTime()>Date.now():!1,u=c==="active"||c==="trialing"||d,f=r||i,h=f?null:s||u,p=!1,y=m.useCallback(b=>{if(f||h===null||s||h)return!0;const w=b.replace(/^\//,"").toLowerCase();return rm.some(_=>w===_||w.startsWith(_))},[f,h,s]),g=m.useCallback(b=>{const w=b.replace(/^\//,"").toLowerCase();return sm.some(_=>w===_||w.startsWith(_))},[]),x=m.useCallback(()=>{l()},[l]),v={isFullMember:h,isSemiFullMember:p,isAdmin:s,loading:f,canAccessSystem:y,isRestrictedSystem:g,refreshAccessLevel:x,FREE_SYSTEMS:rm,MEMBER_ONLY_SYSTEMS:sm};return a.jsx(db.Provider,{value:v,children:e})},SA=()=>{const e=m.useContext(db);if(!e)throw new Error("useAccessLevelContext must be used within an AccessLevelProvider");return e},ub=m.createContext(null),am=6.5,CA=({children:e})=>{const[t,n]=m.useState(0),[r,s]=m.useState([]),[o,i]=m.useState(!0),l=m.useCallback(async()=>{n(0),i(!1)},[]),c=m.useCallback(async()=>{s([])},[]);m.useEffect(()=>{l()},[l]);const d=m.useCallback(g=>!0,[]),u=m.useCallback(async(g,x,v)=>!0,[]),f=m.useCallback(g=>{const x=g*am;return new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(x)},[]),h=m.useCallback(g=>g/am,[]),p=m.useCallback(async()=>{i(!0),await Promise.all([l(),c()])},[l,c]),y={balance:t,loading:o,canAfford:d,deductCredits:u,transactions:r,loadTransactions:c,refresh:p,creditsToReais:f,reaisToCredits:h};return a.jsx(ub.Provider,{value:y,children:e})},jA=()=>{const e=m.useContext(ub);if(!e)throw new Error("useCreditsContext must be used within a CreditsProvi
406der");return e},Xr=()=>Al(),Tf=()=>SA();var Ec="focusScope.autoFocusOnMount",Nc="focusScope.autoFocusOnUnmount",om={bubbles:!1,cancelable:!0},kA="FocusScope",Tl=m.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...i}=e,[l,c]=m.useState(null),d=$r(s),u=$r(o),f=m.useRef(null),h=Ze(t,g=>c(g)),p=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(r){let g=function(w){if(p.paused||!l)return;const _=w.target;l.contains(_)?f.current=_:kr(f.current,{select:!0})},x=function(w){if(p.paused||!l)return;const _=w.relatedTarget;_!==null&&(l.contains(_)||kr(f.current,{select:!0}))},v=function(w){if(document.activeElement===document.body)for(const C of w)C.removedNodes.length>0&&kr(l)};document.addEventListener("focusin",g),document.addEventListener("focusout",x);const b=new MutationObserver(v);return l&&b.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",x),b.disconnect()}}},[r,l,p.paused]),m.useEffect(()=>{if(l){lm.add(p);const g=document.activeElement;if(!l.contains(g)){const v=new CustomEvent(Ec,om);l.addEventListener(Ec,d),l.dispatchEvent(v),v.defaultPrevented||(EA(IA(fb(l)),{select:!0}),document.activeElement===g&&kr(l))}return()=>{l.removeEventListener(Ec,d),setTimeout(()=>{const v=new CustomEvent(Nc,om);l.addEventListener(Nc,u),l.dispatchEvent(v),v.defaultPrevented||kr(g??document.body,{select:!0}),l.removeEventListener(Nc,u),lm.remove(p)},0)}}},[l,d,u,p]);const y=m.useCallback(g=>{if(!n&&!r||p.paused)return;const x=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,v=document.activeElement;if(x&&v){const b=g.currentTarget,[w,_]=NA(b);w&&_?!g.shiftKey&&v===_?(g.preventDefault(),n&&kr(w,{select:!0})):g.shiftKey&&v===w&&(g.preventDefault(),n&&kr(_,{select:!0})):v===b&&g.preventDefault()}},[n,r,p.paused]);return a.jsx(Ie.div,{tabIndex:-1,...i,ref:h,onKeyDown:y})});Tl.displayName=kA;function EA(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(kr(r,{select:t}),document.activeElement!==n)return}function NA(e){const t=fb(e),n=im(t,e),r=im(t.reverse(),e);return[n,r]}function fb(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function im(e,t){for(const n of e)if(!PA(n,{upTo:t}))return n}function PA(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function AA(e){return e instanceof HTMLInputElement&&"select"in e}function kr(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&AA(e)&&t&&e.select()}}var lm=TA();function TA(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=cm(e,t),e.unshift(t)},remove(t){var n;e=cm(e,t),(n=e[0])==null||n.resume()}}}function cm(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function IA(e){return e.filter(t=>t.tagName!=="A")}var Pc=0;function If(){m.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??dm()),document.body.insertAdjacentElement("beforeend",e[1]??dm()),Pc++,()=>{Pc===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Pc--}},[])}function dm(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Ri="right-scroll-bar-position",Di="width-before-scroll-bar",MA="with-scroll-bars-hidden",RA="--removed-body-scroll-bar-size";function Ac(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function DA(e,t){var n=m.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var OA=typeof window<"u"?m.useLayoutEffect:m.useEffect,um=new WeakMap;function LA(e,t){var n=DA(null,function(r){return e.forEach(function(s){return Ac(s,r)})});return OA(function(){var r=um.get(n);if(r){var s=new Set(r),o=new Set(e),i=n.current;
vendor: 4,196 bytes, lines 406-421
406s.forEach(function(l){o.has(l)||Ac(l,null)}),o.forEach(function(l){s.has(l)||Ac(l,i)})}um.set(n,e)},[e]),n}function FA(e){return e}function zA(e,t){t===void 0&&(t=FA);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var i=t(o,r);return n.push(i),function(){n=n.filter(function(l){return l!==i})}},assignSyncMedium:function(o){for(r=!0;n.length;){var i=n;n=[],i.forEach(o)}n={push:function(l){return o(l)},filter:function(){return n}}},assignMedium:function(o){r=!0;var i=[];if(n.length){var l=n;n=[],l.forEach(o),i=n}var c=function(){var u=i;i=[],u.forEach(o)},d=function(){return Promise.resolve().then(c)};d(),n={push:function(u){i.push(u),d()},filter:function(u){return i=i.filter(u),n}}}};return s}function BA(e){e===void 0&&(e={});var t=zA(null);return t.options=Nr({async:!0,ssr:!1},e),t}var hb=function(e){var t=e.sideCar,n=Cv(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return m.createElement(r,Nr({},n))};hb.isSideCarExport=!0;function VA(e,t){return e.useMedium(t),hb}var pb=BA(),Tc=function(){},Il=m.forwardRef(function(e,t){var n=m.useRef(null),r=m.useState({onScrollCapture:Tc,onWheelCapture:Tc,onTouchMoveCapture:Tc}),s=r[0],o=r[1],i=e.forwardProps,l=e.children,c=e.className,d=e.removeScrollBar,u=e.enabled,f=e.shards,h=e.sideCar,p=e.noRelative,y=e.noIsolation,g=e.inert,x=e.allowPinchZoom,v=e.as,b=v===void 0?"div":v,w=e.gapMode,_=Cv(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=h,N=LA([n,t]),k=Nr(Nr({},_),s);return m.createElement(m.Fragment,null,u&&m.createElement(C,{sideCar:pb,removeScrollBar:d,shards:f,noRelative:p,noIsolation:y,inert:g,setCallbacks:o,allowPinchZoom:!!x,lockRef:n,gapMode:w}),i?m.cloneElement(m.Children.only(l),Nr(Nr({},k),{ref:N})):m.createElement(b,Nr({},k,{className:c,ref:N}),l))});Il.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Il.classNames={fullWidth:Di,zeroRight:Ri};var $A=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function UA(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=$A();return t&&e.setAttribute("nonce",t),e}function WA(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function HA(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var qA=function(){var e=0,t=null;return{add:function(n){e==0&&(t=UA())&&(WA(t,n),HA(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},GA=function(){var e=qA();return function(t,n){m.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},mb=function(){var e=GA(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},KA={left:0,top:0,right:0,gap:0},Ic=function(e){return parseInt(e||"",10)||0},YA=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[Ic(n),Ic(r),Ic(s)]},XA=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return KA;var t=YA(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},ZA=mb(),aa="data-scroll-locked",QA=function(e,t,n,r){var s=e.left,o=e.top,i=e.right,l=e.gap;return n===void 0&&(n="margin"),`
407  .`.concat(MA,` {
408   overflow: hidden `).concat(r,`;
409   padding-right: `).concat(l,"px ").concat(r,`;
410  }
411  body[`).concat(aa,`] {
412    overflow: hidden `).concat(r,`;
413    overscroll-behavior: contain;
414    `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
415    padding-left: `.concat(s,`px;
416    padding-top: `).concat(o,`px;
417    padding-right: `).concat(i,`px;
418    margin-left:0;
419    margin-top:0;
420    margin-right: `).concat(l,"px ").concat(r,`;
421    `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";
421")].filter(Boolean).join(""),`
422  }
423  
424  .`).concat(Ri,` {
425    right: `).concat(l,"px ").concat(r,`;
426  }
427  
428  .`).concat(Di,` {
429    margin-right: `).concat(l,"px ").concat(r,`;
430  }
431  
432  .`).concat(Ri," .").concat(Ri,` {
433    right: 0 `).concat(r,`;
434  }
435  
436  .`).concat(Di," .").concat(Di,` {
437    margin-right: 0 `).concat(r,`;
438  }
439  
440  body[`).concat(aa,`] {
441    `).concat(RA,": ").concat(l,`px;
442  }
443`)},fm=function(){var e=parseInt(document.body.getAttribute(aa)||"0",10);return isFinite(e)?e:0},JA=function(){m.useEffect(function(){return document.body.setAttribute(aa,(fm()+1).toString()),function(){var e=fm()-1;e<=0?document.body.removeAttribute(aa):document.body.setAttribute(aa,e.toString())}},[])},eT=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;JA();var o=m.useMemo(function(){return XA(s)},[s]);return m.createElement(ZA,{styles:QA(o,!t,s,n?"":"!important")})},$d=!1;if(typeof window<"u")try{var pi=Object.defineProperty({},"passive",{get:function(){return $d=!0,!0}});window.addEventListener("test",pi,pi),window.removeEventListener("test",pi,pi)}catch{$d=!1}var Bs=$d?{passive:!1}:!1,tT=function(e){return e.tagName==="TEXTAREA"},gb=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!tT(e)&&n[t]==="visible")},nT=function(e){return gb(e,"overflowY")},rT=function(e){return gb(e,"overflowX")},hm=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=xb(e,r);if(s){var o=vb(e,r),i=o[1],l=o[2];if(i>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},sT=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},aT=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},xb=function(e,t){return e==="v"?nT(t):rT(t)},vb=function(e,t){return e==="v"?sT(t):aT(t)},oT=function(e,t){return e==="h"&&t==="rtl"?-1:1},iT=function(e,t,n,r,s){var o=oT(e,window.getComputedStyle(t).direction),i=o*r,l=n.target,c=t.contains(l),d=!1,u=i>0,f=0,h=0;do{if(!l)break;var p=vb(e,l),y=p[0],g=p[1],x=p[2],v=g-x-o*y;(y||v)&&xb(e,l)&&(f+=v,h+=y);var b=l.parentNode;l=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(u&&(Math.abs(f)<1||!s)||!u&&(Math.abs(h)<1||!s))&&(d=!0),d},mi=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},pm=function(e){return[e.deltaX,e.deltaY]},mm=function(e){return e&&"current"in e?e.current:e},lT=function(e,t){return e[0]===t[0]&&e[1]===t[1]},cT=function(e){return`
444  .block-interactivity-`.concat(e,` {pointer-events: none;}
445  .allow-interactivity-`).concat(e,` {pointer-events: all;}
446`)},dT=0,Vs=[];function uT(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),s=m.useState(dT++)[0],o=m.useState(mb)[0],i=m.useRef(e);m.useEffect(function(){i.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var g=F2([e.lockRef.current],(e.shards||[]).map(mm),!0).filter(Boolean);return g.forEach(function(x){return x.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),g.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var l=m.useCallback(function(g,x){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!i.current.allowPinchZoom;var v=mi(g),b=n.current,w="deltaX"in g?g.deltaX:b[0]-v[0],_="deltaY"in g?g.deltaY:b[1]-v[1],C,N=g.target,k=Math.abs(w)>Math.abs(_)?"h":"v";if("touches"in g&&k==="h"&&N.type==="range")return!1;var P=hm(k,N);if(!P)return!0;if(P?C=k:(C=k==="v"?"h":"v",P=hm(k,N)),!P)return!1;if(!r.current&&"changedTouches"in g&&(w||_)&&(r.current=C),!C)return!0;var A=r.current||C;return iT(A,x,g,A==="h"?w:_,!0)},[]),c=m.useCallback(function(g){var x=g;if(!(!Vs.length||Vs[Vs.length-1]!==o)){var v="deltaY"in x?pm(x):mi(x),b=t.current.filter(function(C){return C.name===x.type&&(C.target===x.target||x.target===C.shadowParent)&&lT(C.delta,v)}
vendor: 4,137 bytes, line 446
446)[0];if(b&&b.should){x.cancelable&&x.preventDefault();return}if(!b){var w=(i.current.shards||[]).map(mm).filter(Boolean).filter(function(C){return C.contains(x.target)}),_=w.length>0?l(x,w[0]):!i.current.noIsolation;_&&x.cancelable&&x.preventDefault()}}},[]),d=m.useCallback(function(g,x,v,b){var w={name:g,delta:x,target:v,should:b,shadowParent:fT(v)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(_){return _!==w})},1)},[]),u=m.useCallback(function(g){n.current=mi(g),r.current=void 0},[]),f=m.useCallback(function(g){d(g.type,pm(g),g.target,l(g,e.lockRef.current))},[]),h=m.useCallback(function(g){d(g.type,mi(g),g.target,l(g,e.lockRef.current))},[]);m.useEffect(function(){return Vs.push(o),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,Bs),document.addEventListener("touchmove",c,Bs),document.addEventListener("touchstart",u,Bs),function(){Vs=Vs.filter(function(g){return g!==o}),document.removeEventListener("wheel",c,Bs),document.removeEventListener("touchmove",c,Bs),document.removeEventListener("touchstart",u,Bs)}},[]);var p=e.removeScrollBar,y=e.inert;return m.createElement(m.Fragment,null,y?m.createElement(o,{styles:cT(s)}):null,p?m.createElement(eT,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function fT(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const hT=VA(pb,uT);var Ml=m.forwardRef(function(e,t){return m.createElement(Il,Nr({},e,{ref:t,sideCar:hT}))});Ml.classNames=Il.classNames;var pT=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},$s=new WeakMap,gi=new WeakMap,xi={},Mc=0,yb=function(e){return e&&(e.host||yb(e.parentNode))},mT=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=yb(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},gT=function(e,t,n,r){var s=mT(t,Array.isArray(e)?e:[e]);xi[n]||(xi[n]=new WeakMap);var o=xi[n],i=[],l=new Set,c=new Set(s),d=function(f){!f||l.has(f)||(l.add(f),d(f.parentNode))};s.forEach(d);var u=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(h){if(l.has(h))u(h);else try{var p=h.getAttribute(r),y=p!==null&&p!=="false",g=($s.get(h)||0)+1,x=(o.get(h)||0)+1;$s.set(h,g),o.set(h,x),i.push(h),g===1&&y&&gi.set(h,!0),x===1&&h.setAttribute(n,"true"),y||h.setAttribute(r,"true")}catch(v){console.error("aria-hidden: cannot operate on ",h,v)}})};return u(t),l.clear(),Mc++,function(){i.forEach(function(f){var h=$s.get(f)-1,p=o.get(f)-1;$s.set(f,h),o.set(f,p),h||(gi.has(f)||f.removeAttribute(r),gi.delete(f)),p||f.removeAttribute(n)}),Mc--,Mc||($s=new WeakMap,$s=new WeakMap,gi=new WeakMap,xi={})}},Mf=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=pT(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live]"))),gT(r,s,n,"aria-hidden")):function(){return null}},Rl="Dialog",[bb,wb]=Vn(Rl),[xT,Un]=bb(Rl),_b=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:o,modal:i=!0}=e,l=m.useRef(null),c=m.useRef(null),[d,u]=As({prop:r,defaultProp:s??!1,onChange:o,caller:Rl});return a.jsx(xT,{scope:t,triggerRef:l,contentRef:c,contentId:ln(),titleId:ln(),descriptionId:ln(),open:d,onOpenChange:u,onOpenToggle:m.useCallback(()=>u(f=>!f),[u]),modal:i,children:n})};_b.displayName=Rl;var Sb="DialogTrigger",Cb=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Un(Sb,n),o=Ze(t,s.triggerRef);return a.jsx(Ie.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Of(s.open),...r,ref:o,onClick:ze(e.onClick,s.onOpenToggle)})});Cb.displayName=Sb;var Rf="DialogPortal",[vT,jb]=bb(Rf,{forceMount:void 0}),kb=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,o=Un(Rf,t);return a.jsx(vT,{scope:t,forceMount:n,children:m.Children.map(r,i=>a.jsx(Kr,{present:n||o.open,children:a.jsx(kl,{asChild:!0,container:s,children:i})}))})};kb.displayName=Rf;var tl="DialogOverlay",Eb=m.forwardRef((e,t)=>
vendor: 4,903 bytes, lines 446-450
446{const n=jb(tl,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=Un(tl,e.__scopeDialog);return o.modal?a.jsx(Kr,{present:r||o.open,children:a.jsx(bT,{...s,ref:t})}):null});Eb.displayName=tl;var yT=Ns("DialogOverlay.RemoveScroll"),bT=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Un(tl,n);return a.jsx(Ml,{as:yT,allowPinchZoom:!0,shards:[s.contentRef],children:a.jsx(Ie.div,{"data-state":Of(s.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Is="DialogContent",Nb=m.forwardRef((e,t)=>{const n=jb(Is,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=Un(Is,e.__scopeDialog);return a.jsx(Kr,{present:r||o.open,children:o.modal?a.jsx(wT,{...s,ref:t}):a.jsx(_T,{...s,ref:t})})});Nb.displayName=Is;var wT=m.forwardRef((e,t)=>{const n=Un(Is,e.__scopeDialog),r=m.useRef(null),s=Ze(t,n.contentRef,r);return m.useEffect(()=>{const o=r.current;if(o)return Mf(o)},[]),a.jsx(Pb,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ze(e.onCloseAutoFocus,o=>{var i;o.preventDefault(),(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:ze(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,l=i.button===0&&i.ctrlKey===!0;(i.button===2||l)&&o.preventDefault()}),onFocusOutside:ze(e.onFocusOutside,o=>o.preventDefault())})}),_T=m.forwardRef((e,t)=>{const n=Un(Is,e.__scopeDialog),r=m.useRef(!1),s=m.useRef(!1);return a.jsx(Pb,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,o),o.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),o.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:o=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=o.target;((d=n.triggerRef.current)==null?void 0:d.contains(i))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),Pb=m.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:o,...i}=e,l=Un(Is,n),c=m.useRef(null),d=Ze(t,c);return If(),a.jsxs(a.Fragment,{children:[a.jsx(Tl,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:o,children:a.jsx(Uo,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Of(l.open),...i,ref:d,onDismiss:()=>l.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(CT,{titleId:l.titleId}),a.jsx(kT,{contentRef:c,descriptionId:l.descriptionId})]})]})}),Df="DialogTitle",Ab=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Un(Df,n);return a.jsx(Ie.h2,{id:s.titleId,...r,ref:t})});Ab.displayName=Df;var Tb="DialogDescription",Ib=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Un(Tb,n);return a.jsx(Ie.p,{id:s.descriptionId,...r,ref:t})});Ib.displayName=Tb;var Mb="DialogClose",Rb=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Un(Mb,n);return a.jsx(Ie.button,{type:"button",...r,ref:t,onClick:ze(e.onClick,()=>s.onOpenChange(!1))})});Rb.displayName=Mb;function Of(e){return e?"open":"closed"}var Db="DialogTitleWarning",[ST,Ob]=Ej(Db,{contentName:Is,titleName:Df,docsSlug:"dialog"}),CT=({titleId:e})=>{const t=Ob(Db),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
447
448If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
449
450For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return m.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},jT="DialogDescriptionWarning",kT=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ob(jT).contentName}}.`;return m.useEffect(()=>{var o;const s=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Lf=_b,Lb=Cb,Ff=kb,Dl=Eb,Ol=Nb,zf=Ab,Bf=Ib,Ll=Rb;const cn=Lf,ET=Lb,NT=Ff,q$=Ll,Fb=m.forwardRef(({className:e,...t},n)=>a.jsx(Dl,{ref:n,className:xe("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));Fb.displayName=Dl.displayName;const Qt=m.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(NT,{children:[a.jsx(Fb,{}),a.jsxs(Ol,{ref:r,className:xe("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rou
450nded-lg",e),...n,children:[t,a.jsxs(Ll,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-accent data-[state=open]:text-muted-foreground hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[a.jsx(sr,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Qt.displayName=Ol.displayName;const qt=({className:e,...t})=>a.jsx("div",{className:xe("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});qt.displayName="DialogHeader";const zb=({className:e,...t})=>a.jsx("div",{className:xe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});zb.displayName="DialogFooter";const Gt=m.forwardRef(({className:e,...t},n)=>a.jsx(zf,{ref:n,className:xe("text-lg font-semibold leading-none tracking-tight",e),...t}));Gt.displayName=zf.displayName;const En=m.forwardRef(({className:e,...t},n)=>a.jsx(Bf,{ref:n,className:xe("text-sm text-muted-foreground",e),...t}));En.displayName=Bf.displayName;const gm=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,xm=Iy,Vf=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return xm(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:o}=t,i=Object.keys(s).map(d=>{const u=n==null?void 0:n[d],f=o==null?void 0:o[d];if(u===null)return null;const h=gm(u)||gm(f);return s[d][h]}),l=n&&Object.entries(n).reduce((d,u)=>{let[f,h]=u;return h===void 0||(d[f]=h),d},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,u)=>{let{class:f,className:h,...p}=u;return Object.entries(p).every(y=>{let[g,x]=y;return Array.isArray(x)?x.includes({...o,...l}[g]):{...o,...l}[g]===x})?[...d,f,h]:d},[]);return xm(e,i,c,n==null?void 0:n.class,n==null?void 0:n.className)},nl=Vf("relative group inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90 border border-primary/20",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90 border border-destructive/20",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 border border-border/20",ghost:"hover:bg-accent hover:text-accent-foreground border-transparent",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),pe=m.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,neon:s=!0,children:o,...i},l)=>{const c=s&&t!=="link"&&t!=="ghost"&&!r;return r?a.jsx(Pj,{className:xe(nl({variant:t,size:n,className:e})),ref:l,...i,children:o}):a.jsxs("button",{className:xe(nl({variant:t,size:n,className:e})),ref:l,...i,children:[c&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"absolute h-px opacity-0 group-hover:opacity-100 transition-all duration-500 ease-in-out inset-x-0 top-0 bg-gradient-to-r w-3/4 mx-auto from-transparent via-accent to-transparent pointer-events-none"}),a.jsx("span",{className:"absolute group-hover:opacity-30 transition-all duration-500 ease-in-out inset-x-0 h-px -bottom-px bg-gradient-to-r w-3/4 mx-auto from-transparent via-accent to-transparent pointer-events-none"})]}),o]})});pe.displayName="Button";function PT(){return bf({queryKey:["billing-catalog-v2"],staleTime:6e4,retry:!1,queryFn:async()=>{const{data:e,error:t}=await he.rpc("billing_v2_enabled");return t?!1:e===!0}}).data===!0}const vm=e=>new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(e/100),AT=["monthly","quarterly","yearly"],TT={monthly:"Mensal",quarterly:"Trimestral",yearly:"Anual"};
450function Bb({initialConnections:e=1,period:t,onPeriodChange:n,showPeriods:r=!0,compact:s=!1,onChoose:o,eligible:i}){const[l,c]=m.useState("monthly"),d=t??l,[u,f]=m.useState({basic:Math.min(20,e),pro:Math.min(20,e)}),[h,p]=m.useState("pro"),[y,g]=m.useState(String(Math.max(21,e))),[x,v]=m.useState(null),[b,w]=m.useState(""),_=async(k,P,A)=>{v(A),w("");try{await o(k,P,d)}catch(T){w(T instanceof Error?T.message:"Não foi possível selecionar o plano.")}finally{v(null)}},C=k=>k==="basic"?["Conexão de WhatsApp","Extensão para WhatsApp Web","Fluxos, agendamentos e CRM"]:["Tudo do Basic","WhatsApp oficial, Instagram e Messenger","Bots Telegram ilimitados","500 leads Telegram incluídos"],N=(k,P,A=!1)=>{const T=Number.isInteger(P)&&P>=1&&P<=1e4,D=T&&(!i||i(k,P,d)),E=T?Nf(k,P,d):0,I=d==="quarterly"?3:d==="yearly"?12:1,S=A?"custom":k;return a.jsxs("article",{className:`relative flex h-full flex-col rounded-2xl border p-5 ${k==="pro"&&!A?"border-orange-500 bg-orange-500/5 shadow-lg":"border-border bg-card"}`,children:[k==="pro"&&!A&&a.jsx("span",{className:"absolute -top-3 left-5 rounded-full bg-orange-500 px-3 py-1 text-xs font-semibold text-white",children:"Plano recomendado"}),a.jsx("h3",{className:"mb-5 text-2xl font-semibold",children:A?"Mais conexões":k==="basic"?"Basic":"Pro"}),A&&a.jsxs("label",{className:"mb-3 text-sm",children:["Plano",a.jsxs("select",{"aria-label":"Plano personalizado",value:h,onChange:L=>p(L.target.value),className:"mt-1 w-full rounded-lg border bg-background p-2",children:[a.jsx("option",{value:"basic",children:"Basic"}),a.jsx("option",{value:"pro",children:"Pro"})]})]}),a.jsxs("label",{className:"text-sm",children:["Quantidade de conexões",A?a.jsx("input",{"aria-label":"Quantidade personalizada de conexões",type:"number",min:1,max:1e4,step:1,value:y,onChange:L=>g(L.target.value),className:"mt-1 w-full rounded-lg border bg-background p-2"}):a.jsx("select",{"aria-label":`Conexões ${k==="basic"?"Basic":"Pro"}`,value:P,onChange:L=>f(Y=>({...Y,[k]:Number(L.target.value)})),className:"mt-1 w-full rounded-lg border bg-background p-2",children:Array.from({length:20},(L,Y)=>a.jsxs("option",{value:Y+1,children:[Y+1," ",Y===0?"conexão":"conexões"]},Y+1))})]}),a.jsxs("div",{className:"my-5",children:[a.jsx("strong",{className:"text-3xl tracking-tight",children:T?vm(E):"—"}),a.jsxs("span",{className:"ml-1 text-sm text-muted-foreground",children:["/",d==="monthly"?"mês":d==="quarterly"?"trimestre":"ano"]}),d!=="monthly"&&T&&a.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["Equivale a ",vm(Math.round(E/I)),"/mês. Cobrança pelo período completo."]})]}),a.jsx(pe,{disabled:!D||x!==null,className:"w-full bg-orange-500 text-white hover:bg-orange-600",onClick:()=>_(k,P,S),children:x===S?a.jsx(st,{className:"h-4 w-4 animate-spin"}):"Selecionar plano"}),!D&&T&&a.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"Esta opção não se aplica à alteração selecionada."}),!T&&a.jsx("p",{role:"alert",className:"mt-2 text-xs text-destructive",children:"Informe de 1 a 10.000 conexões."}),a.jsx("ul",{className:"mt-6 flex-1 space-y-3 text-sm",children:C(k).map(L=>a.jsxs("li",{className:"flex gap-2",children:[a.jsx(Lr,{className:"mt-0.5 h-4 w-4 shrink-0 text-orange-500"}),a.jsx("span",{children:L})]},L))}),a.jsx("p",{className:"mt-5 border-t pt-3 text-xs leading-relaxed text-muted-foreground",children:k==="pro"?"Telegram não ocupa conexões. Acima dos 500 leads incluídos, escolha um pacote mensal pré-pago por R$ 0,05 por lead de capacidade.":"Cada conexão ou instalação da extensão ocupa uma vaga, mesmo quando utiliza o mesmo número."})]},S)};return a.jsxs("div",{className:"space-y-6",children:[r&&a.jsx("div",{className:"flex flex-wrap justify-center gap-2",role:"group","aria-label":"Período de cobrança",children:AT.map(k=>a.jsxs(pe,{variant:d===k?"default":"outline","aria-pressed":d===k,onClick:()=>{c(k),n==null||n(k)},children:[TT[k],k==="quarterly"?" · 20% off":k==="yearly"?" · 30% off":""]},k))}),b&&a.jsx("p",{role:"alert",className:"rounded-lg border border-destructive/30 p-3 text-sm text-destructive",children:b}),a.jsxs("div",{className:`grid items-stretch gap-5 pt-3 ${s?"grid-cols-1":"grid-cols-1 md:grid-cols-3"}`,children:[N("basic",u.basic),N("pro",u.pro),N(h,Number(y),!0)]})]})}const IT="553192432482";function MT(){const[e]=m.useState(IT);return e}const RT=Vf("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Yn({className:e,variant:t,...n}){return a.jsx("div",{className:xe(RT({variant:t}),e),...n})}function DT(e){return Object.prototype.toString.call(e)==="[object Object]"}function ym(e){return DT(e)||Array.isArray(e)}function OT(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function $f(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;const s=JSON.stringify(Object.keys(e.breakpoints||{})),o=JSON.stringify(Object.keys(t.breakpoints||{}));return s!==o?!1:n.every(i=>{const l=e[i],c=t[i];return typeof l=="function"?`${l}`==`${c}`:!ym(l)||!ym(c)?l===c:$f(l,c)})}function bm(e){return e.concat().sort((t,n)=>t.name>n.name?1:-1).map(t=>t.options)}function LT(e,t){if(e.length!==t.length)return!1;const n=bm(e),r=bm(t);return n.every((s,o)=>{const i=r[o];return $f(s,i)})}function Uf(e){return typeof e=="number"}function Ud(e){return typeof e=="string"}function Fl(e){return typeof e=="boolean"}function wm(e){return Object.prototype.toString.call(e)==="[object Object]"}function gt(e){return Math.abs(e)}function Wf(e){return Math.sign(e)}function ho(e,t){return gt(e-t)}function FT(e,t){if(e===0||t===0||gt(e)<=gt(t))return 0;const n=ho(gt(e),gt(t));return gt(n/e)}function zT(e){return Math.round(e*100)/100}function Po(e){return Ao(e).map(Number)}function Fn(e){return e[Yo(e)]}function Yo(e){return Math.max(0,e.length-1)}function Hf(e,t){return t===Yo(e)}function _m(e,t=0){return Array.from(Array(e),(n,r)=>t+r)}function Ao(e){return Object.keys(e)}function Vb(e,t){return[e,t].reduce((n,r)=>(Ao(r).forEach(s=>{const o=n[s],i=r[s],l=wm(o)&&wm(i);n[s]=l?Vb(o,i):i}),n),{})}function Wd(e,t){return typeof t.MouseEvent<"u"&&e instanceof t.MouseEvent}function BT(e,t){const n={start:r,center:s,end:o};function r(){return 0}function s(c){return o(c)/2}function o(c){return t-c}function i(c,d){return Ud(e)?n[e](c):e(t,c,d)}return{measure:i}}function To(){let e=[];function t(s,o,i,l={passive:!0}){let c;if("addEventListener"in s)s.addEventListener(o,i,l),c=()=>s.removeEventListener(o,i,l);else{const d=s;d.addListener(i),c=()=>d.removeListener(i)}return e.push(c),r}function n(){e=e.filter(s=>s())}const r={add:t,clear:n};return r}function VT(e,t,n,r){const s=To(),o=1e3/60;let i=null,l=0,c=0;function d(){s.add(e,"visibilitychange",()=>{e.hidden&&y()})}function u(){p(),s.clear()}function f(x){if(!c)return;
vendor: 15,310 bytes, line 450
450i||(i=x,n(),n());const v=x-i;for(i=x,l+=v;l>=o;)n(),l-=o;const b=l/o;r(b),c&&(c=t.requestAnimationFrame(f))}function h(){c||(c=t.requestAnimationFrame(f))}function p(){t.cancelAnimationFrame(c),i=null,l=0,c=0}function y(){i=null,l=0}return{init:d,destroy:u,start:h,stop:p,update:n,render:r}}function $T(e,t){const n=t==="rtl",r=e==="y",s=r?"y":"x",o=r?"x":"y",i=!r&&n?-1:1,l=u(),c=f();function d(y){const{height:g,width:x}=y;return r?g:x}function u(){return r?"top":n?"right":"left"}function f(){return r?"bottom":n?"left":"right"}function h(y){return y*i}return{scroll:s,cross:o,startEdge:l,endEdge:c,measureSize:d,direction:h}}function Ms(e=0,t=0){const n=gt(e-t);function r(d){return d<e}function s(d){return d>t}function o(d){return r(d)||s(d)}function i(d){return o(d)?r(d)?e:t:d}function l(d){return n?d-n*Math.ceil((d-t)/n):d}return{length:n,max:t,min:e,constrain:i,reachedAny:o,reachedMax:s,reachedMin:r,removeOffset:l}}function $b(e,t,n){const{constrain:r}=Ms(0,e),s=e+1;let o=i(t);function i(h){return n?gt((s+h)%s):r(h)}function l(){return o}function c(h){return o=i(h),f}function d(h){return u().set(l()+h)}function u(){return $b(e,l(),n)}const f={get:l,set:c,add:d,clone:u};return f}function UT(e,t,n,r,s,o,i,l,c,d,u,f,h,p,y,g,x,v,b){const{cross:w,direction:_}=e,C=["INPUT","SELECT","TEXTAREA"],N={passive:!1},k=To(),P=To(),A=Ms(50,225).constrain(p.measure(20)),T={mouse:300,touch:400},D={mouse:500,touch:600},E=y?43:25;let I=!1,S=0,L=0,Y=!1,B=!1,q=!1,F=!1;function ee(z){if(!b)return;function ie(H){(Fl(b)||b(z,H))&&de(H)}const j=t;k.add(j,"dragstart",H=>H.preventDefault(),N).add(j,"touchmove",()=>{},N).add(j,"touchend",()=>{}).add(j,"touchstart",ie).add(j,"mousedown",ie).add(j,"touchcancel",ae).add(j,"contextmenu",ae).add(j,"click",re,!0)}function $(){k.clear(),P.clear()}function M(){const z=F?n:t;P.add(z,"touchmove",te,N).add(z,"touchend",ae).add(z,"mousemove",te,N).add(z,"mouseup",ae)}function J(z){const ie=z.nodeName||"";return C.includes(ie)}function K(){return(y?D:T)[F?"mouse":"touch"]}function X(z,ie){const j=f.add(Wf(z)*-1),H=u.byDistance(z,!y).distance;return y||gt(z)<A?H:x&&ie?H*.5:u.byIndex(j.get(),0).distance}function de(z){const ie=Wd(z,r);F=ie,q=y&&ie&&!z.buttons&&I,I=ho(s.get(),i.get())>=2,!(ie&&z.button!==0)&&(J(z.target)||(Y=!0,o.pointerDown(z),d.useFriction(0).useDuration(0),s.set(i),M(),S=o.readPoint(z),L=o.readPoint(z,w),h.emit("pointerDown")))}function te(z){if(!Wd(z,r)&&z.touches.length>=2)return ae(z);const j=o.readPoint(z),H=o.readPoint(z,w),G=ho(j,S),O=ho(H,L);if(!B&&!F&&(!z.cancelable||(B=G>O,!B)))return ae(z);const R=o.pointerMove(z);G>g&&(q=!0),d.useFriction(.3).useDuration(.75),l.start(),s.add(_(R)),z.preventDefault()}function ae(z){const j=u.byDistance(0,!1).index!==f.get(),H=o.pointerUp(z)*K(),G=X(_(H),j),O=FT(H,G),R=E-10*O,U=v+O/50;B=!1,Y=!1,P.clear(),d.useDuration(R).useFriction(U),c.distance(G,!y),F=!1,h.emit("pointerUp")}function re(z){q&&(z.stopPropagation(),z.preventDefault(),q=!1)}function le(){return Y}return{init:ee,destroy:$,pointerDown:le}}function WT(e,t){let r,s;function o(f){return f.timeStamp}function i(f,h){const y=`client${(h||e.scroll)==="x"?"X":"Y"}`;return(Wd(f,t)?f:f.touches[0])[y]}function l(f){return r=f,s=f,i(f)}function c(f){const h=i(f)-i(s),p=o(f)-o(r)>170;return s=f,p&&(r=f),h}function d(f){if(!r||!s)return 0;const h=i(s)-i(r),p=o(f)-o(r),y=o(f)-o(s)>170,g=h/p;return p&&!y&&gt(g)>.1?g:0}return{pointerDown:l,pointerMove:c,pointerUp:d,readPoint:i}}function HT(){function e(n){const{offsetTop:r,offsetLeft:s,offsetWidth:o,offsetHeight:i}=n;return{top:r,right:s+o,bottom:r+i,left:s,width:o,height:i}}return{measure:e}}function qT(e){function t(r){return e*(r/100)}return{measure:t}}function GT(e,t,n,r,s,o,i){const l=[e].concat(r);let c,d,u=[],f=!1;function h(x){return s.measureSize(i.measure(x))}function p(x){if(!o)return;d=h(e),u=r.map(h);function v(b){for(const w of b){if(f)return;const _=w.target===e,C=r.indexOf(w.target),N=_?d:u[C],k=h(_?e:r[C]);if(gt(k-N)>=.5){x.reInit(),t.emit("resize");break}}}c=new ResizeObserver(b=>{(Fl(o)||o(x,b))&&v(b)}),n.requestAnimationFrame(()=>{l.forEach(b=>c.observe(b))})}function y(){f=!0,c&&c.disconnect()}return{init:p,destroy:y}}function KT(e,t,n,r,s,o){let i=0,l=0,c=s,d=o,u=e.get(),f=0;function h(){const N=r.get()-e.get(),k=!c;let P=0;return k?(i=0,n.set(r),e.set(r),P=N):(n.set(e),i+=N/c,i*=d,u+=i,e.add(i),P=u-f),l=Wf(P),f=u,C}function p(){const N=r.get()-t.get();return gt(N)<.001}function y(){return c}function g(){return l}function x(){return i}function v(){return w(s)}function b(){return _(o)}function w(N){return c=N,C}function _(N){return d=N,C}const C={direction:g,duration:y,velocity:x,seek:h,settled:p,useBaseFriction:b,useBaseDuration:v,useFriction:_,useDuration:w};return C}function YT(e,t,n,r,s){const o=s.measure(10),i=s.measure(50),l=Ms(.1,.99);let c=!1;function d(){return!(c||!e.reachedAny(n.get())||!e.reachedAny(t.get()))}function u(p){if(!d())return;const y=e.reachedMin(t.get())?"min":"max",g=gt(e[y]-t.get()),x=n.get()-t.get(),v=l.constrain(g/i);n.subtract(x*v),!p&&gt(x)<o&&(n.set(e.constrain(n.get())),r.useDuration(25).useBaseFriction())}function f(p){c=!p}return{shouldConstrain:d,constrain:u,toggleActive:f}}function XT(e,t,n,r,s){const o=Ms(-t+e,0),i=f(),l=u(),c=h();function d(y,g){return ho(y,g)<=1}function u(){const y=i[0],g=Fn(i),x=i.lastIndexOf(y),v=i.indexOf(g)+1;return Ms(x,v)}function f(){return n.map((y,g)=>{const{min:x,max:v}=o,b=o.constrain(y),w=!g,_=Hf(n,g);return w?v:_||d(x,b)?x:d(v,b)?v:b}).map(y=>parseFloat(y.toFixed(3)))}function h(){if(t<=e+s)return[o.max];if(r==="keepSnaps")return i;const{min:y,max:g}=l;return i.slice(y,g)}return{snapsContained:c,scrollContainLimit:l}}function ZT(e,t,n){const r=t[0],s=n?r-e:Fn(t);return{limit:Ms(s,r)}}function QT(e,t,n,r){const o=t.min+.1,i=t.max+.1,{reachedMin:l,reachedMax:c}=Ms(o,i);function d(h){return h===1?c(n.get()):h===-1?l(n.get()):!1}function u(h){if(!d(h))return;const p=e*(h*-1);r.forEach(y=>y.add(p))}return{loop:u}}function JT(e){const{max:t,length:n}=e;function r(o){const i=o-t;return n?i/-n:0}return{get:r}}function eI(e,t,n,r,s){const{startEdge:o,endEdge:i}=e,{groupSlides:l}=s,c=f().map(t.measure),d=h(),u=p();function f(){return l(r).map(g=>Fn(g)[i]-g[0][o]).map(gt)}function h(){return r.map(g=>n[o]-g[o]).map(g=>-gt(g))}function p(){return l(d).map(g=>g[0]).map((g,x)=>g+c[x])}return{snaps:d,snapsAligned:u}}function tI(e,t,n,r,s,o){const{groupSlides:i}=s,{min:l,max:c}=r,d=u();function u(){const h=i(o),p=!e||t==="keepSnaps";return n.length===1?[o]:p?h:h.slice(l,c).map((y,g,x)=>{const v=!g,b=Hf(x,g);if(v){const w=Fn(x[0])+1;return _m(w)}if(b){const w=Yo(o)-Fn(x)[0]+1;return _m(w,Fn(x)[0])}return y})}return{slideRegistry:d}}function nI(e,t,n,r,s){const{reachedAny:o,removeOffset:i,constrain:l}=r;function c(y){return y.concat().sort((g,x)=>gt(g)-gt(x))[0]}function d(y){const g=e?i(y):l(y),x=t.map((b,w)=>({diff:u(b-g,0),index:w})).sort((b,w)=>gt(b.diff)-gt(w.diff)),{index:v}=x[0];return{index:v,distance:g}}function u(y,g){const x=[y,y+n,y-n];if(!e)return y;if(!g)return c(x);const v=x.filter(b=>Wf(b)===g);return v.length?c(v):Fn(x)-n}function f(y,g){const x=t[y]-s.get(),v=u(x,g);return{index:y,distance:v}}function h(y,g){const x=s.get()+y,{index:v,distance:b}=d(x),w=!e&&o(x);if(!g||w)return{index:v,distance:y};const _=t[v]-b,C=y+u(_,0);return{index:v,distance:C}}return{byDistance:h,byIndex:f,shortcut:u}}function rI(e,t,n,r,s,o,i){function l(f){const h=f.distance,p=f.index!==t.get();o.add(h),h&&(r.duration()?e.start():(e.update(),e.render(1),e.update())),p&&(n.set(t.get()),t.set(f.index),i.emit("select"))}function c(f,h){const p=s.byDistance(f,h);l(p)}function d(f,h){const p=t.clone().set(f),y=s.byIndex(p.get(),h);l(y)}return{distance:c,index:d}}function sI(e,t,n,r,s,o,i,l){const c={passive:!0,capture:!0};let d=0;function u(p){if(!l)return;function y(g){if(new Date().getTime()-d>10)return;i.emit("slideFocusStart"),e.scrollLeft=0;const b=n.findIndex(w=>w.includes(g));Uf(b)&&(s.useDuration(0),r.index(b,0),i.emit("slideFocus"))}o.add(document,"keydown",f,!1),t.forEach((g,x)=>{o.add(g,"focus",v=>{(Fl(l)||l(p,v))&&y(x)},c)})}function f(p){p.code==="Tab"&&(d=new Date().getTime())}return{init:u}}function so(e){let t=e;function n(){return t}function r(c){t=i(c)}function s(c){t+=i(c)}function o(c){t-=i(c)}function i(c){return Uf(c)?c:c.get()}return{get:n,set:r,add:s,subtract:o}}function Ub(e,t){const n=e.scroll==="x"?i:l,r=t.style;let s=null,o=!1;function i(h){return`translate3d(${h}px,0px,0px)`}function l(h){return`translate3d(0px,${h}px,0px)`}function c(h){if(o)return;const p=zT(e.direction(h));p!==s&&(r.transform=n(p),s=p)}function d(h){o=!h}function u(){o||(r.transform="",t.getAttribute("style")||t.removeAttribute("style"))}return{clear:u,to:c,toggleActive:d}}function aI(e,t,n,r,s,o,i,l,c){const u=Po(s),f=Po(s).reverse(),h=v().concat(b());function p(k,P){return k.reduce((A,T)=>A-s[T],P)}function y(k,P){return k.reduce((A,T)=>p(A,P)>0?A.concat([T]):A,[])}function g(k){return o.map((P,A)=>({start:P-r[A]+.5+k,end:P+t-.5+k}))}function x(k,P,A){const T=g(P);return k.map(D=>{const E=A?0:-n,I=A?n:0,S=A?"end":"start",L=T[D][S];return{index:D,loopPoint:L,slideLocation:so(-1),translate:Ub(e,c[D]),target:()=>l.get()>L?E:I}})}function v(){const k=i[0],P=y(f,k);return x(P,n,!1)}function b(){const k=t-i[0]-1,P=y(u,k);return x(P,-n,!0)}function w(){return h.every(({index:k})=>{const P=u.filter(A=>A!==k);return p(P,t)<=.1})}function _(){h.forEach(k=>{const{target:P,translate:A,slideLocation:T}=k,D=P();D!==T.get()&&(A.to(D),T.set(D))})}function C(){h.forEach(k=>k.translate.clear())}return{canLoop:w,clear:C,loop:_,loopPoints:h}}function oI(e,t,n){let r,s=!1;function o(c){if(!n)return;function d(u){for(const f of u)if(f.type==="childList"){c.reInit(),t.emit("slidesChanged");break}}r=new MutationObserver(u=>{s||(Fl(n)||n(c,u))&&d(u)}),r.observe(e,{childList:!0})}function i(){r&&r.disconnect(),s=!0}return{init:o,destroy:i}}function iI(e,t,n,r){const s={};let o=null,i=null,l,c=!1;function d(){l=new IntersectionObserver(y=>{c||(y.forEach(g=>{const x=t.indexOf(g.target);s[x]=g}),o=null,i=null,n.emit("slidesInView"))},{root:e.parentElement,threshold:r}),t.forEach(y=>l.observe(y))}function u(){l&&l.disconnect(),c=!0}function f(y){return Ao(s).reduce((g,x)=>{const v=parseInt(x),{isIntersecting:b}=s[v];return(y&&b||!y&&!b)&&g.push(v),g},[])}function h(y=!0){if(y&&o)return o;if(!y&&i)return i;const g=f(y);return y&&(o=g),y||(i=g),g}return{init:d,destroy:u,get:h}}function lI(e,t,n,r,s,o){const{measureSize:i,startEdge:l,endEdge:c}=e,d=n[0]&&s,u=y(),f=g(),h=n.map(i),p=x();function y(){if(!d)return 0;const b=n[0];return gt(t[l]-b[l])}function g(){if(!d)return 0;const b=o.getComputedStyle(Fn(r));return parseFloat(b.getPropertyValue(`margin-${c}`))}function x(){return n.map((b,w,_)=>{const C=!w,N=Hf(_,w);return C?h[w]+u:N?h[w]+f:_[w+1][l]-b[l]}).map(gt)}return{slideSizes:h,slideSizesWithGaps:p,startGap:u,endGap:f}}function cI(e,t,n,r,s,o,i,l,c){const{startEdge:d,endEdge:u,direction:f}=e,h=Uf(n);function p(v,b){return Po(v).filter(w=>w%b===0).map(w=>v.slice(w,w+b))}function y(v){return v.length?Po(v).reduce((b,w,_)=>{const C=Fn(b)||0,N=C===0,k=w===Yo(v),P=s[d]-o[C][d],A=s[d]-o[w][u],T=!r&&N?f(i):0,D=!r&&k?f(l):0,E=gt(A-D-(P+T));return _&&E>t+c&&b.push(w),k&&b.push(v.length),b},[]).map((b,w,_)=>{const C=Math.max(_[w-1]||0);return v.slice(C,b)}):[]}function g(v){return h?p(v,n):y(v)}return{groupSlides:g}}function dI(e,t,n,r,s,o,i){const{align:l,axis:c,direction:d,startIndex:u,loop:f,duration:h,dragFree:p,dragThreshold:y,inViewThreshold:g,slidesToScroll:x,skipSnaps:v,containScroll:b,watchResize:w,watchSlides:_,watchDrag:C,watchFocus:N}=o,k=2,P=HT(),A=P.measure(t),T=n.map(P.measure),D=$T(c,d),E=D.measureSize(A),I=qT(E),S=BT(l,E),L=!f&&!!b,Y=f||!!b,{slideSizes:B,slideSizesWithGaps:q,startGap:F,endGap:ee}=lI(D,A,T,n,Y,s),$=cI(D,E,x,f,A,T,F,ee,k),{snaps:M,snapsAligned:J}=eI(D,S,A,T,$),K=-Fn(M)+Fn(q),{snapsContained:X,scrollContainLimit:de}=XT(E,K,J,b,k),te=L?X:J,{limit:ae}=ZT(K,te,f),re=$b(Yo(te),u,f),le=re.clone(),ue=Po(n),z=({dragHandler:ct,scrollBody:ye,scrollBounds:Re,options:{loop:Ce}})=>{Ce||Re.constrain(ct.pointerDown()),ye.seek()},ie=({scrollBody:ct,translate:ye,location:Re,offsetLocation:Ce,previousLocation:De,scrollLooper:Ue,slideLooper:Ve,dragHandler:pt,animation:At,eventHandler:jt,scrollBounds:Bt,options:{loop:hn}},Vt)=>{const St=ct.settled(),zs=!Bt.shouldConstrain(),Pe=hn?St:St&&zs,He=Pe&&!pt.pointerDown();He&&At.stop();const nt=Re.get()*Vt+De.get()*(1-Vt);Ce.set(nt),hn&&(Ue.loop(ct.direction()),Ve.loop()),ye.to(Ce.get()),He&&jt.emit("settle"),Pe||jt.emit("scroll")},j=VT(r,s,()=>z(Je),ct=>ie(Je,ct)),H=.68,G=te[re.get()],O=so(G),R=so(G),U=so(G),V=so(G),Q=KT(O,U,R,V,h,H),W=nI(f,te,K,ae,V),se=rI(j,re,le,Q,W,V,i),fe=JT(ae),ce=To(),me=iI(t,n,i,g),{slideRegistry:ke}=tI(L,b,te,de,$,ue),Ne=sI(e,n,ke,se,Q,ce,i,N),Je={ownerDocument:r,ownerWindow:s,eventHandler:i,containerRect:A,slideRects:T,animation:j,axis:D,dragHandler:UT(D,e,r,s,V,WT(D,s),O,j,se,Q,W,re,i,I,p,y,v,H,C),eventStore:ce,percentOfView:I,index:re,indexPrevious:le,limit:ae,location:O,offsetLocation:U,previousLocation:R,options:o,resizeHandler:GT(t,i,s,n,D,w,P),scrollBody:Q,scrollBounds:YT(ae,U,V,Q,I),scrollLooper:QT(K,ae,U,[O,U,R,V]),scrollProgress:fe,scrollSnapList:te.map(fe.get),scrollSnaps:te,scrollTarget:W,scrollTo:se,slideLooper:aI(D,E,K,B,q,M,te,U,n),slideFocus:Ne,slidesHandler:oI(t,i,_),slidesInView:me,slideIndexes:ue,slideRegistry:ke,slidesToScroll:$,target:V,translate:Ub(D,t)};return Je}function uI(){let e={},t;function n(d){t=d}function r(d){return e[d]||[]}function s(d){return r(d).forEach(u=>u(t,d)),c}function o(d,u){return e[d]=r(d).concat([u]),c}function i(d,u){return e[d]=r(d).filter(f=>f!==u),c}function l(){e={}}const c={init:n,emit:s,off:i,on:o,clear:l};return c}const fI={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function hI(e){function t(o,i){return Vb(o,i||{})}function n(o){const i=o.breakpoints||{},l=Ao(i).filter(c=>e.matchMedia(c).matches).map(c=>i[c]).reduce((c,d)=>t(c,d),{});return t(o,l)}function r(o){return o.map(i=>Ao(i.breakpoints||{})).reduce((i,l)=>i.concat(l),[]).map(e.matchMedia)}return{mergeOptions:t,optionsAtMedia:n,optionsMediaQueries:r}}function pI(e){let t=[];function n(o,i){return t=i.filter(({options:l})=>e.optionsAtMedia(l).active!==!1),t.forEach(l=>l.init(o,e)),i.reduce((l,c)=>Object.assign(l,{[c.name]:c}),{})}function r(){t=t.filter(o=>o.destroy())}return{init:n,destroy:r}}function rl(e,t,n){const r=e.ownerDocument,s=r.defaultView,o=hI(s),i=pI(o),l=To(),c=uI(),{mergeOptions:d,optionsAtMedia:u,optionsMediaQueries:f}=o,{on:h,off:p,emit:y}=c,g=D;let x=!1,v,b=d(fI,rl.globalOptions),w=d(b),_=[],C,N,k;function P(){const{container:ue,slides:z}=w;N=(Ud(ue)?e.querySelector(ue):ue)||e.children[0];const j=Ud(z)?N.querySelectorAll(z):z;k=[].slice.call(j||N.children)}function A(ue){const z=dI(e,N,k,r,s,ue,c);if(ue.loop&&!z.slideLooper.canLoop()){const ie=Object.assign({},ue,{loop:!1});return A(ie)}return z}function T(ue,z){x||(b=d(b,ue),w=u(b),_=z||_,P(),v=A(w),f([b,..._.map(({options:ie})=>
450ie)]).forEach(ie=>l.add(ie,"change",D)),w.active&&(v.translate.to(v.location.get()),v.animation.init(),v.slidesInView.init(),v.slideFocus.init(le),v.eventHandler.init(le),v.resizeHandler.init(le),v.slidesHandler.init(le),v.options.loop&&v.slideLooper.loop(),N.offsetParent&&k.length&&v.dragHandler.init(le),C=i.init(le,_)))}function D(ue,z){const ie=$();E(),T(d({startIndex:ie},ue),z),c.emit("reInit")}function E(){v.dragHandler.destroy(),v.eventStore.clear(),v.translate.clear(),v.slideLooper.clear(),v.resizeHandler.destroy(),v.slidesHandler.destroy(),v.slidesInView.destroy(),v.animation.destroy(),i.destroy(),l.clear()}function I(){x||(x=!0,l.clear(),E(),c.emit("destroy"),c.clear())}function S(ue,z,ie){!w.active||x||(v.scrollBody.useBaseFriction().useDuration(z===!0?0:w.duration),v.scrollTo.index(ue,ie||0))}function L(ue){const z=v.index.add(1).get();S(z,ue,-1)}function Y(ue){const z=v.index.add(-1).get();S(z,ue,1)}function B(){return v.index.add(1).get()!==$()}function q(){return v.index.add(-1).get()!==$()}function F(){return v.scrollSnapList}function ee(){return v.scrollProgress.get(v.offsetLocation.get())}function $(){return v.index.get()}function M(){return v.indexPrevious.get()}function J(){return v.slidesInView.get()}function K(){return v.slidesInView.get(!1)}function X(){return C}function de(){return v}function te(){return e}function ae(){return N}function re(){return k}const le={canScrollNext:B,canScrollPrev:q,containerNode:ae,internalEngine:de,destroy:I,off:p,on:h,emit:y,plugins:X,previousScrollSnap:M,reInit:g,rootNode:te,scrollNext:L,scrollPrev:Y,scrollProgress:ee,scrollSnapList:F,scrollTo:S,selectedScrollSnap:$,slideNodes:re,slidesInView:J,slidesNotInView:K};return T(t,n),setTimeout(()=>c.emit("init"),0),le}rl.globalOptions=void 0;function qf(e={},t=[]){const n=m.useRef(e),r=m.useRef(t),[s,o]=m.useState(),[i,l]=m.useState(),c=m.useCallback(()=>{s&&s.reInit(n.current,r.current)},[s]);return m.useEffect(()=>{$f(n.current,e)||(n.current=e,c())},[e,c]),m.useEffect(()=>{LT(r.current,t)||(r.current=t,c())},[t,c]),m.useEffect(()=>{if(OT()&&i){rl.globalOptions=qf.globalOptions;const d=rl(i,n.current,r.current);return o(d),()=>d.destroy()}else o(void 0)},[i,o]),[l,s]}qf.globalOptions=void 0;const Wb=m.createContext(null);function zl(){const e=m.useContext(Wb);if(!e)throw new Error("useCarousel must be used within a <Carousel />");return e}const Hb=m.forwardRef(({orientation:e="horizontal",opts:t,setApi:n,plugins:r,className:s,children:o,...i},l)=>{const[c,d]=qf({...t,axis:e==="horizontal"?"x":"y"},r),[u,f]=m.useState(!1),[h,p]=m.useState(!1),y=m.useCallback(b=>{b&&(f(b.canScrollPrev()),p(b.canScrollNext()))},[]),g=m.useCallback(()=>{d==null||d.scrollPrev()},[d]),x=m.useCallback(()=>{d==null||d.scrollNext()},[d]),v=m.useCallback(b=>{b.key==="ArrowLeft"?(b.preventDefault(),g()):b.key==="ArrowRight"&&(b.preventDefault(),x())},[g,x]);return m.useEffect(()=>{!d||!n||n(d)},[d,n]),m.useEffect(()=>{if(d)return y(d),d.on("reInit",y),d.on("select",y),()=>{d==null||d.off("select",y)}},[d,y]),a.jsx(Wb.Provider,{value:{carouselRef:c,api:d,opts:t,orientation:e||((t==null?void 0:t.axis)==="y"?"vertical":"horizontal"),scrollPrev:g,scrollNext:x,canScrollPrev:u,canScrollNext:h},children:a.jsx("div",{ref:l,onKeyDownCapture:v,className:xe("relative",s),role:"region","aria-roledescription":"carousel",...i,children:o})})});Hb.displayName="Carousel";const qb=m.forwardRef(({className:e,...t},n)=>{const{carouselRef:r,orientation:s}=zl();return a.jsx("div",{ref:r,className:"overflow-hidden",children:a.jsx("div",{ref:n,className:xe("flex",s==="horizontal"?"-ml-4":"-mt-4 flex-col",e),...t})})});qb.displayName="CarouselContent";const Oi=m.forwardRef(({className:e,...t},n)=>{const{orientation:r}=zl();return a.jsx("div",{ref:n,role:"group","aria-roledescription":"slide",className:xe("min-w-0 shrink-0 grow-0 basis-full",r==="horizontal"?"pl-4":"pt-4",e),...t})});Oi.displayName="CarouselItem";const Gb=m.forwardRef(({className:e,variant:t="outline",size:n="icon",...r},s)=>{const{orientation:o,scrollPrev:i,canScrollPrev:l}=zl();return a.jsxs(pe,{ref:s,variant:t,size:n,className:xe("absolute h-8 w-8 rounded-full",o==="horizontal"?"-left-12 top-1/2 -translate-y-1/2":"-top-12 left-1/2 -translate-x-1/2 rotate-90",e),disabled:!l,onClick:i,...r,children:[a.jsx(ks,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Previous slide"})]})});
vendor: 24,643 bytes, line 450
450Gb.displayName="CarouselPrevious";const Kb=m.forwardRef(({className:e,variant:t="outline",size:n="icon",...r},s)=>{const{orientation:o,scrollNext:i,canScrollNext:l}=zl();return a.jsxs(pe,{ref:s,variant:t,size:n,className:xe("absolute h-8 w-8 rounded-full",o==="horizontal"?"-right-12 top-1/2 -translate-y-1/2":"-bottom-12 left-1/2 -translate-x-1/2 rotate-90",e),disabled:!l,onClick:i,...r,children:[a.jsx(Ca,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Next slide"})]})});Kb.displayName="CarouselNext";function rs({className:e,...t}){return a.jsx("div",{className:xe("animate-pulse rounded-md bg-muted",e),...t})}const et=m.forwardRef(({className:e,type:t,...n},r)=>a.jsx("input",{type:t,className:xe("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...n}));et.displayName="Input";const Gf=m.createContext({});function Xo(e){const t=m.useRef(null);return t.current===null&&(t.current=e()),t.current}const Kf=typeof window<"u",Yf=Kf?m.useLayoutEffect:m.useEffect,Bl=m.createContext(null);function Xf(e,t){e.indexOf(t)===-1&&e.push(t)}function Zf(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}function G$([...e],t,n){const r=t<0?e.length+t:t;if(r>=0&&r<e.length){const s=n<0?e.length+n:n,[o]=e.splice(t,1);e.splice(s,0,o)}return e}const xr=(e,t,n)=>n>t?t:n<e?e:n;let sl=()=>{};const vr={},Yb=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Xb(e){return typeof e=="object"&&e!==null}const Zb=e=>/^0[^.\s]+$/u.test(e);function Qf(e){let t;return()=>(t===void 0&&(t=e()),t)}const kn=e=>e,mI=(e,t)=>n=>t(e(n)),Zo=(...e)=>e.reduce(mI),Io=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r};class Jf{constructor(){this.subscriptions=[]}add(t){return Xf(this.subscriptions,t),()=>Zf(this.subscriptions,t)}notify(t,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,r);else for(let o=0;o<s;o++){const i=this.subscriptions[o];i&&i(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const tr=e=>e*1e3,Cn=e=>e/1e3;function Qb(e,t){return t?e*(1e3/t):0}const Jb=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,gI=1e-7,xI=12;function vI(e,t,n,r,s){let o,i,l=0;do i=t+(n-t)/2,o=Jb(i,r,s)-e,o>0?n=i:t=i;while(Math.abs(o)>gI&&++l<xI);return i}function Qo(e,t,n,r){if(e===t&&n===r)return kn;const s=o=>vI(o,0,1,e,n);return o=>o===0||o===1?o:Jb(s(o),t,r)}const e0=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,t0=e=>t=>1-e(1-t),n0=Qo(.33,1.53,.69,.99),eh=t0(n0),r0=e0(eh),s0=e=>(e*=2)<1?.5*eh(e):.5*(2-Math.pow(2,-10*(e-1))),th=e=>1-Math.sin(Math.acos(e)),a0=t0(th),o0=e0(th),yI=Qo(.42,0,1,1),bI=Qo(0,0,.58,1),i0=Qo(.42,0,.58,1),wI=e=>Array.isArray(e)&&typeof e[0]!="number",l0=e=>Array.isArray(e)&&typeof e[0]=="number",Sm={linear:kn,easeIn:yI,easeInOut:i0,easeOut:bI,circIn:th,circInOut:o0,circOut:a0,backIn:eh,backInOut:r0,backOut:n0,anticipate:s0},_I=e=>typeof e=="string",Cm=e=>{if(l0(e)){sl(e.length===4);const[t,n,r,s]=e;return Qo(t,n,r,s)}else if(_I(e))return sl(Sm[e]!==void 0),Sm[e];return e},vi=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],jm={value:null,addProjectionMetrics:null};function SI(e,t){let n=new Set,r=new Set,s=!1,o=!1;const i=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1},c=0;function d(f){i.has(f)&&(u.schedule(f),e()),c++,f(l)}const u={schedule:(f,h=!1,p=!1)=>{const g=p&&s?n:r;return h&&i.add(f),g.has(f)||g.add(f),f},cancel:f=>{r.delete(f),i.delete(f)},process:f=>{if(l=f,s){o=!0;return}s=!0,[n,r]=[r,n],n.forEach(d),t&&jm.value&&jm.value.frameloop[t].push(c),c=0,n.clear(),s=!1,o&&(o=!1,u.process(f))}};return u}const CI=40;function c0(e,t){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,i=vi.reduce((w,_)=>(w[_]=SI(o,t?_:void 0),w),{}),{setup:l,read:c,resolveKeyframes:d,preUpdate:u,update:f,preRender:h,render:p,postRender:y}=i,g=()=>{const w=vr.useManualTiming?s.timestamp:performance.now();n=!1,vr.useManualTiming||(s.delta=r?1e3/60:Math.max(Math.min(w-s.timestamp,CI),1)),s.timestamp=w,s.isProcessing=!0,l.process(s),c.process(s),d.process(s),u.process(s),f.process(s),h.process(s),p.process(s),y.process(s),s.isProcessing=!1,n&&t&&(r=!1,e(g))},x=()=>{n=!0,r=!0,s.isProcessing||e(g)};return{schedule:vi.reduce((w,_)=>{const C=i[_];return w[_]=(N,k=!1,P=!1)=>(n||x(),C.schedule(N,k,P)),w},{}),cancel:w=>{for(let _=0;_<vi.length;_++)i[vi[_]].cancel(w)},state:s,steps:i}}const{schedule:ft,cancel:yr,state:Lt,steps:Rc}=c0(typeof requestAnimationFrame<"u"?requestAnimationFrame:kn,!0);let Li;function jI(){Li=void 0}const on={now:()=>(Li===void 0&&on.set(Lt.isProcessing||vr.useManualTiming?Lt.timestamp:performance.now()),Li),set:e=>{Li=e,queueMicrotask(jI)}},d0=e=>t=>typeof t=="string"&&t.startsWith(e),u0=d0("--"),kI=d0("var(--"),nh=e=>kI(e)?EI.test(e.split("/*")[0].trim()):!1,EI=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Oa={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Mo={...Oa,transform:e=>xr(0,1,e)},yi={...Oa,default:1},po=e=>Math.round(e*1e5)/1e5,rh=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function NI(e){return e==null}const PI=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,sh=(e,t)=>n=>!!(typeof n=="string"&&PI.test(n)&&n.startsWith(e)||t&&!NI(n)&&Object.prototype.hasOwnProperty.call(n,t)),f0=(e,t,n)=>r=>{if(typeof r!="string")return r;const[s,o,i,l]=r.match(rh);return{[e]:parseFloat(s),[t]:parseFloat(o),[n]:parseFloat(i),alpha:l!==void 0?parseFloat(l):1}},AI=e=>xr(0,255,e),Dc={...Oa,transform:e=>Math.round(AI(e))},is={test:sh("rgb","red"),parse:f0("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+Dc.transform(e)+", "+Dc.transform(t)+", "+Dc.transform(n)+", "+po(Mo.transform(r))+")"};function TI(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const Hd={test:sh("#"),parse:TI,transform:is.transform},Jo=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Er=Jo("deg"),nr=Jo("%"),Te=Jo("px"),II=Jo("vh"),MI=Jo("vw"),km={...nr,parse:e=>nr.parse(e)/100,transform:e=>nr.transform(e*100)},Ks={test:sh("hsl","hue"),parse:f0("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+nr.transform(po(t))+", "+nr.transform(po(n))+", "+po(Mo.transform(r))+")"},Ct={test:e=>is.test(e)||Hd.test(e)||Ks.test(e),parse:e=>is.test(e)?is.parse(e):Ks.test(e)?Ks.parse(e):Hd.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?is.transform(e):Ks.transform(e),getAnimatableNone:e=>{const t=Ct.parse(e);return t.alpha=0,Ct.transform(t)}},RI=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function DI(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(rh))==null?void 0:t.length)||0)+(((n=e.match(RI))==null?void 0:n.length)||0)>0}const h0="number",p0="color",OI="var",LI="var(",Em="${}",FI=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ro(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let o=0;const l=t.replace(FI,c=>(Ct.test(c)?(r.color.push(o),s.push(p0),n.push(Ct.parse(c))):c.startsWith(LI)?(r.var.push(o),s.push(OI),n.push(c)):(r.number.push(o),s.push(h0),n.push(parseFloat(c))),++o,Em)).split(Em);return{values:n,split:l,indexes:r,types:s}}function m0(e){return Ro(e).values}function g0(e){const{split:t,types:n}=Ro(e),r=t.length;return s=>{let o="";for(let i=0;i<r;i++)if(o+=t[i],s[i]!==void 0){const l=n[i];l===h0?o+=po(s[i]):l===p0?o+=Ct.transform(s[i]):o+=s[i]}return o}}const zI=e=>typeof e=="number"?0:Ct.test(e)?Ct.getAnimatableNone(e):e;function BI(e){const t=m0(e);return g0(e)(t.map(zI))}const Hr={test:DI,parse:m0,createTransformer:g0,getAnimatableNone:BI};function Oc(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function VI({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let s=0,o=0,i=0;if(!t)s=o=i=n;else{const l=n<.5?n*(1+t):n+t-n*t,c=2*n-l;s=Oc(c,l,e+1/3),o=Oc(c,l,e),i=Oc(c,l,e-1/3)}return{red:Math.round(s*255),green:Math.round(o*255),blue:Math.round(i*255),alpha:r}}function al(e,t){return n=>n>0?t:e}const xt=(e,t,n)=>e+(t-e)*n,Lc=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},$I=[Hd,is,Ks],UI=e=>$I.find(t=>t.test(e));function Nm(e){const t=UI(e);if(!t)return!1;let n=t.parse(e);return t===Ks&&(n=VI(n)),n}const Pm=(e,t)=>{const n=Nm(e),r=Nm(t);if(!n||!r)return al(e,t);const s={...n};return o=>(s.red=Lc(n.red,r.red,o),s.green=Lc(n.green,r.green,o),s.blue=Lc(n.blue,r.blue,o),s.alpha=xt(n.alpha,r.alpha,o),is.transform(s))},qd=new Set(["none","hidden"]);function WI(e,t){return qd.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function HI(e,t){return n=>xt(e,t,n)}function ah(e){return typeof e=="number"?HI:typeof e=="string"?nh(e)?al:Ct.test(e)?Pm:KI:Array.isArray(e)?x0:typeof e=="object"?Ct.test(e)?Pm:qI:al}function x0(e,t){const n=[...e],r=n.length,s=e.map((o,i)=>ah(o)(o,t[i]));return o=>{for(let i=0;i<r;i++)n[i]=s[i](o);return n}}function qI(e,t){const n={...e,...t},r={};for(const s in n)e[s]!==void 0&&t[s]!==void 0&&(r[s]=ah(e[s])(e[s],t[s]));return s=>{for(const o in r)n[o]=r[o](s);return n}}function GI(e,t){const n=[],r={color:0,var:0,number:0};for(let s=0;s<t.values.length;s++){const o=t.types[s],i=e.indexes[o][r[o]],l=e.values[i]??0;n[s]=l,r[o]++}return n}const KI=(e,t)=>{const n=Hr.createTransformer(t),r=Ro(e),s=Ro(t);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?qd.has(e)&&!s.values.length||qd.has(t)&&!r.values.length?WI(e,t):Zo(x0(GI(r,s),s.values),n):al(e,t)};function v0(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?xt(e,t,n):ah(e)(e,t)}const YI=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>ft.update(t,n),stop:()=>yr(t),now:()=>Lt.isProcessing?Lt.timestamp:on.now()}},y0=(e,t,n=10)=>{let r="";const s=Math.max(Math.round(t/n),2);for(let o=0;o<s;o++)r+=Math.round(e(o/(s-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},ol=2e4;function oh(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<ol;)t+=n,r=e.next(t);return t>=ol?1/0:t}function XI(e,t=100,n){const r=n({...e,keyframes:[0,t]}),s=Math.min(oh(r),ol);return{type:"keyframes",ease:o=>r.next(s*o).value/t,duration:Cn(s)}}const ZI=5;function b0(e,t,n){const r=Math.max(t-ZI,0);return Qb(n-e(r),t-r)}const _t={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Fc=.001;function QI({duration:e=_t.duration,bounce:t=_t.bounce,velocity:n=_t.velocity,mass:r=_t.mass}){let s,o,i=1-t;i=xr(_t.minDamping,_t.maxDamping,i),e=xr(_t.minDuration,_t.maxDuration,Cn(e)),i<1?(s=d=>{const u=d*i,f=u*e,h=u-n,p=Gd(d,i),y=Math.exp(-f);return Fc-h/p*y},o=d=>{const f=d*i*e,h=f*n+n,p=Math.pow(i,2)*Math.pow(d,2)*e,y=Math.exp(-f),g=Gd(Math.pow(d,2),i);return(-s(d)+Fc>0?-1:1)*((h-p)*y)/g}):(s=d=>{const u=Math.exp(-d*e),f=(d-n)*e+1;return-Fc+u*f},o=d=>{const u=Math.exp(-d*e),f=(n-d)*(e*e);return u*f});const l=5/e,c=eM(s,o,l);if(e=tr(e),isNaN(c))return{stiffness:_t.stiffness,damping:_t.damping,duration:e};{const d=Math.pow(c,2)*r;return{stiffness:d,damping:i*2*Math.sqrt(r*d),duration:e}}}const JI=12;function eM(e,t,n){let r=n;for(let s=1;s<JI;s++)r=r-e(r)/t(r);return r}function Gd(e,t){return e*Math.sqrt(1-t*t)}const tM=["duration","bounce"],nM=["stiffness","damping","mass"];function Am(e,t){return t.some(n=>e[n]!==void 0)}function rM(e){let t={velocity:_t.velocity,stiffness:_t.stiffness,damping:_t.damping,mass:_t.mass,isResolvedFromDuration:!1,...e};if(!Am(e,nM)&&Am(e,tM))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,o=2*xr(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:_t.mass,stiffness:s,damping:o}}else{const n=QI(e);t={...t,...n,mass:_t.mass},t.isResolvedFromDuration=!0}return t}function il(e=_t.visualDuration,t=_t.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:s}=n;const o=n.keyframes[0],i=n.keyframes[n.keyframes.length-1],l={done:!1,value:o},{stiffness:c,damping:d,mass:u,duration:f,velocity:h,isResolvedFromDuration:p}=rM({...n,velocity:-Cn(n.velocity||0)}),y=h||0,g=d/(2*Math.sqrt(c*u)),x=i-o,v=Cn(Math.sqrt(c/u)),b=Math.abs(x)<5;r||(r=b?_t.restSpeed.granular:_t.restSpeed.default),s||(s=b?_t.restDelta.granular:_t.restDelta.default);let w;if(g<1){const C=Gd(v,g);w=N=>{const k=Math.exp(-g*v*N);return i-k*((y+g*v*x)/C*Math.sin(C*N)+x*Math.cos(C*N))}}else if(g===1)w=C=>i-Math.exp(-v*C)*(x+(y+v*x)*C);else{const C=v*Math.sqrt(g*g-1);w=N=>{const k=Math.exp(-g*v*N),P=Math.min(C*N,300);return i-k*((y+g*v*x)*Math.sinh(P)+C*x*Math.cosh(P))/C}}const _={calculatedDuration:p&&f||null,next:C=>{const N=w(C);if(p)l.done=C>=f;else{let k=C===0?y:0;g<1&&(k=C===0?tr(y):b0(w,C,N));const P=Math.abs(k)<=r,A=Math.abs(i-N)<=s;l.done=P&&A}return l.value=l.done?i:N,l},toString:()=>{const C=Math.min(oh(_),ol),N=y0(k=>_.next(C*k).value,C,30);return C+"ms "+N},toTransition:()=>{}};return _}il.applyToOptions=e=>{const t=XI(e,100,il);return e.ease=t.ease,e.duration=tr(t.duration),e.type="keyframes",e};function Kd({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:o=500,modifyTarget:i,min:l,max:c,restDelta:d=.5,restSpeed:u}){const f=e[0],h={done:!1,value:f},p=P=>l!==void 0&&P<l||c!==void 0&&P>c,y=P=>l===void 0?c:c===void 0||Math.abs(l-P)<Math.abs(c-P)?l:c;let g=n*t;const x=f+g,v=i===void 0?x:i(x);v!==x&&(g=v-f);const b=P=>-g*Math.exp(-P/r),w=P=>v+b(P),_=P=>{const A=b(P),T=w(P);h.done=Math.abs(A)<=d,h.value=h.done?v:T};let C,N;const k=P=>{p(h.value)&&(C=P,N=il({keyframes:[h.value,y(h.value)],velocity:b0(w,P,h.value),damping:s,stiffness:o,restDelta:d,restSpeed:u}))};return k(0),{calculatedDuration:null,next:P=>{let A=!1;return!N&&C===void 0&&(A=!0,_(P),k(P)),C!==void 0&&P>=C?N.next(P-C):(!A&&_(P),h)}}}function sM(e,t,n){const r=[],s=n||vr.mix||v0,o=e.length-1;for(let i=0;i<o;i++){let l=s(e[i],e[i+1]);if(t){const c=Array.isArray(t)?t[i]||kn:t;l=Zo(c,l)}r.push(l)}return r}function w0(e,t,{clamp:n=!0,ease:r,mixer:s}={}){const o=e.length;if(sl(o===t.length),o===1)return()=>t[0];if(o===2&&t[0]===t[1])return()=>t[1];const i=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=sM(t,r,s),c=l.length,d=u=>{if(i&&u<e[0])return t[0];let f=0;if(c>1)for(;f<e.length-2&&!(u<e[f+1]);f++);const h=Io(e[f],e[f+1],u);return l[f](h)};return n?u=>d(xr(e[0],e[o-1],u)):d}function aM(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=Io(0,t,r);e.push(xt(n,1,s))}}function oM(e){const t=[0];return aM(t,e.length-1),t}function iM(e,t){return e.map(n=>n*t)}function lM(e,t){return e.map(()=>t||i0).splice(0,e.length-1)}function mo({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const s=wI(r)?r.map(Cm):Cm(r),o={done:!1,value:t[0]},i=iM(n&&n.length===t.length?n:oM(t),e),l=w0(i,t,{ease:Array.isArray(s)?s:lM(t,s)});return{calculatedDuration:e,next:c=>(o.value=l(c),o.done=c>=e,o)}}const cM=e=>e!==null;function ih(e,{repeat:t,repeatType:n="loop"},r,s=1){const o=e.filter(cM),l=s<0||t&&n!=="loop"&&t%2===1?0:o.length-1;return!l||r===void 0?o[l]:r}const dM={decay:Kd,inertia:Kd,tween:mo,keyframes:mo,spring:il};function _0(e){typeof e.type=="string"&&(e.type=dM[e.type])}class lh{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const uM=e=>e/100;class ch extends lh{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var r,s;const{motionValue:n}=this.options;n&&n.updatedAt!==on.now()&&this.tick(on.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(s=(r=this.options).onStop)==null||s.call(r))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;_0(t);const{type:n=mo,repeat:r=0,repeatDelay:s=0,repeatType:o,velocity:i=0}=t;let{keyframes:l}=t;const c=n||mo;c!==mo&&typeof l[0]!="number"&&(this.mixKeyframes=Zo(uM,v0(l[0],l[1])),l=[0,100]);const d=c({...t,keyframes:l});o==="mirror"&&(this.mirroredGenerator=c({...t,keyframes:[...l].reverse(),velocity:-i})),d.calculatedDuration===null&&(d.calculatedDuration=oh(d));const{calculatedDuration:u}=d;this.calculatedDuration=u,this.resolvedDuration=u+s,this.totalDuration=this.resolvedDuration*(r+1)-s,this.generator=d}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:r,totalDuration:s,mixKeyframes:o,mirroredGenerator:i,resolvedDuration:l,calculatedDuration:c}=this;if(this.startTime===null)return r.next(0);const{delay:d=0,keyframes:u,repeat:f,repeatType:h,repeatDelay:p,type:y,onUpdate:g,finalKeyframe:x}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-s/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const v=this.currentTime-d*(this.playbackSpeed>=0?1:-1),b=this.playbackSpeed>=0?v<0:v>s;this.currentTime=Math.max(v,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let w=this.currentTime,_=r;if(f){const P=Math.min(this.currentTime,s)/l;let A=Math.floor(P),T=P%1;!T&&P>=1&&(T=1),T===1&&A--,A=Math.min(A,f+1),!!(A%2)&&(h==="reverse"?(T=1-T,p&&(T-=p/l)):h==="mirror"&&(_=i)),w=xr(0,1,T)*l}const C=b?{done:!1,value:u[0]}:_.next(w);o&&(C.value=o(C.value));let{done:N}=C;!b&&c!==null&&(N=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const k=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&N);return k&&y!==Kd&&(C.value=ih(u,this.options,x,this.speed)),g&&g(C.value),k&&this.finish(),C}then(t,n){return this.finished.then(t,n)}get duration(){return Cn(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Cn(t)}get time(){return Cn(this.currentTime)}set time(t){var n;t=tr(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),(n=this.driver)==null||n.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(on.now());const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=Cn(this.currentTime))}play(){var s,o;if(this.isStopped)return;const{driver:t=YI,startTime:n}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),(o=(s=this.options).onPlay)==null||o.call(s);const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(on.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(t=this.options).onComplete)==null||n.call(t)}cancel(){var t,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(t=this.options).onCancel)==null||n.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),t.observe(this)}}function fM(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const ls=e=>e*180/Math.PI,Yd=e=>{const t=ls(Math.atan2(e[1],e[0]));return Xd(t)},hM={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Yd,rotateZ:Yd,skewX:e=>ls(Math.atan(e[1])),skewY:e=>ls(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Xd=e=>(e=e%360,e<0&&(e+=360),e),Tm=Yd,Im=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Mm=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),pM={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Im,scaleY:Mm,scale:e=>(Im(e)+Mm(e))/2,rotateX:e=>Xd(ls(Math.atan2(e[6],e[5]))),rotateY:e=>Xd(ls(Math.atan2(-e[2],e[0]))),rotateZ:Tm,rotate:Tm,skewX:e=>ls(Math.atan(e[4])),skewY:e=>ls(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Zd(e){return e.includes("scale")?1:0}function Qd(e,t){if(!e||e==="none")return Zd(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,s;if(n)r=pM,s=n;else{const l=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=hM,s=l}if(!s)return Zd(t);const o=r[t],i=s[1].split(",").map(gM);return typeof o=="function"?o(i):i[o]}const mM=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return Qd(n,t)};function gM(e){return parseFloat(e.trim())}const La=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Fa=new Set(La),Rm=e=>e===Oa||e===Te,xM=new Set(["x","y","z"]),vM=La.filter(e=>!xM.has(e));function yM(e){const t=[];return vM.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const Ss={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>Qd(t,"x"),y:(e,{transform:t})=>Qd(t,"y")};Ss.translateX=Ss.x;Ss.translateY=Ss.y;const Cs=new Set;let Jd=!1,eu=!1,tu=!1;function S0(){if(eu){const e=Array.from(Cs).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const s=yM(r);s.length&&(n.set(r,s),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([o,i])=>{var l;(l=r.getValue(o))==null||l.set(i)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}eu=!1,Jd=!1,Cs.forEach(e=>e.complete(tu)),Cs.clear()}function C0(){Cs.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(eu=!0)})}function bM(){tu=!0,C0(),S0(),tu=!1}class dh{constructor(t,n,r,s,o,i=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=s,this.element=o,this.isAsync=i}scheduleResolve(){this.state="scheduled",this.isAsync?(Cs.add(this),Jd||(Jd=!0,ft.read(C0),ft.resolveKeyframes(S0))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:s}=this;if(t[0]===null){const o=s==null?void 0:s.get(),i=t[t.length-1];if(o!==void 0)t[0]=o;else if(r&&n){const l=r.readValue(n,i);l!=null&&(t[0]=l)}t[0]===void 0&&(t[0]=i),s&&o===void 0&&s.set(t[0])}fM(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Cs.delete(this)}cancel(){this.state==="scheduled"&&(Cs.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const wM=e=>e.startsWith("--");function _M(e,t,n){wM(t)?e.style.setProperty(t,n):e.style[t]=n}const SM=Qf(()=>window.ScrollTimeline!==void 0),CM={};function jM(e,t){const n=Qf(e);return()=>CM[t]??n()}const j0=jM(()=>{try{document.createElement("div").animate({opacity:0}
450,{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),ao=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Dm={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ao([0,.65,.55,1]),circOut:ao([.55,0,1,.45]),backIn:ao([.31,.01,.66,-.59]),backOut:ao([.33,1.53,.69,.99])};function k0(e,t){if(e)return typeof e=="function"?j0()?y0(e,t):"ease-out":l0(e)?ao(e):Array.isArray(e)?e.map(n=>k0(n,t)||Dm.easeOut):Dm[e]}function kM(e,t,n,{delay:r=0,duration:s=300,repeat:o=0,repeatType:i="loop",ease:l="easeOut",times:c}={},d=void 0){const u={[t]:n};c&&(u.offset=c);const f=k0(l,s);Array.isArray(f)&&(u.easing=f);const h={delay:r,duration:s,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:o+1,direction:i==="reverse"?"alternate":"normal"};return d&&(h.pseudoElement=d),e.animate(u,h)}function E0(e){return typeof e=="function"&&"applyToOptions"in e}function EM({type:e,...t}){return E0(e)&&j0()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class NM extends lh{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;const{element:n,name:r,keyframes:s,pseudoElement:o,allowFlatten:i=!1,finalKeyframe:l,onComplete:c}=t;this.isPseudoElement=!!o,this.allowFlatten=i,this.options=t,sl(typeof t.type!="string");const d=EM(t);this.animation=kM(n,r,s,d,o),d.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!o){const u=ih(s,this.options,l,this.speed);this.updateMotionValue?this.updateMotionValue(u):_M(n,r,u),this.animation.cancel()}c==null||c(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,n;(n=(t=this.animation).finish)==null||n.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var t,n;this.isPseudoElement||(n=(t=this.animation).commitStyles)==null||n.call(t)}get duration(){var n,r;const t=((r=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:r.call(n).duration)||0;return Cn(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Cn(t)}get time(){return Cn(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=tr(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(t){this.animation.startTime=t}attachTimeline({timeline:t,observe:n}){var r;return this.allowFlatten&&((r=this.animation.effect)==null||r.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&SM()?(this.animation.timeline=t,kn):n(this)}}const N0={anticipate:s0,backInOut:r0,circInOut:o0};function PM(e){return e in N0}function AM(e){typeof e.ease=="string"&&PM(e.ease)&&(e.ease=N0[e.ease])}const Om=10;class TM extends NM{constructor(t){AM(t),_0(t),super(t),t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:r,onComplete:s,element:o,...i}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const l=new ch({...i,autoplay:!1}),c=tr(this.finishedTime??this.time);n.setWithVelocity(l.sample(c-Om).value,l.sample(c).value,Om),l.stop()}}const Lm=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Hr.test(e)||e==="0")&&!e.startsWith("url("));function IM(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function MM(e,t,n,r){const s=e[0];if(s===null)return!1;if(t==="display"||t==="visibility")return!0;const o=e[e.length-1],i=Lm(s,t),l=Lm(o,t);return!i||!l?!1:IM(e)||(n==="spring"||E0(n))&&r}function nu(e){e.duration=0,e.type="keyframes"}const RM=new Set(["opacity","clipPath","filter","transform"]),DM=Qf(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function OM(e){var u;const{motionValue:t,name:n,repeatDelay:r,repeatType:s,damping:o,type:i}=e;if(!(((u=t==null?void 0:t.owner)==null?void 0:u.current)instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:d}=t.owner.getProps();return DM()&&n&&RM.has(n)&&(n!=="transform"||!d)&&!c&&!r&&s!=="mirror"&&o!==0&&i!=="inertia"}const LM=40;class FM extends lh{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:o=0,repeatType:i="loop",keyframes:l,name:c,motionValue:d,element:u,...f}){var y;super(),this.stop=()=>{var g,x;this._animation&&(this._animation.stop(),(g=this.stopTimeline)==null||g.call(this)),(x=this.keyframeResolver)==null||x.cancel()},this.createdAt=on.now();const h={autoplay:t,delay:n,type:r,repeat:s,repeatDelay:o,repeatType:i,name:c,motionValue:d,element:u,...f},p=(u==null?void 0:u.KeyframeResolver)||dh;this.keyframeResolver=new p(l,(g,x,v)=>this.onKeyframesResolved(g,x,h,!v),c,d,u),(y=this.keyframeResolver)==null||y.scheduleResolve()}onKeyframesResolved(t,n,r,s){this.keyframeResolver=void 0;const{name:o,type:i,velocity:l,delay:c,isHandoff:d,onUpdate:u}=r;this.resolvedAt=on.now(),MM(t,o,i,l)||((vr.instantAnimations||!c)&&(u==null||u(ih(t,r,n))),t[0]=t[t.length-1],nu(r),r.repeat=0);const h={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>LM?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:t},p=!d&&OM(h)?new TM({...h,element:h.motionValue.owner.current}):new ch(h);p.finished.then(()=>this.notifyFinished()).catch(kn),this.pendingTimeline&&(this.stopTimeline=p.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=p}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),bM()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}const zM=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function BM(e){const t=zM.exec(e);if(!t)return[,];const[,n,r,s]=t;return[`--${n??r}`,s]}function P0(e,t,n=1){const[r,s]=BM(e);if(!r)return;const o=window.getComputedStyle(t).getPropertyValue(r);if(o){const i=o.trim();return Yb(i)?parseFloat(i):i}return nh(s)?P0(s,t,n+1):s}function uh(e,t){return(e==null?void 0:e[t])??(e==null?void 0:e.default)??e}const A0=new Set(["width","height","top","left","right","bottom",...La]),VM={test:e=>e==="auto",parse:e=>e},T0=e=>t=>t.test(e),I0=[Oa,Te,nr,Er,MI,II,VM],Fm=e=>I0.find(T0(e));function $M(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Zb(e):!0}const UM=new Set(["brightness","contrast","saturate","opacity"]);function WM(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(rh)||[];if(!r)return e;const s=n.replace(r,"");let o=UM.has(t)?1:0;return r!==n&&(o*=100),t+"("+o+s+")"}const HM=/\b([a-z-]*)\(.*?\)/gu,ru={...Hr,getAnimatableNone:e=>{const t=e.match(HM);return t?t.map(WM).join(" "):e}},zm={...Oa,transform:Math.round},qM={rotate:Er,rotateX:Er,rotateY:Er,rotateZ:Er,scale:yi,scaleX:yi,scaleY:yi,scaleZ:yi,skew:Er,skewX:Er,skewY:Er,distance:Te,translateX:Te,translateY:Te,translateZ:Te,x:Te,y:Te,z:Te,perspective:Te,transformPerspective:Te,opacity:Mo,originX:km,originY:km,originZ:Te},fh={borderWidth:Te,borderTopWidth:Te,borderRightWidth:Te,borderBottomWidth:Te,borderLeftWidth:Te,borderRadius:Te,radius:Te,borderTopLeftRadius:Te,borderTopRightRadius:Te,borderBottomRightRadius:Te,borderBottomLeftRadius:Te,width:Te,maxWidth:Te,height:Te,maxHeight:Te,top:Te,right:Te,bottom:Te,left:Te,padding:Te,paddingTop:Te,paddingRight:Te,paddingBottom:Te,paddingLeft:Te,margin:Te,marginTop:Te,marginRight:Te,marginBottom:Te,marginLeft:Te,backgroundPositionX:Te,backgroundPositionY:Te,...qM,zIndex:zm,fillOpacity:Mo,strokeOpacity:Mo,numOctaves:zm},GM={...fh,color:Ct,backgroundColor:Ct,outlineColor:Ct,fill:Ct,stroke:Ct,borderColor:Ct,borderTopColor:Ct,borderRightColor:Ct,borderBottomColor:Ct,borderLeftColor:Ct,filter:ru,WebkitFilter:ru},M0=e=>GM[e];function R0(e,t){let n=M0(e);return n!==ru&&(n=Hr),n.getAnimatableNone?n.getAnimatableNone(t):void 0}
vendor: 10,518 bytes, lines 450-458
450const KM=new Set(["auto","none","0"]);function YM(e,t,n){let r=0,s;for(;r<e.length&&!s;){const o=e[r];typeof o=="string"&&!KM.has(o)&&Ro(o).values.length&&(s=e[r]),r++}if(s&&n)for(const o of t)e[o]=R0(n,s)}class XM extends dh{constructor(t,n,r,s,o){super(t,n,r,s,o,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c<t.length;c++){let d=t[c];if(typeof d=="string"&&(d=d.trim(),nh(d))){const u=P0(d,n.current);u!==void 0&&(t[c]=u),c===t.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!A0.has(r)||t.length!==2)return;const[s,o]=t,i=Fm(s),l=Fm(o);if(i!==l)if(Rm(i)&&Rm(l))for(let c=0;c<t.length;c++){const d=t[c];typeof d=="string"&&(t[c]=parseFloat(d))}else Ss[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let s=0;s<t.length;s++)(t[s]===null||$M(t[s]))&&r.push(s);r.length&&YM(t,r,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Ss[r](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&t.getValue(r,s).jump(s,!1)}measureEndState(){var l;const{element:t,name:n,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const s=t.getValue(n);s&&s.jump(this.measuredOrigin,!1);const o=r.length-1,i=r[o];r[o]=Ss[n](t.measureViewportBox(),window.getComputedStyle(t.current)),i!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=i),(l=this.removedTransforms)!=null&&l.length&&this.removedTransforms.forEach(([c,d])=>{t.getValue(c).set(d)}),this.resolveNoneKeyframes()}}function ZM(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e=="string"){const s=document.querySelectorAll(e);return s?Array.from(s):[]}return Array.from(e)}const D0=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function O0(e){return Xb(e)&&"offsetHeight"in e}const Bm=30,QM=e=>!isNaN(parseFloat(e)),go={current:void 0};class JM{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{var o;const s=on.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&((o=this.events.change)==null||o.notify(this.current),this.dependents))for(const i of this.dependents)i.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=on.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=QM(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Jf);const r=this.events[t].add(n);return t==="change"?()=>{r(),ft.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var t;(t=this.events.change)==null||t.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return go.current&&go.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=on.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Bm)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Bm);return Qb(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var t,n;(t=this.dependents)==null||t.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Rs(e,t){return new JM(e,t)}const{schedule:hh,cancel:K$}=c0(queueMicrotask,!1),In={x:!1,y:!1};function L0(){return In.x||In.y}function eR(e){return e==="x"||e==="y"?In[e]?null:(In[e]=!0,()=>{In[e]=!1}):In.x||In.y?null:(In.x=In.y=!0,()=>{In.x=In.y=!1})}function F0(e,t){const n=ZM(e),r=new AbortController,s={passive:!0,...t,signal:r.signal};return[n,s,()=>r.abort()]}function Vm(e){return!(e.pointerType==="touch"||L0())}function tR(e,t,n={}){const[r,s,o]=F0(e,n),i=l=>{if(!Vm(l))return;const{target:c}=l,d=t(c,l);if(typeof d!="function"||!c)return;const u=f=>{Vm(f)&&(d(f),c.removeEventListener("pointerleave",u))};c.addEventListener("pointerleave",u,s)};return r.forEach(l=>{l.addEventListener("pointerenter",i,s)}),o}const z0=(e,t)=>t?e===t?!0:z0(e,t.parentElement):!1,ph=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,nR=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function rR(e){return nR.has(e.tagName)||e.tabIndex!==-1}const Fi=new WeakSet;function $m(e){return t=>{t.key==="Enter"&&e(t)}}function zc(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const sR=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=$m(()=>{if(Fi.has(n))return;zc(n,"down");const s=$m(()=>{zc(n,"up")}),o=()=>zc(n,"cancel");n.addEventListener("keyup",s,t),n.addEventListener("blur",o,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function Um(e){return ph(e)&&!L0()}function aR(e,t,n={}){const[r,s,o]=F0(e,n),i=l=>{const c=l.currentTarget;if(!Um(l))return;Fi.add(c);const d=t(c,l),u=(p,y)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),Fi.has(c)&&Fi.delete(c),Um(p)&&typeof d=="function"&&d(p,{success:y})},f=p=>{u(p,c===window||c===document||n.useGlobalTarget||z0(c,p.target))},h=p=>{u(p,!1)};window.addEventListener("pointerup",f,s),window.addEventListener("pointercancel",h,s)};return r.forEach(l=>{(n.useGlobalTarget?window:l).addEventListener("pointerdown",i,s),O0(l)&&(l.addEventListener("focus",d=>sR(d,s)),!rR(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),o}function B0(e){return Xb(e)&&"ownerSVGElement"in e}function oR(e){return B0(e)&&e.tagName==="svg"}function iR(...e){const t=!Array.isArray(e[0]),n=t?0:-1,r=e[0+n],s=e[1+n],o=e[2+n],i=e[3+n],l=w0(s,o,i);return t?l(r):l}const Ht=e=>!!(e&&e.getVelocity),lR=[...I0,Ct,Hr],cR=e=>lR.find(T0(e)),Vl=m.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function Wm(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function dR(...e){return t=>{let n=!1;const r=e.map(s=>{const o=Wm(s,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let s=0;s<r.length;s++){const o=r[s];typeof o=="function"?o():Wm(e[s],null)}}}}function uR(...e){return m.useCallback(dR(...e),e)}class fR extends m.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=n.offsetParent,s=O0(r)&&r.offsetWidth||0,o=this.props.sizeRef.current;o.height=n.offsetHeight||0,o.width=n.offsetWidth||0,o.top=n.offsetTop,o.left=n.offsetLeft,o.right=s-o.width-o.left}return null}componentDidUpdate(){}render(){return this.props.children}}function hR({children:e,isPresent:t,anchorX:n,root:r}){const s=m.useId(),o=m.useRef(null),i=m.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:l}=m.useContext(Vl),c=uR(o,e==null?void 0:e.ref);return m.useInsertionEffect(()=>{const{width:d,height:u,top:f,left:h,right:p}=i.current;if(t||!o.current||!d||!u)return;const y=n==="left"?`left: ${h}`:`right: ${p}`;o.current.dataset.motionPopId=s;const g=document.createElement("style");l&&(g.nonce=l);const x=r??document.head;return x.appendChild(g),g.sheet&&g.sheet.insertRule(`
451          [data-motion-pop-id="${s}"] {
452            position: absolute !important;
453            width: ${d}px !important;
454            height: ${u}px !important;
455            ${y}px !important;
456            top: ${f}px !important;
457          }
458        `),()=>{x.contains(g)&&x.removeChild(g)}},[t]),a.jsx(fR,{isPresent:t,childRef:o,sizeRef:i,children:m.cloneElement(e,{ref:c})})}const pR=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:o,mode:i,anchorX:l,root:c})=>{const d=Xo(mR),u=m.useId();let f=!0,h=m.useMemo(()=>(f=!1,{id:u,initial:t,isPresent:n,custom:s,onExitComplete:p=>{d.set(p,!0);for(const y of d.values())if(!y)return;r&&r()},register:p=>(d.set(p,!1),()=>d.delete(p))}),[n,d,r]);return o&&f&&(h={...h}),m.useMemo(()=>{d.forEach((p,y)=>d.set(y,!1))},[n]),m.useEffect(()=>{!n&&!d.size&&r&&r()},[n]),i==="popLayout"&&(e=a.jsx(hR,{isPresent:n,anchorX:l,root:c,children:e})),a.jsx(Bl.Provider,{value:h,children:e})};function mR(){return new Map}function V0(e=!0){const t=m.useContext(Bl);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=t,o=m.useId();m.useEffect(()=>{if(e)return s(o)},[e]);const i=m.useCallback(()=>e&&r&&r(o),[o,r,e]);return!n&&r?[!1,i]:[!0]}const bi=e=>e.key||"";function Hm(e){const t=[];return m.Children.forEach(e,n=>{m.isValidElement(n)&&t.push(n)}),t}const $l=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:o="sync",propagate:i=!1,anchorX:l="left",root:c})=>{const[d,u]=V0(i),f=m.useMemo(()=>Hm(e),[e]),h=i&&!d?[]:f.map(bi),p=m.useRef(!0),y=m.useRef(f),g=Xo(()=>new Map),[x,v]=m.useState(f),[b,w]=m.useState(f);Yf(()=>{p.current=!1,y.current=f;for(let N=0;N<b.length;N++){const k=bi(b[N]);h.includes(k)?g.delete(k):g.get(k)!==!0&&g.set(k,!1)}},[b,h.length,h.join("-")]);const _=[];if(f!==x){let N=[...f];for(let k=0;k<b.length;k++){const P=b[k],A=bi(P);h.includes(A)||(N.splice(k,0,P),_.push(P))}return o==="wait"&&_.length&&(N=_),w(Hm(N)),v(f),null}const{forceRender:C}=m.useContext(Gf);return a.jsx(a.Fragment,{children:b.map(N=>{const k=bi(N),P=i&&!d?!1:f===b||h.includes(k),A=()=>{if(g.has(k))g.set(k,!0);else return;let T=!0;g.forEach(D=>{D||(T=!1)}
vendor: 4,787 bytes, line 458
458),T&&(C==null||C(),w(y.current),i&&(u==null||u()),r&&r())};return a.jsx(pR,{isPresent:P,initial:!p.current||n?void 0:!1,custom:t,presenceAffectsLayout:s,mode:o,root:c,onExitComplete:P?void 0:A,anchorX:l,children:N},k)})})},$0=m.createContext({strict:!1}),qm={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Ea={};for(const e in qm)Ea[e]={isEnabled:t=>qm[e].some(n=>!!t[n])};function gR(e){for(const t in e)Ea[t]={...Ea[t],...e[t]}}const xR=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function ll(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||xR.has(e)}let U0=e=>!ll(e);function vR(e){typeof e=="function"&&(U0=t=>t.startsWith("on")?!ll(t):e(t))}try{vR(require("@emotion/is-prop-valid").default)}catch{}function yR(e,t,n){const r={};for(const s in e)s==="values"&&typeof e.values=="object"||(U0(s)||n===!0&&ll(s)||!t&&!ll(s)||e.draggable&&s.startsWith("onDrag"))&&(r[s]=e[s]);return r}const Ul=m.createContext({});function Wl(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Do(e){return typeof e=="string"||Array.isArray(e)}const mh=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],gh=["initial",...mh];function Hl(e){return Wl(e.animate)||gh.some(t=>Do(e[t]))}function W0(e){return!!(Hl(e)||e.variants)}function bR(e,t){if(Hl(e)){const{initial:n,animate:r}=e;return{initial:n===!1||Do(n)?n:void 0,animate:Do(r)?r:void 0}}return e.inherit!==!1?t:{}}function wR(e){const{initial:t,animate:n}=bR(e,m.useContext(Ul));return m.useMemo(()=>({initial:t,animate:n}),[Gm(t),Gm(n)])}function Gm(e){return Array.isArray(e)?e.join(" "):e}function Km(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Ha={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Te.test(e))e=parseFloat(e);else return e;const n=Km(e,t.target.x),r=Km(e,t.target.y);return`${n}% ${r}%`}},_R={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,s=Hr.parse(e);if(s.length>5)return r;const o=Hr.createTransformer(e),i=typeof s[0]!="number"?1:0,l=n.x.scale*t.x,c=n.y.scale*t.y;s[0+i]/=l,s[1+i]/=c;const d=xt(l,c,.5);return typeof s[2+i]=="number"&&(s[2+i]/=d),typeof s[3+i]=="number"&&(s[3+i]/=d),o(s)}},su={borderRadius:{...Ha,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Ha,borderTopRightRadius:Ha,borderBottomLeftRadius:Ha,borderBottomRightRadius:Ha,boxShadow:_R};function H0(e,{layout:t,layoutId:n}){return Fa.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!su[e]||e==="opacity")}const SR={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},CR=La.length;function jR(e,t,n){let r="",s=!0;for(let o=0;o<CR;o++){const i=La[o],l=e[i];if(l===void 0)continue;let c=!0;if(typeof l=="number"?c=l===(i.startsWith("scale")?1:0):c=parseFloat(l)===0,!c||n){const d=D0(l,fh[i]);if(!c){s=!1;const u=SR[i]||i;r+=`${u}(${d}) `}n&&(t[i]=d)}}return r=r.trim(),n?r=n(t,s?"":r):s&&(r="none"),r}function xh(e,t,n){const{style:r,vars:s,transformOrigin:o}=e;let i=!1,l=!1;for(const c in t){const d=t[c];if(Fa.has(c)){i=!0;continue}else if(u0(c)){s[c]=d;continue}else{const u=D0(d,fh[c]);c.startsWith("origin")?(l=!0,o[c]=u):r[c]=u}}if(t.transform||(i||n?r.transform=jR(t,e.transform,n):r.transform&&(r.transform="none")),l){const{originX:c="50%",originY:d="50%",originZ:u=0}=o;r.transformOrigin=`${c} ${d} ${u}`}}const vh=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function q0(e,t,n){for(const r in t)!Ht(t[r])&&!H0(r,n)&&(e[r]=t[r])}function kR({transformTemplate:e},t){return m.useMemo(()=>{const n=vh();return xh(n,t,e),Object.assign({},n.vars,n.style)},[t])}function ER(e,t){const n=e.style||{},r={};return q0(r,n,e),Object.assign(r,kR(e,t)),r}function NR(e,t){const n={},r=ER(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}
458`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}const PR={offset:"stroke-dashoffset",array:"stroke-dasharray"},AR={offset:"strokeDashoffset",array:"strokeDasharray"};function TR(e,t,n=1,r=0,s=!0){e.pathLength=1;const o=s?PR:AR;e[o.offset]=Te.transform(-r);const i=Te.transform(t),l=Te.transform(n);e[o.array]=`${i} ${l}`}function G0(e,{attrX:t,attrY:n,attrScale:r,pathLength:s,pathSpacing:o=1,pathOffset:i=0,...l},c,d,u){if(xh(e,l,d),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:f,style:h}=e;f.transform&&(h.transform=f.transform,delete f.transform),(h.transform||f.transformOrigin)&&(h.transformOrigin=f.transformOrigin??"50% 50%",delete f.transformOrigin),h.transform&&(h.transformBox=(u==null?void 0:u.transformBox)??"fill-box",delete f.transformBox),t!==void 0&&(f.x=t),n!==void 0&&(f.y=n),r!==void 0&&(f.scale=r),s!==void 0&&TR(f,s,o,i,!1)}const K0=()=>({...vh(),attrs:{}}),Y0=e=>typeof e=="string"&&e.toLowerCase()==="svg";function IR(e,t,n,r){const s=m.useMemo(()=>{const o=K0();return G0(o,t,Y0(r),e.transformTemplate,e.style),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};q0(o,e.style,e),s.style={...o,...s.style}}return s}const MR=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function yh(e){return typeof e!="string"||e.includes("-")?!1:!!(MR.indexOf(e)>-1||/[A-Z]/u.test(e))}function RR(e,t,n,{latestValues:r},s,o=!1){const l=(yh(e)?IR:NR)(t,r,s,e),c=yR(t,typeof e=="string",o),d=e!==m.Fragment?{...c,...l,ref:n}:{},{children:u}=t,f=m.useMemo(()=>Ht(u)?u.get():u,[u]);return m.createElement(e,{...d,children:f})}function Ym(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function bh(e,t,n,r){if(typeof t=="function"){const[s,o]=Ym(r);t=t(n!==void 0?n:e.custom,s,o)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,o]=Ym(r);t=t(n!==void 0?n:e.custom,s,o)}return t}function zi(e){return Ht(e)?e.get():e}function DR({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,s){return{latestValues:OR(n,r,s,e),renderState:t()}}function OR(e,t,n,r){const s={},o=r(e,{});for(const h in o)s[h]=zi(o[h]);let{initial:i,animate:l}=e;const c=Hl(e),d=W0(e);t&&d&&!c&&e.inherit!==!1&&(i===void 0&&(i=t.initial),l===void 0&&(l=t.animate));let u=n?n.initial===!1:!1;u=u||i===!1;const f=u?l:i;if(f&&typeof f!="boolean"&&!Wl(f)){const h=Array.isArray(f)?f:[f];for(let p=0;p<h.length;p++){const y=bh(e,h[p]);if(y){const{transitionEnd:g,transition:x,...v}=y;for(const b in v){let w=v[b];if(Array.isArray(w)){const _=u?w.length-1:0;w=w[_]}w!==null&&(s[b]=w)}for(const b in g)s[b]=g[b]}}}return s}const X0=e=>(t,n)=>{const r=m.useContext(Ul),s=m.useContext(Bl),o=()=>DR(e,t,r,s);return n?o():Xo(o)};function wh(e,t,n){var o;const{style:r}=e,s={};for(const i in r)(Ht(r[i])||t.style&&Ht(t.style[i])||H0(i,e)||((o=n==null?void 0:n.getValue(i))==null?void 0:o.liveStyle)!==void 0)&&(s[i]=r[i]);return s}const LR=X0({scrapeMotionValuesFromProps:wh,createRenderState:vh});function Z0(e,t,n){const r=wh(e,t,n);for(const s in e)if(Ht(e[s])||Ht(t[s])){const o=La.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[o]=e[s]}return r}const FR=X0({scrapeMotionValuesFromProps:Z0,createRenderState:K0}),zR=Symbol.for("motionComponentSymbol");function Ys(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function BR(e,t,n){return m.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):Ys(n)&&(n.current=r))},[t])}const _h=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),VR="framerAppearId",Q0="data-"+_h(VR),J0=m.createContext({});function $R(e,t,n,r,s){var g,x;const{visualElement:o}=m.useContext(Ul),i=m.useContext($0),l=m.useContext(Bl),c=m.useContext(Vl).reducedMotion,d=m.useRef(null);r=r||i.renderer,!d.current&&r&&(d.current=r(e,{visualState:t,parent:o,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:c}
vendor: 17,613 bytes, line 458
458));const u=d.current,f=m.useContext(J0);u&&!u.projection&&s&&(u.type==="html"||u.type==="svg")&&UR(d.current,n,s,f);const h=m.useRef(!1);m.useInsertionEffect(()=>{u&&h.current&&u.update(n,l)});const p=n[Q0],y=m.useRef(!!p&&!((g=window.MotionHandoffIsComplete)!=null&&g.call(window,p))&&((x=window.MotionHasOptimisedAnimation)==null?void 0:x.call(window,p)));return Yf(()=>{u&&(h.current=!0,window.MotionIsMounted=!0,u.updateFeatures(),u.scheduleRenderMicrotask(),y.current&&u.animationState&&u.animationState.animateChanges())}),m.useEffect(()=>{u&&(!y.current&&u.animationState&&u.animationState.animateChanges(),y.current&&(queueMicrotask(()=>{var v;(v=window.MotionHandoffMarkAsComplete)==null||v.call(window,p)}),y.current=!1),u.enteringChildren=void 0)}),u}function UR(e,t,n,r){const{layoutId:s,layout:o,drag:i,dragConstraints:l,layoutScroll:c,layoutRoot:d,layoutCrossfade:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:ew(e.parent)),e.projection.setOptions({layoutId:s,layout:o,alwaysMeasureLayout:!!i||l&&Ys(l),visualElement:e,animationType:typeof o=="string"?o:"both",initialPromotionConfig:r,crossfade:u,layoutScroll:c,layoutRoot:d})}function ew(e){if(e)return e.options.allowProjection!==!1?e.projection:ew(e.parent)}function Bc(e,{forwardMotionProps:t=!1}={},n,r){n&&gR(n);const s=yh(e)?FR:LR;function o(l,c){let d;const u={...m.useContext(Vl),...l,layoutId:WR(l)},{isStatic:f}=u,h=wR(l),p=s(l,f);if(!f&&Kf){HR();const y=qR(u);d=y.MeasureLayout,h.visualElement=$R(e,p,u,r,y.ProjectionNode)}return a.jsxs(Ul.Provider,{value:h,children:[d&&h.visualElement?a.jsx(d,{visualElement:h.visualElement,...u}):null,RR(e,l,BR(p,h.visualElement,c),p,f,t)]})}o.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const i=m.forwardRef(o);return i[zR]=e,i}function WR({layoutId:e}){const t=m.useContext(Gf).id;return t&&e!==void 0?t+"-"+e:e}function HR(e,t){m.useContext($0).strict}function qR(e){const{drag:t,layout:n}=Ea;if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function GR(e,t){if(typeof Proxy>"u")return Bc;const n=new Map,r=(o,i)=>Bc(o,i,e,t),s=(o,i)=>r(o,i);return new Proxy(s,{get:(o,i)=>i==="create"?r:(n.has(i)||n.set(i,Bc(i,void 0,e,t)),n.get(i))})}function tw({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function KR({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function YR(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Vc(e){return e===void 0||e===1}function au({scale:e,scaleX:t,scaleY:n}){return!Vc(e)||!Vc(t)||!Vc(n)}function ss(e){return au(e)||nw(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function nw(e){return Xm(e.x)||Xm(e.y)}function Xm(e){return e&&e!=="0%"}function cl(e,t,n){const r=e-n,s=t*r;return n+s}function Zm(e,t,n,r,s){return s!==void 0&&(e=cl(e,s,r)),cl(e,n,r)+t}function ou(e,t=0,n=1,r,s){e.min=Zm(e.min,t,n,r,s),e.max=Zm(e.max,t,n,r,s)}function rw(e,{x:t,y:n}){ou(e.x,t.translate,t.scale,t.originPoint),ou(e.y,n.translate,n.scale,n.originPoint)}const Qm=.999999999999,Jm=1.0000000000001;function XR(e,t,n,r=!1){const s=n.length;if(!s)return;t.x=t.y=1;let o,i;for(let l=0;l<s;l++){o=n[l],i=o.projectionDelta;const{visualElement:c}=o.options;c&&c.props.style&&c.props.style.display==="contents"||(r&&o.options.layoutScroll&&o.scroll&&o!==o.root&&Zs(e,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),i&&(t.x*=i.x.scale,t.y*=i.y.scale,rw(e,i)),r&&ss(o.latestValues)&&Zs(e,o.latestValues))}t.x<Jm&&t.x>Qm&&(t.x=1),t.y<Jm&&t.y>Qm&&(t.y=1)}function Xs(e,t){e.min=e.min+t,e.max=e.max+t}function eg(e,t,n,r,s=.5){const o=xt(e.min,e.max,s);ou(e,t,n,o,r)}function Zs(e,t){eg(e.x,t.x,t.scaleX,t.scale,t.originX),eg(e.y,t.y,t.scaleY,t.scale,t.originY)}function sw(e,t){return tw(YR(e.getBoundingClientRect(),t))}function ZR(e,t,n){const r=sw(e,n),{scroll:s}=t;return s&&(Xs(r.x,s.offset.x),Xs(r.y,s.offset.y)),r}const tg=()=>({translate:0,scale:1,origin:0,originPoint:0}),Qs=()=>({x:tg(),y:tg()}),ng=()=>({min:0,max:0}),Nt=()=>({x:ng(),y:ng()}),iu={current:null},aw={current:!1};function QR(){if(aw.current=!0,!!Kf)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>iu.current=e.matches;e.addEventListener("change",t),t()}else iu.current=!1}const JR=new WeakMap;function e5(e,t,n){for(const r in t){const s=t[r],o=n[r];if(Ht(s))e.addValue(r,s);else if(Ht(o))e.addValue(r,Rs(s,{owner:e}));else if(o!==s)if(e.hasValue(r)){const i=e.getValue(r);i.liveStyle===!0?i.jump(s):i.hasAnimated||i.set(s)}else{const i=e.getStaticValue(r);e.addValue(r,Rs(i!==void 0?i:s,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const rg=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class t5{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:o,visualState:i},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=dh,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const h=on.now();this.renderScheduledAt<h&&(this.renderScheduledAt=h,ft.render(this.render,!1,!0))};const{latestValues:c,renderState:d}=i;this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=d,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.options=l,this.blockInitialAnimation=!!o,this.isControllingVariants=Hl(n),this.isVariantNode=W0(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:u,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const h in f){const p=f[h];c[h]!==void 0&&Ht(p)&&p.set(c[h])}}mount(t){var n;this.current=t,JR.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,s)=>this.bindToMotionValue(s,r)),aw.current||QR(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:iu.current,(n=this.parent)==null||n.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var t;this.projection&&this.projection.unmount(),yr(this.notifyUpdate),yr(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const r=this.features[n];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const r=Fa.has(t);r&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",i=>{this.latestValues[t]=i,this.props.onUpdate&&ft.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{s(),o&&o(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Ea){const n=Ea[t];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[t]&&s&&r(this.props)&&(this.features[t]=new s(this)),this.features[t]){const o=this.features[t];o.isMounted?o.update():(o.mount(),o.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Nt()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<rg.length;r++){const s=rg[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const o="on"+s,i=t[o];i&&(this.propEventSubscriptions[s]=this.on(s,i))}this.prevMotionValues=e5(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=Rs(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(Yb(r)||Zb(r))?r=parseFloat(r):!cR(r)&&Hr.test(n)&&(r=R0(t,n)),this.setBaseTarget(t,Ht(r)?r.get():r)),Ht(r)?r.get():r}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var o;const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const i=bh(this.props,n,(o=this.presenceContext)==null?void 0:o.custom);i&&(r=i[t])}if(n&&r!==void 0)return r;const s=this.getBaseTargetFromProps(this.props,t);return s!==void 0&&!Ht(s)?s:this.initialValues[t]!==void 0&&r===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Jf),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){hh.render(this.render)}}class ow extends t5{constructor(){super(...arguments),this.KeyframeResolver=XM}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Ht(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function iw(e,{style:t,vars:n},r,s){const o=e.style;let i;for(i in t)o[i]=t[i];s==null||s.applyProjectionStyles(o,r);for(i in n)o.setProperty(i,n[i])}function n5(e){return window.getComputedStyle(e)}class r5 extends ow{constructor(){super(...arguments),this.type="html",this.renderInstance=iw}readValueFromInstance(t,n){var r;if(Fa.has(n))return(r=this.projection)!=null&&r.isProjecting?Zd(n):mM(t,n);{const s=n5(t),o=(u0(n)?s.getPropertyValue(n):s[n])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(t,{transformPagePoint:n}){return sw(t,n)}build(t,n,r){xh(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return wh(t,n,r)}}const lw=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function s5(e,t,n,r){iw(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(lw.has(s)?s:_h(s),t.attrs[s])}class a5 extends ow{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Nt}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Fa.has(n)){const r=M0(n);return r&&r.default||0}return n=lw.has(n)?n:_h(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return Z0(t,n,r)}build(t,n,r){G0(t,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(t,n,r,s){s5(t,n,r,s)}mount(t){this.isSVGTag=Y0(t.tagName),super.mount(t)}}const o5=(e,t)=>yh(e)?new a5(t):new r5(t,{allowProjection:e!==m.Fragment});function oa(e,t,n){const r=e.getProps();return bh(r,t,n!==void 0?n:r.custom,e)}const lu=e=>Array.isArray(e);function i5(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Rs(n))}function l5(e){return lu(e)?e[e.length-1]||0:e}function c5(e,t){const n=oa(e,t);let{transitionEnd:r={},transition:s={},...o}=n||{};o={...o,...r};for(const i in o){const l=l5(o[i]);i5(e,i,l)}}function d5(e){return!!(Ht(e)&&e.add)}function cu(e,t){const n=e.getValue("willChange");if(d5(n))return n.add(t);if(!n&&vr.WillChange){const r=new vr.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function cw(e){return e.props[Q0]}const u5=e=>e!==null;function f5(e,{repeat:t,repeatType:n="loop"},r){const s=e.filter(u5),o=t&&n!=="loop"&&t%2===1?0:s.length-1;return!o||r===void 0?s[o]:r}const h5={type:"spring",stiffness:500,damping:25,restSpeed:10},p5=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),m5={type:"keyframes",duration:.8},g5={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},x5=(e,{keyframes:t})=>t.length>2?m5:Fa.has(e)?e.startsWith("scale")?p5(t[1]):h5:g5;function v5({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:o,repeatType:i,repeatDelay:l,from:c,elapsed:d,...u}){return!!Object.keys(u).length}const Sh=(e,t,n,r={},s,o)=>i=>{const l=uh(r,e)||{},c=l.delay||r.delay||0;let{elapsed:d=0}=r;d=d-tr(c);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-d,onUpdate:h=>{t.set(h),l.onUpdate&&l.onUpdate(h)},onComplete:()=>{i(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:o?void 0:s};v5(l)||Object.assign(u,x5(e,u)),u.duration&&(u.duration=tr(u.duration)),u.repeatDelay&&(u.repeatDelay=tr(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let f=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(nu(u),u.delay===0&&(f=!0)),(vr.instantAnimations||vr.skipAnimations)&&(f=!0,nu(u),u.delay=0),u.allowFlatten=!l.type&&!l.ease,f&&!o&&t.get()!==void 0){const h=f5(u.keyframes,l);if(h!==void 0){ft.update(()=>{u.onUpdate(h),u.onComplete()});return}}return l.isSync?new ch(u):new FM(u)};function y5({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function dw(e,t,{delay:n=0,transitionOverride:r,type:s}={}){let{transition:o=e.getDefaultTransition(),transitionEnd:i,...l}=t;r&&(o=r);const c=[],d=s&&e.animationState&&e.animationState.getState()[s];for(const u in l){const f=e.getValue(u,e.latestValues[u]??null),h=l[u];if(h===void 0||d&&y5(d,u))continue;const p={delay:n,...uh(o||{},u)},y=f.get();if(y!==void 0&&!f.isAnimating&&!Array.isArray(h)&&h===y&&!p.velocity)continue;let g=!1;if(window.MotionHandoffAnimation){const v=cw(e);if(v){const b=window.MotionHandoffAnimation(v,u,ft);b!==null&&(p.startTime=b,g=!0)}}cu(e,u),f.start(Sh(u,f,h,e.shouldReduceMotion&&A0.has(u)?{type:!1}:p,e,g));const x=f.animation;x&&c.push(x)}return i&&Promise.all(c).then(()=>{ft.update(()=>{i&&c5(e,i)})}),c}function uw(e,t,n,r=0,s=1){const o=Array.from(e).sort((d,u)=>d.sortNodePosition(u)).indexOf(t),i=e.size,l=(i-1)*r;return typeof n=="function"?n(o,i):s===1?o*r:l-o*r}function du(e,t,n={}){var c;const r=oa(e,t,n.type==="exit"?(c=e.presenceContext)==null?void 0:c.custom:void 0);let{transition:s=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(s=n.transitionOverride);const o=r?()=>Promise.all(dw(e,r,n)):()=>Promise.resolve(),i=e.variantChildren&&e.variantChildren.size?(d=0)=>{const{delayChildren:u=0,staggerChildren:f,staggerDirection:h}=s;return b5(e,t,d,u,f,h,n)}:()=>Promise.resolve(),{when:l}=s;if(l){const[d,u]=l==="beforeChildren"?[o,i]:[i,o];return d().then(()=>u())}else return Promise.all([o(),i(n.delay)])}function b5(e,t,n=0,r=0,s=0,o=1,i){const l=[];for(const c of e.variantChildren)c.notify("AnimationStart",t),l.push(du(c,t,{...i,delay:n+(typeof r=="function"?0:r)+uw(e.variantChildren,c,r,s,o)}).then(()=>c.notify("AnimationComplete",t)));return Promise.all(l)}function w5(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const s=t.map(o=>du(e,o,n));r=Promise.all(s)}else if(typeof t=="string")r=du(e,t,n);else{const s=typeof t=="function"?oa(e,t,n.custom):t;r=Promise.all(dw(e,s,n))}return r.then(()=>
vendor: 21,882 bytes, line 458
458{e.notify("AnimationComplete",t)})}function fw(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}const _5=gh.length;function hw(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?hw(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<_5;n++){const r=gh[n],s=e.props[r];(Do(s)||s===!1)&&(t[r]=s)}return t}const S5=[...mh].reverse(),C5=mh.length;function j5(e){return t=>Promise.all(t.map(({animation:n,options:r})=>w5(e,n,r)))}function k5(e){let t=j5(e),n=sg(),r=!0;const s=c=>(d,u)=>{var h;const f=oa(e,u,c==="exit"?(h=e.presenceContext)==null?void 0:h.custom:void 0);if(f){const{transition:p,transitionEnd:y,...g}=f;d={...d,...g,...y}}return d};function o(c){t=c(e)}function i(c){const{props:d}=e,u=hw(e.parent)||{},f=[],h=new Set;let p={},y=1/0;for(let x=0;x<C5;x++){const v=S5[x],b=n[v],w=d[v]!==void 0?d[v]:u[v],_=Do(w),C=v===c?b.isActive:null;C===!1&&(y=x);let N=w===u[v]&&w!==d[v]&&_;if(N&&r&&e.manuallyAnimateOnMount&&(N=!1),b.protectedKeys={...p},!b.isActive&&C===null||!w&&!b.prevProp||Wl(w)||typeof w=="boolean")continue;const k=E5(b.prevProp,w);let P=k||v===c&&b.isActive&&!N&&_||x>y&&_,A=!1;const T=Array.isArray(w)?w:[w];let D=T.reduce(s(v),{});C===!1&&(D={});const{prevResolvedValues:E={}}=b,I={...E,...D},S=B=>{P=!0,h.has(B)&&(A=!0,h.delete(B)),b.needsAnimating[B]=!0;const q=e.getValue(B);q&&(q.liveStyle=!1)};for(const B in I){const q=D[B],F=E[B];if(p.hasOwnProperty(B))continue;let ee=!1;lu(q)&&lu(F)?ee=!fw(q,F):ee=q!==F,ee?q!=null?S(B):h.add(B):q!==void 0&&h.has(B)?S(B):b.protectedKeys[B]=!0}b.prevProp=w,b.prevResolvedValues=D,b.isActive&&(p={...p,...D}),r&&e.blockInitialAnimation&&(P=!1);const L=N&&k;P&&(!L||A)&&f.push(...T.map(B=>{const q={type:v};if(typeof B=="string"&&r&&!L&&e.manuallyAnimateOnMount&&e.parent){const{parent:F}=e,ee=oa(F,B);if(F.enteringChildren&&ee){const{delayChildren:$}=ee.transition||{};q.delay=uw(F.enteringChildren,e,$)}}return{animation:B,options:q}}))}if(h.size){const x={};if(typeof d.initial!="boolean"){const v=oa(e,Array.isArray(d.initial)?d.initial[0]:d.initial);v&&v.transition&&(x.transition=v.transition)}h.forEach(v=>{const b=e.getBaseTarget(v),w=e.getValue(v);w&&(w.liveStyle=!0),x[v]=b??null}),f.push({animation:x})}let g=!!f.length;return r&&(d.initial===!1||d.initial===d.animate)&&!e.manuallyAnimateOnMount&&(g=!1),r=!1,g?t(f):Promise.resolve()}function l(c,d){var f;if(n[c].isActive===d)return Promise.resolve();(f=e.variantChildren)==null||f.forEach(h=>{var p;return(p=h.animationState)==null?void 0:p.setActive(c,d)}),n[c].isActive=d;const u=i(c);for(const h in n)n[h].protectedKeys={};return u}return{animateChanges:i,setActive:l,setAnimateFunction:o,getState:()=>n,reset:()=>{n=sg()}}}function E5(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!fw(t,e):!1}function ns(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function sg(){return{animate:ns(!0),whileInView:ns(),whileHover:ns(),whileTap:ns(),whileDrag:ns(),whileFocus:ns(),exit:ns()}}class Zr{constructor(t){this.isMounted=!1,this.node=t}update(){}}class N5 extends Zr{constructor(t){super(t),t.animationState||(t.animationState=k5(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Wl(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let P5=0;class A5 extends Zr{constructor(){super(...arguments),this.id=P5++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const s=this.node.animationState.setActive("exit",!t);n&&!t&&s.then(()=>{n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const T5={animation:{Feature:N5},exit:{Feature:A5}};function Oo(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function ei(e){return{point:{x:e.pageX,y:e.pageY}}}const I5=e=>t=>ph(t)&&e(t,ei(t));function xo(e,t,n,r){return Oo(e,t,I5(n),r)}const pw=1e-4,M5=1-pw,R5=1+pw,mw=.01,D5=0-mw,O5=0+mw;function Zt(e){return e.max-e.min}function L5(e,t,n){return Math.abs(e-t)<=n}function ag(e,t,n,r=.5){e.origin=r,e.originPoint=xt(t.min,t.max,e.origin),e.scale=Zt(n)/Zt(t),e.translate=xt(n.min,n.max,e.origin)-e.originPoint,(e.scale>=M5&&e.scale<=R5||isNaN(e.scale))&&(e.scale=1),(e.translate>=D5&&e.translate<=O5||isNaN(e.translate))&&(e.translate=0)}function vo(e,t,n,r){ag(e.x,t.x,n.x,r?r.originX:void 0),ag(e.y,t.y,n.y,r?r.originY:void 0)}function og(e,t,n){e.min=n.min+t.min,e.max=e.min+Zt(t)}function F5(e,t,n){og(e.x,t.x,n.x),og(e.y,t.y,n.y)}function ig(e,t,n){e.min=t.min-n.min,e.max=e.min+Zt(t)}function dl(e,t,n){ig(e.x,t.x,n.x),ig(e.y,t.y,n.y)}function vn(e){return[e("x"),e("y")]}const gw=({current:e})=>e?e.ownerDocument.defaultView:null,lg=(e,t)=>Math.abs(e-t);function z5(e,t){const n=lg(e.x,t.x),r=lg(e.y,t.y);return Math.sqrt(n**2+r**2)}class xw{constructor(t,n,{transformPagePoint:r,contextWindow:s=window,dragSnapToOrigin:o=!1,distanceThreshold:i=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const h=Uc(this.lastMoveEventInfo,this.history),p=this.startEvent!==null,y=z5(h.offset,{x:0,y:0})>=this.distanceThreshold;if(!p&&!y)return;const{point:g}=h,{timestamp:x}=Lt;this.history.push({...g,timestamp:x});const{onStart:v,onMove:b}=this.handlers;p||(v&&v(this.lastMoveEvent,h),this.startEvent=this.lastMoveEvent),b&&b(this.lastMoveEvent,h)},this.handlePointerMove=(h,p)=>{this.lastMoveEvent=h,this.lastMoveEventInfo=$c(p,this.transformPagePoint),ft.update(this.updatePoint,!0)},this.handlePointerUp=(h,p)=>{this.end();const{onEnd:y,onSessionEnd:g,resumeAnimation:x}=this.handlers;if(this.dragSnapToOrigin&&x&&x(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const v=Uc(h.type==="pointercancel"?this.lastMoveEventInfo:$c(p,this.transformPagePoint),this.history);this.startEvent&&y&&y(h,v),g&&g(h,v)},!ph(t))return;this.dragSnapToOrigin=o,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=i,this.contextWindow=s||window;const l=ei(t),c=$c(l,this.transformPagePoint),{point:d}=c,{timestamp:u}=Lt;this.history=[{...d,timestamp:u}];const{onSessionStart:f}=n;f&&f(t,Uc(c,this.history)),this.removeListeners=Zo(xo(this.contextWindow,"pointermove",this.handlePointerMove),xo(this.contextWindow,"pointerup",this.handlePointerUp),xo(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),yr(this.updatePoint)}}function $c(e,t){return t?{point:t(e.point)}:e}function cg(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Uc({point:e},t){return{point:e,delta:cg(e,vw(t)),offset:cg(e,B5(t)),velocity:V5(t,.1)}}function B5(e){return e[0]}function vw(e){return e[e.length-1]}function V5(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=vw(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>tr(t)));)n--;if(!r)return{x:0,y:0};const o=Cn(s.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const i={x:(s.x-r.x)/o,y:(s.y-r.y)/o};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function $5(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?xt(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?xt(n,e,r.max):Math.min(e,n)),e}function dg(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function U5(e,{top:t,left:n,bottom:r,right:s}){return{x:dg(e.x,n,s),y:dg(e.y,t,r)}}function ug(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function W5(e,t){return{x:ug(e.x,t.x),y:ug(e.y,t.y)}}function H5(e,t){let n=.5;const r=Zt(e),s=Zt(t);return s>r?n=Io(t.min,t.max-r,e.min):r>s&&(n=Io(e.min,e.max-s,t.min)),xr(0,1,n)}function q5(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const uu=.35;function G5(e=uu){return e===!1?e=0:e===!0&&(e=uu),{x:fg(e,"left","right"),y:fg(e,"top","bottom")}}function fg(e,t,n){return{min:hg(e,t),max:hg(e,n)}}function hg(e,t){return typeof e=="number"?e:e[t]||0}const K5=new WeakMap;class Y5{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Nt(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const o=f=>{const{dragSnapToOrigin:h}=this.getProps();h?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(ei(f).point)},i=(f,h)=>{const{drag:p,dragPropagation:y,onDragStart:g}=this.getProps();if(p&&!y&&(this.openDragLock&&this.openDragLock(),this.openDragLock=eR(p),!this.openDragLock))return;this.latestPointerEvent=f,this.latestPanInfo=h,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),vn(v=>{let b=this.getAxisMotionValue(v).get()||0;if(nr.test(b)){const{projection:w}=this.visualElement;if(w&&w.layout){const _=w.layout.layoutBox[v];_&&(b=Zt(_)*(parseFloat(b)/100))}}this.originPoint[v]=b}),g&&ft.postRender(()=>g(f,h)),cu(this.visualElement,"transform");const{animationState:x}=this.visualElement;x&&x.setActive("whileDrag",!0)},l=(f,h)=>{this.latestPointerEvent=f,this.latestPanInfo=h;const{dragPropagation:p,dragDirectionLock:y,onDirectionLock:g,onDrag:x}=this.getProps();if(!p&&!this.openDragLock)return;const{offset:v}=h;if(y&&this.currentDirection===null){this.currentDirection=X5(v),this.currentDirection!==null&&g&&g(this.currentDirection);return}this.updateAxis("x",h.point,v),this.updateAxis("y",h.point,v),this.visualElement.render(),x&&x(f,h)},c=(f,h)=>{this.latestPointerEvent=f,this.latestPanInfo=h,this.stop(f,h),this.latestPointerEvent=null,this.latestPanInfo=null},d=()=>vn(f=>{var h;return this.getAnimationState(f)==="paused"&&((h=this.getAxisMotionValue(f).animation)==null?void 0:h.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new xw(t,{onSessionStart:o,onStart:i,onMove:l,onSessionEnd:c,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,distanceThreshold:r,contextWindow:gw(this.visualElement)})}stop(t,n){const r=t||this.latestPointerEvent,s=n||this.latestPanInfo,o=this.isDragging;if(this.cancel(),!o||!s||!r)return;const{velocity:i}=s;this.startAnimation(i);const{onDragEnd:l}=this.getProps();l&&ft.postRender(()=>l(r,s))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:s}=this.getProps();if(!r||!wi(t,s,this.currentDirection))return;const o=this.getAxisMotionValue(t);let i=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(i=$5(i,this.constraints[t],this.elastic[t])),o.set(i)}resolveConstraints(){var o;const{dragConstraints:t,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(o=this.visualElement.projection)==null?void 0:o.layout,s=this.constraints;t&&Ys(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=U5(r.layoutBox,t):this.constraints=!1,this.elastic=G5(n),s!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&vn(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=q5(r.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Ys(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const o=ZR(r,s.root,this.visualElement.getTransformPagePoint());let i=W5(s.layout.layoutBox,o);if(n){const l=n(KR(i));this.hasMutatedConstraints=!!l,l&&(i=tw(l))}return i}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:o,dragSnapToOrigin:i,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},d=vn(u=>{if(!wi(u,n,this.currentDirection))return;let f=c&&c[u]||{};i&&(f={min:0,max:0});const h=s?200:1e6,p=s?40:1e7,y={type:"inertia",velocity:r?t[u]:0,bounceStiffness:h,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...o,...f};return this.startAxisValueAnimation(u,y)});return Promise.all(d).then(l)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return cu(this.visualElement,t),r.start(Sh(t,r,0,n,this.visualElement,!1))}stopAnimation(){vn(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){vn(t=>{var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){vn(n=>{const{drag:r}=this.getProps();if(!wi(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,o=this.getAxisMotionValue(n);if(s&&s.layout){const{min:i,max:l}=s.layout.layoutBox[n];o.set(t[n]-xt(i,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Ys(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};vn(i=>{const l=this.getAxisMotionValue(i);if(l&&this.constraints!==!1){const c=l.get();s[i]=H5({min:c,max:c},this.constraints[i])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),vn(i=>{if(!wi(i,t,null))return;const l=this.getAxisMotionValue(i),{min:c,max:d}=this.constraints[i];l.set(xt(c,d,s[i]))})}addListeners(){if(!this.visualElement.current)return;K5.set(this.visualElement,this);const t=this.visualElement.current,n=xo(t,"pointerdown",c=>{const{drag:d,dragListener:u=!0}=this.getProps();d&&u&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();Ys(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,o=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),ft.read(r);const i=Oo(window,"resize",()=>this.scalePositionWithinConstraints()),l=s.addEventListener("didUpdate",({delta:c,hasLayoutChanged:d})=>{this.isDragging&&d&&(vn(u=>{const f=this.getAxisMotionValue(u);f&&(this.originPoint[u]+=c[u].translate,f.set(f.get()+c[u].translate))}),this.visualElement.render())});return()=>{i(),n(),o(),l&&l()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:o=!1,dragElastic:i=uu,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:o,dragElastic:i,dragMomentum:l}}}function wi(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function X5(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class Z5 extends Zr{constructor(t){super(t),this.removeGroupControls=kn,this.removeListeners=kn,this.controls=new Y5(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||kn}unmount(){this.removeGroupControls(),this.removeListeners()}}const pg=e=>(t,n)=>{e&&ft.postRender(()=>e(t,n))};class Q5 extends Zr{constructor(){super(...arguments),this.removePointerDownListener=kn}onPointerDown(t){this.session=new xw(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:gw(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:pg(t),onStart:pg(n),onMove:r,onEnd:(o,i)=>{delete this.session,s&&ft.postRender(()=>s(o,i))}}}mount(){this.removePointerDownListener=xo(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const Bi={hasAnimatedSinceResize:!0,hasEverUpdated:!1};let Wc=!1;class J5 extends m.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:o}=t;o&&(n.group&&n.group.add(o),r&&r.register&&s&&r.register(o),Wc&&o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,onExitComplete:()=>this.safeToRemove()})),Bi.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:s,isPresent:o}=this.props,{projection:i}=r;return i&&(i.isPresent=o,Wc=!0,s||t.layoutDependency!==n||n===void 0||t.isPresent!==o?i.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?i.promote():i.relegate()||ft.postRender(()=>{const l=i.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),hh.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=t;Wc=!0,s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function yw(e){const[t,n]=V0(),r=m.useContext(Gf);return a.jsx(J5,{...e,layoutGroup:r,switchLayoutGroup:m.useContext(J0),isPresent:t,safeToRemove:n})}function eD(e,t,n){const r=Ht(e)?e:Rs(e);return r.start(Sh("",r,t,n)),r.animation}const tD=(e,t)=>e.depth-t.depth;class nD{constructor(){this.children=[],this.isDirty=!1}add(t){Xf(this.children,t),this.isDirty=!0}remove(t){Zf(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(tD),this.isDirty=!1,this.children.forEach(t)}}function rD(e,t){const n=on.now(),r=({timestamp:s})=>{const o=s-n;o>=t&&(yr(r),e(o-t))};return ft.setup(r,!0),()=>yr(r)}const bw=["TopLeft","TopRight","BottomLeft","BottomRight"],sD=bw.length,mg=e=>typeof e=="string"?parseFloat(e):e,gg=e=>typeof e=="number"||Te.test(e);function aD(e,t,n,r,s,o){s?(e.opacity=xt(0,n.opacity??1,oD(r)),e.opacityExit=xt(t.opacity??1,0,iD(r))):o&&(e.opacity=xt(t.opacity??1,n.opacity??1,r));for(let i=0;i<sD;i++){const l=`border${bw[i]}Radius`;let c=xg(t,l),d=xg(n,l);if(c===void 0&&d===void 0)continue;c||(c=0),d||(d=0),c===0||d===0||gg(c)===gg(d)?(e[l]=Math.max(xt(mg(c),mg(d),r),0),(nr.test(d)||nr.test(c))&&(e[l]+="%")):e[l]=d}(t.rotate||n.rotate)&&(e.rotate=xt(t.rotate||0,n.rotate||0,r))}function xg(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const oD=ww(0,.5,a0),iD=ww(.5,.95,kn);function ww(e,t,n){return r=>r<e?0:r>t?1:n(Io(e,t,r))}function vg(e,t){e.min=t.min,e.max=t.max}function Tn(e,t){vg(e.x,t.x),vg(e.y,t.y)}function yg(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function bg(e,t,n,r,s){return e-=t,e=cl(e,1/n,r),s!==void 0&&(e=cl(e,1/s,r)),e}function lD(e,t=0,n=1,r=.5,s,o=e,i=e){if(nr.test(t)&&(t=parseFloat(t),t=xt(i.min,i.max,t/100)-i.min),typeof t!="number")return;let l=xt(o.min,o.max,r);e===o&&(l-=t),e.min=bg(e.min,t,n,l,s),e.max=bg(e.max,t,n,l,s)}function wg(e,t,[n,r,s],o,i){lD(e,t[n],t[r],t[s],t.scale,o,i)}const cD=["x","scaleX","originX"],dD=["y","scaleY","originY"];function _g(e,t,n,r){wg(e.x,t,cD,n?n.x:void 0,r?r.x:void 0),wg(e.y,t,dD,n?n.y:void 0,r?r.y:void 0)}function Sg(e){return e.translate===0&&e.scale===1}function _w(e){return Sg(e.x)&&Sg(e.y)}function Cg(e,t){return e.min===t.min&&e.max===t.max}function uD(e,t){return Cg(e.x,t.x)&&Cg(e.y,t.y)}function jg(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Sw(e,t){return jg(e.x,t.x)&&jg(e.y,t.y)}function kg(e){return Zt(e.x)/Zt(e.y)}function Eg(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class fD{constructor(){this.members=[]}add(t){Xf(this.members,t),t.scheduleRender()}remove(t){if(Zf(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(s=>t===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const o=this.members[s];if(o.isPresent!==!1){r=o;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:s}=t.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function hD(e,t,n){let r="";
vendor: 16,621 bytes, line 458
458const s=e.x.translate/t.x,o=e.y.translate/t.y,i=(n==null?void 0:n.z)||0;if((s||o||i)&&(r=`translate3d(${s}px, ${o}px, ${i}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:d,rotate:u,rotateX:f,rotateY:h,skewX:p,skewY:y}=n;d&&(r=`perspective(${d}px) ${r}`),u&&(r+=`rotate(${u}deg) `),f&&(r+=`rotateX(${f}deg) `),h&&(r+=`rotateY(${h}deg) `),p&&(r+=`skewX(${p}deg) `),y&&(r+=`skewY(${y}deg) `)}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(r+=`scale(${l}, ${c})`),r||"none"}const Hc=["","X","Y","Z"],pD=1e3;let mD=0;function qc(e,t,n,r){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),r&&(r[e]=0))}function Cw(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=cw(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:o}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",ft,!(s||o))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&Cw(r)}function jw({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(i={},l=t==null?void 0:t()){this.id=mD++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(vD),this.nodes.forEach(_D),this.nodes.forEach(SD),this.nodes.forEach(yD)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=i,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new nD)}addEventListener(i,l){return this.eventHandlers.has(i)||this.eventHandlers.set(i,new Jf),this.eventHandlers.get(i).add(l)}notifyListeners(i,...l){const c=this.eventHandlers.get(i);c&&c.notify(...l)}hasListeners(i){return this.eventHandlers.has(i)}mount(i){if(this.instance)return;this.isSVG=B0(i)&&!oR(i),this.instance=i;const{layoutId:l,layout:c,visualElement:d}=this.options;if(d&&!d.current&&d.mount(i),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(c||l)&&(this.isLayoutDirty=!0),e){let u,f=0;const h=()=>this.root.updateBlockedByResize=!1;ft.read(()=>{f=window.innerWidth}),e(i,()=>{const p=window.innerWidth;p!==f&&(f=p,this.root.updateBlockedByResize=!0,u&&u(),u=rD(h,250),Bi.hasAnimatedSinceResize&&(Bi.hasAnimatedSinceResize=!1,this.nodes.forEach(Ag)))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&d&&(l||c)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:f,hasRelativeLayoutChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const y=this.options.transition||d.getDefaultTransition()||ND,{onLayoutAnimationStart:g,onLayoutAnimationComplete:x}=d.getProps(),v=!this.targetLayout||!Sw(this.targetLayout,p),b=!f&&h;if(this.options.layoutRoot||this.resumeFrom||b||f&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const w={...uh(y,"layout"),onPlay:g,onComplete:x};(d.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w),this.setAnimationOrigin(u,b)}else f||Ag(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const i=this.getStack();i&&i.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),yr(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(CD),this.animationId++)}getTransformTemplate(){const{visualElement:i}=this.options;return i&&i.getProps().transformTemplate}willUpdate(i=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Cw(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const f=this.path[u];f.shouldResetTransform=!0,f.updateScroll("snapshot"),f.options.layoutRoot&&f.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),i&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Ng);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Pg);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(wD),this.nodes.forEach(gD),this.nodes.forEach(xD)):this.nodes.forEach(Pg),this.clearAllSnapshots();const l=on.now();Lt.delta=xr(0,1e3/60,l-Lt.timestamp),Lt.timestamp=l,Lt.isProcessing=!0,Rc.update.process(Lt),Rc.preRender.process(Lt),Rc.render.process(Lt),Lt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,hh.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(bD),this.sharedNodes.forEach(jD)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,ft.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){ft.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Zt(this.snapshot.measuredBox.x)&&!Zt(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const i=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=Nt(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,i?i.layoutBox:void 0)}updateScroll(i="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===i&&(l=!1),l&&this.instance){const c=r(this.instance);this.scroll={animationId:this.root.animationId,phase:i,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!s)return;const i=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!_w(this.projectionDelta),c=this.getTransformTemplate(),d=c?c(this.latestValues,""):void 0,u=d!==this.prevTransformTemplateValue;i&&this.instance&&(l||ss(this.latestValues)||u)&&(s(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(i=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return i&&(c=this.removeTransform(c)),PD(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var d;const{visualElement:i}=this.options;if(!i)return Nt();const l=i.measureViewportBox();if(!(((d=this.scroll)==null?void 0:d.wasRoot)||this.path.some(AD))){const{scroll:u}=this.root;u&&(Xs(l.x,u.offset.x),Xs(l.y,u.offset.y))}return l}removeElementScroll(i){var c;const l=Nt();if(Tn(l,i),(c=this.scroll)!=null&&c.wasRoot)return l;for(let d=0;d<this.path.length;d++){const u=this.path[d],{scroll:f,options:h}=u;u!==this.root&&f&&h.layoutScroll&&(f.wasRoot&&Tn(l,i),Xs(l.x,f.offset.x),Xs(l.y,f.offset.y))}return l}applyTransform(i,l=!1){const c=Nt();Tn(c,i);for(let d=0;d<this.path.length;d++){const u=this.path[d];!l&&u.options.layoutScroll&&u.scroll&&u!==u.root&&Zs(c,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),ss(u.latestValues)&&Zs(c,u.latestValues)}return ss(this.latestValues)&&Zs(c,this.latestValues),c}removeTransform(i){const l=Nt();Tn(l,i);for(let c=0;c<this.path.length;c++){const d=this.path[c];if(!d.instance||!ss(d.latestValues))continue;au(d.latestValues)&&d.updateSnapshot();const u=Nt(),f=d.measurePageBox();Tn(u,f),_g(l,d.latestValues,d.snapshot?d.snapshot.layoutBox:void 0,u)}return ss(this.latestValues)&&_g(l,this.latestValues),l}setTargetDelta(i){this.targetDelta=i,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(i){this.options={...this.options,...i,crossfade:i.crossfade!==void 0?i.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Lt.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(i=!1){var p;const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==l;if(!(i||c&&this.isSharedProjectionDirty||this.isProjectionDirty||(p=this.parent)!=null&&p.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:u,layoutId:f}=this.options;if(!this.layout||!(u||f))return;this.resolvedRelativeTargetAt=Lt.timestamp;const h=this.getClosestProjectingParent();h&&this.linkedParentVersion!==h.layoutVersion&&!h.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(h&&h.layout?this.createRelativeTarget(h,this.layout.layoutBox,h.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Nt(),this.targetWithTransforms=Nt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),F5(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Tn(this.target,this.layout.layoutBox),rw(this.target,this.targetDelta)):Tn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,h&&!!h.resumingFrom==!!this.resumingFrom&&!h.options.layoutScroll&&h.target&&this.animationProgress!==1?this.createRelativeTarget(h,this.target,h.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||au(this.parent.latestValues)||nw(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(i,l,c){this.relativeParent=i,this.linkedParentVersion=i.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Nt(),this.relativeTargetOrigin=Nt(),dl(this.relativeTargetOrigin,l,c),Tn(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var y;const i=this.getLead(),l=!!this.resumingFrom||this!==i;let c=!0;if((this.isProjectionDirty||(y=this.parent)!=null&&y.isProjectionDirty)&&(c=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===Lt.timestamp&&(c=!1),c)return;const{layout:d,layoutId:u}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||u))return;Tn(this.layoutCorrected,this.layout.layoutBox);const f=this.treeScale.x,h=this.treeScale.y;XR(this.layoutCorrected,this.treeScale,this.path,l),i.layout&&!i.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(i.target=i.layout.layoutBox,i.targetWithTransforms=Nt());const{target:p}=i;if(!p){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(yg(this.prevProjectionDelta.x,this.projectionDelta.x),yg(this.prevProjectionDelta.y,this.projectionDelta.y)),vo(this.projectionDelta,this.layoutCorrected,p,this.latestValues),(this.treeScale.x!==f||this.treeScale.y!==h||!Eg(this.projectionDelta.x,this.prevProjectionDelta.x)||!Eg(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",p))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(i=!0){var l;if((l=this.options.visualElement)==null||l.scheduleRender(),i){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Qs(),this.projectionDelta=Qs(),this.projectionDeltaWithTransform=Qs()}setAnimationOrigin(i,l=!1){const c=this.snapshot,d=c?c.latestValues:{},u={...this.latestValues},f=Qs();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const h=Nt(),p=c?c.source:void 0,y=this.layout?this.layout.source:void 0,g=p!==y,x=this.getStack(),v=!x||x.members.length<=1,b=!!(g&&!v&&this.options.crossfade===!0&&!this.path.some(ED));this.animationProgress=0;let w;this.mixTargetDelta=_=>{const C=_/1e3;Tg(f.x,i.x,C),Tg(f.y,i.y,C),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(dl(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),kD(this.relativeTarget,this.relativeTargetOrigin,h,C),w&&uD(this.relativeTarget,w)&&(this.isProjectionDirty=!1),w||(w=Nt()),Tn(w,this.relativeTarget)),g&&(this.animationValues=u,aD(u,d,this.latestValues,C,b,v)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=C},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(i){var l,c,d;this.notifyListeners("animationStart"),(l=this.currentAnimation)==null||l.stop(),(d=(c=this.resumingFrom)==null?void 0:c.currentAnimation)==null||d.stop(),this.pendingAnimation&&(yr(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ft.update(()=>{Bi.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Rs(0)),this.currentAnimation=eD(this.motionValue,[0,1e3],{...i,velocity:0,isSync:!0,onUpdate:u=>{this.mixTargetDelta(u),i.onUpdate&&i.onUpdate(u)},onStop:()=>{},onComplete:()=>{i.onComplete&&i.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const i=this.getStack();i&&i.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(pD),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const i=this.getLead();let{targetWithTransforms:l,target:c,layout:d,latestValues:u}=i;if(!(!l||!c||!d)){if(this!==i&&this.layout&&d&&kw(this.options.animationType,this.layout.layoutBox,d.layoutBox)){c=this.target||Nt();const f=Zt(this.layout.layoutBox.x);
vendor: 5,324 bytes, line 458
458c.x.min=i.target.x.min,c.x.max=c.x.min+f;const h=Zt(this.layout.layoutBox.y);c.y.min=i.target.y.min,c.y.max=c.y.min+h}Tn(l,c),Zs(l,u),vo(this.projectionDeltaWithTransform,this.layoutCorrected,l,u)}}registerSharedNode(i,l){this.sharedNodes.has(i)||this.sharedNodes.set(i,new fD),this.sharedNodes.get(i).add(l);const d=l.options.initialPromotionConfig;l.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(l):void 0})}isLead(){const i=this.getStack();return i?i.lead===this:!0}getLead(){var l;const{layoutId:i}=this.options;return i?((l=this.getStack())==null?void 0:l.lead)||this:this}getPrevLead(){var l;const{layoutId:i}=this.options;return i?(l=this.getStack())==null?void 0:l.prevLead:void 0}getStack(){const{layoutId:i}=this.options;if(i)return this.root.sharedNodes.get(i)}promote({needsReset:i,transition:l,preserveFollowOpacity:c}={}){const d=this.getStack();d&&d.promote(this,c),i&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const i=this.getStack();return i?i.relegate(this):!1}resetSkewAndRotation(){const{visualElement:i}=this.options;if(!i)return;let l=!1;const{latestValues:c}=i;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const d={};c.z&&qc("z",i,d,this.animationValues);for(let u=0;u<Hc.length;u++)qc(`rotate${Hc[u]}`,i,d,this.animationValues),qc(`skew${Hc[u]}`,i,d,this.animationValues);i.render();for(const u in d)i.setStaticValue(u,d[u]),this.animationValues&&(this.animationValues[u]=d[u]);i.scheduleRender()}applyProjectionStyles(i,l){if(!this.instance||this.isSVG)return;if(!this.isVisible){i.visibility="hidden";return}const c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,i.visibility="",i.opacity="",i.pointerEvents=zi(l==null?void 0:l.pointerEvents)||"",i.transform=c?c(this.latestValues,""):"none";return}const d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){this.options.layoutId&&(i.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,i.pointerEvents=zi(l==null?void 0:l.pointerEvents)||""),this.hasProjected&&!ss(this.latestValues)&&(i.transform=c?c({},""):"none",this.hasProjected=!1);return}i.visibility="";const u=d.animationValues||d.latestValues;this.applyTransformsToTarget();let f=hD(this.projectionDeltaWithTransform,this.treeScale,u);c&&(f=c(u,f)),i.transform=f;const{x:h,y:p}=this.projectionDelta;i.transformOrigin=`${h.origin*100}% ${p.origin*100}% 0`,d.animationValues?i.opacity=d===this?u.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:u.opacityExit:i.opacity=d===this?u.opacity!==void 0?u.opacity:"":u.opacityExit!==void 0?u.opacityExit:0;for(const y in su){if(u[y]===void 0)continue;const{correct:g,applyTo:x,isCSSVariable:v}=su[y],b=f==="none"?u[y]:g(u[y],d);if(x){const w=x.length;for(let _=0;_<w;_++)i[x[_]]=b}else v?this.options.visualElement.renderState.vars[y]=b:i[y]=b}this.options.layoutId&&(i.pointerEvents=d===this?zi(l==null?void 0:l.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(i=>{var l;return(l=i.currentAnimation)==null?void 0:l.stop()}),this.root.nodes.forEach(Ng),this.root.sharedNodes.clear()}}}function gD(e){e.updateLayout()}function xD(e){var n;const t=((n=e.resumeFrom)==null?void 0:n.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=e.layout,{animationType:o}=e.options,i=t.source!==e.layout.source;o==="size"?vn(f=>{const h=i?t.measuredBox[f]:t.layoutBox[f],p=Zt(h);h.min=r[f].min,h.max=h.min+p}):kw(o,t.layoutBox,r)&&vn(f=>{const h=i?t.measuredBox[f]:t.layoutBox[f],p=Zt(r[f]);h.max=h.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+p)});const l=Qs();vo(l,r,t.layoutBox);const c=Qs();i?vo(c,e.applyTransform(s,!0),t.measuredBox):vo(c,r,t.layoutBox);const d=!_w(l);let u=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:p}=f;if(h&&p){const y=Nt();dl(y,t.layoutBox,h.layoutBox);const g=Nt();dl(g,r,p.layoutBox),Sw(y,g)||(u=!0),f.options.layoutRoot&&(e.relativeTarget=g,e.relativeTargetOrigin=y,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:c,layoutDelta:l,hasLayoutChanged:d,hasRelativeLayoutChanged:u})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function vD(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function yD(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function bD(e){e.clearSnapshot()}function Ng(e){e.clearMeasurements()}function Pg(e){e.isLayoutDirty=!1}function wD(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Ag(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function _D(e){e.resolveTargetDelta()}function SD(e){e.calcProjection()}
vendor: 4,557 bytes, line 458
458function CD(e){e.resetSkewAndRotation()}function jD(e){e.removeLeadSnapshot()}function Tg(e,t,n){e.translate=xt(t.translate,0,n),e.scale=xt(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Ig(e,t,n,r){e.min=xt(t.min,n.min,r),e.max=xt(t.max,n.max,r)}function kD(e,t,n,r){Ig(e.x,t.x,n.x,r),Ig(e.y,t.y,n.y,r)}function ED(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const ND={duration:.45,ease:[.4,0,.1,1]},Mg=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Rg=Mg("applewebkit/")&&!Mg("chrome/")?Math.round:kn;function Dg(e){e.min=Rg(e.min),e.max=Rg(e.max)}function PD(e){Dg(e.x),Dg(e.y)}function kw(e,t,n){return e==="position"||e==="preserve-aspect"&&!L5(kg(t),kg(n),.2)}function AD(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const TD=jw({attachResizeListener:(e,t)=>Oo(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Gc={current:void 0},Ew=jw({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Gc.current){const e=new TD({});e.mount(window),e.setOptions({layoutScroll:!0}),Gc.current=e}return Gc.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),ID={pan:{Feature:Q5},drag:{Feature:Z5,ProjectionNode:Ew,MeasureLayout:yw}};function Og(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,o=r[s];o&&ft.postRender(()=>o(t,ei(t)))}class MD extends Zr{mount(){const{current:t}=this.node;t&&(this.unmount=tR(t,(n,r)=>(Og(this.node,r,"Start"),s=>Og(this.node,s,"End"))))}unmount(){}}class RD extends Zr{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Zo(Oo(this.node.current,"focus",()=>this.onFocus()),Oo(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Lg(e,t,n){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),o=r[s];o&&ft.postRender(()=>o(t,ei(t)))}class DD extends Zr{mount(){const{current:t}=this.node;t&&(this.unmount=aR(t,(n,r)=>(Lg(this.node,r,"Start"),(s,{success:o})=>Lg(this.node,s,o?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const fu=new WeakMap,Kc=new WeakMap,OD=e=>{const t=fu.get(e.target);t&&t(e)},LD=e=>{e.forEach(OD)};function FD({root:e,...t}){const n=e||document;Kc.has(n)||Kc.set(n,{});const r=Kc.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(LD,{root:e,...t})),r[s]}function zD(e,t,n){const r=FD(t);return fu.set(e,n),r.observe(e),()=>{fu.delete(e),r.unobserve(e)}}const BD={some:0,all:1};class VD extends Zr{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:o}=t,i={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:BD[s]},l=c=>{const{isIntersecting:d}=c;if(this.isInView===d||(this.isInView=d,o&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:u,onViewportLeave:f}=this.node.getProps(),h=d?u:f;h&&h(c)};return zD(this.node.current,i,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some($D(t,n))&&this.startObserver()}unmount(){}}function $D({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const UD={inView:{Feature:VD},tap:{Feature:DD},focus:{Feature:RD},hover:{Feature:MD}},WD={layout:{ProjectionNode:Ew,MeasureLayout:yw}},HD={...T5,...UD,...ID,...WD},ht=GR(HD,o5);function hu(e){const t=Xo(()=>Rs(e)),{isStatic:n}=m.useContext(Vl);if(n){const[,r]=m.useState(e);m.useEffect(()=>t.on("change",r),[])}return t}function Nw(e,t){const n=hu(t()),r=()=>n.set(t());return r(),Yf(()=>{const s=()=>ft.preRender(r,!1,!0),o=e.map(i=>i.on("change",s));return()=>{o.forEach(i=>
458i()),yr(r)}}),n}function qD(e){go.current=[],e();const t=Nw(go.current,e);return go.current=void 0,t}function Fg(e,t,n,r){if(typeof e=="function")return qD(e);const s=typeof t=="function"?t:iR(t,n,r);return Array.isArray(e)?zg(e,s):zg([e],([o])=>s(o))}function zg(e,t){const n=Xo(()=>[]);return Nw(e,()=>{n.length=0;const r=e.length;for(let s=0;s<r;s++)n[s]=e[s].get();return t(n)})}function GD({open:e,onOpenChange:t,onSelectPix:n,onSelectCard:r}){const{t:s}=Qe("billing");return a.jsx(cn,{open:e,onOpenChange:t,children:a.jsxs(Qt,{className:"sm:max-w-md border-2 border-accent",children:[a.jsx(qt,{children:a.jsxs(Gt,{className:"text-center",children:["💰 ",s("paymentMethodModal.title")]})}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsx(ht.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:.1},children:a.jsxs(pe,{variant:"outline",className:"w-full h-auto p-4 flex items-start gap-4 hover:border-green-500 hover:bg-green-500/10 transition-all",onClick:n,children:[a.jsx("div",{className:"p-3 rounded-lg bg-green-500/20",children:a.jsx(tj,{className:"h-6 w-6 text-green-500"})}),a.jsxs("div",{className:"text-left flex-1",children:[a.jsx("p",{className:"font-semibold text-lg",children:"PIX"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:s("paymentMethodModal.pixDescription")})]})]})}),a.jsx(ht.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:.2},children:a.jsxs(pe,{variant:"outline",className:"w-full h-auto p-4 flex items-start gap-4 hover:border-accent hover:bg-accent/10 transition-all",onClick:r,children:[a.jsx("div",{className:"p-3 rounded-lg bg-accent/20",children:a.jsx(Aa,{className:"h-6 w-6 text-accent"})}),a.jsxs("div",{className:"text-left flex-1",children:[a.jsx("p",{className:"font-semibold text-lg",children:s("paymentMethodModal.cardTitle")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:s("paymentMethodModal.cardDescription")})]})]})})]})]})})}function Vi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Vi=function(t){return typeof t}:Vi=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vi(e)}var Pw="clover",KD=function(t){return t===3?"v3":t},Aw="https://js.stripe.com",YD="".concat(Aw,"/").concat(Pw,"/stripe.js"),XD=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,ZD=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/,Bg="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",QD=function(t){return XD.test(t)||ZD.test(t)},JD=function(){for(var t=document.querySelectorAll('script[src^="'.concat(Aw,'"]')),n=0;n<t.length;n++){var r=t[n];if(QD(r.src))return r}return null},Vg=function(t){var n="",r=document.createElement("script");r.src="".concat(YD).concat(n);var s=document.head||document.body;if(!s)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return s.appendChild(r),r},e4=function(t,n){!t||!t._registerWrapper||t._registerWrapper({name:"stripe-js",version:"8.7.0",startTime:n})},qa=null,_i=null,Si=null,t4=function(t){return function(n){t(new Error("Failed to load Stripe.js",{cause:n}))}},n4=function(t,n){return function(){window.Stripe?t(window.Stripe):n(new Error("Stripe.js not available"))}},r4=function(t){return qa!==null?qa:(qa=new Promise(function(n,r){if(typeof window>"u"||typeof document>"u"){n(null);return}if(window.Stripe&&t&&console.warn(Bg),window.Stripe){n(window.Stripe);return}try{var s=JD();if(s&&t)console.warn(Bg);else if(!s)s=Vg(t);else if(s&&Si!==null&&_i!==null){var o;s.removeEventListener("load",Si),s.removeEventListener("error",_i),(o=s.parentNode)===null||o===void 0||o.removeChild(s),s=Vg(t)}Si=n4(n,r),_i=t4(r),s.addEventListener("load",Si),s.addEventListener("error",_i)}catch(i){r(i);return}}),qa.catch(function(n){return qa=null,Promise.reject(n)}))},s4=function(t,n,r){if(t===null)return null;var s=n[0];if(typeof s!="string")throw new Error("Expected publishable key to be of type string, got type ".concat(Vi(s)," instead."));var o=s.match(/^pk_test/),i=KD(t.version),l=Pw;o&&i!==l&&console.warn("Stripe.js@".concat(i," was loaded on the page, but @stripe/stripe-js@").concat("8.7.0"," expected Stripe.js@").concat(l,". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));var c=t.apply(void 0,n);return e4(c,r),c}
458,Ga,Tw=!1,Iw=function(){return Ga||(Ga=r4(null).catch(function(t){return Ga=null,Promise.reject(t)}),Ga)};Promise.resolve().then(function(){return Iw()}).catch(function(e){Tw||console.warn(e)});var a4=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];Tw=!0;var s=Date.now();return Iw().then(function(o){return s4(o,n,s)})};const o4="pt-BR",$g={insufficient_funds:"O cartão não tem limite disponível para esta cobrança. Use outro cartão ou libere limite com o banco.",expired_card:"O cartão está vencido. Use outro cartão.",incorrect_cvc:"O código de segurança (CVV) está incorreto.",incorrect_number:"O número do cartão está incorreto.",card_not_supported:"Este cartão não aceita esse tipo de cobrança. Tente um cartão de crédito de outra bandeira.",currency_not_supported:"Este cartão não aceita cobranças em reais (BRL). Use um cartão nacional.",do_not_honor:"O banco recusou a cobrança sem informar o motivo. Ligue para o seu banco ou use outro cartão.",generic_decline:"O banco recusou a cobrança. Ligue para o seu banco ou use outro cartão.",transaction_not_allowed:"O banco não permite este tipo de transação neste cartão. Use outro cartão.",fraudulent:"O banco bloqueou a cobrança por suspeita de fraude. Fale com o seu banco ou use outro cartão.",lost_card:"O banco recusou a cobrança. Use outro cartão.",stolen_card:"O banco recusou a cobrança. Use outro cartão.",processing_error:"Houve um erro no processamento no banco. Tente de novo em alguns minutos.",try_again_later:"O banco pediu para tentar novamente mais tarde. Aguarde alguns minutos.",card_velocity_exceeded:"O cartão excedeu o limite de tentativas permitido pelo banco. Aguarde algumas horas ou use outro cartão.",authentication_required:"O banco exigiu autenticação para esta compra. Tente novamente e aprove a cobrança no app do banco."},Ug={card_declined:"O banco recusou a cobrança. Ligue para o seu banco ou use outro cartão.",expired_card:"O cartão está vencido. Use outro cartão.",incorrect_cvc:"O código de segurança (CVV) está incorreto.",invalid_cvc:"O código de segurança (CVV) é inválido.",incorrect_number:"O número do cartão está incorreto.",invalid_number:"O número do cartão é inválido.",invalid_expiry_month:"O mês de validade é inválido.",invalid_expiry_year:"O ano de validade é inválido.",processing_error:"Houve um erro no processamento. Tente de novo em alguns minutos.",authentication_required:"O banco exigiu autenticação para esta compra. Tente novamente e aprove a cobrança no app do banco.",card_decline_rate_limit_exceeded:"Este cartão foi recusado vezes demais. A Stripe bloqueia novas tentativas por algumas horas. Use outro cartão ou tente de novo mais tarde.",rate_limit:"Tentativas demais em pouco tempo. Aguarde alguns minutos antes de tentar de novo."},i4=[[/too many attempts/i,"Tentativas demais em pouco tempo. Aguarde alguns minutos antes de tentar de novo."],[/rate limit/i,"Tentativas demais em pouco tempo. Aguarde alguns minutos antes de tentar de novo."],[/declined/i,"O banco recusou a cobrança. Ligue para o seu banco ou use outro cartão."],[/expired/i,"O cartão está vencido. Use outro cartão."],[/security code|cvc/i,"O código de segurança (CVV) está incorreto."],[/insufficient funds/i,"O cartão não tem limite disponível para esta cobrança."],[/your card number is invalid|invalid card number/i,"O número do cartão é inválido."],[/network error|failed to fetch/i,"Falha de conexão ao falar com o processador de pagamento. Verifique a internet e tente de novo."]],l4="Não foi possível concluir a cobrança agora. Tente novamente em alguns minutos.";function Wg(e,t=l4){const n=((e==null?void 0:e.decline_code)??(e==null?void 0:e.declineCode)??"").trim();if(n&&$g[n])return $g[n];const r=((e==null?void 0:e.code)??"").trim();if(r&&Ug[r])return Ug[r];const s=((e==null?void 0:e.message)??"").trim();if(s){for(const[o,i]of i4)if(o.test(s))return i;if(/[áàâãéêíóôõúüç]/i.test(s)||/\b(não|cartão|cobrança|plano|assinatura|pagamento|tente)\b/i.test(s))return s}return t}var Mw={exports:{}},c4="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",d4=c4,u4=d4;function Rw(){}function Dw(){}Dw.resetWarningCache=Rw;var f4=function(){function e(r,s,o,i,l,c){if(c!==u4){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol
vendor: 7,380 bytes, lines 458-459
458:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:Dw,resetWarningCache:Rw};return n.PropTypes=n,n};Mw.exports=f4();var h4=Mw.exports;const lt=Ev(h4);function Hg(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function qg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Hg(Object(n),!0).forEach(function(r){Ow(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hg(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function $i(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?$i=function(t){return typeof t}:$i=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$i(e)}function Ow(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p4(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,o;for(o=0;o<r.length;o++)s=r[o],!(t.indexOf(s)>=0)&&(n[s]=e[s]);return n}function m4(e,t){if(e==null)return{};var n=p4(e,t),r,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)r=o[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Lw(e,t){return g4(e)||x4(e,t)||v4(e,t)||y4()}function g4(e){if(Array.isArray(e))return e}function x4(e,t){var n=e&&(typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"]);if(n!=null){var r=[],s=!0,o=!1,i,l;try{for(n=n.call(e);!(s=(i=n.next()).done)&&(r.push(i.value),!(t&&r.length===t));s=!0);}catch(c){o=!0,l=c}finally{try{!s&&n.return!=null&&n.return()}finally{if(o)throw l}}return r}}function v4(e,t){if(e){if(typeof e=="string")return Gg(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Gg(e,t)}}function Gg(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function y4(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
459In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Kt=function(t,n,r){var s=!!r,o=oe.useRef(r);oe.useEffect(function(){o.current=r},[r]),oe.useEffect(function(){if(!s||!t)return function(){};var i=function(){o.current&&o.current.apply(o,arguments)};return t.on(n,i),function(){t.off(n,i)}},[s,n,t,o])},pu=function(t){var n=oe.useRef(t);return oe.useEffect(function(){n.current=t},[t]),n.current},Na=function(t){return t!==null&&$i(t)==="object"},b4=function(t){return Na(t)&&typeof t.then=="function"},w4=function(t){return Na(t)&&typeof t.elements=="function"&&typeof t.createToken=="function"&&typeof t.createPaymentMethod=="function"&&typeof t.confirmCardPayment=="function"},Kg="[object Object]",_4=function e(t,n){if(!Na(t)||!Na(n))return t===n;var r=Array.isArray(t),s=Array.isArray(n);if(r!==s)return!1;var o=Object.prototype.toString.call(t)===Kg,i=Object.prototype.toString.call(n)===Kg;if(o!==i)return!1;if(!o&&!r)return t===n;var l=Object.keys(t),c=Object.keys(n);if(l.length!==c.length)return!1;for(var d={},u=0;u<l.length;u+=1)d[l[u]]=!0;for(var f=0;f<c.length;f+=1)d[c[f]]=!0;var h=Object.keys(d);if(h.length!==l.length)return!1;var p=t,y=n,g=function(v){return e(p[v],y[v])};return h.every(g)},Fw=function(t,n,r){return Na(t)?Object.keys(t).reduce(function(s,o){var i=!Na(n)||!_4(t[o],n[o]);return r.includes(o)?(i&&console.warn("Unsupported prop change: options.".concat(o," is not a mutable property.")),s):i?qg(qg({},s||{}),{},Ow({},o,t[o])):s},null):null},zw="Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.",Yg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:zw;if(t===null||w4(t))return t;throw new Error(n)},S4=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:zw;if(b4(t))return{tag:"async",stripePromise:Promise.resolve(t).then(function(s){return Yg(s,n)})};var r=Yg(t,n);return r===null?{tag:"empty"}:{tag:"sync",stripe:r}},C4=function(t){!t||!t._registerWrapper||!t.registerAppInfo||(t._registerWrapper({name:"react-stripe-js",version:"5.6.0"}),t.registerAppInfo({name:"react-stripe-js",version:"5.6.0",url:"https://stripe.com/docs/stripe-js/react"}))},ql=oe.createContext(null);ql.displayName="ElementsContext";var Bw=function(t,n){if(!t)throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(n," in an <Elements> provider."));return t},Vw=function(t){var n=t.stripe,r=t.options,s=t.children,o=oe.useMemo(function(){return S4(n)},[n]),i=oe.useState(function(){return{stripe:o.tag==="sync"?o.stripe:null,elements:o.tag==="sync"?o.stripe.elements(r):null}}),l=Lw(i,2),c=l[0],d=l[1];oe.useEffect(function(){var h=!0,p=function(g){d(function(x){return x.stripe?x:{stripe:g,elements:g.elements(r)}})};return o.tag==="async"&&!c.stripe?o.stripePromise.then(function(y){y&&h&&p(y)}):o.tag==="sync"&&!c.stripe&&p(o.stripe),function(){h=!1}},[o,c,r]);var u=pu(n);oe.useEffect(function(){u!==null&&u!==n&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.")},[u,n]);var f=pu(r);return oe.useEffect(function(){if(c.elements){var h=Fw(r,f,["clientSecret","fonts"]);h&&c.elements.update(h)}},[r,f,c.elements]),oe.useEffect(function(){C4(c.stripe)},[c.stripe]),oe.createElement(ql.Provider,{value:c},s)};Vw.propTypes={stripe:lt.any,options:lt.object};var j4=function(t){var n=oe.useContext(ql);return Bw(n,t)},k4=function(){var t=j4("calls useElements()"),n=t.elements;return n};lt.func.isRequired;var $w=oe.createContext(null);$w.displayName="CheckoutContext";lt.any,lt.shape({clientSecret:lt.oneOfType([lt.string,lt.instanceOf(Promise)]).isRequired,elementsOptions:lt.object}).isRequired;var mu=function(t){var n=oe.useContext($w),r=oe.useContext(ql);if(n){if(r)throw new Error("You cannot wrap the part of your app that ".concat(t," in both <CheckoutProvider> and <Elements> providers."));return n}else return Bw(r,t)},E4=["mode"],N4=function(t){return t.charAt(0).toUpperCase()+t.slice(1)},dn=function(t,n){var r="".concat(N4(t),"Element"),s=function(c){var d=c.id,u=c.className,f=c.options,h=f===void 0?{}:f,p=c.onBlur,y=c.onFocus,g=c.onReady,x=c.onChange,v=c.onEscape,b=c.onClick,w=c.onLoadError,_=c.onLoaderStart,C=c.onNetworksChange,N=c.onConfirm,k=c.onCancel,P=c.onShippingAddressChange,A=c.onShippingRateChange,T=c.onSavedPaymentMethodRemove,D=c.onSavedPaymentMethodUpdate,E=mu("mounts <".concat(r,">")),I="elements"in E?E.elements:null,S="checkoutState"in E?E.checkoutState:null,L=(S==null?void 0:S.type)==="success"||(S==null?void 0:S.type)==="loading"?S.sdk:null,Y=oe.useState(null),B=Lw(Y,2),q=B[0],F=B[1],ee=oe.useRef(null),$=oe.useRef(null);Kt(q,"blur",p),Kt(q,"focus",y),Kt(q,"escape",v),Kt(q,"click",b),Kt(q,"loaderror",w),Kt(q,"loaderstart",_),Kt(q,"networksch
459ange",C),Kt(q,"confirm",N),Kt(q,"cancel",k),Kt(q,"shippingaddresschange",P),Kt(q,"shippingratechange",A),Kt(q,"savedpaymentmethodremove",T),Kt(q,"savedpaymentmethodupdate",D),Kt(q,"change",x);var M;g&&(t==="expressCheckout"?M=g:M=function(){g(q)}),Kt(q,"ready",M),oe.useLayoutEffect(function(){if(ee.current===null&&$.current!==null&&(I||L)){var K=null;if(L)switch(t){case"paymentForm":K=L.createPaymentFormElement(h);break;case"payment":K=L.createPaymentElement(h);break;case"address":if("mode"in h){var X=h.mode,de=m4(h,E4);if(X==="shipping")K=L.createShippingAddressElement(de);else if(X==="billing")K=L.createBillingAddressElement(de);else throw new Error("Invalid options.mode. mode must be 'billing' or 'shipping'.")}else throw new Error("You must supply options.mode. mode must be 'billing' or 'shipping'.");break;case"expressCheckout":K=L.createExpressCheckoutElement(h);break;case"currencySelector":K=L.createCurrencySelectorElement();break;case"taxId":K=L.createTaxIdElement(h);break;default:throw new Error("Invalid Element type ".concat(r,". You must use either the <PaymentElement />, <AddressElement options={{mode: 'shipping'}} />, <AddressElement options={{mode: 'billing'}} />, or <ExpressCheckoutElement />."))}else I&&(K=I.create(t,h));ee.current=K,F(K),K&&K.mount($.current)}},[I,L,h]);var J=pu(h);return oe.useEffect(function(){if(ee.current){var K=Fw(h,J,["paymentRequest"]);K&&"update"in ee.current&&ee.current.update(K)}},[h,J]),oe.useLayoutEffect(function(){return function(){if(ee.current&&typeof ee.current.destroy=="function")try{ee.current.destroy(),ee.current=null}catch{}}},[]),oe.createElement("div",{id:d,className:u,ref:$})},o=function(c){mu("mounts <".concat(r,">"));var d=c.id,u=c.className;return oe.createElement("div",{id:d,className:u})},i=n?o:s;return i.propTypes={id:lt.string,className:lt.string,onChange:lt.func,onBlur:lt.func,onFocus:lt.func,onReady:lt.func,onEscape:lt.func,onClick:lt.func,onLoadError:lt.func,onLoaderStart:lt.func,onNetworksChange:lt.func,onConfirm:lt.func,onCancel:lt.func,onShippingAddressChange:lt.func,onShippingRateChange:lt.func,onSavedPaymentMethodRemove:lt.func,onSavedPaymentMethodUpdate:lt.func,options:lt.object},i.displayName=r,i.__elementType=t,i},un=typeof window>"u",P4=oe.createContext(null);P4.displayName="EmbeddedCheckoutProviderContext";var A4=function(){var t=mu("calls useStripe()"),n=t.stripe;return n};dn("auBankAccount",un);var X$=dn("card",un),Xg=dn("cardNumber",un),T4=dn("cardExpiry",un),I4=dn("cardCvc",un);dn("iban",un);dn("payment",un);dn("expressCheckout",un);dn("paymentRequestButton",un);dn("linkAuthentication",un);dn("address",un);dn("shippingAddress",un);dn("paymentMethodMessaging",un);dn("taxId",un);const Uw=m.forwardRef(({className:e,cardholderName:t,cardNumber:n,expiryDate:r,cvv:s,isFlipped:o=!1,...i},l)=>a.jsx("div",{ref:l,className:xe("group w-full max-w-[320px] h-[200px] perspective-1000",e),...i,children:a.jsxs("div",{className:xe("relative w-full h-full transition-transform duration-700 transform-style-3d",o?"rotate-y-180":""),style:{transformStyle:"preserve-3d",transform:o?"rotateY(180deg)":"rotateY(0deg)"},children:[a.jsx("div",{className:"absolute w-full h-full backface-hidden rounded-2xl overflow-hidden",style:{backfaceVisibility:"hidden"},children:a.jsxs("div",{className:"w-full h-full bg-gradient-to-br from-orange-500 via-orange-600 to-orange-700 p-5 flex flex-col justify-between",children:[a.jsxs("div",{className:"flex justify-between items-start",children:[a.jsxs("svg",{className:"w-10 h-10 text-orange-300/80",viewBox:"0 0 24 24",fill:"currentColor",children:[a.jsx("rect",{x:"1",y:"4",width:"22",height:"16",rx:"3",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),a.jsx("rect",{x:"1",y:"8",width:"22",height:"4",fill:"currentColor",opacity:"0.3"})]}),a.jsx("span",{className:"text-white/90 font-bold text-sm tracking-wider",children:"VISA"})]}),a.jsx("div",{className:"text-white font-mono text-lg tracking-[0.2em] drop-shadow-md",children:n||"•••• •••• •••• ••••"}),a.jsxs("div",{className:"flex justify-between items-end",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-orange-200/70 text-[10px] uppercase tracking-wider",children:"Titular do Cartão"}),a.jsx("p",{className:"text-white font-medium text-sm tracking-wide truncate max-w-[180px]",children:t||"SEU NOME"})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("p",{className:"text-orange-200/70 text-[10px] uppercase tracking-wider",children:"Validade"}),a.jsx("p",{className:"text-white font-medium text-sm",children:r||"MM/AA"})]})]})]})}),a.jsx("div",{className:"absolute w-full h-full backface-hidden rounded-2xl overflow-hidden",style:{backfaceVisibility:"hidden",transform:"rotateY(180deg)"},children:a.jsxs("div",{className:"w-full h-full bg-gradient-to-br from-orange-600 via-orange-700 to-orange-800 flex flex-col justify-between py-5",children:[a.jsx("div",{className:"w-full h-10 bg-black/40"}),a.jsx("div",{className:"px-5",children:a.jsx("div",{className:"bg-white/90 rounded h-8 flex items-center justify-end px-3",children:a.jsx("span",{className:"font-mono text-gray-800 tracking-widest",children:s||"•••"})})}),a.jsx("p",{className:"text-orange-200/70 text-[10px] uppercase tracking-wider text-center",children:"CVV"}),a.jsx("div",{className:"px-5 flex justify-end",children:a.jsxs("svg",{className:"w-12 h-8 text-white/30",viewBox:"0 0 48 32",children:[a.jsx("circle",{cx:"16",cy:"16",r:"14",fill:"
459currentColor"}),a.jsx("circle",{cx:"32",cy:"16",r:"14",fill:"currentColor",opacity:"0.7"}),a.jsx("path",{d:"M24 6 Q16 16 24 26 Q32 16 24 6",fill:"white",opacity:"0.3"})]})})]})})]})}));Uw.displayName="FlippableCreditCard";const Ka=z2("https://jevbzxxgwsbbxzwwszag.supabase.co","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImpldmJ6eHhnd3NiYnh6d3dzemFnIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODM2OTYwMzQsImV4cCI6MjA5OTI3MjAzNH0.hOFQSgGE04I7fhEbiIIF4E2AtOOciicNOL37bCfBJtc",{accessToken:async()=>null}),M4=new Set(["published_sites","status_components","status_page_settings","blog_posts"]),Ln={from:e=>{if(!M4.has(e))throw new Error("Recurso público indisponível.");const t=Ka.from(e);return{select:t.select.bind(t)}},rpc:(e,t)=>{if(!["get_public_user_count","lookup_affiliate_by_code"].includes(e))throw new Error("Consulta pública indisponível.");return Ka.rpc.call(Ka,e,t)},trackAffiliateClick:(e,t)=>Ka.from("affiliate_link_clicks").insert({affiliate_code:e,user_agent:t.slice(0,255)}),functions:{invoke:(e,t)=>{if(!["handle-email-unsubscribe","forgot-password","contact","lp-signup-and-login","lp-tracking-config-public","lp-meta-capi","lp-tiktok-events","lp-google-events","lp-track-session"].includes(e))throw new Error("Operação pública indisponível.");return Ka.functions.invoke(e,t)}}},Ww=async(e,t)=>{var l;const n=new URL(e instanceof Request?e.url:String(e),window.location.href);if(!/^\/(functions|rest|storage)\/v1\//.test(n.pathname))return fetch(e,t);const r=new URL("https://jevbzxxgwsbbxzwwszag.supabase.co"),s=new Set([r.origin]);if(r.hostname==="jevbzxxgwsbbxzwwszag.supabase.co"&&s.add("https://webhook.zapdata.co"),!s.has(n.origin)){if(up().mode!=="legacy"&&(n.hostname.endsWith(".supabase.co")||n.hostname==="webhook.zapdata.co"))throw new pc("http:unvalidated backend");return fetch(e,t)}if(up().mode==="legacy"){X2();const c=await fetch(e,t);return await Z2(c),c}const o=Gi();if(n.pathname.startsWith("/storage/v1/object/public/")&&((t==null?void 0:t.method)??"GET")==="GET"){const c=await fetch(e,t);return Q2(o),c}const i=(l=n.pathname.match(/^\/functions\/v1\/([^/]+)/))==null?void 0:l[1];if(!i||!J2.has(i))throw new pc(`http:${n.pathname}`);if(eC.has(i)&&o.role!=="owner")throw new pc("billing:owner required");return tC(o,(c,d)=>globalThis.fetch(c,d))(e,t)};let Zg=!1;const Qg=new Set;function R4(e){var t;if(!(typeof window>"u"||!e)&&(Zg||(function(n,r,s,o){var d;if(n.fbq)return;const i=function(...u){i.callMethod?i.callMethod.apply(i,u):i.queue.push(u)};n.fbq=i,n._fbq||(n._fbq=i),i.push=i,i.loaded=!0,i.version="2.0",i.queue=[];const l=r.createElement(s);l.async=!0,l.src=o;const c=r.getElementsByTagName(s)[0];(d=c.parentNode)==null||d.insertBefore(l,c)}(window,document,"script","https://connect.facebook.net/en_US/fbevents.js"),Zg=!0),!Qg.has(e)&&((t=window.fbq)==null||t.call(window,"init",e),Qg.add(e),typeof document<"u"&&!document.getElementById(`fb-noscript-${e}`)))){const n=document.createElement("noscript");n.id=`fb-noscript-${e}`,n.innerHTML=`<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=${e}&ev=PageView&noscript=1" />`,document.body.appendChild(n)}}function D4(e=3e3){return new Promise(t=>{const n=Date.now(),r=()=>{if(typeof window<"u"&&typeof window.fbq=="function")return t(!0);if(Date.now()-n>e)return t(!1);setTimeout(r,50)};r()})}let Jg=!1;const ex=new Set;function O4(e){var n,r,s;if(typeof window>"u"||!e)return;Jg||(function(o,i,l){o.TiktokAnalyticsObject=l;const c=o[l]=o[l]||[];c.methods=["page","track","identify","instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie"],c.setAndDefer=function(d,u){d[u]=function(...f){d.push([u,...f])}};for(const d of c.methods)c.setAndDefer(c,d);c.instance=function(d){const u=c._i[d]||[];for(const f of c.methods)c.setAndDefer(u,f);return u},c.load=function(d){var p;const u="https://analytics.tiktok.com/i18n/pixel/events.js";c._i=c._i||{},c._i[d]=[],c._i[d]._u=u,c._t=c._t||{},c._t[d]=+new Date,c._o=c._o||{},c._o[d]={};const f=i.createElement("script");f.async=!0,f.src=`${u}?sdkid=${d}&lib=${l}`;const h=i.getElementsByTagName("script")[0];(p=h.parentNode)==null||p.insertBefore(f,h)}}(window,document,"ttq"),Jg=!0);const t=window;!ex.has(e)&&((n=t.ttq)!=null&&n.load)&&(t.ttq.load(e),(s=(r=t.ttq).page)==null||s.call(r),ex.add(e))}function L4(e=3e3){return new Promise(t=>{const n=Date.now(),r=()=>{var s;if((s=window==null?void 0:window.ttq)!=null&&s.track)return t(!0);if(Date.now()-n>e)return t(!1);setTimeout(r,50)};r()})}let tx=!1;const Ci=new Set;
459function F4(e,t){var r,s;if(typeof window>"u")return;const n=e||t;if(n){if(!tx){window.dataLayer=window.dataLayer||[],window.gtag=function(){window.dataLayer.push(arguments)},window.gtag("js",new Date);const o=document.createElement("script");o.async=!0,o.src=`https://www.googletagmanager.com/gtag/js?id=${n}`,document.head.appendChild(o),tx=!0}e&&!Ci.has(e)&&((r=window.gtag)==null||r.call(window,"config",e,{send_page_view:!0}),Ci.add(e)),t&&!Ci.has(t)&&((s=window.gtag)==null||s.call(window,"config",t),Ci.add(t))}}function Yc(e,t={}){typeof window>"u"||!window.gtag||window.gtag("event",e,t)}function z4(e){var r;if(typeof document>"u"||!e)return;const t=document.cookie.split("; ").find(s=>s.startsWith("_ga="));if(!t)return;const n=((r=t.split("=")[1])==null?void 0:r.split("."))||[];if(n.length>=4)return`${n[2]}.${n[3]}`}async function ji(e){try{if(typeof crypto>"u"||!crypto.subtle)return;const t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(r=>r.toString(16).padStart(2,"0")).join("")}catch{return}}function B4(e){const t=e.replace(/\D/g,"");return t?t.startsWith("55")?`+${t}`:t.length===10||t.length===11?`+55${t}`:`+${t}`:""}async function V4(e){if(typeof window>"u"||!window.gtag)return;const t={};if(e.email){const r=await ji(e.email.trim().toLowerCase());r&&(t.sha256_email_address=r)}if(e.phone){const r=await ji(B4(e.phone));r&&(t.sha256_phone_number=r)}const n={};if(e.first_name){const r=await ji(e.first_name.trim().toLowerCase());r&&(n.sha256_first_name=r)}if(e.last_name){const r=await ji(e.last_name.trim().toLowerCase());r&&(n.sha256_last_name=r)}Object.keys(n).length&&(t.address=n),Object.keys(t).length&&window.gtag("set","user_data",t)}function Sn(e){if(typeof document>"u")return;const t=document.cookie.split("; ").find(n=>n.startsWith(`${e}=`));if(t)try{return decodeURIComponent(t.split("=").slice(1).join("="))}catch{return t.split("=").slice(1).join("=")}}function gu(e,t,n=90){if(typeof document>"u")return;const r=new Date(Date.now()+n*86400*1e3).toUTCString();document.cookie=`${e}=${encodeURIComponent(t)}; expires=${r}; path=/; SameSite=Lax`}const Hw=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],xu={};function $4(){const e=Math.random().toString(36).slice(2,10);return`sck_${Date.now().toString(36)}_${e}`}function U4(){if(typeof window>"u")return"";let e=window.localStorage.getItem("rla_sck")||Sn("rla_sck");return e||(e=$4(),window.localStorage.setItem("rla_sck",e)),gu("rla_sck",e,180),e}function W4(){if(typeof window>"u")return{};const e=new URL(window.location.href),t={};let n=!1;for(const r of Hw){const s=e.searchParams.get(r),o=Sn(r);let i=s||o;!i&&xu[r]&&(i=xu[r]),i&&(gu(r,i,90),t[r]=i,e.searchParams.get(r)!==i&&(e.searchParams.set(r,i),n=!0))}for(const r of["fbclid","ttclid","gclid"]){const s=e.searchParams.get(r);s&&gu(r,s,90)}if(n)try{const r=e.pathname+(e.search?e.search:"")+(e.hash||"");window.history.replaceState(null,"",r)}catch{}return t}function nx(){const e={};for(const t of Hw)e[t]=Sn(t)||xu[t];return e}function H4(e){const t=(e.utm_source||"").toLowerCase();return t.includes("facebook")||t.includes("meta")||t.includes("instagram")?"meta":t.includes("tiktok")?"tiktok":t.includes("google")?"google":Sn("fbclid")?"meta":Sn("ttclid")?"tiktok":Sn("gclid")?"google":typeof document<"u"&&document.referrer?"referral":"direct"}const vu="zapdata_marketing_opt_out",qw="zapdata_cookie_notice_seen";function ul(){try{return localStorage.getItem(vu)==="1"}catch{return!1}}function q4(e){try{e?localStorage.setItem(vu,"1"):localStorage.removeItem(vu)}catch{}}function G4(){try{return localStorage.getItem(qw)==="1"}catch{return!1}}function K4(){try{localStorage.setItem(qw,"1")}catch{}}const rx="rla_lp_cfg_v1",Y4=5*60*1e3;async function X4(){try{const e=sessionStorage.getItem(rx);if(e){const t=JSON.parse(e);if(Date.now()-t.ts<Y4)return t.cfg}}catch{}try{const{data:e}=await Ln.functions.invoke("lp-tracking-config-public",{method:"GET"}),t=e||null;return t&&sessionStorage.setItem(rx,JSON.stringify({ts:Date.now(),cfg:t})),t}catch(e){return console.warn("[useLpTracking] load config failed",e),null}}async function Z4(){if(ul())return null;try{const e=sessionStorage.getItem("rla_lp_geo");if(e)return JSON.parse(e);const t=await Ww("https://ipapi.co/json/");if(!t.ok)return null;const n=await t.json(),r={country:n==null?void 0:n.country_code,state:n==null?void 0:n.region_code,city:n==null?void 0:n.city,ip:n==null?void 0:n.ip};return sessionStorage.setItem("rla_lp_geo",JSON.stringify(r)),r}catch{return null}}function Xc(e){return`${e}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,10)}`}function Ch(){const[e,t]=m.useState(null),n=m.useRef(""),r=m.useRef(!1);m.useEffect(()=>{let d=!0;return(async()=>{n.current=U4(),W4();const u=await X4();d&&t(u)})(),()=>{d=!1}},[]);const s=m.useCallback(async(d,u,f={})=>
459{if(!(e!=null&&e.enabled)||ul())return;const h=nx(),p=n.current,y=window.location.href,g=navigator.userAgent,x={session_sck:p,event_id:u,event_name:d,event_source_url:y,user_agent:g,...h,...f},v=[];if(e.meta_enabled&&v.push(Ln.functions.invoke("lp-meta-capi",{body:{...x}})),e.tiktok_enabled){const b={PageView:"Pageview",InitiateCheckout:"InitiateCheckout",Purchase:"CompletePayment"};v.push(Ln.functions.invoke("lp-tiktok-events",{body:{...x,event_name:b[d]||d}}))}if(e.google_enabled){const b={PageView:"page_view",InitiateCheckout:"begin_checkout",Purchase:"purchase"};v.push(Ln.functions.invoke("lp-google-events",{body:{...x,event_name:b[d]||d.toLowerCase(),client_id:z4(e.ga4_measurement_id)||p}}))}await Promise.allSettled(v)},[e]),o=m.useCallback(async()=>{var f;if(!(e!=null&&e.enabled)||r.current)return;r.current=!0;const d=!ul(),u=Xc("pv");d&&e.meta_enabled&&e.meta_pixel_id&&(R4(e.meta_pixel_id),await D4(2e3),(f=window.fbq)==null||f.call(window,"track","PageView",{},{eventID:u})),d&&e.tiktok_enabled&&e.tiktok_pixel_id&&(O4(e.tiktok_pixel_id),await L4(2e3)),d&&e.google_enabled&&F4(e.ga4_measurement_id,e.google_ads_conversion_id);try{const h=nx(),p=await Z4();await Ln.functions.invoke("lp-track-session",{body:{sck:n.current,fbc:Sn("_fbc"),fbp:Sn("_fbp"),fbclid:Sn("fbclid"),ttclid:Sn("ttclid"),gclid:Sn("gclid"),ttp:Sn("_ttp"),user_agent:navigator.userAgent,country:p==null?void 0:p.country,state:p==null?void 0:p.state,city:p==null?void 0:p.city,src:H4(h),...h}})}catch{}await s("PageView",u)},[e,s]),i=m.useCallback(async(d={})=>{var f,h,p;if(!(e!=null&&e.enabled))return;const u=Xc("ic");e.meta_enabled&&((f=window.fbq)==null||f.call(window,"track","InitiateCheckout",{value:d.value,currency:d.currency||"BRL"},{eventID:u})),e.tiktok_enabled&&((p=(h=window.ttq)==null?void 0:h.track)==null||p.call(h,"InitiateCheckout",{value:d.value,currency:d.currency||"BRL"},{event_id:u})),e.google_enabled&&Yc("begin_checkout",{value:d.value,currency:d.currency||"BRL"}),await s("InitiateCheckout",u,{value:d.value,currency:d.currency||"BRL",content_name:d.content_name})},[e,s]),l=m.useCallback(async d=>{if(!(e!=null&&e.enabled))return;const[u,...f]=(d.name||"").trim().split(/\s+/),h=f.join(" ")||void 0;try{sessionStorage.setItem("rla_lp_lead",JSON.stringify({email:d.email,phone:d.phone,first_name:u||void 0,last_name:h}))}catch{}try{await Ln.functions.invoke("lp-track-session",{body:{sck:n.current,email:d.email,phone:d.phone,first_name:u||void 0,last_name:h,external_id:d.cpf||void 0}})}catch{}},[e]),c=m.useCallback(async d=>{var h,p,y;if(!(e!=null&&e.enabled))return;const u=d.eventId||(d.orderId?`pur_${d.orderId}_meta`:Xc("pur")),f=d.eventId||(d.orderId?`pur_${d.orderId}_tt`:u);if(e.meta_enabled&&((h=window.fbq)==null||h.call(window,"track","Purchase",{value:d.value,currency:d.currency||"BRL"},{eventID:u})),e.tiktok_enabled&&((y=(p=window.ttq)==null?void 0:p.track)==null||y.call(p,"CompletePayment",{value:d.value,currency:d.currency||"BRL"},{event_id:f})),e.google_enabled){try{const g=sessionStorage.getItem("rla_lp_lead");g&&await V4(JSON.parse(g))}catch{}Yc("purchase",{value:d.value,currency:d.currency||"BRL",transaction_id:d.orderId}),e.google_ads_conversion_id&&e.google_ads_conversion_label&&Yc("conversion",{send_to:`${e.google_ads_conversion_id}/${e.google_ads_conversion_label}`,value:d.value,currency:d.currency||"BRL",transaction_id:d.orderId})}},[e]);return{config:e,sck:n.current,init:o,trackInitiateCheckout:i,saveLead:l,trackPurchase:c}}const yu="efi",Q4="stripe",J4="efi";let mn=null,Ya=null;async function e3(){if(!mn){if(Ya)return Ya;Ya=(async()=>{const{data:e,error:t}=await he.from("payment_gateway_config").select("key, value").in("key",["default_gateway","efi_payee_code"]);if(t){console.error("[usePaymentGateway] load error",t),mn={gateway:yu,efiPayeeCode:null};return}const n={};e==null||e.forEach(r=>{n[r.key]=r.value}),mn={gateway:n.default_gateway||yu,efiPayeeCode:n.efi_payee_code||null}})(),await Ya,Ya=null}}function sx(e,t,n){return{gateway:e,efiPayeeCode:t,loading:n,isEfi:e==="efi",isStripe:e==="stripe",isMercadoPago:e==="mercadopago",isPixup:e==="pixup",cardGateway:Q4,pixGateway:J4}}function t3(){const[e,t]=m.useState(sx((mn==null?void 0:mn.gateway)||yu,(mn==null?void 0:mn.efiPayeeCode)||null,!mn
459));return m.useEffect(()=>{let n=!0;return e3().catch(r=>{console.error("[usePaymentGateway] configuration unavailable",r)}).then(()=>{!n||!mn||t(sx(mn.gateway,mn.efiPayeeCode,!1))}),()=>{n=!1}},[]),e}var n3="Label",Gw=m.forwardRef((e,t)=>a.jsx(Ie.label,{...e,ref:t,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Gw.displayName=n3;var Kw=Gw;const r3=Vf("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Be=m.forwardRef(({className:e,...t},n)=>a.jsx(Kw,{ref:n,className:xe(r3(),e),...t}));Be.displayName=Kw.displayName;var s3=Object.defineProperty,fl=Object.getOwnPropertySymbols,Yw=Object.prototype.hasOwnProperty,Xw=Object.prototype.propertyIsEnumerable,ax=(e,t,n)=>t in e?s3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bu=(e,t)=>{for(var n in t||(t={}))Yw.call(t,n)&&ax(e,n,t[n]);if(fl)for(var n of fl(t))Xw.call(t,n)&&ax(e,n,t[n]);return e},wu=(e,t)=>{var n={};for(var r in e)Yw.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&fl)for(var r of fl(e))t.indexOf(r)<0&&Xw.call(e,r)&&(n[r]=e[r]);return n};/**
460 * @license QR Code generator library (TypeScript)
461 * Copyright (c) Project Nayuki.
462 * SPDX-License-Identifier: MIT
463 */var Ds;(e=>{const t=class $e{constructor(c,d,u,f){if(this.version=c,this.errorCorrectionLevel=d,this.modules=[],this.isFunction=[],c<$e.MIN_VERSION||c>$e.MAX_VERSION)throw new RangeError("Version value out of range");if(f<-1||f>7)throw new RangeError("Mask value out of range");this.size=c*4+17;let h=[];for(let y=0;y<this.size;y++)h.push(!1);for(let y=0;y<this.size;y++)this.modules.push(h.slice()),this.isFunction.push(h.slice());this.drawFunctionPatterns();const p=this.addEccAndInterleave(u);if(this.drawCodewords(p),f==-1){let y=1e9;for(let g=0;g<8;g++){this.applyMask(g),this.drawFormatBits(g);const x=this.getPenaltyScore();x<y&&(f=g,y=x),this.applyMask(g)}}s(0<=f&&f<=7),this.mask=f,this.applyMask(f),this.drawFormatBits(f),this.isFunction=[]}static encodeText(c,d){const u=e.QrSegment.makeSegments(c);return $e.encodeSegments(u,d)}static encodeBinary(c,d){const u=e.QrSegment.makeBytes(c);return $e.encodeSegments([u],d)}static encodeSegments(c,d,u=1,f=40,h=-1,p=!0){if(!($e.MIN_VERSION<=u&&u<=f&&f<=$e.MAX_VERSION)||h<-1||h>7)throw new RangeError("Invalid value");let y,g;for(y=u;;y++){const w=$e.getNumDataCodewords(y,d)*8,_=i.getTotalBits(c,y);if(_<=w){g=_;break}if(y>=f)throw new RangeError("Data too long")}for(const w of[$e.Ecc.MEDIUM,$e.Ecc.QUARTILE,$e.Ecc.HIGH])p&&g<=$e.getNumDataCodewords(y,w)*8&&(d=w);let x=[];for(const w of c){n(w.mode.modeBits,4,x),n(w.numChars,w.mode.numCharCountBits(y),x);for(const _ of w.getData())x.push(_)}s(x.length==g);const v=$e.getNumDataCodewords(y,d)*8;s(x.length<=v),n(0,Math.min(4,v-x.length),x),n(0,(8-x.length%8)%8,x),s(x.length%8==0);for(let w=236;x.length<v;w^=253)n(w,8,x);let b=[];for(;b.length*8<x.length;)b.push(0);return x.forEach((w,_)=>b[_>>>3]|=w<<7-(_&7)),new $e(y,d,b,h)}getModule(c,d){return 0<=c&&c<this.size&&0<=d&&d<this.size&&this.modules[d][c]}getModules(){return this.modules}drawFunctionPatterns(){for(let u=0;u<this.size;u++)this.setFunctionModule(6,u,u%2==0),this.setFunctionModule(u,6,u%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const c=this.getAlignmentPatternPositions(),d=c.length;for(let u=0;u<d;u++)for(let f=0;f<d;f++)u==0&&f==0||u==0&&f==d-1||u==d-1&&f==0||this.drawAlignmentPattern(c[u],c[f]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(c){const d=this.errorCorrectionLevel.formatBits<<3|c;let u=d;for(let h=0;h<10;h++)u=u<<1^(u>>>9)*1335;const f=(d<<10|u)^21522;s(f>>>15==0);for(let h=0;h<=5;h++)this.setFunctionModule(8,h,r(f,h));this.setFunctionModule(8,7,r(f,6)),this.setFunctionModule(8,8,r(f,7)),this.setFunctionModule(7,8,r(f,8));for(let h=9;h<15;h++)this.setFunctionModule(14-h,8,r(f,h));for(let h=0;h<8;h++)this.setFunctionModule(this.size-1-h,8,r(f,h));for(let h=8;h<15;h++)this.setFunctionModule(8,this.size-15+h,r(f,h));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let c=this.version;for(let u=0;u<12;u++)c=c<<1^(c>>>11)*7973;const d=this.version<<12|c;s(d>>>18==0);for(let u=0;u<18;u++){const f=r(d,u),h=this.size-11+u%3,p=Math.floor(u/3);this.setFunctionModule(h,p,f),this.setFunctionModule(p,h,f)}}drawFinderPattern(c,d){for(let u=-4;u<=4;u++)for(let f=-4;f<=4;f++){const h=Math.max(Math.abs(f),Math.abs(u)),p=c+f,y=d+u;0<=p&&p<this.size&&0<=y&&y<this.size&&this.setFunctionModule(p,y,h!=2&&h!=4)}}drawAlignmentPattern(c,d){for(let u=-2;u<=2;u++)for(let f=-2;f<=2;f++)this.setFunctionModule(c+f,d+u,Math.max(Math.abs(f),Math.abs(u))!=1)}setFunctionModule(c,d,u){this.modules[d][c]=u,this.isFunction[d][c]=!0}addEccAndInterleave(c){const d=this.version,u=this.errorCorrectionLevel;if(c.length!=$e.getNumDataCodewords(d,u))throw new RangeError("Invalid argument");const f=$e.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][d],h=$e.ECC_CODEWORDS_PER_BLOCK[u.ordinal][d],p=Math.floor($e.getNumRawDataModules(d)/8),y=f-p%f,g=Math.floor(p/f);let x=[];const v=$e.reedSolomonComputeDivisor(h);for(let w=0,_=0;w<f;w++){let C=c.slice(_,_+g-h+(w<y?0:1));_+=C.length;const N=$e.reedSolomonComputeRemainder(C,v);w<y&&C.push(0),x.push(C.concat(N))}let b=[];for(let w=0;w<x[0].length;
463w++)x.forEach((_,C)=>{(w!=g-h||C>=y)&&b.push(_[w])});return s(b.length==p),b}drawCodewords(c){if(c.length!=Math.floor($e.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let d=0;for(let u=this.size-1;u>=1;u-=2){u==6&&(u=5);for(let f=0;f<this.size;f++)for(let h=0;h<2;h++){const p=u-h,g=(u+1&2)==0?this.size-1-f:f;!this.isFunction[g][p]&&d<c.length*8&&(this.modules[g][p]=r(c[d>>>3],7-(d&7)),d++)}}s(d==c.length*8)}applyMask(c){if(c<0||c>7)throw new RangeError("Mask value out of range");for(let d=0;d<this.size;d++)for(let u=0;u<this.size;u++){let f;switch(c){case 0:f=(u+d)%2==0;break;case 1:f=d%2==0;break;case 2:f=u%3==0;break;case 3:f=(u+d)%3==0;break;case 4:f=(Math.floor(u/3)+Math.floor(d/2))%2==0;break;case 5:f=u*d%2+u*d%3==0;break;case 6:f=(u*d%2+u*d%3)%2==0;break;case 7:f=((u+d)%2+u*d%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[d][u]&&f&&(this.modules[d][u]=!this.modules[d][u])}}getPenaltyScore(){let c=0;for(let h=0;h<this.size;h++){let p=!1,y=0,g=[0,0,0,0,0,0,0];for(let x=0;x<this.size;x++)this.modules[h][x]==p?(y++,y==5?c+=$e.PENALTY_N1:y>5&&c++):(this.finderPenaltyAddHistory(y,g),p||(c+=this.finderPenaltyCountPatterns(g)*$e.PENALTY_N3),p=this.modules[h][x],y=1);c+=this.finderPenaltyTerminateAndCount(p,y,g)*$e.PENALTY_N3}for(let h=0;h<this.size;h++){let p=!1,y=0,g=[0,0,0,0,0,0,0];for(let x=0;x<this.size;x++)this.modules[x][h]==p?(y++,y==5?c+=$e.PENALTY_N1:y>5&&c++):(this.finderPenaltyAddHistory(y,g),p||(c+=this.finderPenaltyCountPatterns(g)*$e.PENALTY_N3),p=this.modules[x][h],y=1);c+=this.finderPenaltyTerminateAndCount(p,y,g)*$e.PENALTY_N3}for(let h=0;h<this.size-1;h++)for(let p=0;p<this.size-1;p++){const y=this.modules[h][p];y==this.modules[h][p+1]&&y==this.modules[h+1][p]&&y==this.modules[h+1][p+1]&&(c+=$e.PENALTY_N2)}let d=0;for(const h of this.modules)d=h.reduce((p,y)=>p+(y?1:0),d);const u=this.size*this.size,f=Math.ceil(Math.abs(d*20-u*10)/u)-1;return s(0<=f&&f<=9),c+=f*$e.PENALTY_N4,s(0<=c&&c<=2568888),c}getAlignmentPatternPositions(){if(this.version==1)return[];{const c=Math.floor(this.version/7)+2,d=this.version==32?26:Math.ceil((this.version*4+4)/(c*2-2))*2;let u=[6];for(let f=this.size-7;u.length<c;f-=d)u.splice(1,0,f);return u}}static getNumRawDataModules(c){if(c<$e.MIN_VERSION||c>$e.MAX_VERSION)throw new RangeError("Version number out of range");let d=(16*c+128)*c+64;if(c>=2){const u=Math.floor(c/7)+2;d-=(25*u-10)*u-55,c>=7&&(d-=36)}return s(208<=d&&d<=29648),d}static getNumDataCodewords(c,d){return Math.floor($e.getNumRawDataModules(c)/8)-$e.ECC_CODEWORDS_PER_BLOCK[d.ordinal][c]*$e.NUM_ERROR_CORRECTION_BLOCKS[d.ordinal][c]}static reedSolomonComputeDivisor(c){if(c<1||c>255)throw new RangeError("Degree out of range");let d=[];for(let f=0;f<c-1;f++)d.push(0);d.push(1);let u=1;for(let f=0;f<c;f++){for(let h=0;h<d.length;h++)d[h]=$e.reedSolomonMultiply(d[h],u),h+1<d.length&&(d[h]^=d[h+1]);u=$e.reedSolomonMultiply(u,2)}return d}static reedSolomonComputeRemainder(c,d){let u=d.map(f=>0);for(const f of c){const h=f^u.shift();u.push(0),d.forEach((p,y)=>u[y]^=$e.reedSolomonMultiply(p,h))}return u}static reedSolomonMultiply(c,d){if(c>>>8||d>>>8)throw new RangeError("Byte out of range");let u=0;for(let f=7;f>=0;f--)u=u<<1^(u>>>7)*285,u^=(d>>>f&1)*c;return s(u>>>8==0),u}finderPenaltyCountPatterns(c){const d=c[1];s(d<=this.size*3);const u=d>0&&c[2]==d&&c[3]==d*3&&c[4]==d&&c[5]==d;return(u&&c[0]>=d*4&&c[6]>=d?1:0)+(u&&c[6]>=d*4&&c[0]>=d?1:0)}finderPenaltyTerminateAndCount(c,d,u){return c&&(this.finderPenaltyAddHistory(d,u),d=0),d+=this.size,this.finderPenaltyAddHistory(d,u),this.finderPenaltyCountPatterns(u)}finderPenaltyAddHistory(c,d){d[0]==0&&(c+=this.size),d.pop(),d.unshift(c)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(l,c,d){if(c<0||c>31||l>>>c)throw new RangeError("Value out of range");for(let u=c-1;u>=0;u--)d.push(l>>>u&1)}function r(l,c){return(l>>>c&1)!=0}function s(l){if(!l)throw new Error("Assertion error")}const o=class bt{constructor(c,d,u){if(this.mode=c,this.numChars=d,this.bitData=u,d<0)throw new RangeError("Invalid argument");this.bitData=u.slice()}static makeBytes(c){let d=[];for(const u of c)n(u,8,d);return new bt(bt.Mode.BYTE,c.length,d)}static makeNumeric(c){if(!bt.isNumeric(c))throw new RangeError("String contains 
463non-numeric characters");let d=[];for(let u=0;u<c.length;){const f=Math.min(c.length-u,3);n(parseInt(c.substring(u,u+f),10),f*3+1,d),u+=f}return new bt(bt.Mode.NUMERIC,c.length,d)}static makeAlphanumeric(c){if(!bt.isAlphanumeric(c))throw new RangeError("String contains unencodable characters in alphanumeric mode");let d=[],u;for(u=0;u+2<=c.length;u+=2){let f=bt.ALPHANUMERIC_CHARSET.indexOf(c.charAt(u))*45;f+=bt.ALPHANUMERIC_CHARSET.indexOf(c.charAt(u+1)),n(f,11,d)}return u<c.length&&n(bt.ALPHANUMERIC_CHARSET.indexOf(c.charAt(u)),6,d),new bt(bt.Mode.ALPHANUMERIC,c.length,d)}static makeSegments(c){return c==""?[]:bt.isNumeric(c)?[bt.makeNumeric(c)]:bt.isAlphanumeric(c)?[bt.makeAlphanumeric(c)]:[bt.makeBytes(bt.toUtf8ByteArray(c))]}static makeEci(c){let d=[];if(c<0)throw new RangeError("ECI assignment value out of range");if(c<128)n(c,8,d);else if(c<16384)n(2,2,d),n(c,14,d);else if(c<1e6)n(6,3,d),n(c,21,d);else throw new RangeError("ECI assignment value out of range");return new bt(bt.Mode.ECI,0,d)}static isNumeric(c){return bt.NUMERIC_REGEX.test(c)}static isAlphanumeric(c){return bt.ALPHANUMERIC_REGEX.test(c)}getData(){return this.bitData.slice()}static getTotalBits(c,d){let u=0;for(const f of c){const h=f.mode.numCharCountBits(d);if(f.numChars>=1<<h)return 1/0;u+=4+h+f.bitData.length}return u}static toUtf8ByteArray(c){c=encodeURI(c);let d=[];for(let u=0;u<c.length;u++)c.charAt(u)!="%"?d.push(c.charCodeAt(u)):(d.push(parseInt(c.substring(u+1,u+3),16)),u+=2);return d}};o.NUMERIC_REGEX=/^[0-9]*$/,o.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,o.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let i=o;e.QrSegment=o})(Ds||(Ds={}));(e=>{(t=>{const n=class{constructor(s,o){this.ordinal=s,this.formatBits=o}};n.LOW=new n(0,1),n.MEDIUM=new n(1,0),n.QUARTILE=new n(2,3),n.HIGH=new n(3,2),t.Ecc=n})(e.QrCode||(e.QrCode={}))})(Ds||(Ds={}));(e=>{(t=>{const n=class{constructor(s,o){this.modeBits=s,this.numBitsCharCount=o}numCharCountBits(s){return this.numBitsCharCount[Math.floor((s+7)/17)]}};n.NUMERIC=new n(1,[10,12,14]),n.ALPHANUMERIC=new n(2,[9,11,13]),n.BYTE=new n(4,[8,16,16]),n.KANJI=new n(8,[8,10,12]),n.ECI=new n(7,[0,0,0]),t.Mode=n})(e.QrSegment||(e.QrSegment={}))})(Ds||(Ds={}));var Js=Ds;/**
464 * @license qrcode.react
465 * Copyright (c) Paul O'Shannessy
466 * SPDX-License-Identifier: ISC
467 */var a3={L:Js.QrCode.Ecc.LOW,M:Js.QrCode.Ecc.MEDIUM,Q:Js.QrCode.Ecc.QUARTILE,H:Js.QrCode.Ecc.HIGH},Zw=128,Qw="L",Jw="#FFFFFF",e1="#000000",t1=!1,n1=1,o3=4,i3=0,l3=.1;function r1(e,t=0){const n=[];return e.forEach(function(r,s){let o=null;r.forEach(function(i,l){if(!i&&o!==null){n.push(`M${o+t} ${s+t}h${l-o}v1H${o+t}z`),o=null;return}if(l===r.length-1){if(!i)return;o===null?n.push(`M${l+t},${s+t} h1v1H${l+t}z`):n.push(`M${o+t},${s+t} h${l+1-o}v1H${o+t}z`);return}i&&o===null&&(o=l)})}),n.join("")}function s1(e,t){return e.slice().map((n,r)=>r<t.y||r>=t.y+t.h?n:n.map((s,o)=>o<t.x||o>=t.x+t.w?s:!1))}function c3(e,t,n,r){if(r==null)return null;const s=e.length+n*2,o=Math.floor(t*l3),i=s/t,l=(r.width||o)*i,c=(r.height||o)*i,d=r.x==null?e.length/2-l/2:r.x*i,u=r.y==null?e.length/2-c/2:r.y*i,f=r.opacity==null?1:r.opacity;let h=null;if(r.excavate){let y=Math.floor(d),g=Math.floor(u),x=Math.ceil(l+d-y),v=Math.ceil(c+u-g);h={x:y,y:g,w:x,h:v}}const p=r.crossOrigin;return{x:d,y:u,h:c,w:l,excavation:h,opacity:f,crossOrigin:p}}function d3(e,t){return t!=null?Math.max(Math.floor(t),0):e?o3:i3}function a1({value:e,level:t,minVersion:n,includeMargin:r,marginSize:s,imageSettings:o,size:i,boostLevel:l}){let c=oe.useMemo(()=>{const y=(Array.isArray(e)?e:[e]).reduce((g,x)=>(g.push(...Js.QrSegment.makeSegments(x)),g),[]);return Js.QrCode.encodeSegments(y,a3[t],n,void 0,void 0,l)},[e,t,n,l]);const{cells:d,margin:u,numCells:f,calculatedImageSettings:h}=oe.useMemo(()=>{let p=c.getModules();const y=d3(r,s),g=p.length+y*2,x=c3(p,i,y,o);return{cells:p,margin:y,numCells:g,calculatedImageSettings:x}},[c,i,o,r,s]);return{qrcode:c,margin:u,cells:d,numCells:f,calculatedImageSettings:h}}var u3=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),f3=oe.forwardRef(function(t,n){const r=t,{value:s,size:o=Zw,level:i=Qw,bgColor:l=Jw,fgColor:c=e1,includeMargin:d=t1,minVersion:u=n1,boostLevel:f,marginSize:h,imageSettings:p}=r,g=wu(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:x}=g,v=wu(g,["style"]),b=p==null?void 0:p.src,w=oe.useRef(null),_=oe.useRef(null),C=oe.useCallback(S=>
467{w.current=S,typeof n=="function"?n(S):n&&(n.current=S)},[n]),[N,k]=oe.useState(!1),{margin:P,cells:A,numCells:T,calculatedImageSettings:D}=a1({value:s,level:i,minVersion:u,boostLevel:f,includeMargin:d,marginSize:h,imageSettings:p,size:o});oe.useEffect(()=>{if(w.current!=null){const S=w.current,L=S.getContext("2d");if(!L)return;let Y=A;const B=_.current,q=D!=null&&B!==null&&B.complete&&B.naturalHeight!==0&&B.naturalWidth!==0;q&&D.excavation!=null&&(Y=s1(A,D.excavation));const F=window.devicePixelRatio||1;S.height=S.width=o*F;const ee=o/T*F;L.scale(ee,ee),L.fillStyle=l,L.fillRect(0,0,T,T),L.fillStyle=c,u3?L.fill(new Path2D(r1(Y,P))):A.forEach(function($,M){$.forEach(function(J,K){J&&L.fillRect(K+P,M+P,1,1)})}),D&&(L.globalAlpha=D.opacity),q&&L.drawImage(B,D.x+P,D.y+P,D.w,D.h)}}),oe.useEffect(()=>{k(!1)},[b]);const E=bu({height:o,width:o},x);let I=null;return b!=null&&(I=oe.createElement("img",{src:b,key:b,style:{display:"none"},onLoad:()=>{k(!0)},ref:_,crossOrigin:D==null?void 0:D.crossOrigin})),oe.createElement(oe.Fragment,null,oe.createElement("canvas",bu({style:E,height:o,width:o,ref:C,role:"img"},v)),I)});f3.displayName="QRCodeCanvas";var jh=oe.forwardRef(function(t,n){const r=t,{value:s,size:o=Zw,level:i=Qw,bgColor:l=Jw,fgColor:c=e1,includeMargin:d=t1,minVersion:u=n1,boostLevel:f,title:h,marginSize:p,imageSettings:y}=r,g=wu(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:x,cells:v,numCells:b,calculatedImageSettings:w}=a1({value:s,level:i,minVersion:u,boostLevel:f,includeMargin:d,marginSize:p,imageSettings:y,size:o});let _=v,C=null;y!=null&&w!=null&&(w.excavation!=null&&(_=s1(v,w.excavation)),C=oe.createElement("image",{href:y.src,height:w.h,width:w.w,x:w.x+x,y:w.y+x,preserveAspectRatio:"none",opacity:w.opacity,crossOrigin:w.crossOrigin}));const N=r1(_,x);return oe.createElement("svg",bu({height:o,width:o,viewBox:`0 0 ${b} ${b}`,ref:n,role:"img"},g),!!h&&oe.createElement("title",null,h),oe.createElement("path",{fill:l,d:`M0,0 h${b}v${b}H0z`,shapeRendering:"crispEdges"}),oe.createElement("path",{fill:c,d:N,shapeRendering:"crispEdges"}),C)});jh.displayName="QRCodeSVG";const o1="/_releases/admin/assets/zapdata-logo-X4vvddIU.png";function ox(e){return e.replace(/\D/g,"").slice(0,11).replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d{1,2})$/,"$1-$2")}const h3=4e3,p3=10*60*1e3,m3=3e4,g3=12e3,Zc=7;function x3({onRetry:e,onBack:t}){const[n,r]=m.useState(!1);return m.useEffect(()=>{const s=setTimeout(()=>r(!0),g3);return()=>clearTimeout(s)},[]),a.jsx("div",{className:"space-y-4 py-8",children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx(st,{className:"h-8 w-8 animate-spin text-emerald-500"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Gerando autorização PIX Automático..."}),n&&a.jsxs("div",{className:"flex gap-2 pt-2",children:[a.jsx(pe,{variant:"outline",size:"sm",onClick:t,children:"Voltar"}),a.jsx(pe,{size:"sm",onClick:e,className:"bg-emerald-600 hover:bg-emerald-700 text-white",children:"Tentar novamente"})]})]})})}function v3({planId:e,planName:t,amount:n,billingPeriod:r,instanceCount:s,mode:o="create",lpContext:i,isFreeTrial:l=!1,onSuccess:c,onBack:d}){const{user:u}=at(),f=Ch(),[h,p]=m.useState("form"),[y,g]=m.useState(""),[x,v]=m.useState(""),[b,w]=m.useState(!1),[_,C]=m.useState(null),[N,k]=m.useState(0),P=r==="yearly"?"anual":r==="quarterly"?"trimestral":"mensal",A=r==="yearly"?"daqui a 12 meses":r==="quarterly"?"daqui a 3 meses":"no próximo mês",T=r==="yearly"?"a cada 12 meses":r==="quarterly"?"a cada 3 meses":"por mês";m.useEffect(()=>{u&&(async()=>{const{data:E}=await he.from("profiles").select("cpf, username").eq("id",u.id).maybeSingle();E&&(E.cpf&&g(ox(E.cpf)),E.username&&v(E.username))})()},[u]);const D=m.useCallback(async()=>{var S;const E=y.replace(/\D/g,"");if(E.length!==11){Xe({title:"CPF inválido",description:"Informe um CPF com 11 dígitos.",variant:"destructive"});return}if(x.trim().length<3){Xe({title:"Nome inválido",description:"Informe seu nome completo.",variant:"destructive"});return}w(!0),p("loading");const I={planId:e,billingPeriod:r,mode:o};try{let L=!1;try{const{data:J}=await he.rpc("free_trial_needs_pix_auth");L=J===!0}catch(J){console.warn("[EfiPix] free_trial_needs_pix_auth check failed",J)}const Y=L?"efi-create-pix-recurrence-scheduled":"efi-create-pix-recurrence",B=s?{instance_count:s}:{},q=L?{planId:e,billingPeriod:r,cpf:E,fullName:x.trim(),firstChargeInDays:Zc,...B}:{planId:e,billingPeriod:r,cpf:E,fullName:x.trim(),lp_context:i?{...i,full_name:x.trim()}:null,...B};console.log(`[EfiPix][handleGenerate] modo=${L?"free-trial (agendado 7d)":"normal (imediato)"}`,I);const F=he.functions.invoke(Y,{body:q}),ee=new Promise((J,K)=>setTimeout(()=>K(new Error("TIMEOUT")),m3)),{data:$,error:M}=await Promise.race([F,ee]);if(M||!($!=null&&$.ok)){const J=($==null?void 0:$.error)||(M==null?void 0:M.message)||"Falha ao gerar autorização PIX Automático";console.warn("[EfiPix][handleGenerate] falha",{...I,status:(S=M==null?void 0:M.context)==null?void 0:S.status,msg:J,data:$,error:M}),Xe({title:"Erro ao gerar PIX Automático",description:J,variant:"destructive"}),p("form");return}console.log("[EfiPix][handleGenerate] ok",{...I,idRec:$.idRec}),C({idRec:$.idRec,pixCopiaECola:$.pixCopiaECola,valor:$.valor}),k(Date.now()),p("qr")}catch(L){const Y=(L==null?void 0:L.message)==="TIMEOUT";console.error("[EfiPix][handleGenerate] exception",{...I,isTimeout:Y,error:L}),Xe({title:Y?"A Efí demorou demais pra responder":(L==null?void 0:L.message)||"Erro inesperado",description:Y?"Tente gerar o QR Code novamente.":void 0,variant:"destructive"}),p("form")}finally{w(!1)}},[y,x,e,r,s,o,i]);return m.useEffect(()=>{if(h!=="qr"||!_)return;const E=setInterval(async()=>
467{if(Date.now()-N>p3){clearInterval(E),p("expired");return}try{const{data:I}=await he.functions.invoke("efi-check-rec-status",{body:{recId:_.idRec}});if((I==null?void 0:I.status)==="active"||(I==null?void 0:I.status)==="authorized_pending_charge"){if(hd("efi-create-pix-recurrence"),hd("efi-create-pix-recurrence-scheduled"),clearInterval(E),p("done"),I.status==="active"){if(Av(n),i!=null&&i.sck)try{await f.trackPurchase({value:n,currency:"BRL",orderId:_.idRec,content_name:t})}catch(L){console.warn("[EfiPixAutomaticoCheckout] lp trackPurchase failed",L)}Xe({title:"Autorização confirmada!",description:`Plano ${t} ativado. Cobrança automática ${P} habilitada.`})}else Xe({title:"Autorização confirmada!",description:`Plano ${t} liberado. 1ª cobrança automática só daqui a ${Zc} dias.`});setTimeout(c,1500)}else((I==null?void 0:I.status)==="cancelled"||(I==null?void 0:I.status)==="canceled")&&(clearInterval(E),Xe({title:"Autorização cancelada",variant:"destructive"}),d())}catch{}},h3);return()=>clearInterval(E)},[h,_,N,n,t,c,d]),h==="done"?a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 space-y-4",children:[a.jsx(Vo,{className:"h-16 w-16 text-emerald-500 animate-in zoom-in-50 duration-300"}),a.jsxs("div",{className:"text-center space-y-2",children:[a.jsx("h3",{className:"text-lg font-semibold text-emerald-500",children:"Autorização Confirmada!"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:l?`Plano ${t} liberado. 1ª cobrança automática só daqui a ${Zc} dias.`:`Plano ${t} ativado. Próximas cobranças serão automáticas via PIX.`})]})]}):h==="expired"?a.jsxs("div",{className:"space-y-4 py-6 text-center",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"O tempo para autorizar expirou. Você pode gerar um novo QR Code."}),a.jsxs("div",{className:"flex gap-2 justify-center",children:[a.jsx(pe,{variant:"outline",onClick:d,children:"Voltar"}),a.jsx(pe,{onClick:()=>p("form"),className:"bg-emerald-600 hover:bg-emerald-700 text-white",children:"Tentar novamente"})]})]}):h==="qr"&&_?a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(pe,{type:"button",variant:"ghost",size:"icon",onClick:d,className:"h-8 w-8",children:a.jsx(ks,{className:"h-4 w-4"})}),a.jsxs("span",{className:"font-medium text-foreground",children:["PIX Automático — ",t]})]}),a.jsxs("div",{className:"rounded-lg border border-emerald-500/40 bg-emerald-500/5 p-3 text-sm space-y-1",children:[a.jsxs("p",{className:"font-medium text-emerald-600 flex items-center gap-1.5",children:[a.jsx(Vv,{className:"h-4 w-4"}),"Autorização de débito automático ",P]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Você está autorizando uma cobrança recorrente ",a.jsx("strong",{children:P})," de"," ",a.jsxs("strong",{children:["R$ ",Number(_.valor).toFixed(2)]})," via PIX. Este valor será debitado"," ",a.jsx("strong",{children:"agora"})," e novamente ",a.jsx("strong",{children:A}),". Este QR Code"," ",a.jsx("strong",{children:"não é um pagamento único avulso"})," — é a autorização da recorrência. Cancele quando quiser, sem multa."]})]}),a.jsx("div",{className:"flex justify-center",children:a.jsx("div",{className:"bg-white p-4 rounded-lg",children:a.jsx(jh,{value:_.pixCopiaECola,size:208,level:"H",includeMargin:!1,imageSettings:{src:o1,height:44,width:44,excavate:!0}})})}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"Ou copie o código PIX:"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(et,{value:_.pixCopiaECola,readOnly:!0,className:"font-mono text-xs"}),a.jsx(pe,{variant:"outline",size:"icon",onClick:()=>{navigator.clipboard.writeText(_.pixCopiaECola),Xe({title:"Código copiado!"})},children:a.jsx(Fv,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground justify-center",children:[a.jsx(st,{className:"h-4 w-4 animate-spin"}),"Aguardando autorização no app do seu banco..."]})]}):h==="loading"?a.jsx(x3,{onBack:d,onRetry:()=>p("form")}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(pe,{type:"button",variant:"ghost",size:"icon",onClick:d,className:"h-8 w-8",children:a.jsx(ks,{className:"h-4 w-4"})}),a.jsxs("span",{className:"font-medium text-foreground",children:[o==="upgrade"?"
467Upgrade":"Assinar"," ",t," — PIX Automático"]})]}),l?a.jsxs("div",{className:"rounded-lg border border-emerald-500/40 bg-emerald-500/10 p-3 text-sm space-y-1",children:[a.jsxs("p",{className:"font-medium text-emerald-600 flex items-center gap-1.5",children:[a.jsx(xp,{className:"h-4 w-4"}),"🎁 7 dias grátis — sem cobrança agora"]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Você autoriza o PIX automático agora, mas a ",a.jsxs("strong",{children:["1ª cobrança de R$ ",Number(n).toFixed(2)," só acontece daqui a 7 dias"]}),". Cancele antes e não paga nada."]})]}):a.jsxs("div",{className:"rounded-lg border border-emerald-500/40 bg-emerald-500/5 p-3 text-sm space-y-1",children:[a.jsxs("p",{className:"font-medium text-emerald-600 flex items-center gap-1.5",children:[a.jsx(xp,{className:"h-4 w-4"}),"Cobrança recorrente ",P," via PIX"]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Sem cartão de crédito. O valor será debitado da sua conta ",T,", automaticamente. Cancele a qualquer momento."]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Be,{children:"Nome completo do titular da conta"}),a.jsx(et,{value:x,onChange:E=>v(E.target.value),placeholder:"Como aparece no banco",maxLength:120})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Be,{children:"CPF do titular"}),a.jsx(et,{value:y,onChange:E=>g(ox(E.target.value)),placeholder:"000.000.000-00",inputMode:"numeric",maxLength:14}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Deve ser o mesmo CPF da conta bancária que você usará para autorizar."})]}),a.jsx(pe,{onClick:D,disabled:b,className:"w-full bg-emerald-600 hover:bg-emerald-700 text-white h-11",children:b?a.jsxs(a.Fragment,{children:[a.jsx(st,{className:"h-4 w-4 mr-2 animate-spin"})," Gerando..."]}):a.jsxs(a.Fragment,{children:["Gerar QR Code de autorização — R$ ",n.toFixed(2)]})}),a.jsx("p",{className:"text-[11px] text-center text-muted-foreground",children:"Após escanear, você autoriza no app do seu banco e a assinatura é ativada automaticamente."})]})}function ix(e,[t,n]){return Math.min(n,Math.max(t,e))}function y3(e){const t=e+"CollectionProvider",[n,r]=Vn(t),[s,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=g=>{const{scope:x,children:v}=g,b=oe.useRef(null),w=oe.useRef(new Map).current;return a.jsx(s,{scope:x,itemMap:w,collectionRef:b,children:v})};i.displayName=t;const l=e+"CollectionSlot",c=Ns(l),d=oe.forwardRef((g,x)=>{const{scope:v,children:b}=g,w=o(l,v),_=Ze(x,w.collectionRef);return a.jsx(c,{ref:_,children:b})});d.displayName=l;const u=e+"CollectionItemSlot",f="data-radix-collection-item",h=Ns(u),p=oe.forwardRef((g,x)=>{const{scope:v,children:b,...w}=g,_=oe.useRef(null),C=Ze(x,_),N=o(u,v);return oe.useEffect(()=>(N.itemMap.set(_,{ref:_,...w}),()=>void N.itemMap.delete(_))),a.jsx(h,{[f]:"",ref:C,children:b})});p.displayName=u;function y(g){const x=o(e+"CollectionConsumer",g);return oe.useCallback(()=>{const b=x.collectionRef.current;if(!b)return[];const w=Array.from(b.querySelectorAll(`[${f}]`));return Array.from(x.itemMap.values()).sort((N,k)=>w.indexOf(N.ref.current)-w.indexOf(k.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:i,Slot:d,ItemSlot:p},y,r]}var b3=m.createContext(void 0);function w3(e){const t=m.useContext(b3);return e||t||"ltr"}function kh(e){const t=m.useRef({value:e,previous:e});return m.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var _3=[" ","Enter","ArrowUp","ArrowDown"],S3=[" ","Enter"],Os="Select",[Gl,Kl,C3]=y3(Os),[za,J$]=Vn(Os,[C3,Ma]),Yl=Ma(),[j3,Qr]=za(Os),[k3,E3]=za(Os),i1=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:o,value:i,defaultValue:l,onValueChange:c,dir:d,name:u,autoComplete:f,disabled:h,required:p,form:y}=e,g=Yl(t),[x,v]=m.useState(null),[b,w]=m.useState(null),[_,C]=m.useState(!1),N=w3(d),[k,P]=As({prop:r,defaultProp:s??!1,onChange:o,caller:Os}),[A,T]=As({prop:i,defaultProp:l,onChange:c,caller:Os}),D=m.useRef(null),E=x?y||!!x.closest("form"):!0,[I,S]=m.useState(new Set),L=Array.from(I).map(Y=>Y.props.value).join(";");return a.jsx(cf,{...g,children:a.jsxs(j3,{required:p,scope:t,trigger:x,onTriggerChange:v,valueNode:b,onValueNodeChange:w,valueNodeHasChildren:_,onValueNodeHasChildrenChange:C,contentId:ln(),value:A,onValueChange:T,open:k,onOpenChange:P,dir:N,triggerPointerDownPosRef:D,disabled:h,children:[a.jsx(Gl.Provider,{scope:t,children:a.jsx(k3,{scope:e.__scopeSelect,onNativeOptionAdd:m.useCallback(Y=>{S(B=>new Set(B).add(Y))},[]),onNativeOptionRemove:m.useCallback(Y=>{S(B=>{const q=new Set(B);return q.delete(Y),q})},[]),children:n})}),E?a.jsxs(I1,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:f,value:A,onChange:Y=>T(Y.target.value),disabled:h,form:y,children:[A===void 0?a.jsx("option",{value:""}):null,Array.from(I)]},L):null]})})};i1.displayName=Os;var l1="SelectTrigger",c1=m.forwardRef((e,t)=>
vendor: 16,822 bytes, line 467
467{const{__scopeSelect:n,disabled:r=!1,...s}=e,o=Yl(n),i=Qr(l1,n),l=i.disabled||r,c=Ze(t,i.onTriggerChange),d=Kl(n),u=m.useRef("touch"),[f,h,p]=R1(g=>{const x=d().filter(w=>!w.disabled),v=x.find(w=>w.value===i.value),b=D1(x,g,v);b!==void 0&&i.onValueChange(b.value)}),y=g=>{l||(i.onOpenChange(!0),p()),g&&(i.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)})};return a.jsx(jl,{asChild:!0,...o,children:a.jsx(Ie.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":M1(i.value)?"":void 0,...s,ref:c,onClick:ze(s.onClick,g=>{g.currentTarget.focus(),u.current!=="mouse"&&y(g)}),onPointerDown:ze(s.onPointerDown,g=>{u.current=g.pointerType;const x=g.target;x.hasPointerCapture(g.pointerId)&&x.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&g.pointerType==="mouse"&&(y(g),g.preventDefault())}),onKeyDown:ze(s.onKeyDown,g=>{const x=f.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&h(g.key),!(x&&g.key===" ")&&_3.includes(g.key)&&(y(),g.preventDefault())})})})});c1.displayName=l1;var d1="SelectValue",u1=m.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:o,placeholder:i="",...l}=e,c=Qr(d1,n),{onValueNodeHasChildrenChange:d}=c,u=o!==void 0,f=Ze(t,c.onValueNodeChange);return Pt(()=>{d(u)},[d,u]),a.jsx(Ie.span,{...l,ref:f,style:{pointerEvents:"none"},children:M1(c.value)?a.jsx(a.Fragment,{children:i}):o})});u1.displayName=d1;var N3="SelectIcon",f1=m.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return a.jsx(Ie.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});f1.displayName=N3;var P3="SelectPortal",h1=e=>a.jsx(kl,{asChild:!0,...e});h1.displayName=P3;var Ls="SelectContent",p1=m.forwardRef((e,t)=>{const n=Qr(Ls,e.__scopeSelect),[r,s]=m.useState();if(Pt(()=>{s(new DocumentFragment)},[]),!n.open){const o=r;return o?yl.createPortal(a.jsx(m1,{scope:e.__scopeSelect,children:a.jsx(Gl.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),o):null}return a.jsx(g1,{...e,ref:t})});p1.displayName=Ls;var Mn=10,[m1,Jr]=za(Ls),A3="SelectContentImpl",T3=Ns("SelectContent.RemoveScroll"),g1=m.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:i,side:l,sideOffset:c,align:d,alignOffset:u,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:y,hideWhenDetached:g,avoidCollisions:x,...v}=e,b=Qr(Ls,n),[w,_]=m.useState(null),[C,N]=m.useState(null),k=Ze(t,te=>_(te)),[P,A]=m.useState(null),[T,D]=m.useState(null),E=Kl(n),[I,S]=m.useState(!1),L=m.useRef(!1);m.useEffect(()=>{if(w)return Mf(w)},[w]),If();const Y=m.useCallback(te=>{const[ae,...re]=E().map(z=>z.ref.current),[le]=re.slice(-1),ue=document.activeElement;for(const z of te)if(z===ue||(z==null||z.scrollIntoView({block:"nearest"}),z===ae&&C&&(C.scrollTop=0),z===le&&C&&(C.scrollTop=C.scrollHeight),z==null||z.focus(),document.activeElement!==ue))return},[E,C]),B=m.useCallback(()=>Y([P,w]),[Y,P,w]);m.useEffect(()=>{I&&B()},[I,B]);const{onOpenChange:q,triggerPointerDownPosRef:F}=b;m.useEffect(()=>{if(w){let te={x:0,y:0};const ae=le=>{var ue,z;te={x:Math.abs(Math.round(le.pageX)-(((ue=F.current)==null?void 0:ue.x)??0)),y:Math.abs(Math.round(le.pageY)-(((z=F.current)==null?void 0:z.y)??0))}},re=le=>{te.x<=10&&te.y<=10?le.preventDefault():w.contains(le.target)||q(!1),document.removeEventListener("pointermove",ae),F.current=null};return F.current!==null&&(document.addEventListener("pointermove",ae),document.addEventListener("pointerup",re,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ae),document.removeEventListener("pointerup",re,{capture:!0})}}},[w,q,F]),m.useEffect(()=>{const te=()=>q(!1);return window.addEventListener("blur",te),window.addEventListener("resize",te),()=>{window.removeEventListener("blur",te),window.removeEventListener("resize",te)}},[q]);const[ee,$]=R1(te=>{const ae=E().filter(ue=>!ue.disabled),re=ae.find(ue=>ue.ref.current===document.activeElement),le=D1(ae,te,re);le&&setTimeout(()=>le.ref.current.focus())}),M=m.useCallback((te,ae,re)=>{const le=!L.current&&!re;(b.value!==void 0&&b.value===ae||le)&&(A(te),le&&(L.current=!0))},[b.value]),J=m.useCallback(()=>w==null?void 0:w.focus(),[w]),K=m.useCallback((te,ae,re)=>{const le=!L.current&&!re;(b.value!==void 0&&b.value===ae||le)&&D(te)},[b.value]),X=r==="popper"?_u:x1,de=X===_u?{side:l,sideOffset:c,align:d,alignOffset:u,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:y,hideWhenDetached:g,avoidCollisions:x}:{};return a.jsx(m1,{scope:n,content:w,viewport:C,onViewportChange:N,itemRefCallback:M,selectedItem:P,onItemLeave:J,itemTextRefCallback:K,focusSelectedItem:B,selectedItemText:T,position:r,isPositioned:I,searchRef:ee,children:a.jsx(Ml,{as:T3,allowPinchZoom:!0,children:a.jsx(Tl,{asChild:!0,trapped:b.open,onMountAutoFocus:te=>{te.preventDefault()},onUnmountAutoFocus:ze(s,te=>{var ae;(ae=b.trigger)==null||ae.focus({preventScroll:!0}),te.preventDefault()}),children:a.jsx(Uo,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:te=>te.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:a.jsx(X,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:te=>te.preventDefault(),...v,...de,onPlaced:()=>S(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:ze(v.onKeyDown,te=>{const ae=te.ctrlKey||te.altKey||te.metaKey;if(te.key==="Tab"&&te.preventDefault(),!ae&&te.key.length===1&&$(te.key),["ArrowUp","ArrowDown","Home","End"].includes(te.key)){let le=E().filter(ue=>!ue.disabled).map(ue=>ue.ref.current);if(["ArrowUp","End"].includes(te.key)&&(le=le.slice().reverse()),["ArrowUp","ArrowDown"].includes(te.key)){const ue=te.target,z=le.indexOf(ue);le=le.slice(z+1)}setTimeout(()=>Y(le)),te.preventDefault()}})})})})})})});g1.displayName=A3;var I3="SelectItemAlignedPosition",x1=m.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,o=Qr(Ls,n),i=Jr(Ls,n),[l,c]=m.useState(null),[d,u]=m.useState(null),f=Ze(t,k=>u(k)),h=Kl(n),p=m.useRef(!1),y=m.useRef(!0),{viewport:g,selectedItem:x,selectedItemText:v,focusSelectedItem:b}=i,w=m.useCallback(()=>{if(o.trigger&&o.valueNode&&l&&d&&g&&x&&v){const k=o.trigger.getBoundingClientRect(),P=d.getBoundingClientRect(),A=o.valueNode.getBoundingClientRect(),T=v.getBoundingClientRect();if(o.dir!=="rtl"){const ue=T.left-P.left,z=A.left-ue,ie=k.left-z,j=k.width+ie,H=Math.max(j,P.width),G=window.innerWidth-Mn,O=ix(z,[Mn,Math.max(Mn,G-H)]);l.style.minWidth=j+"px",l.style.left=O+"px"}else{const ue=P.right-T.right,z=window.innerWidth-A.right-ue,ie=window.innerWidth-k.right-z,j=k.width+ie,H=Math.max(j,P.width),G=window.innerWidth-Mn,O=ix(z,[Mn,Math.max(Mn,G-H)]);l.style.minWidth=j+"px",l.style.right=O+"px"}const D=h(),E=window.innerHeight-Mn*2,I=g.scrollHeight,S=window.getComputedStyle(d),L=parseInt(S.borderTopWidth,10),Y=parseInt(S.paddingTop,10),B=parseInt(S.borderBottomWidth,10),q=parseInt(S.paddingBottom,10),F=L+Y+I+q+B,ee=Math.min(x.offsetHeight*5,F),$=window.getComputedStyle(g),M=parseInt($.paddingTop,10),J=parseInt($.paddingBottom,10),K=k.top+k.height/2-Mn,X=E-K,de=x.offsetHeight/2,te=x.offsetTop+de,ae=L+Y+te,re=F-ae;if(ae<=K){const ue=D.length>0&&x===D[D.length-1].ref.current;l.style.bottom="0px";const z=d.clientHeight-g.offsetTop-g.offsetHeight,ie=Math.max(X,de+(ue?J:0)+z+B),j=ae+ie;l.style.height=j+"px"}else{const ue=D.length>0&&x===D[0].ref.current;l.style.top="0px";const ie=Math.max(K,L+g.offsetTop+(ue?M:0)+de)+re;l.style.height=ie+"px",g.scrollTop=ae-K+g.offsetTop}l.style.margin=`${Mn}px 0`,l.style.minHeight=ee+"px",l.style.maxHeight=E+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[h,o.trigger,o.valueNode,l,d,g,x,v,o.dir,r]);Pt(()=>w(),[w]);const[_,C]=m.useState();Pt(()=>{d&&C(window.getComputedStyle(d).zIndex)},[d]);const N=m.useCallback(k=>{k&&y.current===!0&&(w(),b==null||b(),y.current=!1)},[w,b]);return a.jsx(R3,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:p,onScrollButtonChange:N,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:a.jsx(Ie.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});x1.displayName=I3;var M3="SelectPopperPosition",_u=m.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=Mn,...o}=e,i=Yl(n);return a.jsx(df,{...i,...o,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});_u.displayName=M3;var[R3,Eh]=za(Ls,{}),Su="SelectViewport",v1=m.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,o=Jr(Su,n),i=Eh(Su,n),l=Ze(t,o.onViewportChange),c=m.useRef(0);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),a.jsx(Gl.Slot,{scope:n,children:a.jsx(Ie.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:ze(s.onScroll,d=>{const u=d.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=i;if(h!=null&&h.current&&f){const p=Math.abs(c.current-u.scrollTop);if(p>0){const y=window.innerHeight-Mn*2,g=parseFloat(f.style.minHeight),x=parseFloat(f.style.height),v=Math.max(g,x);if(v<y){const b=v+p,w=Math.min(y,b),_=b-w;f.style.height=w+"px",f.style.bottom==="0px"&&(u.scrollTop=_>0?_:0,f.style.justifyContent="flex-end")}}}c.current=u.scrollTop})})})]})});v1.displayName=Su;var y1="SelectGroup",[D3,O3]=za(y1),b1=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=ln();return a.jsx(D3,{scope:n,id:s,children:a.jsx(Ie.div,{role:"group","aria-labelledby":s,...r,ref:t})})});b1.displayName=y1;var w1="SelectLabel",_1=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=O3(w1,n);return a.jsx(Ie.div,{id:s.id,...r,ref:t})});_1.displayName=w1;var hl="SelectItem",[L3,S1]=za(hl),C1=m.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:o,...i}=e,l=Qr(hl,n),c=Jr(hl,n),d=l.value===r,[u,f]=m.useState(o??""),[h,p]=m.useState(!1),y=Ze(t,b=>{var w;return(w=c.itemRefCallback)==null?void 0:w.call(c,b,r,s)}),g=ln(),x=m.useRef("touch"),v=()=>{s||(l.onValueChange(r),l.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return a.jsx(L3,{scope:n,value:r,disabled:s,textId:g,isSelected:d,onItemTextChange:m.useCallback(b=>{f(w=>w||((b==null?void 0:b.textContent)??"").trim())},[]),children:a.jsx(Gl.ItemSlot,{scope:n,value:r,disabled:s,textValue:u,children:a.jsx(Ie.div,{role:"option","aria-labelledby":g,"data-highlighted":h?"":void 0,"aria-selected":d&&h,"data-state":d?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...i,ref:y,onFocus:ze(i.onFocus,()=>p(!0)),onBlur:ze(i.onBlur,()=>p(!1)),onClick:ze(i.onClick,()=>{x.current!=="mouse"&&v()}),onPointerUp:ze(i.onPointerUp,()=>{x.current==="mouse"&&v()}),onPointerDown:ze(i.onPointerDown,b=>{x.current=b.pointerType}),onPointerMove:ze(i.onPointerMove,b=>{var w;x.current=b.pointerType,s?(w=c.onItemLeave)==null||w.call(c):x.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ze(i.onPointerLeave,b=>{var w;b.currentTarget===document.activeElement&&((w=c.onItemLeave)==null||w.call(c))}),onKeyDown:ze(i.onKeyDown,b=>{var _;((_=c.searchRef)==null?void 0:_.current)!==""&&b.key===" "||(S3.includes(b.key)&&v(),b.key===" "&&b.preventDefault())})})})})});C1.displayName=hl;var oo="SelectItemText",j1=m.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...o}=e,i=Qr(oo,n),l=Jr(oo,n),c=S1(oo,n),d=E3(oo,n),[u,f]=m.useState(null),h=Ze(t,v=>f(v),c.onItemTextChange,v=>{var b;return(b=l.itemTextRefCallback)==null?void 0:b.call(l,v,c.value,c.disabled)}),p=u==null?void 0:u.textContent,y=m.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:g,onNativeOptionRemove:x}=d;return Pt(()=>(g(y),()=>x(y)),[g,x,y]),a.jsxs(a.Fragment,{children:[a.jsx(Ie.span,{id:c.textId,...o,ref:h}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?yl.createPortal(o.children,i.valueNode):null]})});j1.displayName=oo;var k1="SelectItemIndicator",E1=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return S1(k1,n).isSelected?a.jsx(Ie.span,{"aria-hidden":!0,...r,ref:t}):null});E1.displayName=k1;var Cu="SelectScrollUpButton",N1=m.forwardRef((e,t)=>{const n=Jr(Cu,e.__scopeSelect),r=Eh(Cu,e.__scopeSelect),[s,o]=m.useState(!1),i=Ze(t,r.onScrollButtonChange);return Pt(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollTop>0;o(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?a.jsx(A1,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});N1.displayName=Cu;var ju="SelectScrollDownButton",P1=m.forwardRef((e,t)=>{const n=Jr(ju,e.__scopeSelect),r=Eh(ju,e.__scopeSelect),[s,o]=m.useState(!1),i=Ze(t,r.onScrollButtonChange);return Pt(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollHeight-c.clientHeight,u=Math.ceil(c.scrollTop)<d;o(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?a.jsx(A1,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});P1.displayName=ju;var A1=m.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,o=Jr("SelectScrollButton",n),i=m.useRef(null),l=Kl(n),c=m.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return m.useEffect(()=>()=>c(),[c]),Pt(()=>{var u;const d=l().find(f=>f.ref.current===document.activeElement);(u=d==null?void 0:d.ref.current)==null||u.scrollIntoView({block:"nearest"})},[l]),a.jsx(Ie.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:ze(s.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:ze(s.onPointerMove,()=>{var d;(d=o.onItemLeave)==null||d.call(o),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:ze(s.onPointerLeave,()=>{c()})})}),F3="SelectSeparator",T1=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return a.jsx(Ie.div,{"aria-hidden":!0,...r,ref:t})});T1.displayName=F3;var ku="SelectArrow",z3=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Yl(n),o=Qr(ku,n),i=Jr(ku,n);return o.open&&i.position==="popper"?a.jsx(uf,{...s,...r,ref:t}):null});z3.displayName=ku;var B3="SelectBubbleInput",I1=m.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const s=m.useRef(null),o=Ze(r,s),i=kh(t);return m.useEffect(()=>{const l=s.current;if(!l)return;const c=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&u){const f=new Event("change",{bubbles:!0});u.call(l,t),l.dispatchEvent(f)}},[i,t]),a.jsx(Ie.select,{...n,style:{...wy,...n.style},ref:o,defaultValue:t})});I1.displayName=B3;function M1(e){return e===""||e===void 0}function R1(e){const t=$r(e),n=m.useRef(""),r=m.useRef(0),s=m.useCallback(i=>{const l=n.current+i;t(l),function c(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),o=m.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return m.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,o]}function D1(e,t,n){const s=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let i=V3(e,Math.max(o,0));s.length===1&&(i=i.filter(d=>d!==n));const c=i.find(d=>d.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function V3(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var $3=i1,O1=c1,U3=u1,W3=f1,H3=h1,L1=p1,q3=v1,G3=b1,F1=_1,z1=C1,K3=j1,Y3=E1,B1=N1,V1=P1,$1=T1;const cs=$3,eU=G3,ds=U3,Fr=m.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(O1,{ref:r,className:xe("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm r
467ing-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,a.jsx(W3,{asChild:!0,children:a.jsx(Lv,{className:"h-4 w-4 opacity-50"})})]}));Fr.displayName=O1.displayName;const U1=m.forwardRef(({className:e,...t},n)=>a.jsx(B1,{ref:n,className:xe("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(OC,{className:"h-4 w-4"})}));U1.displayName=B1.displayName;const W1=m.forwardRef(({className:e,...t},n)=>a.jsx(V1,{ref:n,className:xe("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Lv,{className:"h-4 w-4"})}));W1.displayName=V1.displayName;const zr=m.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>a.jsx(H3,{children:a.jsxs(L1,{ref:s,className:xe("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[a.jsx(U1,{}),a.jsx(q3,{className:xe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),a.jsx(W1,{})]})}));zr.displayName=L1.displayName;const X3=m.forwardRef(({className:e,...t},n)=>a.jsx(F1,{ref:n,className:xe("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));X3.displayName=F1.displayName;const Ut=m.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(z1,{ref:r,className:xe("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Y3,{children:a.jsx(Lr,{className:"h-4 w-4"})})}),a.jsx(K3,{children:t})]}));Ut.displayName=z1.displayName;const Z3=m.forwardRef(({className:e,...t},n)=>a.jsx($1,{ref:n,className:xe("-mx-1 my-1 h-px bg-muted",e),...t}));Z3.displayName=$1.displayName;function Q3({value:e,onChange:t,minInstances:n,billingPeriod:r="monthly",disabled:s}){const o=hA(n);return a.jsxs(cs,{value:e?String(e):"",onValueChange:i=>t(Number(i)),disabled:s||o.length===0,children:[a.jsx(Fr,{children:a.jsx(ds,{placeholder:"Quantas conexões?"})}),a.jsx(zr,{className:"max-h-72",children:o.map(i=>{const l=Pf(i),c=ur(i,r);return a.jsxs(Ut,{value:String(i),children:[i," conexões — R$ ",l.toFixed(0),"/mês",r!=="monthly"?` (R$ ${c.toFixed(0)} no período)`:""]},i)})})]})}const J3=a4("pk_live_51R6AxvHXG4eRgF5T45efMhG8WJ0605AlcmF695vLZpJg04s9siAlJguRs5KsiEU9bMpo5YpK9lhtDw32honsAbSR009pN8TpXA",{locale:o4});async function eO(e,t,n){let r=null;try{const o=e==null?void 0:e.context;o&&typeof o.json=="function"?r=await(typeof o.clone=="function"?o.clone():o).json():typeof(o==null?void 0:o.body)=="string"&&(r=JSON.parse(o.body))}catch{}const s=r??t??{};return{code:(s==null?void 0:s.error)||(e==null?void 0:e.name)||null,message:(s==null?void 0:s.message)||(s==null?void 0:s.error_description)||(s==null?void 0:s.error)||(e==null?void 0:e.message)||n||Fe.t("billing:planSelectionModal.genericRequestError"),raw:s}}const tO={free:a.jsx(Yu,{className:"h-6 w-6"}),iniciante:a.jsx(lj,{className:"h-6 w-6"}),acesso:a.jsx(Hv,{className:"h-6 w-6"}),expansao:a.jsx(rj,{className:"h-6 w-6"}),ascensao:a.jsx(dj,{className:"h-6 w-6"}),dominacao:a.jsx(Ki,{className:"h-6 w-6"}),titan:a.jsx(YC,{className:"h-6 w-6"}),enterprise:a.jsx(Ov,{className:"h-6 w-6"})},lx=["cloud","aiAgent","metaPixel","pixAuto","crmKanban"],nO=["acesso","expansao","ascensao","dominacao","titan","enterprise","custom"],Qc=e=>nO.includes(e)?[...lx,"iaStudio","adsTab","groupTab"]:lx,rO={free:"border-muted-foreground
467/30",iniciante:"border-orange-500",acesso:"border-orange-500",expansao:"border-orange-500",ascensao:"border-orange-500",dominacao:"border-orange-500",titan:"border-orange-500",enterprise:"border-purple-500"};function sO({planId:e,planName:t,amount:n,onSuccess:r,onBack:s,billingPeriod:o="monthly",lpContext:i,isFreeTrial:l=!1,instanceCount:c}){const{t:d}=Qe("billing"),u=A4(),f=k4(),h=Ch(),{theme:p}=Xu(),y=m.useMemo(()=>({base:{fontSize:"16px",color:p==="dark"?"#ffffff":"#1a1a1a","::placeholder":{color:"#71717a"},iconColor:"#f97316"},invalid:{color:"#ef4444",iconColor:"#ef4444"}}),[p]),[g,x]=m.useState(!1),[v,b]=m.useState(!1),[w,_]=m.useState(!1),[C,N]=m.useState(!1),[k,P]=m.useState(!1),[A,T]=m.useState(!1),[D,E]=m.useState("•••• •••• •••• ••••"),[I,S]=m.useState("••/••"),[L,Y]=m.useState("•••"),[B,q]=m.useState(""),[F,ee]=m.useState(""),$=de=>{N(de.complete),de.empty?E("•••• •••• •••• ••••"):de.complete&&E("**** **** **** ••••")},M=de=>{P(de.complete),(de.empty||de.complete)&&S("••/••")},J=de=>{T(de.complete),de.empty?Y("•••"):de.complete&&Y("***")},K=de=>{const te=de.toUpperCase().slice(0,25);ee(te),q(te||d("planSelectionModal.cardForm.cardholderPlaceholder"))},X=async de=>{if(de.preventDefault(),!u||!f)return;const te=f.getElement(Xg);if(!te)return;if(!F.trim()){Xe({title:d("planSelectionModal.cardForm.cardholderName"),description:d("planSelectionModal.cardForm.cardholderRequired"),variant:"destructive"});return}x(!0);const ae=setTimeout(()=>{x(!1),Xe({title:d("planSelectionModal.cardForm.timeoutTitle"),description:d("planSelectionModal.cardForm.timeoutDescription"),variant:"destructive"})},3e4);try{console.log("[PlanCardForm] Starting subscription for plan:",e);const{data:re,error:le}=await he.functions.invoke("create-plan-subscription-inline",{body:{plan_id:e,billing_period:o,cardholder_name:F,...c?{instance_count:c}:{}}});if(console.log("[PlanCardForm] Backend response:",{data:re?{...re,clientSecret:re!=null&&re.clientSecret?"***":null}:null,error:le}),le||re!=null&&re.error){const H=await eO(le,re);Xe({title:H.code==="USE_UPGRADE_FLOW"?d("planSelectionModal.cardForm.alreadyActivePlanTitle"):d("planSelectionModal.cardForm.couldNotStartSubscription"),description:H.message,variant:"destructive"});return}if(re.alreadyActive){console.log("[PlanCardForm] Subscription already active, provisioning..."),await he.functions.invoke("create-plan-subscription-inline",{body:{action:"confirm",plan_id:e,subscription_id:re.subscriptionId,lp_context:i}}),clearTimeout(ae),b(!0),setTimeout(()=>r(),800);return}const{clientSecret:ue,mode:z}=re;if(!ue)throw new Error(d("planSelectionModal.cardForm.missingClientSecret"));if(z==="setup"){console.log("[PlanCardForm] Free trial — confirmando SetupIntent (sem cobrança)...");const{error:H,setupIntent:G}=await u.confirmCardSetup(ue,{payment_method:{card:te,billing_details:{name:F||void 0}}});if(console.log("[PlanCardForm] confirmCardSetup result:",{error:H,status:G==null?void 0:G.status}),H)Xe({title:d("planSelectionModal.cardForm.couldNotSaveCard"),description:Wg(H),variant:"destructive"});else if((G==null?void 0:G.status)==="succeeded"){if(G.payment_method){const O=typeof G.payment_method=="string"?G.payment_method:G.payment_method.id;he.functions.invoke("manage-payment-methods",{body:{action:"save-payment-method",paymentMethodId:O}}).catch(()=>{})}await he.functions.invoke("create-plan-subscription-inline",{body:{action:"confirm",plan_id:e,subscription_id:re.subscriptionId,lp_context:i}}),clearTimeout(ae),b(!0),setTimeout(()=>r(),800)}return}console.log("[PlanCardForm] Got clientSecret, confirming card payment...");const{error:ie,paymentIntent:j}=await u.confirmCardPayment(ue,{payment_method:{card:te,billing_details:{name:F||void 0}}});if(console.log("[PlanCardForm] Stripe confirmCardPayment result:",{error:ie,status:j==null?void 0:j.status}),ie)Xe({title:ie.code==="card_declined"?d("planSelectionModal.cardForm.cardDeclined"):d("planSelectionModal.cardForm.processError"),description:Wg(ie),variant:"destructive"});else if((j==null?void 0:j.status)==="succeeded"){if(j.payment_method){const G=typeof j.payment_method=="string"?j.payment_method:j.payment_method.id;he.functions.invoke("manage-payment-methods",{body:{action:"save-payment-method",paymentMethodId:G}}).catch(()=>{})}const{data:H}=await he.functions.invoke("create-plan-subscription-inline",{body:{action:"confirm",plan_id:e,subscription_id:re.subscriptionId,lp_context:i}});if(Av(n),i!=null&&i.sck)try{await h.trackPurchase({value:n,currency:"BRL",orderId:re.subscriptionId,content_name:t})}catch(G){console.warn("[PlanCardForm] lp trackPurchase failed",G)}b(!0),setTimeout(()=>r(),800)}else Xe({title:d("planSelectionModal.cardForm.unexpectedStatus"),variant:"destructive"})}catch(re){console.error("[PlanCardForm] Payment error:",re),Xe({title:re.message||d("planSelectionModal.cardForm.processError"),variant:"destructive"})}finally{clearTimeout(ae),x(!1)}};return v?a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 space-y-4",children:[a.jsx(Vo,{className:"h-16 w-16 text-orange-500 animate-in zoom-in-50 duration-300"}),a.jsxs("div",{className:"text-center space-y-2",children:[a.jsx("h3",{className:"text-lg font-semibold text-orange-500",children:d("planSelectionModal.cardForm.approvedTitle")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:d("planSelectionModal.cardForm.planActivatedSuccess",{planName:t})})]})]}):a.jsxs("form",{onSubmit:X,className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(pe,{type:"button",variant:"ghost",size:"icon",onClick:s,className:"h-8 w-8",children:a.jsx(ks,{className:"h-4 w-4"})}),a.jsx("span",{className:"font-medium text-foreground",children:d("planSelectionModal.cardForm.confirmPayment",{amount:n.toFixed(2)})})]}),a.jsx("div",{className:"flex justify-center mb-2",children:a.jsx(Uw,{cardholderName:B||d("planSelectionModal.cardForm.cardholderPlaceholder"),cardNumber:D,expiryDate:I,cvv:L,isFlipped:w})}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:d("planSelectionModal.cardForm.cardholderName")}),a.jsx(et,{type:"text",placeholder:d("planSelectionModal.cardForm.cardholderPlaceholder"),value:F,onChange:de=>K(de.target.value),className:"bg-card border-border text-foreground placeholder:text-muted-foreground
467/50 h-11 uppercase",maxLength:25})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:d("planSelectionModal.cardForm.cardNumber")}),a.jsx("div",{className:"bg-card border border-border rounded-md px-3 py-3 h-11 flex items-center [&_.StripeElement]:w-full",children:a.jsx(Xg,{options:{style:y,showIcon:!0},onChange:$,className:"w-full"})})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:d("planSelectionModal.cardForm.expiry")}),a.jsx("div",{className:"bg-card border border-border rounded-md px-3 py-3 h-11 flex items-center [&_.StripeElement]:w-full",children:a.jsx(T4,{options:{style:y},onChange:M,onFocus:()=>_(!1),className:"w-full"})})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"CVV"}),a.jsx("div",{className:"bg-card border border-border rounded-md px-3 py-3 h-11 flex items-center [&_.StripeElement]:w-full",children:a.jsx(I4,{options:{style:y},onChange:J,onFocus:()=>_(!0),onBlur:()=>_(!1),className:"w-full"})})]})]})]}),l&&a.jsxs("div",{className:"rounded-lg border border-emerald-500/40 bg-emerald-500/10 p-3 text-sm text-emerald-700 dark:text-emerald-300",children:["🎁 ",a.jsx("strong",{children:d("planSelectionModal.cardForm.freeTrialBanner.freeDays")})," ",d("planSelectionModal.cardForm.freeTrialBanner.youIntro")," ",a.jsx("strong",{children:d("planSelectionModal.cardForm.freeTrialBanner.notChargedToday")}),d("planSelectionModal.cardForm.freeTrialBanner.cardSavedLeadIn")," ",a.jsxs("strong",{children:["R$ ",n.toFixed(2)]})," ",d("planSelectionModal.cardForm.freeTrialBanner.onlyHappens")," ",a.jsx("strong",{children:d("planSelectionModal.cardForm.freeTrialBanner.in7Days")}),d("planSelectionModal.cardForm.freeTrialBanner.cancelFooter")]}),a.jsx(pe,{type:"submit",disabled:!u||g||!C||!k||!A||!F.trim(),className:"w-full bg-emerald-600 text-white hover:bg-emerald-700 h-11",children:g?a.jsxs(a.Fragment,{children:[a.jsx(st,{className:"h-4 w-4 mr-2 animate-spin"}),d("planSelectionModal.cardForm.processing")]}):a.jsxs(a.Fragment,{children:[a.jsx(Aa,{className:"h-4 w-4 mr-2"}),l?d("planSelectionModal.cardForm.startFreeTrial"):d("planSelectionModal.cardForm.confirmPayment",{amount:n.toFixed(2)})]})}),a.jsxs("p",{className:"text-xs text-center text-muted-foreground flex items-center justify-center gap-1",children:[a.jsx(fo,{className:"h-3 w-3"}),d(l?"planSelectionModal.cardForm.freeTrialSecureNote":"planSelectionModal.cardForm.securePaymentNote")]})]})}const pr=({open:e,onOpenChange:t,hideFreePlan:n,hideIniciante:r,forceSelection:s,mode:o,preselectedPlanId:i,preselectedBillingPeriod:l,preselectedInstanceCount:c,onPaymentSuccess:d,lpMode:u,lpContext:f})=>{const{t:h}=Qe("billing"),{plans:p,startCheckout:y,refresh:g,currentPlan:x,hasActivePlan:v,subscription:b,isPastDue:w,isSubscriptionExpired:_,isInGracePeriod:C}=Xr(),{user:N}=at(),k=MT();t3();const[P,A]=m.useState("monthly"),[T,D]=m.useState(null),[E,I]=m.useState(null),[S,L]=m.useState(null),[Y,B]=m.useState(!1),[q,F]=m.useState(null),[ee,$]=m.useState(_s),M=PT(),J=async(V,Q,W)=>{const se=await iA(V,Q);A(W),F({id:se.id,name:`${se.name} · ${Q} conexões`,price:Nf(V,Q,W)/100}),B(!0)},[K,X]=m.useState(!1);m.useEffect(()=>{if(!e||!N){X(!1);return}let V=!1;return(async()=>{try{const{data:Q}=await he.rpc("free_trial_needs_pix_auth");V||X(Q===!0)}catch{}})(),()=>{V=!0}},[e,N]);const[de,te]=m.useState(!1);m.useEffect(()=>{if(!e){te(!1);return}if(de||!i)return;const V=Ko(i);if(V){te(!0),J(V.family,V.connections,l??"monthly").catch(se=>{Xe({title:"Não foi possível abrir o pagamento",description:se.message,variant:"destructive"}),t(!1)});return}if(!p||p.length===0)return;const Q=p.find(se=>se.id===i);if(!Q)return;te(!0);const W=l??"monthly";if(A(W),ib(Q.id)){const se=c??_s;F({id:Q.id,name:`Modo Enterprise (${se} números)`,price:ur(se,W),instanceCount:se}),B(!0);return}F({id:Q.id,name:Q.name,price:ae(Q,W).total}),B(!0)},[e,i,c,l,p,de]);const ae=(V,Q=P)=>{var se;return((se={iniciante:{monthly:{monthly:59,total:59},quarterly:{monthly:47,total:142},yearly:{monthly:41,total:496}},acesso:{monthly:{monthly:119,total:119},quarterly:{monthly:95,total:286},yearly:{monthly:83,total:1e3}},expansao:{monthly:{monthly:169,total:169},quarterly:{monthly:135,total:406},yearly:{monthly:118,total:1420}},ascensao:{monthly:{monthly:219,total:219},quarterly:{monthly:175,total:526},yearly:{monthly:153,total:1840}},dominacao:{monthly:{monthly:319,total:319},quarterly:{monthly:255,total:766},yearly:{monthly:223,total:2680}},titan:{monthly:{monthly:519,total:519},quarterly:{monthly:415,total:1246},yearly:{monthly:363,total:4360}}}[V.id])==null?void 0:se[Q])||{monthly:V.price_brl,total:V.price_brl}},re=async V=>{const Q=p.find(se=>se.id===V);if(!Q)return;if(V==="free"){D(V);try{await y(V),await g(),Xe({title:h("planSelectionModal.toasts.planActivatedTitle"),description:h("planSelectionModal.toasts.freePlanActivated")}),t(!1)}catch{Xe({title:h("planSelectionModal.toasts.genericErrorTitle"),description:h("planSelectionModal.toasts.couldNotActivatePlan"),variant:"destructive"})}finally{D(null)}return}const W=ae(Q);F({id:V,name:Q.name,price:W.total}),B(!0)},le=()=>{const V=ur(ee,P);F({id:ro,name:`Modo Enterprise (${ee} números)`,price:V,instanceCount:ee}),B(!0)},ue=()=>{B(!1),q&&I(q)},z=()=>{B(!1),q&&L(q)},ie=async()=>{await g();try{d&&E&&await d({planId:E.id})}catch(V){console.warn("[PlanSelectionModal] onPaymentSuccess callback failed",V)}Xe({title:h("planSelectionModal.toasts.planActivatedTitle"),description:h("planSelectionModal.toasts.subscriptionCreated")}),I(null),t(!1)},j=async()=>{await g();try{d&&q&&await d({planId:q.id})}catch(V){console.warn("[PlanSelectionModal] onPaymentSuccess callback failed",V)}Xe(K&&jc((S==null?void 0:S.id)??(q==null?void 0:q.id))?{title:h("planSelectionModal.toasts.planUnlockedTitle"),description:h("planSelectionModal.toasts.freeTrialReady")}:{title:h("planSelectionModal.toasts.planActivatedTitle"),description:h("planSelectionModal.toasts.pixConfirmed")}),F(null),L(null),t(!1),window.dispatchEvent(new Event("subscription-changed"))},H=v&&(x!=null&&x.price_brl)?x.price_brl:0,G=b!=null&&b.current_period_end?new Date(b.current_period_end):null,O=!!G&&G.getTime()<Date.now(),R=o==="regularize"||o!=="upgrade"&&(w||_||C||O||(b==null?void 0:b.cancel_at_period_end)===!0),U=p.filter(V=>!(V.id==="free"||!(Number(V.price_brl)>0)||V.id===ro||r&&V.id==="iniciante"||!R&&H>0&&V.price_brl<=H));return a.jsxs(a.Fragment,{children:[a.jsx(cn,{open:e,onOpenChange:V=>{S&&!V||t(V)},children:a.jsx(Qt,{className:"max-w-[95vw] sm:max-w-4xl w-full max-h-[95vh] overflow-visible flex flex-col p-0",children:S?a.jsx("div",{className:"p-4 sm:p-6 overflow-y-auto",children:a.jsx(v3,{planId:S.id,planName:S.name,amount:S.price,billingPeriod:P,instanceCount:S.instanceCount,mode:"create",lpContext:f,isFreeTrial:K&&jc(S.id),onSuccess:()=>{L(null),j()},onBack:()=>L(null)})}):E?a.jsx("div",{className:"p-4 sm:p-6 overflow-y-auto",children:a.jsx(Vw,{stripe:J3,children:a.jsx(sO,{planId:E.id,planName:E.name,instanceCount:E.instanceCount,amount:E.price,onSuccess:ie,onBack:()=>I(null),billingPeriod:P,lpContext:f,isFreeTrial:K&&jc(E.id)})})}):u?a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 gap-3",children:[a.jsx(st,{className:"h-6 w-6 animate-spin text-orange-500"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:h("planSelectionModal.preparingCheckout")})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"text-center pt-6 pb-2 px-4 sm:px-6 shrink-0",children:[a.jsx("h2",{className:"text-xl sm:text-2xl font-bold",children:h("planSelectionModal.header.chooseYourPlan")}),a.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:h("planSelectionModal.header.chooseYourPlanSubtitle")}),a.jsxs("div",{className:"flex items-center justify-center gap-2 mt-4",children:[a.jsx("button",{onClick:()=>A("monthly"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${P==="monthly"?"bg-orange-500 text-white":"bg-muted text-muted-foreground hover:bg-muted/80"}`,children:h("planSelectionModal.header.monthly")}),a.jsxs("button",{onClick:()=>A("quarterly"),className:`relative px-4 py-2 rounded-lg text-sm font-medium transition-all ${P==="quarterly"?"bg-
467orange-500 text-white":"bg-muted text-muted-foreground hover:bg-muted/80"}`,children:[h("planSelectionModal.header.quarterly"),a.jsx("span",{className:"absolute -top-2 -right-2 bg-emerald-500 text-white text-[10px] px-1.5 py-0.5 rounded-full font-bold",children:"-20%"})]}),a.jsxs("button",{onClick:()=>A("yearly"),className:`relative px-4 py-2 rounded-lg text-sm font-medium transition-all ${P==="yearly"?"bg-orange-500 text-white":"bg-muted text-muted-foreground hover:bg-muted/80"}`,children:[h("planSelectionModal.header.yearly"),a.jsx("span",{className:"absolute -top-2 -right-2 bg-emerald-500 text-white text-[10px] px-1.5 py-0.5 rounded-full font-bold",children:"-30%"})]})]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto px-4 pb-16 sm:px-6",children:M?a.jsx(Bb,{period:P,showPeriods:!1,onChoose:J}):U.length===0?a.jsx("div",{className:"flex gap-4 justify-center pt-4",children:[1,2,3].map(V=>a.jsxs("div",{className:"rounded-xl border-2 border-border bg-card p-4 sm:p-5 flex flex-col w-64 space-y-3",children:[a.jsx(rs,{className:"h-6 w-24"}),a.jsx(rs,{className:"h-10 w-full"}),a.jsx(rs,{className:"h-7 w-20"}),a.jsxs("div",{className:"space-y-2 flex-1",children:[a.jsx(rs,{className:"h-4 w-full"}),a.jsx(rs,{className:"h-4 w-3/4"})]}),a.jsx(rs,{className:"h-10 w-full rounded-md"})]},V))}):a.jsx("div",{className:"px-8 sm:px-12 pt-4 pb-4",children:a.jsxs(Hb,{opts:{align:"start",loop:!1},className:"w-full",children:[a.jsxs(qb,{className:"-ml-4 py-6",children:[U.map(V=>{const Q=ae(V),W=Q.monthly,se=Q.total,fe=P==="quarterly"?3:P==="yearly"?12:1,ce=W/30,me=V.id==="acesso"||V.id==="dominacao",ke=P!=="monthly";return a.jsx(Oi,{className:"pl-4 basis-full sm:basis-1/2 lg:basis-1/3",children:a.jsxs("div",{className:`relative rounded-xl border-2 ${rO[V.id]||"border-border"} bg-card p-4 sm:p-5 flex flex-col h-full transition-all hover:scale-[1.02] overflow-visible mt-3`,children:[me&&a.jsx(Yn,{className:"absolute -top-3 left-1/2 -translate-x-1/2 bg-orange-500 text-white text-xs whitespace-nowrap z-10",children:h("planSelectionModal.mostPopular")}),a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("div",{className:"text-orange-500",children:tO[V.id]}),a.jsx("span",{className:"text-xs sm:text-sm font-medium text-muted-foreground uppercase tracking-wider truncate",children:V.name})]}),V.id!=="free"&&a.jsx("p",{className:"text-orange-500 text-base sm:text-lg font-bold mb-3",children:h(`planSelectionModal.plans.subtitles.${V.id}`)}),V.id!=="free"&&a.jsx(Yn,{variant:"outline",className:"border-orange-500 text-orange-500 text-xs mb-2 w-fit",children:h("planSelectionModal.instancesConnected",{count:V.max_instances})}),a.jsx("div",{className:"mb-3",children:V.price_brl>0?a.jsxs("div",{children:[ke&&a.jsx("p",{className:"text-muted-foreground text-xs line-through",children:h("planSelectionModal.priceFrom",{price:V.price_brl.toFixed(0)})}),a.jsxs("span",{className:"text-xl sm:text-2xl font-bold",children:["R$ ",W.toFixed(0),",00"]}),a.jsxs("span",{className:"text-muted-foreground text-xs sm:text-sm",children:[" ",h("planSelectionModal.perMonth")]}),a.jsxs("p",{className:"text-muted-foreground text-[10px]",children:["R$ ",ce.toFixed(2),h("planSelectionModal.perDay")]}),ke&&a.jsxs("p",{className:"text-orange-500 text-xs font-semibold mt-1",children:[h("planSelectionModal.totalLabel")," R$ ",se.toFixed(0),",00 ",h("planSelectionModal.everyMonths",{months:fe})]})]}):a.jsx("span",{className:"text-xl sm:text-2xl font-bold",children:h("planSelectionModal.viaRecharge")})}),a.jsx("ul",{className:"space-y-1.5 flex-1 mb-3",children:V.id!=="free"?Qc(V.id).map((Ne,Je)=>a.jsxs("li",{className:"flex items-start gap-1.5 text-xs",children:[a.jsx(Lr,{className:"h-3.5 w-3.5 text-orange-500 shrink-0 mt-0.5"}),a.jsx("span",{children:h(`planSelectionModal.plans.features.${Ne}`)})]},Je)):a.jsxs("li",{className:"flex items-center gap-1.5 text-xs",children:[a.jsx(Lr,{className:"h-3.5 w-3.5 text-orange-500 shrink-0"}),h("planSelectionModal.allFeatures")]})}),a.jsx(pe,{onClick:()=>re(V.id),disabled:T!==null,className:`w-full text-sm ${V.id==="free"?"bg-emerald-600 text-white hover:bg-emerald-700":"bg-orange-500 text-white hover:bg-orange-600"}`,children:T===V.id?h("planSelectionModal.processingButton"):V.id==="free"?h("planSelectionModal.startButton"):h("planSelectionModal.selectPlanButton")})]})},V.id)}),p.some(V=>V.id===ro&&Number(V.price_brl)>0)&&(R||H<=0||ur(_s,"monthly")>H)&&a.jsx(Oi,{className:"pl-4 basis-full sm:basis-1/2 lg:basis-1/3",children:a.jsxs("div",{className:"relative rounded-xl border-2 border-purple-500 bg-card p-4 sm:p-5 flex flex-col h-full transition-all hover:scale-[1.02] overflow-visible mt-3",children:[a.jsx(Yn,{className:"absolute -top-3 left-1/2 -translate-x-1/2 bg-purple-500 text-white text-xs whitespace-nowrap z-10",children:"21 a 100 conexões"}),a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("div",{className:"text-purple-500",children:a.jsx(Ov,{className:"h-6 w-6"})}),a.jsx("span",{className:"text-xs sm:text-sm font-medium text-muted-foreground uppercase tracking-wider truncate",children:h("planSelectionModal.enterprisePlan.name")}
467)]}),a.jsx("p",{className:"text-purple-500 text-base sm:text-lg font-bold mb-3",children:h("planSelectionModal.enterprisePlan.subtitle")}),a.jsx("div",{className:"mb-3",children:a.jsx(Q3,{value:ee,onChange:$,billingPeriod:P})}),(()=>{const V=fA(ee,P),Q=ur(ee,P),W=P==="quarterly"?3:P==="yearly"?12:1,se=P!=="monthly";return a.jsxs("div",{className:"mb-3",children:[se&&a.jsx("p",{className:"text-muted-foreground text-xs line-through",children:h("planSelectionModal.priceFrom",{price:ur(ee,"monthly").toFixed(0)})}),a.jsxs("span",{className:"text-xl sm:text-2xl font-bold",children:["R$ ",V.toFixed(0),",00"]}),a.jsxs("span",{className:"text-muted-foreground text-xs sm:text-sm",children:[" ",h("planSelectionModal.perMonth")]}),se&&a.jsxs("p",{className:"text-orange-500 text-xs font-semibold mt-1",children:[h("planSelectionModal.totalLabel")," R$ ",Q.toFixed(0),",00 ",h("planSelectionModal.everyMonths",{months:W})]})]})})(),a.jsx("ul",{className:"space-y-1.5 flex-1 mb-3",children:Qc(ro).map((V,Q)=>a.jsxs("li",{className:"flex items-start gap-1.5 text-xs",children:[a.jsx(Lr,{className:"h-3.5 w-3.5 text-purple-500 shrink-0 mt-0.5"}),a.jsx("span",{children:h(`planSelectionModal.plans.features.${V}`)})]},Q))}),a.jsx(pe,{onClick:le,disabled:T!==null,className:"w-full text-sm bg-purple-500 text-white hover:bg-purple-600",children:h("planSelectionModal.selectPlanButton")})]})}),a.jsx(Oi,{className:"pl-4 basis-full sm:basis-1/2 lg:basis-1/3",children:a.jsxs("div",{className:"relative rounded-xl border-2 border-purple-500 bg-card p-4 sm:p-5 flex flex-col h-full transition-all hover:scale-[1.02] overflow-visible mt-3",children:[a.jsx(Yn,{className:"absolute -top-3 left-1/2 -translate-x-1/2 bg-purple-500 text-white text-xs whitespace-nowrap z-10",children:h("planSelectionModal.empire.customQuote")}),a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("div",{className:"text-purple-500",children:a.jsx(Ki,{className:"h-6 w-6"})}),a.jsx("span",{className:"text-xs sm:text-sm font-medium text-muted-foreground uppercase tracking-wider truncate",children:h("planSelectionModal.empire.name")})]}),a.jsx("p",{className:"text-purple-500 text-base sm:text-lg font-bold mb-3",children:h("planSelectionModal.empire.subtitle")}),a.jsx(Yn,{variant:"outline",className:"border-purple-500 text-purple-500 text-xs mb-2 w-fit",children:h("planSelectionModal.empire.customInstances")}),a.jsxs("div",{className:"mb-3",children:[a.jsx("span",{className:"text-sm font-bold",children:h("planSelectionModal.empire.priceOnRequest")}),a.jsx("p",{className:"text-muted-foreground text-xs",children:h("planSelectionModal.empire.priceOnRequestHint")})]}),a.jsx("ul",{className:"space-y-1.5 flex-1 mb-3",children:Qc("custom").map((V,Q)=>a.jsxs("li",{className:"flex items-start gap-1.5 text-xs",children:[a.jsx(Lr,{className:"h-3.5 w-3.5 text-purple-500 shrink-0 mt-0.5"}),a.jsx("span",{children:h(`planSelectionModal.plans.features.${V}`)})]},Q))}),a.jsx(pe,{onClick:()=>window.open(`https://wa.me/${k.replace(/\D/g,"")}?text=Quero%20conhecer%20o%20plano%20Empire`,"_blank"),className:"w-full text-sm bg-purple-500 text-white hover:bg-purple-600",children:h("planSelectionModal.empire.talkToSupport")})]})})]}),a.jsx(Gb,{}),a.jsx(Kb,{})]})})})]})})}),a.jsx(GD,{open:Y,onOpenChange:B,onSelectCard:ue,onSelectPix:z})]})};var H1="AlertDialog",[aO,tU]=Vn(H1,[wb]),br=wb(),q1=e=>{const{__scopeAlertDialog:t,...n}=e,r=br(t);return a.jsx(Lf,{...r,...n,modal:!0})};q1.displayName=H1;var oO="AlertDialogTrigger",G1=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=br(n);return a.jsx(Lb,{...s,...r,ref:t})});G1.displayName=oO;var iO="AlertDialogPortal",K1=e=>{const{__scopeAlertDialog:t,...n}=e,r=br(t);return a.jsx(Ff,{...r,...n})};K1.displayName=iO;var lO="AlertDialogOverlay",Y1=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=br(n);return a.jsx(Dl,{...s,...r,ref:t})});Y1.displayName=lO;var ia="AlertDialogContent",[cO,dO]=aO(ia),uO=Zv("AlertDialogContent"),X1=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...s}=e,o=br(n),i=m.useRef(null),l=Ze(t,i),c=m.useRef(null);return a.jsx(ST,{contentName:ia,titleName:Z1,docsSlug:"alert-dialog",children:a.jsx(cO,{scope:n,cancelRef:c,children:a.jsxs(Ol,{role:"alertdialog",...o,...s,ref:l,onOpenAutoFocus:ze(s.onOpenAutoFocus,d=>{var u;d.preventDefault(),(u=c.current)==null||u.focus({preventScroll:!0})}),onPointerDownOutside:d=>d.preventDefault(),onInteractOutside:d=>d.preventDefault(),children:[a.jsx(uO,{children:r}),a.jsx(hO,{contentRef:i})]})})})});X1.displayName=ia;var Z1="AlertDialogTitle",Q1=m.forwardRef((e,t)=>
467{const{__scopeAlertDialog:n,...r}=e,s=br(n);return a.jsx(zf,{...s,...r,ref:t})});Q1.displayName=Z1;var J1="AlertDialogDescription",e_=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=br(n);return a.jsx(Bf,{...s,...r,ref:t})});e_.displayName=J1;var fO="AlertDialogAction",t_=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=br(n);return a.jsx(Ll,{...s,...r,ref:t})});t_.displayName=fO;var n_="AlertDialogCancel",r_=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:s}=dO(n_,n),o=br(n),i=Ze(t,s);return a.jsx(Ll,{...o,...r,ref:i})});r_.displayName=n_;var hO=({contentRef:e})=>{const t=`\`${ia}\` requires a description for the component to be accessible for screen reader users.
468
469You can add a description to the \`${ia}\` by passing a \`${J1}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
470
471Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${ia}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
472
473For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return m.useEffect(()=>{var r;document.getElementById((r=e.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},pO=q1,mO=G1,gO=K1,s_=Y1,a_=X1,o_=t_,i_=r_,l_=Q1,c_=e_;const d_=pO,nU=mO,xO=gO,u_=m.forwardRef(({className:e,...t},n)=>a.jsx(s_,{className:xe("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));u_.displayName=s_.displayName;const Nh=m.forwardRef(({className:e,...t},n)=>a.jsxs(xO,{children:[a.jsx(u_,{}),a.jsx(a_,{ref:n,className:xe("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));Nh.displayName=a_.displayName;const Ph=({className:e,...t})=>a.jsx("div",{className:xe("flex flex-col space-y-2 text-center sm:text-left",e),...t});Ph.displayName="AlertDialogHeader";const Ah=({className:e,...t})=>a.jsx("div",{className:xe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Ah.displayName="AlertDialogFooter";const Th=m.forwardRef(({className:e,...t},n)=>a.jsx(l_,{ref:n,className:xe("text-lg font-semibold",e),...t}));Th.displayName=l_.displayName;const Ih=m.forwardRef(({className:e,...t},n)=>a.jsx(c_,{ref:n,className:xe("text-sm text-muted-foreground",e),...t}));Ih.displayName=c_.displayName;const Mh=m.forwardRef(({className:e,...t},n)=>a.jsx(o_,{ref:n,className:xe(nl(),e),...t}));Mh.displayName=o_.displayName;const f_=m.forwardRef(({className:e,...t},n)=>a.jsx(i_,{ref:n,className:xe(nl({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));f_.displayName=i_.displayName;
473var Xl="Checkbox",[vO,rU]=Vn(Xl),[yO,Rh]=vO(Xl);function bO(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:s,disabled:o,form:i,name:l,onCheckedChange:c,required:d,value:u="on",internal_do_not_use_render:f}=e,[h,p]=As({prop:n,defaultProp:s??!1,onChange:c,caller:Xl}),[y,g]=m.useState(null),[x,v]=m.useState(null),b=m.useRef(!1),w=y?!!i||!!y.closest("form"):!0,_={checked:h,disabled:o,setChecked:p,control:y,setControl:g,name:l,form:i,value:u,hasConsumerStoppedPropagationRef:b,required:d,defaultChecked:Vr(s)?!1:s,isFormControl:w,bubbleInput:x,setBubbleInput:v};return a.jsx(yO,{scope:t,..._,children:wO(f)?f(_):r})}var h_="CheckboxTrigger",p_=m.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},s)=>{const{control:o,value:i,disabled:l,checked:c,required:d,setControl:u,setChecked:f,hasConsumerStoppedPropagationRef:h,isFormControl:p,bubbleInput:y}=Rh(h_,e),g=Ze(s,u),x=m.useRef(c);return m.useEffect(()=>{const v=o==null?void 0:o.form;if(v){const b=()=>f(x.current);return v.addEventListener("reset",b),()=>v.removeEventListener("reset",b)}},[o,f]),a.jsx(Ie.button,{type:"button",role:"checkbox","aria-checked":Vr(c)?"mixed":c,"aria-required":d,"data-state":y_(c),"data-disabled":l?"":void 0,disabled:l,value:i,...r,ref:g,onKeyDown:ze(t,v=>{v.key==="Enter"&&v.preventDefault()}),onClick:ze(n,v=>{f(b=>Vr(b)?!0:!b),y&&p&&(h.current=v.isPropagationStopped(),h.current||v.stopPropagation())})})});p_.displayName=h_;var Dh=m.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:s,defaultChecked:o,required:i,disabled:l,value:c,onCheckedChange:d,form:u,...f}=e;return a.jsx(bO,{__scopeCheckbox:n,checked:s,defaultChecked:o,disabled:l,required:i,onCheckedChange:d,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:h})=>a.jsxs(a.Fragment,{children:[a.jsx(p_,{...f,ref:t,__scopeCheckbox:n}),h&&a.jsx(v_,{__scopeCheckbox:n})]})})});Dh.displayName=Xl;var m_="CheckboxIndicator",g_=m.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...s}=e,o=Rh(m_,n);return a.jsx(Kr,{present:r||Vr(o.checked)||o.checked===!0,children:a.jsx(Ie.span,{"data-state":y_(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});g_.displayName=m_;var x_="CheckboxBubbleInput",v_=m.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:s,checked:o,defaultChecked:i,required:l,disabled:c,name:d,value:u,form:f,bubbleInput:h,setBubbleInput:p}=Rh(x_,e),y=Ze(n,p),g=kh(o),x=af(r);m.useEffect(()=>{const b=h;if(!b)return;const w=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(w,"checked").set,N=!s.current;if(g!==o&&C){const k=new Event("click",{bubbles:N});b.indeterminate=Vr(o),C.call(b,Vr(o)?!1:o),b.dispatchEvent(k)}},[h,g,o,s]);const v=m.useRef(Vr(o)?!1:o);return a.jsx(Ie.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??v.current,required:l,disabled:c,name:d,value:u,form:f,...t,tabIndex:-1,ref:y,style:{...t.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});v_.displayName=x_;function wO(e){return typeof e=="function"}function Vr(e){return e==="indeterminate"}function y_(e){return Vr(e)?"indeterminate":e?"checked":"unchecked"}const qr=m.forwardRef(({className:e,...t},n)=>a.jsx(Dh,{ref:n,className:xe("peer h-4 w-4 shrink-0 rounded-sm border-2 border-accent bg-background ring-offset-background data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:a.jsx(g_,{className:xe("flex items-center justify-center text-current"),children:a.jsx(Lr,{className:"h-4 w-4",strokeWidth:3})})}));qr.displayName=Dh.displayName;const ti=()=>{var c,d;const{user:e}=at(),{isImpersonating:t,impersonatedUserId:n,impersonatedEmail:r}=qo(),{isCollaborator:s,parentUserId:o,effectiveUserId:i}=Da(),l=$n();return l&&l.status!=="legacy"&&l.status!=="signed-out"?{effectiveUserId:((c=l.scope)==null?void 0:c.owner_user_id)??null,effectiveEmail:null,isImpersonating:!1,realUserId:(e==null?void 0:e.id)??null,realEmail:(e==null?void 0:e.email)??null,companyId:((d=l.scope)==null?void 0:d.company_id)??null}:t&&n?{effectiveUserId:n,effectiveEmail:r,isImpersonating:!0,realUserId:(e==null?void 0:e.id)||null,realEmail:(e==null?void 0:e.email)||null}:s&&o?{effectiveUserId:o,effectiveEmail:(e==null?void 0:e.email)||null,isImpersonating:!1,realUserId:(e==null?void 0:e.id)||null,realEmail:(e==null?void 0:e.email)||null}:{effectiveUserId:(e==null?void 0:e.id)||null,effectiveEmail:(e==null?void 0:e.email)||null,isImpersonating:!1,realUserId:(e==null?void 0:e.id)||null,realEmail:(e==null?void 0:e.email)||null}},_O=["unofficial","official","instagram","messenger","telegram"],SO="zernio";function CO(e){return e==="unofficial"||e==="official"||e==="instagram"||e==="messenger"||e==="telegram"}function jO(e){return e==="whatsapp"?"official":e==="instagram"?"instagram":e==="facebook"?"messenger":e==="telegram"?"telegram":null}function Oh(e,t){return e==="telegram_direct"?"telegram":e!==SO?"unofficial":jO(t)??"official"}function b_(e){return CO(e)?e:"unofficial"}function sU(e){const t=b_(e);return t==="instagram"||t==="messenger"||t==="telegram"}function ea(e,t){return e.filter(n=>Oh(n.api_provider,n.platform)===t)}function kO(e,t,n){const r=new Map(t.map(s=>[s.id,s]));for(const s of e){const o=r.get(s);if(o&&Oh(o.api_provider,o.platform)!==n)return o}return null}function EO(e){const t=(e==null?void 0:e.message)??(typeof e=="string"?e:"");return typeof t=="string"&&t.includes("flow_channel_instance_mismatch")}const NO={unofficial:"WhatsApp (QR Code)",extension:"Extensão WhatsApp Web",official:"WhatsApp Oficial",instagram:"Instagram",messenger:"Messenger",telegram:"Telegram"},PO=["unofficial","extension","official","instagram","messenger","telegram"];function AO(e){return e.api_provider==="wa_extension"?"extension":Oh(e.api_provider,e.platform)}const Lh=e=>(e.api_provider??"uazapi")!=="telegram_direct",Eu=e=>e.api_provider==="zernio"||e.api_provider==="telegram_direct";function cx(e,t,n,r=new Set){const o=e.filter(d=>!r.has(d.id)).filter(Lh).length,i=t==="basic"?e.filter(Eu).map(d=>d.id):[],l=i.filter(d=>!r.has(d)).length,c=Math.max(0,o-n);return{used:o,limit:n,forced:i,extraNeeded:c,fits:c===0&&l===0}}const fr=e=>`${e} ${e===1?"conexão":"conexões"}`;async function Nu(e){if(!e)return[];const[{data:t,error:n},{data:r}]=await Promise.all([he.from("maturador_instances").select("id, instance_name, profile_name, phone_number, api_provider, status, deleti
473on_requested_at").eq("user_id",e).is("archived_at",null).order("created_at"),he.from("zernio_connections").select("instance_id, platform").eq("user_id",e)]);if(n)throw n;const s=new Map((r??[]).map(o=>[o.instance_id,o.platform]));return(t??[]).map(o=>({...o,platform:s.get(o.id)??null}))}async function TO(e){for(let t=0;t<40&&e.length;t++){const{data:n}=await he.from("maturador_instances").select("id").in("id",e).is("archived_at",null);if(!(n!=null&&n.length))return!0;await new Promise(r=>setTimeout(r,3e3))}return!1}function IO({family:e,limit:t,label:n,continueLabel:r,onBack:s,onReady:o}){const{effectiveUserId:i}=ti(),[l,c]=m.useState(null),[d,u]=m.useState(new Set),[f,h]=m.useState(!1),[p,y]=m.useState(!1),[g,x]=m.useState(!1),v=m.useRef(o);v.current=o;const b=T=>e==="basic"?T.filter(Eu).map(D=>D.id):[],w=async(T,D)=>{x(!0),!await TO(T)&&D&&Xe({title:"Liberando as vagas",description:"As conexões foram apagadas e as vagas estão sendo liberadas. Se recusar, aguarde 1 minuto e tente de novo."}),v.current()};m.useEffect(()=>{let T=!1;return Nu(i).then(D=>
473{if(T)return;const E=D.filter(I=>I.deletion_requested_at).map(I=>I.id);if(cx(D,e,t,new Set(E)).fits){w(E,!1);return}c(D),u(new Set(b(D)))}).catch(()=>{T||c([])}),()=>{T=!0}},[i,e,t]);const _=m.useMemo(()=>new Set((l??[]).filter(T=>T.deletion_requested_at).map(T=>T.id)),[l]),C=l?cx(l,e,t,new Set([...d,..._])):null,N=m.useMemo(()=>{const T=(l??[]).filter(D=>Lh(D)||e==="basic"&&Eu(D));return PO.map(D=>({kind:D,items:T.filter(E=>AO(E)===D)})).filter(D=>D.items.length)},[l,e]),k=(l??[]).filter(T=>d.has(T.id)),P=(T,D)=>u(E=>{const I=new Set(E);return D?I.add(T):I.delete(T),I}),A=async()=>{h(!1),y(!0);const T=[],D=[];for(const E of k)try{const{data:I,error:S}=await he.functions.invoke("whatsapp-manager",{body:{action:"delete-instance",instanceName:E.instance_name,instanceId:E.id,targetUserId:i}});if(S)throw new Error(await Tv(S,"Não foi possível apagar."));if(I!=null&&I.error||!(I!=null&&I.success))throw new Error((I==null?void 0:I.error)||"Não foi possível apagar.");D.push(E.id)}catch(I){T.push(`${E.profile_name||E.instance_name}: ${(I==null?void 0:I.message)??"erro"}`)}if(T.length){const E=await Nu(i).catch(()=>l??[]);c(E),u(new Set([...b(E),...[...d].filter(I=>!D.includes(I))])),y(!1),Xe({title:"Algumas conexões não foram apagadas",description:T.join(" · "),variant:"destructive"});return}await w([...D,..._],!0)};return g||!l||!C?a.jsxs("div",{className:"flex flex-col items-center gap-3 py-12 text-center",children:[a.jsx(st,{className:"h-6 w-6 animate-spin text-orange-500"}),g&&a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"font-medium",children:"Liberando as vagas…"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Isso pode levar até 1 minuto. Não feche esta janela."})]})]}):a.jsxs(a.Fragment,{children:[a.jsxs(qt,{children:[a.jsx(Gt,{children:"Escolha as conexões para apagar"}),a.jsxs(En,{children:["O plano ",n," comporta ",fr(t),".",e==="basic"&&C.forced.length>0&&" O Basic inclui só WhatsApp (QR Code) e extensão — conexões oficiais, Instagram, Messenger e Telegram precisam sair."]})]}),a.jsxs(pe,{variant:"ghost",size:"sm",className:"w-fit",disabled:p,onClick:s,children:[a.jsx(ks,{className:"mr-1 h-4 w-4"}),"Trocar plano"]}),a.jsx("div",{className:"space-y-4",children:N.map(T=>a.jsxs("section",{children:[a.jsxs("h4",{className:"mb-2 text-sm font-semibold",children:[NO[T.kind]," ",a.jsxs("span",{className:"font-normal text-muted-foreground",children:["(",T.items.length,")"]})]}),a.jsx("ul",{className:"divide-y rounded-lg border",children:T.items.map(D=>{const E=C.forced.includes(D.id),I=_.has(D.id);return a.jsx("li",{children:a.jsxs("label",{className:"flex cursor-pointer items-center gap-3 px-3 py-2",children:[a.jsx(qr,{checked:I||d.has(D.id),disabled:p||E||I,onCheckedChange:S=>P(D.id,S===!0),"aria-label":`Apagar ${D.profile_name||D.instance_name}`}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"truncate text-sm font-medium",children:D.profile_name||D.instance_name}),a.jsx("p",{className:"truncate text-xs text-muted-foreground",children:[D.phone_number,D.status==="connected"||D.status==="open"?"Conectado":"Desconectado"].filter(
473Boolean).join(" · ")})]}),E&&a.jsx(Yn,{variant:"outline",className:"shrink-0",children:"Não incluso no Basic"}),I&&a.jsx(Yn,{variant:"outline",className:"shrink-0",children:"Apagando…"})]})},D.id)})})]},T.kind))}),a.jsxs("div",{className:"sticky bottom-0 -mx-6 -mb-6 border-t bg-background p-4",children:[a.jsx("p",{className:"mb-3 text-sm",children:C.fits?`Pronto: ficam ${fr(C.used)} — cabe no ${n}.`:C.extraNeeded>0?`Selecione mais ${fr(C.extraNeeded)} para caber no plano.`:"Remova as conexões marcadas para continuar."}),a.jsx(pe,{className:"w-full",variant:"destructive",disabled:!C.fits||p||k.length===0&&_.size===0,onClick:()=>k.length?h(!0):A(),children:p?a.jsx(st,{className:"h-4 w-4 animate-spin"}):a.jsxs(a.Fragment,{children:[a.jsx(_o,{className:"mr-2 h-4 w-4"}),"Apagar ",fr(k.length)," ",r]})})]}),a.jsx(d_,{open:f,onOpenChange:h,children:a.jsxs(Nh,{className:"z-[70]",children:[a.jsxs(Ph,{children:[a.jsxs(Th,{children:["Apagar ",fr(k.length),"?"]}),a.jsxs(Ih,{children:[k.map(T=>T.profile_name||T.instance_name).join(", "),". Isso não pode ser desfeito: a conexão é desligada e, para usar de novo, será preciso conectar outra vez. O histórico de conversas continua salvo."]})]}),a.jsxs(Ah,{children:[a.jsx(f_,{children:"Cancelar"}),a.jsx(Mh,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:A,children:"Apagar e continuar"})]})]})})]})}function MO(e,t){return Number(t==="quarterly"?e.price_brl_quarterly??0:t==="yearly"?e.price_brl_yearly??0:e.price_brl??0)}function RO(e){return e==="quarterly"||e==="yearly"?e:"monthly"}const DO=e=>new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(e),OO={monthly:"/mês",quarterly:"/trimestre",yearly:"/ano"},dx=e=>e==="basic"?"Basic":"Pro";function LO({open:e,onOpenChange:t}){const{subscription:n,currentPlan:r,refresh:s}=Xr(),{effectiveUserId:o}=ti(),[i,l]=m.useState("choose"),[c,d]=m.useState(null),[u,f]=m.useState(null),h=RO(n==null?void 0:n.billing_period),[p,y]=m.useState(h),g=m.useMemo(()=>{const _=n==null?void 0:n.plan_id;if(!_||_==="free")return null;const C=Ko(_);return C?{planId:_,family:C.family,limit:C.connections,period:h,label:`${dx(C.family)} · ${fr(C.connections)}`}:!r||!(Number(r.price_brl)>0)?null:{planId:_,family:null,limit:r.max_instances,period:h,label:`${r.name} · ${fr(r.max_instances)}`,instanceCount:r.max_instances}},[n==null?void 0:n.plan_id,r,h]),x=g?g.family?Nf(g.family,g.limit,h)/100:MO(r,h):0,[v,b]=m.useState(null);m.useEffect(()=>{if(!e){l("choose"),d(null),b(null);return}y(h),g||l("downgrade"),Nu(o).then(_=>b(_.filter(Lh).length)).catch(()=>b(null))},[e]);const w=_=>{if(d(_),!_.family){f(_);return}l("remove")};return a.jsxs(a.Fragment,{children:[a.jsx(cn,{open:e&&!u,onOpenChange:t,children:a.jsxs(Qt,{className:"max-w-[95vw] sm:max-w-3xl max-h-[92vh] overflow-y-auto z-[60]",children:[i==="choose"&&g&&a.jsxs(a.Fragment,{children:[a.jsxs(qt,{children:[a.jsx(Gt,{children:"Regularizar plano"}),a.jsx(En,{children:"Pague o seu plano atual para liberar o acesso, ou troque para um plano menor."})]}),a.jsxs("div",{className:"rounded-xl border-2 border-orange-500 bg-orange-500/5 p-5",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Seu plano"}),a.jsx("p",{className:"text-lg font-semibold",children:g.label}),a.jsxs("p",{className:"mt-2 text-3xl font-bold tracking-tight",children:[DO(x),a.jsx("span",{className:"ml-1 text-sm font-normal text-muted-foreground",children:OO[h]})]}),a.jsxs(pe,{size:"lg",className:"mt-4 w-full bg-orange-500 text-white hover:bg-orange-600",onClick:()=>w(g),children:[a.jsx(Aa,{className:"mr-2 h-4 w-4"}),"Pagar agora e regularizar"]})]}),a.jsxs("div",{className:"rounded-xl border p-5",children:[a.jsx("p",{className:"font-medium",children:"Não quer pagar esse valor?"}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Troque para um plano Basic ou Pro com menos conexões. Se tiver mais conexões do que o novo plano comporta, você escolhe quais apagar antes de pagar."}),a.jsxs(pe,{variant:"outline",className:"mt-4 w-full",onClick:()=>l("downgrade"),children:[a.jsx(NC,{className:"mr-2 h-4 w-4"}),"Fazer downgrade"]})]})]}),i==="downgrade"&&a.jsxs(a.Fragment,{children:[a.jsxs(qt,{children:[a.jsx(Gt,{children:g?"Escolha o novo plano":"Regularizar plano"}),a.jsx(En,{children:v!=null?`Você tem ${fr(v)} hoje (bots Telegram não ocupam vaga).`:"Carregando suas conexões…"})]}),g&&a.jsxs(pe,{variant:"ghost",size:"sm",className:"w-fit",onClick:()=>l("choose"),children:[a.jsx(ks,{className:"mr-1 h-4 w-4"}),"Voltar"]}),a.jsx(Bb,{initialConnections:Math.max(1,Math.min(20,(g==null?void 0:g.limit)??1)-1),period:p,onPeriodChange:y,compact:!1,eligible:(_,C,N)=>!g||g.planId!==Jp(_,C)||N!==h,onChoose:(_,C,N)=>
473w({planId:Jp(_,C),family:_,limit:C,period:N,label:`${dx(_)} · ${fr(C)}`})})]}),i==="remove"&&(c==null?void 0:c.family)&&a.jsx(IO,{family:c.family,limit:c.limit,label:c.label,continueLabel:"e ir para o pagamento",onBack:()=>l("downgrade"),onReady:()=>{s().catch(()=>{}),f(c)}})]})}),u&&a.jsx(pr,{open:!0,onOpenChange:_=>{_||(f(null),l(g?"choose":"downgrade"))},hideFreePlan:!0,mode:"regularize",preselectedPlanId:u.planId,preselectedBillingPeriod:u.period,preselectedInstanceCount:u.instanceCount,onPaymentSuccess:()=>t(!1)})]})}const ux={payment_failure:{icon:a.jsx(Aa,{className:"h-12 w-12 text-destructive mx-auto"}),title:"Pagamento Não Identificado",description:"Não conseguimos confirmar o pagamento da sua assinatura e o acesso foi suspenso. Para reativar a plataforma e recriar suas instâncias, regularize agora escolhendo um plano."},cancel_expiry:{icon:a.jsx(MC,{className:"h-12 w-12 text-destructive mx-auto"}),title:"Assinatura Encerrada",description:"Você cancelou sua assinatura e o período contratado terminou. Para voltar a usar a plataforma e recriar suas instâncias, assine um plano."},refund:{icon:a.jsx(pj,{className:"h-12 w-12 text-destructive mx-auto"}),title:"Assinatura Reembolsada",description:"Sua assinatura foi reembolsada e o acesso foi suspenso. Para voltar a usar a plataforma, assine um plano."},chargeback:{icon:a.jsx(Yi,{className:"h-12 w-12 text-destructive mx-auto"}),title:"Acesso Suspenso por Chargeback",description:"Identificamos um chargeback na sua última cobrança e o acesso foi suspenso. Para regularizar e voltar a usar a plataforma, fale com o suporte."},admin:{icon:a.jsx(Yi,{className:"h-12 w-12 text-destructive mx-auto"}),title:"Acesso Suspenso",description:"Seu acesso foi suspenso. Assine um plano ou fale com o suporte para regularizar."}},Us=({status:e,gracePeriodEnd:t,hasAvulsaInstances:n=!1,isCreditSlotExpiry:r=!1,suspensionReason:s=null})=>{const[o,i]=m.useState(!1),[l,c]=m.useState(!1),{signOut:d}=at(),u=e==="blocked";if(m.useEffect(()=>{var w;if(u)return window.__zdEnforcementActive=!0,(w=window.__zdApplySupport)==null||w.call(window),()=>{var _;window.__zdEnforcementActive=!1,(_=window.__zdApplySupport)==null||_.call(window)}},[u]),!u&&l)return null;const f=()=>{if(!t)return"";const w=new Date,_=t.getTime()-w.getTime();if(_<=0)return"expirado";const C=Math.floor(_/(1e3*60*60*24)),N=Math.floor(_%(1e3*60*60*24)/(1e3*60*60));return C>0?`${C} dia${C>1?"s":""} e ${N}h`:`${N} hora${N>1?"s":""}`},h=u?s&&ux[s]?s:"admin":null,p=()=>{if(r)return{icon:u?a.jsx(Yi,{className:"h-12 w-12 text-destructive mx-auto"}):a.jsx(Jn,{className:"h-12 w-12 text-amber-500 mx-auto"}),title:u?"Instâncias Expiradas":"Instâncias Expirando",description:u?"Suas instâncias avulsas expiraram e o prazo de carência terminou. Assine um plano para criar e manter instâncias.":a.jsxs(a.Fragment,{children:["Suas instâncias avulsas estão expirando! Você tem"," ",a.jsx("span",{className:"font-semibold text-foreground",children:f()})," ","para assinar um plano antes que sejam apagadas."]})};if(u&&h){const w=ux[h];return{icon:w.icon,title:w.title,description:w.description}}return{icon:a.jsx(Jn,{className:"h-12 w-12 text-amber-500 mx-auto"}),title:"Atenção — Plano Expirando",description:a.jsxs(a.Fragment,{children:["Seu pagamento falhou ou sua assinatura foi cancelada. Você tem"," ",a.jsx("span",{className:"font-semibold text-foreground",children:f()})," ","para regularizar antes que o acesso seja bloqueado."]})}},{icon:y,title:g,description:x}=p(),b=u&&!(u&&(h==="refund"||h==="cancel_expiry")&&n);return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-40 bg-black/80","aria-hidden":"true",style:{pointerEvents:b?"auto":"none"}}),a.jsx(cn,{open:!0,modal:!1,children:a.jsxs(Qt,{className:"max-w-md z-50 [&>button]:hidden",onPointerDownOutside:w=>{b&&w.preventDefault()},onEscapeKeyDown:w=>{b&&w.preventDefault()},onInteractOutside:w=>{b&&w.preventDefault()},children:[a.jsxs(qt,{className:"text-center items-center gap-2",children:[y,a.jsx(Gt,{className:"text-xl",children:g}),a.jsx(En,{className:"text-center",children:x})]}),a.jsxs("div",{className:"flex flex-col gap-3 mt-4",children:[h!=="chargeback"&&a.jsx(pe,{onClick:()=>i(!0),className:"w-full",size:"lg",children:r?"Recarregar / Assinar Plano":"Regularizar plano"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(pe,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>{const w=window.$crisp;w&&w.push&&(w.push(["do","chat:show"]),w.push(["do","chat:open"]))},children:[a.jsx(JC,{className:"h-4 w-4 mr-1"}),"Falar com Suporte"]}),a.jsxs(pe,{variant:"ghost",size:"sm",className:"flex-1 text-muted-foreground",onClick:()=>d(),children:[a.jsx(qu,{className:"h-4 w-4 mr-1"}),"Sair da Conta"]})]}),!b&&a.jsxs(a.Fragment,{children:[a.jsx(pe,{variant:"ghost",size:"sm",onClick:()=>c(!0),className:"text-muted-foreground",children:"Fechar por agora"}),!u&&a.jsxs("div",{className:"flex items-center justify-center gap-2 text-xs text-muted-foreground",children:[a.jsx($C,{className:"h-3.5 w-3.5"}),a.jsx("span",{children:"Após o prazo, suas instâncias do plano serão apagadas"})]})]})]})]})}),r?a.jsx(pr,{open:o,onOpenChange:i,hideFreePlan:!0,mode:"regularize"}):a.jsx(LO,{open:o,onOpenChange:i})]})},FO=({userId:e,maxInstances:t,onResolved:n})=>{const{t:r}=Qe("billing"),{subscription:s}=Xr(),o=!!Ko(s==null?void 0:s.plan_id),i=o?"billing_resolve_connection_overage":"resolve_downgrade_overage",l=Rt(),[c,d]=m.useState([]),[u,f]=m.useState(new Set),[h,p]=m.useState(!0),[y,g]=m.useState(!1),[x,v]=m.useState(!1);m.useEffect(()=>{let C=!0;return(async()=>{v(!1);let N=he.from("maturador_instances").select("id, instance_name, phone_number, profile_name").eq("user_id",e).is("deleti
473on_requested_at",null).order("created_at",{ascending:!0});N=o?N.is("archived_at",null).or("api_provider.is.null,api_provider.neq.telegram_direct"):N.in("status",["connected","open"]);const{data:k,error:P}=await N;if(P){C&&(v(!0),p(!1));return}const A=k??[];if(C&&A.length<=t)try{const{data:T,error:D}=await he.rpc(i,{p_keep_instance_ids:A.map(E=>E.id)});if(D||!(T!=null&&T.ok))throw D||new Error("resolution_failed");if(window.dispatchEvent(new Event("subscription-changed")),C){n();return}}catch{}C&&(d(A),p(!1))})(),()=>{C=!1}},[e,t,o,i]);const b=C=>{f(N=>{const k=new Set(N);return k.has(C)?k.delete(C):k.size<t&&k.add(C),k})},w=C=>C.instance_name||C.profile_name||C.phone_number||C.id.slice(0,8),_=async()=>{g(!0);try{const{data:C,error:N}=await he.rpc(i,{p_keep_instance_ids:Array.from(u)});if(N)throw N;if(C&&C.ok===!1)throw new Error(C.error==="too_many_kept"?r("downgradeOverageModal.errors.tooManyKept",{count:t}):r("downgradeOverageModal.errors.couldNotComplete"));Xe({title:r("downgradeOverageModal.readyTitle"),description:r("downgradeOverageModal.readyDescription")}),window.dispatchEvent(new Event("subscription-changed")),n()}catch(C){Xe({title:r("downgradeOverageModal.errors.genericTitle"),description:(C==null?void 0:C.message)||r("downgradeOverageModal.errors.tryAgain"),variant:"destructive"})}finally{g(!1)}};return a.jsx(cn,{open:!0,modal:!0,children:a.jsxs(Qt,{className:"max-w-md [&>button]:hidden",onPointerDownOutside:C=>C.preventDefault(),onEscapeKeyDown:C=>C.preventDefault(),onInteractOutside:C=>C.preventDefault(),children:[a.jsxs(qt,{className:"text-center items-center gap-2",children:[a.jsx(Jn,{className:"h-12 w-12 text-amber-500 mx-auto"}),a.jsx(Gt,{className:"text-xl",children:r("downgradeOverageModal.title")}),a.jsxs(En,{className:"text-center",children:[r("downgradeOverageModal.descriptionPrefix")," ",a.jsx("strong",{children:t})," ",r("downgradeOverageModal.descriptionSuffix",{count:t})]})]}),x&&a.jsx("p",{role:"alert",className:"text-sm text-destructive",children:"Não foi possível carregar suas conexões. Atualize a página para tentar novamente."}),h?a.jsx("div",{className:"flex justify-center py-6",children:a.jsx(st,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):a.jsx("div",{className:"space-y-2 max-h-64 overflow-y-auto py-2",children:c.map(C=>{const N=u.has(C.id),k=!N&&u.size>=t;return a.jsxs("label",{className:`flex items-center gap-3 rounded-md border p-3 cursor-pointer ${N?"border-primary bg-primary/5":"border-border"} ${k?"opacity-50 cursor-not-allowed":""}`,children:[a.jsx(qr,{checked:N,disabled:k,onCheckedChange:()=>b(C.id)}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-sm font-medium truncate",children:w(C)}),C.phone_number&&a.jsx("p",{className:"text-xs text-muted-foreground truncate",children:C.phone_number})]})]},C.id)})}),a.jsx("p",{className:"text-xs text-center text-muted-foreground",children:r("downgradeOverageModal.selectedCount",{selected:u.size,max:t})}),a.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[a.jsxs(pe,{onClick:_,disabled:y||h||x,className:"w-full",size:"lg",children:[y?a.jsx(st,{className:"h-4 w-4 animate-spin mr-2"}):null,r("downgradeOverageModal.keepSelectedButton")]}),a.jsxs(pe,{variant:"outline",className:"w-full gap-2",onClick:()=>l("/subscription"),children:[a.jsx(PC,{className:"h-4 w-4"}),r("downgradeOverageModal.backToLargerPlan")]})]})]})})},zO=()=>{const{user:e}=at(),[t,n]=m.useState([]),[r,s]=m.useState(!0),o=m.useCallback(async()=>{if(!e){n([]),s(!1);return}s(!0);try{const l=new Date(Date.now()-864e5).toISOString(),{data:c,error:d}=await he.from("system_notifications").select("*").eq("user_id",e.id).is("dismissed_at",null).gte("created_at",l).order("created_at",{ascending:!1});if(d)throw d;n(c||[])}catch(l){console.error("[useSystemNotifications] fetch error",l),n([])}finally{s(!1)}},[e]);m.useEffect(()=>{o()},[o]);const i=m.useCallback(async l=>{n(c=>c.filter(d=>d.id!==l));try{await he.from("system_notifications").update({dismissed_at:new Date().toISOString()}).eq("id",l)}catch(c){console.error("[useSystemNotifications] dismiss error",c),o()}},[o]);
473return{notifications:t,loading:r,refresh:o,dismiss:i}},w_=56,fx={warning:{container:"border-amber-500/40 bg-amber-500/10 text-amber-100",icon:Jn},info:{container:"border-sky-500/40 bg-sky-500/10 text-sky-100",icon:Hu},success:{container:"border-emerald-500/40 bg-emerald-500/10 text-emerald-100",icon:Vo}},BO=({notification:e,onDismiss:t})=>{const{t:n}=Qe(["notifications","common"]),r=fx[e.type]??fx.info,s=r.icon;return a.jsx("div",{className:xe("relative border-b backdrop-blur-md px-4 sm:px-6",r.container),style:{height:`${w_}px`},role:"alert",children:a.jsxs("div",{className:"mx-auto flex h-full max-w-6xl items-center gap-3 pr-8",children:[a.jsx(s,{className:"h-5 w-5 flex-shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0 flex flex-col sm:flex-row sm:items-center sm:gap-3",children:[a.jsx("h4",{className:"font-semibold text-sm leading-tight flex-shrink-0",children:e.title}),a.jsx("p",{className:"text-xs leading-snug opacity-90 line-clamp-2 sm:line-clamp-1",children:e.body})]}),e.action_url&&e.action_label&&a.jsx(pe,{asChild:!0,size:"sm",variant:"outline",className:"h-7 text-xs bg-background/20 border-current hover:bg-background/40 flex-shrink-0",children:a.jsx(_a,{to:e.action_url,children:e.action_label})}),a.jsx("button",{onClick:()=>t(e.id),className:"absolute right-3 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-background/20 transition-colors","aria-label":n("banner.dismiss"),children:a.jsx(sr,{className:"h-4 w-4"})})]})})},VO=()=>{const{notifications:e,dismiss:t}=zO(),n=e.length;return m.useEffect(()=>(n>0?(document.body.setAttribute("data-system-banner",String(n)),document.body.style.setProperty("--system-banner-height",`${w_*n}px`)):(document.body.removeAttribute("data-system-banner"),document.body.style.removeProperty("--system-banner-height")),()=>{document.body.removeAttribute("data-system-banner"),document.body.style.removeProperty("--system-banner-height")}),[n]),n?a.jsx("div",{className:"fixed top-0 left-0 right-0 z-[60] flex flex-col max-h-[40vh] overflow-y-auto",children:e.map(r=>a.jsx(BO,{notification:r,onDismiss:t},r.id))}):null},$O=4e3,UO=10*60*1e3,hx="upgrade_reauth_dismissed_v1";function WO(e){const[t,n,r]=(e||"").split("-");return r?`${r}/${n}/${t}`:e}function HO(e){return e.replace(/\D/g,"").slice(0,11).replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d{1,2})$/,"$1-$2")}function px({mode:e="upgrade",open:t,onOpenChange:n,onChangePlan:r}={}){const{user:s}=at(),{subscription:o,refresh:i}=Al(),l=t!==void 0,[c,d]=m.useState(!1),u=l?t:c,f=I=>l?n==null?void 0:n(I):d(I),[h,p]=m.useState("idle"),[y,g]=m.useState(""),[x,v]=m.useState(""),[b,w]=m.useState(null),[_,C]=m.useState(0),[N,k]=m.useState(!1),P=m.useRef(!1),A=o,T=!!A&&A.gateway==="efi"&&A.payment_method==="pix_automatico"&&A.status==="active"&&A.efi_authorized===!1&&!!A.current_period_end&&new Date(A.current_period_end)>new Date;m.useEffect(()=>{if(!l){if(!T){f(!1);return}Mt.getItem(hx)!=="1"&&f(!0)}},[T]);const D=m.useCallback(async I=>{k(!0),p("loading");try{const{data:S,error:L}=await he.functions.invoke("efi-reauth-recurrence",{body:I??{}});if(L||!(S!=null&&S.ok)){const Y=S==null?void 0:S.error;if(S!=null&&S.alreadyAuthorized){p("done"),setTimeout(()=>{i(),f(!1)},1200);return}if(Y==="CPF_REQUIRED"||Y==="NAME_REQUIRED"){p("form");return}Xe({title:"Erro ao gerar re-autorização",description:(S==null?void 0:S.message)||(L==null?void 0:L.message)||"Tente novamente.",variant:"destructive"}),p("form");return}w({idRec:S.idRec,pixCopiaECola:S.pixCopiaECola,valorRec:S.valorRec,scheduledFor:S.scheduledFor}),C(Date.now()),p("qr")}catch(S){Xe({title:(S==null?void 0:S.message)||"Erro inesperado",variant:"destructive"}),p("form")}finally{k(!1)}},[i]);m.useEffect(()=>{u&&h==="idle"&&!P.current&&(P.current=!0,D()),u||(P.current=!1)},[u,h,D]),m.useEffect(()=>{if(h!=="qr"||!b||!s)return;const I=setInterval(async()=>{if(Date.now()-_>UO){clearInterval(I),Xe({title:"Tempo esgotado",description:"Gere um novo QR para tentar de novo.",variant:"destructive"}),p("form");return}try{const{data:S}=await he.functions.invoke("efi-check-reauth-status",{body:{recId:b.idRec}});S!=null&&S.authorized?(clearInterval(I),p("done"),Xe({title:"Recorrência autorizada!",description:"Sua renovação está garantida."}),setTimeout(()=>{i(),f(!1)},1500)):S!=null&&S.rejected&&(clearInterval(I),Xe({title:"Autorização recusada no banco",description:"Gere um novo QR ou use outro banco.",variant:"destructive"}),p("form"))}catch{}},$O);return()=>clearInterval(I)},[h,b,_,s,i]);const E=()=>{l||Mt.setItem(hx,"1"),f(!1)};return T?a.jsx(cn,{open:u,onOpenChange:I=>{I||E()},children:a.jsxs(Qt,{className:"sm:max-w-md",children:[a.jsxs(qt,{children:[a.jsxs(Gt,{className:"flex items-center gap-2",children:[a.jsx(Yi,{className:"h-5 w-5 text-amber-500"}),e==="renew"?"Renovar seu plano":"Autorize a renovação do seu plano"]}),a.jsx(En,{children:e==="renew"?a.jsxs(a.Fragment,{children:["O débito automático do seu plano foi cancelado no banco. Autorize de novo para continuar no mesmo plano. ",a.jsx("strong",{children:"Você não paga na
473da agora"}),": o período que você já pagou continua valendo."]}):a.jsxs(a.Fragment,{children:["Seu upgrade foi pago, mas a autorização do débito automático do ",a.jsx("strong",{children:"próximo mês"})," não foi aprovada pelo banco. ",a.jsx("strong",{children:"Você não paga nada agora"})," — só autoriza a cobrança do próximo ciclo."]})})]}),e==="renew"&&r&&h!=="done"&&a.jsx(pe,{variant:"outline",size:"sm",className:"w-full",onClick:()=>{f(!1),r()},children:"Quero trocar de plano"}),h==="loading"&&a.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[a.jsx(st,{className:"h-8 w-8 animate-spin text-amber-500"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Gerando QR de autorização..."})]}),h==="done"&&a.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[a.jsx(Vo,{className:"h-16 w-16 text-emerald-500"}),a.jsx("p",{className:"text-lg font-semibold text-emerald-500",children:"Renovação autorizada!"})]}),h==="qr"&&b&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"rounded-lg border border-amber-500/40 bg-amber-500/5 p-3 text-sm space-y-1",children:[a.jsxs("p",{className:"font-medium text-amber-600 flex items-center gap-1.5",children:[a.jsx(IC,{className:"h-4 w-4"})," Você não será cobrado agora"]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["A próxima cobrança de ",a.jsxs("strong",{children:["R$ ",Number(b.valorRec).toFixed(2)]})," acontece automaticamente em ",a.jsx("strong",{children:WO(b.scheduledFor)}),". Escaneie para autorizar o débito no app do seu banco."]})]}),a.jsx("div",{className:"flex justify-center",children:a.jsx("div",{className:"bg-white p-4 rounded-lg",children:a.jsx(jh,{value:b.pixCopiaECola,size:208,level:"H",imageSettings:{src:o1,height:44,width:44,excavate:!0}})})}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"Ou copie o código PIX:"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(et,{value:b.pixCopiaECola,readOnly:!0,className:"font-mono text-xs"}),a.jsx(pe,{variant:"outline",size:"icon",onClick:()=>{navigator.clipboard.writeText(b.pixCopiaECola),Xe({title:"Código copiado!"})},children:a.jsx(Fv,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground justify-center",children:[a.jsx(st,{className:"h-4 w-4 animate-spin"})," Aguardando autorização no app do seu banco..."]}),a.jsx(pe,{variant:"ghost",className:"w-full text-xs text-muted-foreground",onClick:E,children:"Fazer isso depois"})]}),h==="form"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(Be,{children:"Nome completo do titular"}),a.jsx(et,{value:x,onChange:I=>v(I.target.value),placeholder:"Como aparece no banco",maxLength:120})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Be,{children:"CPF do titular"}),a.jsx(et,{value:y,onChange:I=>g(HO(I.target.value)),placeholder:"000.000.000-00",inputMode:"numeric",maxLength:14})]}),a.jsx(pe,{className:"w-full bg-amber-600 hover:bg-amber-700 text-white h-11",disabled:N,onClick:()=>{const I=y.replace(/\D/g,"");if(I.length!==11){Xe({title:"CPF inválido",variant:"destructive"});return}if(x.trim().length<3){Xe({title:"Nome inválido",variant:"destructive"});return}D({cpf:I,fullName:x.trim()})},children:N?a.jsxs(a.Fragment,{children:[a.jsx(st,{className:"h-4 w-4 mr-2 animate-spin"})," Gerando..."]}):"Gerar QR de autorização"}),a.jsx(pe,{variant:"ghost",className:"w-full text-xs text-muted-foreground",onClick:E,children:"Fazer isso depois"})]})]})}):null}const qO=["/track-ofertas","/transcricao-audio"];function yo(e){return e?qO.some(t=>e===t||e.startsWith(t+"/")):!1}const __=()=>{const{isAdmin:e,isSupport:t,hasAdminAccess:n,loading:r}=jf();return{isAdmin:e,isSupport:t,hasAdminAccess:n,canEditWallets:e,canEditAffiliates:e,canManageUsersFully:e||t,loading:r}},GO=["acesso","expansao","ascensao","dominacao","titan","enterprise","custom"],KO=["free","iniciante"];function aU(e){var n;if(e.isAdmin)return!0;const t=((n=e.subscription)==null?void 0:n.plan_id)??null;return t&&KO.includes(t)||!t||!GO.includes(t)?!1:S_(e.subscription)}function S_(e){if(!e)return!1;const t=e.status??"";return!!(t==="active"||t==="trialing"||!!e.current_period_end&&new Date(e.current_period_end).getTime()>Date.now()&&(t==="authorized_pending_charge"||t==="pending_authorization")||e.grace_peri
473od_end&&new Date(e.grace_period_end).getTime()>Date.now())}function C_(e){return!e.isCollaborator}const Jc=768;function j_(){const[e,t]=m.useState(void 0);return m.useEffect(()=>{const n=window.matchMedia(`(max-width: ${Jc-1}px)`),r=()=>{t(window.innerWidth<Jc)};return n.addEventListener("change",r),t(window.innerWidth<Jc),()=>n.removeEventListener("change",r)},[]),!!e}const pl="/_releases/admin/assets/zapdata-logo-X4vvddIU.png";function zt(e){const t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function YO(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}const oU=6048e5,iU=864e5,lU=6e4,cU=36e5,ki=43200,mx=1440;let XO={};function ZO(){return XO}function gx(e){const t=zt(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function Ui(e,t){const n=zt(e),r=zt(t),s=n.getTime()-r.getTime();return s<0?-1:s>0?1:s}function QO(e){return YO(e,Date.now())}function JO(e,t){const n=zt(e),r=zt(t),s=n.getFullYear()-r.getFullYear(),o=n.getMonth()-r.getMonth();return s*12+o}function eL(e){return t=>{const r=(e?Math[e]:Math.trunc)(t);return r===0?0:r}}function tL(e,t){return+zt(e)-+zt(t)}function nL(e){const t=zt(e);return t.setHours(23,59,59,999),t}function rL(e){const t=zt(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function sL(e){const t=zt(e);return+nL(t)==+rL(t)}function aL(e,t){const n=zt(e),r=zt(t),s=Ui(n,r),o=Math.abs(JO(n,r));let i;if(o<1)i=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-s*o);let l=Ui(n,r)===-s;sL(zt(e))&&o===1&&Ui(e,r)===1&&(l=!1),i=s*(o-Number(l))}return i===0?0:i}function oL(e,t,n){const r=tL(e,t)/1e3;return eL(n==null?void 0:n.roundingMethod)(r)}const iL={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},lL=(e,t,n)=>{let r;const s=iL[e];return typeof s=="string"?r=s:t===1?r=s.one:r=s.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function la(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const cL={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},dL={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},uL={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},fL={date:la({formats:cL,defaultWidth:"full"}),time:la({formats:dL,defaultWidth:"full"}),dateTime:la({formats:uL,defaultWidth:"full"})},hL={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},pL=(e,t,n,r)=>hL[e];function Xn(e){return(t,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let s;if(r==="formatting"&&e.formattingValues){const i=e.defaultFormattingWidth||e.defaultWidth,l=n!=null&&n.width?String(n.width):i;s=e.formattingValues[l]||e.formattingValues[i]}else{const i=e.defaultWidth,l=n!=null&&n.width?String(n.width):e.defaultWidth;s=e.values[l]||e.values[i]}const o=e.argumentCallback?e.argumentCallback(t):t;return s[o]}}const mL={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},gL={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},xL={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},vL={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Frid
473ay","Saturday"]},yL={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},bL={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},wL=(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},_L={ordinalNumber:wL,era:Xn({values:mL,defaultWidth:"wide"}),quarter:Xn({values:gL,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Xn({values:xL,defaultWidth:"wide"}),day:Xn({values:vL,defaultWidth:"wide"}),dayPeriod:Xn({values:yL,defaultWidth:"wide",formattingValues:bL,defaultFormattingWidth:"wide"})};function Zn(e){return(t,n={})=>{const r=n.width,s=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],o=t.match(s);if(!o)return null;const i=o[0],l=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?CL(l,f=>f.test(i)):SL(l,f=>f.test(i));let d;d=e.valueCallback?e.valueCallback(c):c,d=n.valueCallback?n.valueCallback(d):d;const u=t.slice(i.length);return{value:d,rest:u}}}function SL(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function CL(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function k_(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const s=r[0],o=t.match(e.parsePattern);if(!o)return null;let i=e.valueCallback?e.valueCallback(o[0]):o[0];i=n.valueCallback?n.valueCallback(i):i;const l=t.slice(s.length);return{value:i,rest:l}}}const jL=/^(\d+)(th|st|nd|rd)?/i,kL=/\d+/i,EL={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},NL={any:[/^b/i,/^(a|c)/i]},PL={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},AL={any:[/1/i,/2/i,/3/i,/4/i]},TL={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},IL={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},ML={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},RL={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},DL={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},OL={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},LL={ordinalNumber:k_({matchPattern:jL,parsePattern:kL,valueCallback:e=>parseInt(e,10)}),era:Zn({matchPatterns:EL,defaultMatchWidth:"wide",parsePatterns:NL,defaultParseWidth:"any"}),quarter:Zn({matchPatterns:PL,defaultMatchWidth:"wide",parsePatterns:AL,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Zn({matchPatterns:TL,defaultMatchWidth:"wide",parsePatterns:IL,defaultParseWidth:"any"}),day:Zn({matchPatterns:ML,defaultMatchWidth:"wide",parsePatterns:RL,defaultParseWidth:"any"}),dayPeriod:Zn({matchPatterns:DL,defaultMatchWidth:"any",parsePatterns:OL,defaultParseWidth:"any"})},FL={code:"en-US",formatDistance:lL,formatLong:fL,formatRelative:pL,localize:_L,match:LL,options:{weekStartsOn:0,firstWeekContainsDate:1}};function zL(e,t,n){const r=ZO(),s=(n==null?void 0:n.locale)??r.locale??FL,o=2520,i=Ui(e,t);if(isNaN(i))throw new RangeError("Invalid time value");const l=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:i});let c,d;i>0?(c=zt(t),d=zt(e)):(c=zt(e),d=zt(t));const u=oL(d,c),f=(gx(d)-gx(c))/1e3,h=Math.round((u-f)/60);let p;if(h<2)return n!=null&&n.includeSeconds?u<5?s.formatDistance("lessThanXSeconds",5,l):u<10?s.formatDistance("lessThanXSeconds",10,l):u<20?s.formatDistance("lessThanXSeconds",20,l):u<40?s.formatDistance("halfAMinute",0,l):u<60?s.formatDistance("lessThanXMinutes",1,l):s.formatDistance("xMinutes",1,l):h===0?s.formatDistance("lessThanXMinutes",1,l):s.formatDistance("xMinutes",h,l);if(h<45)return s.formatDistance("xMinutes",h,l);if(h<90)return s.formatDistance("aboutXHours",1,l);if(h<mx){const y=Math.round(h/60);return s.formatDistance("aboutXHours",y,l)}else{if(h<o)return s.formatDistance("xDays",1,l);if(h<ki){const y=Math.round(h/mx);return s.formatDistance("xDays",y,l)}else if(h<ki*2)return p=Math.round(h/ki),s.formatDistance("aboutXMonths",p,l)}if(p=aL(d,c),p<12){const y=Math.round(h/ki);return s.formatDistance("xMonths",y,l)}else{const y=p%12,g=Math.trunc(p/12);return y<3?s.formatDistance("aboutXYears",g,l):y<9?s.formatDistance("overXYears",g,l):s.formatDistance("almostXYears",g+1,l)}}function BL(e,t){return zL(e,QO(e),t)}const VL={lessThanXSeconds:{one:"menos de um segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"meio minuto",lessThanXMinutes:{one:"menos de um minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"cerca de 1 hora",other:"cerca de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 dia",other:"{{count}} dias"},aboutXWeeks:{one:"cerca de 1 semana",other:"cerca de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"cerca de 1 mês",other:"cerca de {{count}} meses"},xMonths:{one:"1 mês",other:"{{count}} meses"},aboutXYears:{one:"cerca de 1 ano",other:"cerca de {{count}} anos"},xYears:{one:"1 ano",other:"{{count}} anos"},overXYears:{one:"mais de 1 ano",other:"mais de {{count}} anos"},almostXYears:{one:"quase 1 ano",other:"quase {{count}} anos"}},$L=(e,t,n)=>{let r;const s=VL[e];return typeof s=="string"?r=s:t===1?r=s.one:r=s.other.replace("{{count}}",String(t)),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"em "+r:"há "+r:r},UL={full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/yyyy"},WL={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},HL={full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},qL={date:la({formats:UL,defaultWidth:"full"}),time:la({formats:WL,defaultWidth:"full"}),dateTime:la({formats:HL,defaultWidth:"full"})},GL={lastWeek:e=>{const t=e.getDay();return"'"+(t===0||t===6?"último":"última")+"' eeee 'às' p"},yesterday:"'ontem às' p",today:"'hoje às' p",tomorrow:"'amanhã às' p",nextWeek:"eeee 'às' p",other:"P"},KL=(e,t,n,r)=>{const s=GL[e];return typeof s=="function"?s(t):s},YL={narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","depois de cristo"]},XL={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},ZL={narrow:["j","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["jan","fev","mar","abr","mai","jun","jul","ago","set","out","nov","dez"],wide:["janeiro","fevereiro","març
473o","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"]},QL={narrow:["D","S","T","Q","Q","S","S"],short:["dom","seg","ter","qua","qui","sex","sab"],abbreviated:["domingo","segunda","terça","quarta","quinta","sexta","sábado"],wide:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"]},JL={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"}},eF={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"}},tF=(e,t)=>{const n=Number(e);return(t==null?void 0:t.unit)==="week"?n+"ª":n+"º"},nF={ordinalNumber:tF,era:Xn({values:YL,defaultWidth:"wide"}),quarter:Xn({values:XL,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Xn({values:ZL,defaultWidth:"wide"}),day:Xn({values:QL,defaultWidth:"wide"}),dayPeriod:Xn({values:JL,defaultWidth:"wide",formattingValues:eF,defaultFormattingWidth:"wide"})},rF=/^(\d+)[ºªo]?/i,sF=/\d+/i,aF={narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|d\.?\s?c\.?)/i,wide:/^(antes de cristo|depois de cristo)/i},oF={any:[/^ac/i,/^dc/i],wide:[/^antes de cristo/i,/^depois de cristo/i]},iF={narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},lF={any:[/1/i,/2/i,/3/i,/4/i]},cF={narrow:/^[jfmajsond]/i,abbreviated:/^(jan|fev|mar|abr|mai|jun|jul|ago|set|out|nov|dez)/i,wide:/^(janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro)/i},dF={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^fev/i,/^mar/i,/^abr/i,/^mai/i,/^jun/i,/^jul/i,/^ago/i,/^set/i,/^out/i,/^nov/i,/^dez/i]},uF={narrow:/^(dom|[23456]ª?|s[aá]b)/i,short:/^(dom|[23456]ª?|s[aá]b)/i,abbreviated:/^(dom|seg|ter|qua|qui|sex|s[aá]b)/i,wide:/^(domingo|(segunda|ter[cç]a|quarta|quinta|sexta)([- ]feira)?|s[aá]bado)/i},fF={short:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],narrow:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],any:[/^d/i,/^seg/i,/^t/i,/^qua/i,/^qui/i,/^sex/i,/^s[aá]b/i]},hF={narrow:/^(a|p|mn|md|(da) (manhã|tarde|noite))/i,any:/^([ap]\.?\s?m\.?|meia[-\s]noite|meio[-\s]dia|(d
473a) (manhã|tarde|noite))/i},pF={any:{am:/^a/i,pm:/^p/i,midnight:/^mn|^meia[-\s]noite/i,noon:/^md|^meio[-\s]dia/i,morning:/manhã/i,afternoon:/tarde/i,evening:/tarde/i,night:/noite/i}},mF={ordinalNumber:k_({matchPattern:rF,parsePattern:sF,valueCallback:e=>parseInt(e,10)}),era:Zn({matchPatterns:aF,defaultMatchWidth:"wide",parsePatterns:oF,defaultParseWidth:"any"}),quarter:Zn({matchPatterns:iF,defaultMatchWidth:"wide",parsePatterns:lF,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Zn({matchPatterns:cF,defaultMatchWidth:"wide",parsePatterns:dF,defaultParseWidth:"any"}),day:Zn({matchPatterns:uF,defaultMatchWidth:"wide",parsePatterns:fF,defaultParseWidth:"any"}),dayPeriod:Zn({matchPatterns:hF,defaultMatchWidth:"any",parsePatterns:pF,defaultParseWidth:"any"})},gF={code:"pt-BR",formatDistance:$L,formatLong:qL,formatRelative:KL,localize:nF,match:mF,options:{weekStartsOn:0,firstWeekContainsDate:1}},Pu="notif_icon_",xF=7*24*60*60*1e3;function E_(e){try{const t=localStorage.getItem(Pu+e);if(!t)return null;const n=JSON.parse(t);return Date.now()-n.ts>xF?(localStorage.removeItem(Pu+e),null):n.dataUrl}catch{return null}}function vF(e){if(!e||E_(e))return;const t=new Image;t.crossOrigin="anonymous",t.onload=()=>{try{const n=document.createElement("canvas");n.width=t.naturalWidth,n.height=t.naturalHeight;const r=n.getContext("2d");if(!r)return;r.drawImage(t,0,0);const s=n.toDataURL("image/webp",.8);localStorage.setItem(Pu+e,JSON.stringify({dataUrl:s,ts:Date.now()}))}catch{}},t.src=e}function N_(e,t){return e?E_(e)||e:t}const yF=45e3;function bF(){const{t:e}=Qe(["notifications","common"]),{user:t}=at(),n=j_(),r=Rt(),[s,o]=m.useState([]),[i,l]=m.useState(0),[c,d]=m.useState(!1),[u,f]=m.useState(!1),h=m.useRef(null),p=m.useCallback(async()=>{if(!(t!=null&&t.id))return;const{data:v}=await he.from("desktop_notifications").select("*").eq("user_id",t.id).order("created_at",{ascending:!1}).limit(50);if(v){const b=v;o(b),l(b.filter(w=>!w.is_read).length),b.forEach(w=>{w.icon_url&&vF(w.icon_url)})}f(!0)},[t==null?void 0:t.id]);m.useEffect(()=>{p().catch(()=>{})},[p]),m.useEffect(()=>{if(!c||!(t!=null&&t.id))return;p().catch(()=>{});const v=setInterval(()=>{p().catch(()=>{})},yF);return()=>clearInterval(v)},[c,t==null?void 0:t.id,p]),m.useEffect(()=>{c&&i>0&&(t!=null&&t.id)&&he.from("desktop_notifications").update({is_read:!0}).eq("user_id",t.id).eq("is_read",!1).then(()=>{l(0),o(v=>v.map(b=>({...b,is_read:!0})))})},[c,i,t==null?void 0:t.id]),m.useEffect(()=>{if(!c)return;const v=b=>{h.current&&!h.current.contains(b.target)&&d(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[c]);const y=async v=>{await he.from("desktop_notifications").delete().eq("id",v),o(b=>b.filter(w=>w.id!==v))},g=async()=>{t!=null&&t.id&&(await he.from("desktop_notifications").delete().eq("user_id",t.id),o([]),l(0))},x=v=>{v.click_url&&(d(!1),r(v.click_url))};return n?null:a.jsxs("div",{className:"relative",ref:h,children:[a.jsxs(pe,{variant:"ghost",size:"icon",className:"h-9 w-9 text-muted-foreground hover:text-foreground relative",onClick:()=>d(v=>!v),children:[a.jsx(TC,{className:"h-4 w-4"}),i>0&&a.jsx("span",{className:"absolute -top-0.5 -right-0.5 bg-destructive text-destructive-foreground text-[10px] font-bold rounded-full min-w-[18px] h-[18px] flex items-center justify-center px-1",children:i>99?"99+":i})]}),a.jsx($l,{children:c&&a.jsxs(ht.div,{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},transition:{duration:.2,ease:"easeOut"},className:"fixed top-14 right-4 z-[9998] max-w-sm w-full",onWheel:v=>v.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-1 mb-2 gap-2",children:[a.jsx("span",{className:"text-xs font-medium px-2.5 py-1 text-foreground",children:e("center.tabs.notifications")}),s.length>0&&a.jsxs(pe,{variant:"ghost",size:"sm",onClick:g,className:"h-7 text-xs text-muted-foreground hover:text-destructive flex-shrink-0",children:[a.jsx(_o,{className:"w-3 h-3 mr-1"}),e("common:actions.clear")]})]}),a.jsx("div",{className:"max-h-[calc(100vh-120px)] overflow-y-auto pr-1 scrollbar-none",style:{overscrollBehavior:"contain"},children:u&&s.length===0?a.jsxs("div",{className:"rounded-2xl bg-[#1a1a1e] border border-white/[0.04] p-6 flex flex-col items-center gap-3 text-center",children:[a.jsx("div",{className:"w-12 h-12 rounded-full bg-white/[0.06] flex items-center justify-center",children:a.jsx(AC,{className:"w-6 h-6 text-muted-foreground"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-semibold text-foreground",children:e("center.empty.title")}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e("center.empty.description")})]}),a.jsx(pe,{size:"sm",variant:"secondary",className:"mt-1 text-xs",onClick:()=>{d(!1),r("/settings")},children:e("center.empty.enableButton")})]}):a.jsx("div",{className:"flex flex-col gap-2",children:s.map((v,b)=>a.jsx(ht.div,{initial:{opacity:0,x:60,scale:.97}
473,animate:{opacity:1,x:0,scale:1},transition:{duration:.25,delay:b*.02,ease:"easeOut"},className:"group relative",children:a.jsxs("div",{className:xe("rounded-2xl bg-[#1a1a1e] border border-white/[0.04] p-3 flex items-start gap-3",v.click_url&&"cursor-pointer hover:border-white/[0.1]"),onClick:()=>x(v),children:[a.jsx("img",{src:N_(v.icon_url,pl),alt:e("iconAlt"),className:"w-10 h-10 rounded-xl object-cover flex-shrink-0",onError:w=>{w.target.src=pl}}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("p",{className:"text-sm font-semibold text-foreground truncate",children:v.title}),(v.occurrence_count??1)>1&&a.jsxs("span",{className:"flex-shrink-0 text-[9px] font-bold px-1.5 py-0.5 rounded-full bg-amber-500/15 text-amber-400 border border-amber-500/30",children:["×",v.occurrence_count]})]}),a.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 mt-0.5",children:v.message}),a.jsx("p",{className:"text-[10px] text-muted-foreground/50 mt-1",children:BL(new Date(v.created_at),{addSuffix:!0,locale:gF})})]}),a.jsx("button",{onClick:w=>{w.stopPropagation(),y(v.id)},className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive flex-shrink-0 mt-1",children:a.jsx(_o,{className:"w-3.5 h-3.5"})})]})},v.id))})})]})})]})}function wF(){return Dv.useSyncExternalStore(_F,()=>!0,()=>!1)}function _F(){return()=>{}}var Fh="Avatar",[SF,dU]=Vn(Fh),[CF,P_]=SF(Fh),A_=m.forwardRef((e,t)=>{const{__scopeAvatar:n,...r}=e,[s,o]=m.useState("idle");return a.jsx(CF,{scope:n,imageLoadingStatus:s,onImageLoadingStatusChange:o,children:a.jsx(Ie.span,{...r,ref:t})})});A_.displayName=Fh;var T_="AvatarImage",I_=m.forwardRef((e,t)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:s=()=>{},...o}=e,i=P_(T_,n),l=jF(r,o),c=$r(d=>{s(d),i.onImageLoadingStatusChange(d)});return Pt(()=>{l!=="idle"&&c(l)},[l,c]),l==="loaded"?a.jsx(Ie.img,{...o,ref:t,src:r}):null});I_.displayName=T_;var M_="AvatarFallback",R_=m.forwardRef((e,t)=>{const{__scopeAvatar:n,delayMs:r,...s}=e,o=P_(M_,n),[i,l]=m.useState(r===void 0);return m.useEffect(()=>{if(r!==void 0){const c=window.setTimeout(()=>l(!0),r);return()=>window.clearTimeout(c)}},[r]),i&&o.imageLoadingStatus!=="loaded"?a.jsx(Ie.span,{...s,ref:t}):null});R_.displayName=M_;function xx(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function jF(e,{referrerPolicy:t,crossOrigin:n}){const r=wF(),s=m.useRef(null),o=r?(s.current||(s.current=new window.Image),s.current):null,[i,l]=m.useState(()=>xx(o,e));return Pt(()=>{l(xx(o,e))},[o,e]),Pt(()=>{const c=f=>()=>{l(f)};if(!o)return;const d=c("loaded"),u=c("error");return o.addEventListener("load",d),o.addEventListener("error",u),t&&(o.referrerPolicy=t),typeof n=="string"&&(o.crossOrigin=n),()=>{o.removeEventListener("load",d),o.removeEventListener("error",u)}},[o,n,t]),i}var D_=A_,O_=I_,L_=R_;const F_=m.forwardRef(({className:e,...t},n)=>a.jsx(D_,{ref:n,className:xe("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));F_.displayName=D_.displayName;const z_=m.forwardRef(({className:e,...t},n)=>a.jsx(O_,{ref:n,className:xe("aspect-square h-full w-full",e),...t}));z_.displayName=O_.displayName;const B_=m.forwardRef(({className:e,...t},n)=>a.jsx(L_,{ref:n,className:xe("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));B_.displayName=L_.displayName;const kF=()=>jA(),EF=6.5,NF=e=>{const t=m.useCallback(r=>new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(r*EF),[]),n=m.useCallback(async()=>{},[]);return{balance:0,loading:!1,transactions:[],creditsToReais:t,refresh:n,loadTransactions:n}},V_=()=>rA(),hr=m.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:xe("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));hr.displayName="Card";const io=m.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:xe("flex flex-col space-y-1.5 p-6",e),...t}));io.displayName="CardHeader";const lo=m.forwardRef(({className:e,...t},n)=>a.jsx("h3",{ref:n,className:xe("text-2xl font-semibold leading-none tracking-tight",e),...t}));
473lo.displayName="CardTitle";const PF=m.forwardRef(({className:e,...t},n)=>a.jsx("p",{ref:n,className:xe("text-sm text-muted-foreground",e),...t}));PF.displayName="CardDescription";const us=m.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:xe("p-6 pt-0",e),...t}));us.displayName="CardContent";const AF=m.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:xe("flex items-center p-6 pt-0",e),...t}));AF.displayName="CardFooter";function TF(){const{t:e}=Qe("billing"),{user:t}=at(),[n,r]=m.useState(!1),[s,o]=m.useState(!0),[i,l]=m.useState(!0);return m.useEffect(()=>{if(!t)return;(async()=>{var d;try{const{data:u}=await he.functions.invoke("manage-payment-methods",{body:{action:"list"}}),f=((d=u==null?void 0:u.methods)==null?void 0:d.length)>0;r(f);const{data:h}=await he.from("profiles").select("auto_renewal_enabled").eq("id",t.id).single();o((h==null?void 0:h.auto_renewal_enabled)!==!1)}catch(u){console.error("Error checking auto-renewal status:",u)}finally{l(!1)}})()},[t]),i||!n||!s?null:a.jsxs("div",{className:"mt-3 p-3 rounded-lg border border-zinc-700 bg-zinc-800/50",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Aa,{className:"h-4 w-4 text-zinc-300"}),a.jsx("span",{className:"text-sm text-white",children:e("autoRenewal.active")})]}),a.jsx("p",{className:"text-xs text-zinc-400 mt-1",children:e("autoRenewal.description")})]})}const IF=({open:e,onOpenChange:t,onViewPlans:n})=>{const{t:r}=Qe("billing"),{plans:s}=Xr(),i=s.filter(l=>l.id!=="free"&&l.id!=="enterprise"&&l.price_brl>0).sort((l,c)=>l.price_brl-c.price_brl)[0];return a.jsx(cn,{open:e,onOpenChange:t,children:a.jsxs(Qt,{className:"sm:max-w-md",children:[a.jsxs(qt,{children:[a.jsxs(Gt,{className:"flex items-center gap-2 text-lg",children:[a.jsx(bl,{className:"h-5 w-5 text-yellow-500"}),r("planUpsellModal.title")]}),a.jsx(En,{children:r("planUpsellModal.description")})]}),i&&a.jsx("div",{className:"py-2",children:a.jsxs("div",{className:"relative p-4 rounded-lg border-2 border-primary bg-primary/5 space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ki,{className:"h-4 w-4 text-primary"}),a.jsx("span",{className:"font-medium text-sm",children:r("planUpsellModal.planLabel",{planName:i.name})})]}),a.jsxs("span",{className:"text-lg font-bold text-primary",children:["R$ ",i.price_brl.toFixed(2).replace(".",","),a.jsx("span",{className:"text-xs font-normal text-muted-foreground",children:r("planUpsellModal.perMonth")})]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[r("planUpsellModal.instancesIncluded",{count:i.max_instances}),i.monthly_credits>0&&` • ${r("planUpsellModal.aiCredits",{count:i.monthly_credits})}`]})]})}),a.jsx("div",{className:"flex flex-col gap-2 pt-2",children:a.jsxs(pe,{onClick:n,className:"w-full gap-2",children:[a.jsx(Ki,{className:"h-4 w-4"}),r("planUpsellModal.viewPlans"),a.jsx(Ca,{className:"h-4 w-4"})]})})]})})},MF=({compact:e=!1,showTransactions:t=!1,userId:n})=>{const{t:r}=Qe("billing"),s=kF(),o=NF(),i=n?o:s,{balance:l,loading:c,transactions:d,creditsToReais:u}=i,f=i.loadTransactions,{isActive:h}=V_(),{hasActivePlan:p,isFreePlan:y,needsPlanSelection:g}=Xr(),x=Rt(),[v,b]=m.useState(!1),[w,_]=m.useState(!1);if(m.useEffect(()=>{t&&f&&f()},[t,f]),!h)return null;if(c)return a.jsx(hr,{className:"border-accent/20",children:a.jsx(us,{className:"p-4",children:a.jsx(rs,{className:"h-16 w-full"})})});const C=()=>{!p&&(y||g)?b(!0):(rr.setItem("homeMode","marketplace"),x("/marketplace?tab=creditos"))};return e?a.jsxs(ht.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"flex items-center gap-2 px-3 py-1.5 rounded-full bg-accent/10 border border-accent/20",children:[a.jsx(yp,{className:"h-4 w-4 text-accent"}),a.jsx("span",{className:"text-sm font-semibold text-accent",children:l.toFixed(2)}),a.jsx("span",{className:"text-xs text-muted-foreground",children:r("shared.credits")})]}):a.jsxs(a.Fragment,{children:[a.jsx(ht.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},children:a.jsx(hr,{className:"border-accent/20 bg-gradient-to-br from-accent/5 to-accent/10",children:a.jsxs(us,{className:"p-4",children:[a.jsx("div",{className:"flex items-center justify-between mb-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"p-2 rounded-lg bg-accent/20",children:a.jsx(yp,{className:"h-5 w-5 text-accent"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:r("creditWallet.yourWallet")}),a.jsxs("p",{className:"text-2xl font-bold",children:[l.toFixed(2)," ",a.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:r("shared.credits")})]})]})]})}),a.jsxs(pe,{onClick:C,className:"w-full bg-accent hover:bg-accent/90",size:"sm",children:[r("creditWallet.recharge"),a.jsx(Ca,{className:"h-4 w-4 ml-2"})]}),a.jsx(TF,{}),t&&d.length>0&&a.jsxs("div",{className:"mt-4 pt-4 border-t border-border",children:[a.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:r("creditWallet.recentTransactions")}),a.jsx("div",{className:"space-y-2 max-h-32 overflow-y-auto",children:d.slice(0,5).map(N=>a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[N.amount>0?a.jsx(hj,{className:"h-3 w-3 text-green-500"}):a.jsx(fj,{className:"h-3 w-3 text-red-500"}),a.jsx("span",{className:"text-xs truncate max-w-[150px]",children:N.description})]}),a.jsxs("span",{className:`font-medium ${N.amount>0?"text-green-500":"text-red-500"}`,children:[N.amount>0?"+":"",N.amount.toFixed(2)]})]},N.id))})]})]})})}),a.jsx(IF,{open:v,onOpenChange:b,instanceCost:10,onContinueAvulsa:()=>{b(!1),rr.setItem("homeMode","marketplace"),x("/marketplace?tab=creditos")},onViewPlans:()=>{b(!1),_(!0)}}),a.jsx(pr,{open:w,onOpenChange:_,hideFreePlan:!0})]})},RF=({open:e,onOpenChange:t})=>{var te,ae;const n=$n(),{t:r}=Qe(["profile","common"]),{user:s}=at(),{isImpersonating:o,impersonatedUserId:i,impersonatedEmail:l}=qo(),c=o&&i?i:s==null?void 0:s.id,d=o&&l?l:s==null?void 0:s.email,{toast:u}=rP(),{theme:f,setTheme:h}=Xu(),p=Rt(),[y,g]=m.useState(""),[x,v]=m.useState(""),[b,w]=m.useState(""),[_,C]=m.useState(!1),[N,k]=m.useState(null),[P,A]=m.useState(!1),T=m.useRef(null),[D,E]=m.useState(((te=s==null?void 0:s.user_metadata)==null?void 0:te.display_name)||""),[I,S]=m.useState(!1),L=async()=>{S(!0);const{error:re}=await he.auth.updateUser({data:{display_name:D.trim()}});S(!1),u(re?{variant:"destructive",title:r("displayName.updateError"),description:re.message}:{title:r("displayName.updateSuccess")})},[Y,B]=m.useState(""),[q,F]=m.useState(""),[ee,$]=m.useState(!1);m.useEffect(()=>{e&&c&&(async()=>
473{if(!c)return;const{data:le}=await he.from("profiles").select("avatar_url, username").eq("id",c).single();le!=null&&le.avatar_url&&k(le.avatar_url),le!=null&&le.username&&(B(le.username),F(le.username))})()},[e,c]);const M=async re=>{var ue;const le=(ue=re.target.files)==null?void 0:ue[0];if(!(!le||!c)){if(!le.type.startsWith("image/")){u({variant:"destructive",title:r("avatar.invalidFile.title"),description:r("avatar.invalidFile.description")});return}if(le.size>2*1024*1024){u({variant:"destructive",title:r("avatar.tooLarge.title"),description:r("avatar.tooLarge.description")});return}A(!0);try{const z=le.name.split(".").pop(),ie=`${c}/avatar.${z}`,{error:j}=await he.storage.from("avatars").upload(ie,le,{upsert:!0});if(j)throw j;const{data:{publicUrl:H}}=he.storage.from("avatars").getPublicUrl(ie),G=`${H}?t=${Date.now()}`,{error:O}=await he.from("profiles").update({avatar_url:G}).eq("id",c);if(O)throw O;k(G),u({title:r("avatar.updateSuccess.title"),description:r("avatar.updateSuccess.description")})}catch(z){console.error("Error uploading avatar:",z),u({variant:"destructive",title:r("avatar.uploadError.title"),description:z.message})}finally{A(!1)}}},J=async()=>{if(!c||!Y.trim()){u({variant:"destructive",title:r("username.invalid.title"),description:r("username.invalid.description")});return}const re=Y.trim();if(re!==q){$(!0);try{const{data:le}=n!=null&&n.scope?{data:null}:await he.from("profiles").select("id").ilike("username",re).neq("id",c).maybeSingle();if(le){u({variant:"destructive",title:r("username.alreadyExists.title"),description:r("username.alreadyExists.description")}),$(!1);return}const{error:ue}=await he.from("profiles").update({username:re}).eq("id",c);if(ue)throw ue;F(re),u({title:r("username.updateSuccess.title"),description:r("username.updateSuccess.description")})}catch(le){console.error("Error updating username:",le),u({variant:"destructive",title:r("username.updateError.title"),description:le.message||r("username.updateError.description")})}finally{$(!1)}}},K=async re=>{if(re.preventDefault(),!x||!b){u({variant:"destructive",title:r("password.requiredFields.title"),description:r("password.requiredFields.description")});return}if(x!==b){u({variant:"destructive",title:r("password.mismatch.title"),description:r("password.mismatch.description")});return}if(x.length<6){u({variant:"destructive",title:r("password.tooShort.title"),description:r("password.tooShort.description")});return}C(!0);const{error:le}=await he.auth.updateUser({password:x});C(!1),le?u({variant:"destructive",title:r("password.changeError.title"),description:le.message}):(u({title:r("password.changeSuccess.title"),description:r("password.changeSuccess.description")}),g(""),v(""),w(""),t(!1))},X=Y||(d==null?void 0:d.split("@")[0])||r("defaultDisplayName"),de=X.slice(0,2).toUpperCase();return a.jsx(cn,{open:e,onOpenChange:t,children:a.jsxs(Qt,{className:"sm:max-w-md border-accent/50",children:[a.jsxs(qt,{children:[a.jsx(Gt,{children:r("title")}),a.jsx(En,{children:r("description")})]}),a.jsxs("div",{className:"space-y-6 max-h-[70vh] overflow-y-auto pr-2",children:[a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsxs("div",{className:"relative",children:[a.jsxs(F_,{className:"w-24 h-24 border-2 border-accent/30",children:[a.jsx(z_,{src:N||void 0,alt:X}),a.jsx(B_,{className:"text-2xl bg-accent/20 text-accent",children:de})]}),a.jsx("button",{onClick:()=>{var re;return(re=T.current)==null?void 0:re.click()},disabled:P,className:"absolute bottom-0 right-0 p-2 bg-accent text-accent-foreground rounded-full hover:bg-accent/90 transition-colors disabled:opacity-50",children:P?a.jsx(st,{className:"w-4 h-4 animate-spin"}):a.jsx(RC,{className:"w-4 h-4"})}),a.jsx("input",{ref:T,type:"file",accept:"image/*",onChange:M,className:"hidden"})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:r("avatar.changeHint")})]}),a.jsxs("div",{className:"space-y-4 p-4 rounded-lg bg-secondary/30 border border-border",children:[a.jsxs("div",{children:[a.jsx(Be,{className:"text-muted-foreground text-sm",children:r("common:fields.email")}),a.jsx("p",{className:"font-medium",children:d})]}),!o&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(Be,{htmlFor:"displayName",className:"text-muted-foreground text-sm",children:r("displayName.label")}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(et,{id:"displayName",type:"text",maxLength:40,placeholder:r("displayName.placeholder"),value:D,onChange:re=>E(re.target.value),disabled:I,className:"flex-1 focus-visible:ring-accent focus-visible:border-accent"}),a.jsx(pe,{onClick:L,disabled:I||D.trim()===(((ae=s==null?void 0:s.user_metadata)==null?void 0:ae.display_name)||""),size:"sm",className:"bg-accent hover:bg-accent/90 text-accent-foreground",children:I?a.jsx(st,{className:"w-4 h-4 animate-spin"}):r("common:actions.save")})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Be,{htmlFor:"username",className:"text-muted-foreground text-sm",children:r("username.label")}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(et,{id:"username",type:"text",placeholder:r("username.placeholder"),value:Y,onChange:re=>B(re.target.value),disabled:ee,className:"flex-1 focus-visible:ring-accent focus-visible:border-accent"}),a.jsx(pe,{onClick:J,disabled:ee||Y.trim()===q,size:"sm",className:"bg-accent hover:bg-accent/90 text-accent-foreground",children:ee?a.jsx(st,{className:"w-4 h-4 animate-spin"}):r("common:actions.save")})]})]})]}),a.jsxs(pe,{variant:"outline",className:"w-full border-accent/50 hover:bg-accent/10",onClick:()=>{t(!1),p("/affiliate")},children:[a.jsx(Uv,{className:"h-4 w-4 mr-2 text-accent"}),r("affiliateArea")]}),a.jsx(MF,{userId:c||void 0}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("h3",{className:"font-semibold text-sm",children:r("theme.title")}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:()=>h("dark"),className:xe("flex-1 flex items-center justify-center gap-2 p-3 rounded-lg border-2 transition-all",f==="dark"?"border-accent bg-accent/10 text-accent":"border-border bg-secondary/30 text-muted-foreground hover:border-accent/50"),children:[a.jsx(Gu,{className:"h-5 w-5"}),a.jsx("span",{className:"text-sm font-medium",children:r("theme.dark")})]}),a.jsxs("button",{onClick:()=>h("light"),className:xe("flex-1 flex items-center justify-center gap-2 p-3 rounded-lg border-2 transition-all",f==="light"?"border-accent bg-accent/10 text-accent":"border-border bg-secondary/30 text-muted-foreground hover:border-accent/50"),children:[a.jsx($v,{className:"h-5 w-5"}),a.jsx("span",{className:"text-sm font-medium",children:r("theme.light")})]})]})]}),a.jsxs("form",{id:"password-section",onSubmit:K,className:"space-y-4",children:[a.jsx("h3",{className:"font-semibold text-sm",children:r("password.title")}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Be,{htmlFor:"new-password",children:r("password.newPassword")}),a.jsx(et,{id:"new-password",type:"password",placeholder:r("password.newPasswordPlaceholder"),value:x,onChange:re=>v(re.target.value),disabled:_,className:"focus-visible:ring-accent focus-visible:border-accent"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Be,{htmlFor:"confirm-password",children:r("password.confirmNewPassword")}),a.jsx(et,{id:"confirm-password",type:"password",placeholder:r("password.confirmNewPasswordPlaceholder"),value:b,onChange:re=>w(re.target.value),disabled:_,className:"focus-visible:ring-accent focus-visible:border-accent"})]}),a.jsx(pe,{type:"submit",className:"w-full bg-accent hover:bg-accent/90 text-accent-foreground",disabled:_,children:r(_?"password.changing":"password.title")})]})]})]})})},$_=()=>{const{i18n:e}=Qe(),t=nC(e.language)?e.language:rC,n=m.useCallback(s=>{e.changeLanguage(s),window.localStorage.setItem(sC,s)},[e]),r=mc.find(s=>s.code===t)??mc[0];return{language:t,setLanguage:n,intlLocale:r.intlLocale,languages:mc}},DF={BR:a.jsxs("svg",{viewBox:"0 0 3 2",preserveAspectRatio:"xMidYMid slice",className:"h-full w-full",children:[a.jsx("rect",{width:"3",height:"2",fill:"#009c3b"}),a.jsx("polygon",{points:"1.5,0.25 2.75,1 1.5,1.75 0.25,1",fill:"#ffdf00"}),a.jsx("circle",{cx:"1.5",cy:"1",r:"0.42",fill:"#002776"})]}),ES:a.jsxs("svg",{viewBox:"0 0 3 2",preserveAspectRatio:"xMidYMid slice",className:"h-full w-full",children:[a.jsx("rect",{width:"3",height:"2",fill:"#aa151b"}),a.jsx("rect",{y:"0.5",width:"3",height:"1",fill:"#f1bf00"})]}),US:a.jsxs("svg",{viewBox:"0 0 3 2",preserveAspectRatio:"xMidYMid slice",className:"h-full w-full",children:[a.jsx("rect",{width:"3",height:"2",fill:"#fff"}),[0,2,4,6,8,10,12].map(e=>a.jsx("rect",{y:e*2/13,width:"3",height:2/13,fill:"#b22234"},e)),a.jsx("rect",{width:"1.5",height:2*7/13,fill:"#3c3b6e"})]})},OF=({code:e,className:t})=>a.jsx("span",{"aria-hidden":"true",className:`relative inline-flex shrink-0 overflow-hidden rounded-full ring-1 ring-black/10 ${t||"h-4 w-4"}`,children:DF[e]}),LF={pt:"BR",es:"ES",en:"US"},FF=()=>{const{theme:e,toggleTheme:t}=Xu(),{language:n,setLanguage:r,languages:s}=$_(),{t:o}=Qe("header");return a.jsxs("div",{className:"flex items-center gap-0.5 rounded-full bg-secondary/60 px-1 py-1",children:[a.jsx("button",{type:"button",onClick:t,title:o("toggleTheme"),"aria-label":o("toggleTheme"),className:"flex h-7 w-7 items-center justify-center rounded-full text-muted-foreground hover:text-foreground hover:bg-secondary transition-colors",children:e==="dark"?a.jsx(Gu,{className:"h-4 w-4"}):a.jsx($v,{className:"h-4 w-4"})}),a.jsx("div",{className:"mx-0.5 h-4 w-px bg-border","aria-hidden":"true"}),a.jsx("div",{role:"group","aria-label":o("changeLanguage"),className:"flex items-center gap-0.5",children:s.map(i=>a.jsx("button",{type:"button",onClick:()=>r(i.code),title:i.label,"aria-label":i.label,"aria-pressed":n===i.code,className:xe("flex h-7 w-7 items-center justify-center rounded-full text-base leading-none transition-all",n===i.co
473de?"ring-2 ring-accent bg-secondary":"opacity-50 hover:opacity-90 hover:bg-secondary/60"),children:a.jsx(OF,{code:LF[i.code],className:"h-4 w-4"})},i.code))})]})},zF="/_releases/admin/assets/zapdata-logo-header-BPwdvO9a.png",Au=({mode:e,onModeChange:t,onSidebarToggle:n,onMobileMenuToggle:r,topOffsetPx:s=0,useBannerOffsetVar:o=!1})=>{const{t:i}=Qe("header"),{signOut:l}=at(),{hasAdminAccess:c}=__(),{isImpersonating:d}=qo(),{isCollaborator:u}=Da(),f=Rt(),h=or(),[p,y]=m.useState(!1),g=h.pathname==="/auth",x=h.pathname.startsWith("/ads");C_({isCollaborator:u});const v=!g&&!x,b=d?40:0,w=b+s,_=o?{top:`calc(var(--app-banner-offset, 0px) + ${b}px)`}:w?{top:w}:void 0;return a.jsxs(a.Fragment,{children:[a.jsx("header",{style:_,className:xe("fixed left-0 right-0 h-14 bg-card border-b border-border z-50",_?"":"top-0"),children:a.jsxs("div",{className:"h-full px-4 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[v&&r&&a.jsx(pe,{variant:"ghost",size:"icon",onClick:r,"aria-label":i("openMenu"),className:"md:hidden h-9 w-9 text-muted-foreground hover:text-foreground",children:a.jsx(gp,{className:"h-5 w-5"})}),v&&n&&a.jsx(pe,{variant:"ghost",size:"icon",onClick:n,className:"hidden md:inline-flex h-9 w-9 text-muted-foreground hover:text-foreground",children:a.jsx(gp,{className:"h-5 w-5"})}),a.jsx("button",{onClick:()=>f("/"),className:"flex items-center gap-2 group",children:a.jsx("img",{src:zF,alt:"Zapdata",className:"h-16 md:h-28 w-auto object-contain"})})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(FF,{}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(bF,{}),!u&&a.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>y(!0),title:i("profile"),"aria-label":i("profile"),className:"hidden sm:inline-flex h-9 w-9 text-muted-foreground hover:text-foreground",children:a.jsx(gj,{className:"h-4 w-4"})}),c&&!u&&a.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>f("/admin-panel"),title:i("adminPanel"),"aria-label":i("adminPanel"),className:"hidden md:inline-flex h-9 w-9 text-muted-foreground hover:text-foreground",children:a.jsx(Yu,{className:"h-4 w-4"})}),a.jsx(pe,{variant:"ghost",size:"icon",onClick:l,title:i("logout"),"aria-label":i("logout"),className:"h-9 w-9 text-muted-foreground hover:text-foreground",children:a.jsx(qu,{className:"h-4 w-4"})})]})]})]})}),a.jsx(RF,{open:p,onOpenChange:y})]})},BF="/_releases/admin/assets/whatsapp-logo-BE1clGI_.png",ed=[{id:"dashboard",path:"/inbox",titleKey:"nav.dashboard",icon:a.jsx(ZC,{className:"w-[18px] h-[18px]"}),exact:!0},{id:"conexoes",path:"/inbox/conexoes",titleKey:"nav.connections",icon:a.jsx(Bv,{className:"w-[18px] h-[18px]"})},{id:"inbox",path:"/inbox/chat",titleKey:"nav.inbox",icon:a.jsx(XC,{className:"w-[18px] h-[18px]"})},{id:"fluxos",path:"/inbox/flows",titleKey:"nav.flows",icon:a.jsx(vj,{className:"w-[18px] h-[18px]"})},{id:"disparos",path:"/disparador",titleKey:"nav.campaigns",icon:a.jsx(oj,{className:"w-[18px] h-[18px]"})},{id:"contatos",path:"/inbox/contacts",titleKey:"nav.contacts",icon:a.jsx(Uv,{className:"w-[18px] h-[18px]"})},{id:"crm",path:"/inbox/kanban",titleKey:"nav.crm",icon:a.jsx(cj,{className:"w-[18px] h-[18px]"})},{id:"respostas-rapidas",path:"/inbox/global-settings",titleKey:"nav.quickReplies",icon:a.jsx(ej,{className:"w-[18px] h-[18px]"})},{id:"ads",path:"/ads",titleKey:"nav.ads",icon:a.jsx(QC,{className:"w-[18px] h-[18px]"})},{id:"ferramentas",path:"/ferramentas",titleKey:"nav.tools",icon:a.jsx(Wv,{className:"w-[18px] h-[18px]"})}],td=[{id:"settings",path:"/settings",titleKey:"accountNav.settings",icon:a.jsx(Ku,{className:"w-[18px] h-[18px]"})},{id:"integrations",path:"/integrations",titleKey:"accountNav.integrations",icon:a.jsx(Bv,{className:"w-[18px] h-[18px]"})},{id:"subscription",path:"/subscription",titleKey:"accountNav.subscription",icon:a.jsx(Aa,{className:"w-[18px] h-[18px]"})},{id:"affiliate",path:"/affiliate",titleKey:"accountNav.affiliate",icon:a.jsx(zv,{className:"w-[18px] h-[18px]"})}],VF=({isOpen:e,onToggle:t,collapsed:n=!1,onCollapse:r})=>{const{t:s}=Qe("sidebar"),o=Rt(),i=or(),{isAdmin:l}=Go(),c=Yr(),d=!!c.actorId&&!["legacy","signed-out"].includes(c.status),u=w=>w.exact?i.pathname===w.path:i.pathname===w.path||i.pathname.startsWith(w.path+"/"),f=w=>{yo(w.path)&&!l||(o(w.path),window.innerWidth<1024&&t())},h=w=>Yv(w.path),p=w=>{const _=u(w),C=yo(w.path)&&!l;return a.jsxs("button",{onClick:()=>f(w),onMouseEnter:()=>h(w),onFocus:()=>h(w),disabled:C,className:xe("group flex items-center gap-3 w-full px-3 py-2.5 rounded-xl text-sm transition-colors",_?"bg-accent text-accent-foreground font-semibold shadow-lg shadow-accent/25":"text-muted-foreground hover:text-foreground hover:bg-secondary/70",C&&"opacity-40 cursor-not-allowed"),children:[a.jsx("span",{className:"flex-shrink-0",children:w.icon}),a.jsx("span",{className:"flex-1 min-w-0 text-left truncate",children:s(w.titleKey)})]},w.id)},y=w=>{const _=u(w),C=yo(w.path)&&!l;return a.jsxs(Fy,{children:[a.jsx(zy,{asChild:!0,children:a.jsx("button",{onClick:()=>f(w),onMouseEnter:()=>h(w),onFocus:()=>h(w),disabled:C,className:xe("flex items-center justify-center w-11 h-11 rounded-xl transition-colors",_?"bg-accent text-accent-foreground shadow-lg shadow-accent/25":"text-muted-foreground hover:text-foreground hover:bg-secondary",C&&"opacity-40 cursor-not-allowed"),children:w.icon})}),a.jsx(mf,{side:"right",className:"text-xs",children:s(w.titleKey)})]},w.id)},g=a.jsxs("div",{className:"px-3 pb-3 space-y-2",children:[a.jsxs("a",{href:"https://zzfunnels.co/tutoriais-zzhub-9360d1ff/membros/share/8g0jt421",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 w-full px-3 py-2.5 rounded-lg border transition-colors bg-blue-500/10 border-blue-500/20 text-blue-400 hover:bg-blue-500/20",children:[a.jsx(BC,{className:"w-5 h-5"}),a.jsx("span",{className:"text-sm font-medium",children:s("tutorials")})]}),a.jsxs("a",{href:"https://whatsapp.com/channel/0029VbDIttjAe5VwHD3NHe03",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 w-full px-3 py-2.5 rounded-lg border transition-colors bg-green-500/10 border-green-500/20 text-green-500 hover:bg-green-500/20",children:[a.jsx("img",{src:BF,alt:"",className:"w-5 h-5 object-contain flex-shrink-0"}),a.jsx("span",{className:"text-sm font-medium",children:s("whatsappChannel")})]})]}
473),x=a.jsx(pf,{delayDuration:0,children:a.jsxs("div",{"data-sidebar-fixed":!0,className:"hidden md:flex flex-col w-16 bg-card border-r border-border fixed left-0 top-14 bottom-0 z-30",children:[a.jsxs("div",{className:"flex-1 overflow-y-auto py-3 flex flex-col items-center gap-1.5 scrollbar-sidebar",children:[ed.map(y),a.jsx("div",{className:"w-8 h-px bg-border my-1.5"}),td.map(y)]}),d&&a.jsx("div",{"aria-hidden":"true",className:"h-32 shrink-0"}),a.jsx("div",{className:"p-2 border-t border-border flex justify-center",children:a.jsx("button",{onClick:()=>r==null?void 0:r(!1),className:"w-9 h-9 flex items-center justify-center rounded-lg text-muted-foreground hover:text-foreground hover:bg-secondary transition-colors",children:a.jsx(DC,{className:"w-4 h-4"})})})]})}),v=a.jsx("div",{"data-sidebar-fixed":!0,className:"hidden md:flex flex-col w-64 bg-card border-r border-border fixed left-0 top-14 bottom-0 z-30",children:a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("nav",{className:"flex-1 overflow-y-auto scrollbar-sidebar px-2 pt-3 space-y-1",children:[a.jsx("div",{className:"px-2 pb-1 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/70",children:s("sectionMenu")}),ed.map(p),a.jsx("div",{className:"my-2 mx-2 h-px bg-border"}),a.jsx("div",{className:"px-2 pb-1 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/70",children:s("sectionAccount")}),td.map(p)]}),g,d&&a.jsx("div",{"aria-hidden":"true",className:"h-32 shrink-0"})]})}),b=a.jsxs(a.Fragment,{children:[e&&a.jsx("div",{className:"fixed inset-0 bg-black/50 z-40 md:hidden",onClick:t}),a.jsxs("div",{className:xe("fixed left-0 top-0 bottom-0 w-64 bg-card border-r border-border z-50 md:hidden transition-transform duration-200 flex flex-col",e?"translate-x-0":"-translate-x-full"),children:[a.jsxs("div",{className:"p-4 border-b border-border flex items-center gap-2",children:[a.jsx("div",{className:"w-8 h-8 rounded-md bg-accent flex items-center justify-center shadow-lg shadow-accent/20",children:a.jsx("span",{className:"text-accent-foreground font-bold text-sm",children:"Z"})}),a.jsx("span",{className:"font-semibold text-accent",children:"Zapdata"})]}),a.jsxs("nav",{className:"flex-1 overflow-y-auto scrollbar-sidebar px-2 py-3 space-y-1",children:[ed.map(p),a.jsx("div",{className:"my-2 mx-2 h-px bg-border"}),td.map(p)]}),g,d&&a.jsx("div",{"aria-hidden":"true",className:"h-32 shrink-0"})]})]});return a.jsxs(a.Fragment,{children:[b,n?x:v]})},$F=[],UF=["/inbox/chat"],U_=({children:e})=>{const t=or(),[n,r]=m.useState(()=>typeof window>"u"?!1:rr.getItem("sidebar-collapsed-v2")==="true"),[s,o]=m.useState(!1);m.useEffect(()=>{o(!1)},[t.pathname]);const i=UF.some(u=>t.pathname===u||t.pathname.startsWith(u+"/")),l=m.useCallback(u=>{r(u),rr.setItem("sidebar-collapsed-v2",String(u))},[]);m.useEffect(()=>{$F.some(f=>t.pathname===f||t.pathname.startsWith(f+"/"))&&!n&&l(!0)},[t.pathname]);const c=m.useCallback(()=>{l(!n)},[n,l]),d=i?"":n?"md:ml-16":"md:ml-64";return a.jsxs(a.Fragment,{children:[a.jsx(Au,{onSidebarToggle:i?void 0:c,onMobileMenuToggle:i?void 0:()=>o(!0),useBannerOffsetVar:!0}),!i&&a.jsx(VF,{isOpen:s,onToggle:()=>o(u=>!u),collapsed:n,onCollapse:l}),a.jsx("div",{style:{height:"calc(var(--app-banner-offset, 0px) + var(--system-header-height, 3.5rem))"},className:`cancel-banner-spacer ${d} transition-[margin] duration-200`}),a.jsx("div",{className:`${d} transition-[margin] duration-200 pb-16 md:pb-0`,children:e})]})},W_=()=>a.jsx(U_,{children:a.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[60vh] text-center px-6",children:[a.jsx("div",{className:"w-16 h-16 rounded-full bg-orange-500/15 flex items-center justify-center mb-5",children:a.jsx(Wv,{className:"w-8 h-8 text-orange-500"})}),a.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Função em manutenção"}),a.jsx("p",{className:"text-muted-foreground max-w-md",children:"Estamos fazendo melhorias nesta função para entregar uma experiência melhor. Ela volta em breve — obrigado pela paciência! 🛠️"})]})}),WF=new Set(["/marketplace","/affiliate","/subscription","/settings","/ads","/gerador-audio","/transcricao-audio","/disparador","/video-downloader","/zap-converter","/limpa-hash","/fabrica-criativos","/gerador-palavras-chaves","/extensao-ads","/sms-bot","/smm-panel","/track-ofertas","/criativos"]),it=({children:e})=>{const{user:t,loading:n}=at(),r=$n(),{isCollaborator:s,loading:o}=Da(),{isInGracePeriod:i,isGraceExpired:l,gracePeriodEnd:c,loading:d,isFreePlan:u,subscription:f,isCancelScheduled:h,periodEndDate:p,isImmediateBlock:y,hasAvulsaInstances:g,isCreditSlotGracePeriod:x,isCreditSlotGraceExpired:v,creditSlotGraceEnd:b,isAvulsaSlotGracePeriod:w,isAvulsaSlotGraceExpired:_,avulsaSlotGraceEnd:C,isPaymentFailure:N,suspensionReason:k,isAdminBlocked:P,effectiveMaxInstances:A,refresh:T}=Xr(),{isAdmin:D}=Go(),{isFullMember:E,isSemiFullMember:I}=Tf(),S=Rt(),[L,Y]=m.useState(!1),[B,q]=m.useState(!1),[F,ee]=m.useState(!1);m.useEffect(()=>{if(d){ee(!1);return}const ae=setTimeout(()=>ee(!0),250);return()=>clearTimeout(ae)},[d]);const $=!!(r!=null&&r.scope)&&window.location.pathname.startsWith("/settings"),M=E&&!I,J=$||!(r
473!=null&&r.scope)&&(D||s)||M||!f||!F,K=F&&h&&!!p&&!D&&!s,X=!J&&u&&!h&&!i&&!l&&!y,de=K||X;if(m.useEffect(()=>(de?document.body.setAttribute("data-cancel-banner","true"):document.body.removeAttribute("data-cancel-banner"),()=>document.body.removeAttribute("data-cancel-banner")),[de]),m.useEffect(()=>{!n&&!t&&S("/auth")},[t,n,S]),m.useEffect(()=>{if(!o&&s){const ae=window.location.pathname||"/";for(const re of WF)if(ae===re||ae.startsWith(re+"/")){S("/inbox");return}}},[s,o,S]),n&&!t)return a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:a.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-md border border-border/60 bg-card/95 px-6 py-5 shadow-lg",children:[a.jsx(st,{className:"h-8 w-8 animate-spin text-accent"}),a.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Carregando sistema..."})]})});if(!t)return null;if($)return a.jsx(a.Fragment,{children:e});if(!D&&yo(window.location.pathname))return a.jsx(W_,{});if(!J&&k==="downgrade_overage"&&!window.location.pathname.startsWith("/subscription"))return a.jsx(FO,{userId:t.id,maxInstances:A,onResolved:()=>{T()}});if(!J&&v)return a.jsx(Us,{status:"blocked",gracePeriodEnd:b,hasAvulsaInstances:!1,isCreditSlotExpiry:!0});if(!J&&x)return a.jsxs(a.Fragment,{children:[a.jsx(Us,{status:"grace",gracePeriodEnd:b,hasAvulsaInstances:!1,isCreditSlotExpiry:!0}),e]});if(!J&&w&&C){const ae=Math.max(0,Math.ceil((C.getTime()-Date.now())/864e5));return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"fixed top-0 left-0 right-0 z-[60] bg-orange-600 px-4 h-[48px] flex items-center justify-center gap-3 text-base shadow-lg overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Jn,{className:"h-5 w-5 text-white flex-shrink-0 animate-pulse"}),a.jsxs("span",{className:"text-white font-bold",children:["Suas instâncias avulsas expiraram e serão apagadas em"," ",a.jsxs("span",{className:"bg-white/20 px-1.5 py-0.5 rounded text-white font-bold text-sm",children:[ae," dia",ae!==1?"s":""]})]})]}),a.jsx("span",{className:"text-orange-100 text-sm hidden sm:inline",children:"Recarregue créditos para mantê-las ativas."}),a.jsxs(pe,{size:"sm",className:"bg-white text-orange-700 hover:bg-orange-50 gap-1.5 font-semibold border-0",onClick:()=>Y(!0),children:[a.jsx(xc,{className:"h-3.5 w-3.5"}),"Recarregar Créditos"]})]}),e,a.jsx(pr,{open:L,onOpenChange:Y,mode:"regularize"})]})}if(!($||!(r!=null&&r.scope)&&D||!F)&&P){const ae=k||(N?"payment_failure":"admin");return a.jsx(Us,{status:"blocked",gracePeriodEnd:null,hasAvulsaInstances:g,suspensionReason:ae})}if(!J&&y){const ae=k||(N?"payment_failure":"admin");return a.jsx(Us,{status:"blocked",gracePeriodEnd:null,hasAvulsaInstances:g,suspensionReason:ae})}if(!J&&l)return a.jsx(Us,{status:"blocked",gracePeriodEnd:c,hasAvulsaInstances:g,suspensionReason:k||"payment_failure"});if(!J&&i)return a.jsxs(a.Fragment,{children:[a.jsx(Us,{status:"grace",gracePeriodEnd:c,hasAvulsaInstances:g}),e]});if(K&&p){const ae=Math.max(0,Math.ceil((p.getTime()-Date.now())/864e5)),re=p.toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit",year:"numeric"}),le=f,ue=(le==null?void 0:le.gateway)==="efi"&&(le==null?void 0:le.payment_method)==="pix_automatico"&&(le==null?void 0:le.efi_authorized)===!1;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"fixed top-0 left-0 right-0 z-[60] bg-red-600 px-4 h-[48px] flex items-center justify-center gap-3 text-base shadow-lg overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Jn,{className:"h-5 w-5 text-white flex-shrink-0 animate-pulse"}),a.jsxs("span",{className:"text-white font-bold",children:["Seu plano foi cancelado e expira em"," ",a.jsx("strong",{children:re})," ",a.jsxs("span",{className:"bg-white/20 px-1.5 py-0.5 rounded text-white font-bold text-sm",children:[ae," dia",ae!==1?"s":""]})]})]}),a.jsx("span",{className:"text-red-100 text-sm",children:g?"Após essa data, a conta voltará ao modo recarga e as instâncias do plano serão apagadas imediatamente.":"Após essa data, você perderá acesso a todas as funcionalidades e suas instâncias do plano serão apagadas imediatamente."}),a.jsxs(pe,{size:"sm",className:"bg-white text-red-700 hover:bg-red-50 gap-1.5 font-semibold border-0",onClick:()=>ue?q(!0):Y(!0),children:[a.jsx(xc,{className:"h-3.5 w-3.5"}),"Renovar Plano"]})]}),e,ue&&a.jsx(px,{mode:"renew",open:B,onOpenChange:q,onChangePlan:()=>S("/subscription")}),a.jsx(pr,{open:L,onOpenChange:Y,hideFreePlan:!0,mode:"regularize"})]})}return X?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"fixed top-0 left-0 right-0 z-[60] bg-blue-600 px-4 h-[48px] flex items-center justify-center gap-3 text-base shadow-lg overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Jn,{className:"h-5 w-5 text-white flex-shrink-0"}),a.jsx("span",{className:"text-white font-bold",children:"Você está no modo recarga — assine um plano e economize em suas instâncias!"})]}),a.jsxs(pe,{size:"sm",className:"bg-white text-blue-700 hover:bg-blue-50 gap-1.5 font-semibold border-0",onClick:()=>Y(!0),children:[a.jsx(xc,{className:"h-3.5 w-3.5"}),"Assinar Plano"]})]}),e,a.jsx(pr,{open:L,onOpenChange:Y,hideFreePlan:!0,mode:"regularize"})]}):a.jsxs(a.Fragment,{children:[a.jsx(VO,{}),e,a.jsx(px,{})]})},Xa=({children:e})=>{const t=Rt(),{isCollaborator:n,loading:r}
473=Da(),s=C_({isCollaborator:n});return m.useEffect(()=>{r||s||(rt.error("Configurações é uma área da conta principal.",{id:"settings-access-denied",description:"Peça ao responsável pela conta para ajustar essas opções."}),t("/inbox",{replace:!0}))},[r,s,t]),r?a.jsx("div",{className:"min-h-screen flex items-center justify-center",children:a.jsx("div",{className:"animate-pulse text-lg",children:"Carregando..."})}):s?a.jsx(a.Fragment,{children:e}):null},yt=({children:e})=>a.jsx(it,{children:e}),HF=3e4,nd=({children:e})=>{const{user:t,loading:n}=at(),{hasAdminAccess:r,loading:s}=__(),o=Rt(),i=m.useRef(null),l=m.useRef(null),c=m.useCallback(()=>{l.current&&(l.current.innerHTML="")},[]),d=m.useCallback(()=>{c(),Vd(),o("/",{replace:!0})},[c,o]);return m.useEffect(()=>{!n&&!t&&o("/auth",{replace:!0})},[t,n,o]),m.useEffect(()=>{!n&&!s&&!r&&t&&o("/",{replace:!0})},[r,s,n,t,o]),m.useEffect(()=>{if(!r||s)return;const u=async()=>{try{const{data:{session:f}}=await he.auth.getSession();if(!(f!=null&&f.access_token)){d();return}const{data:h,error:p}=await he.functions.invoke("validate-admin-access",{headers:{Authorization:`Bearer ${f.access_token}`}});(p||(h==null?void 0:h.hasAdminAccess)!==!0)&&d()}catch{d()}};return i.current=setInterval(u,HF),()=>{i.current&&clearInterval(i.current)}},[r,s,d]),n||s?a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:a.jsxs("div",{className:"text-center space-y-4",children:[a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto"}),a.jsx("p",{className:"text-lg text-muted-foreground",children:"Verificando permissões..."})]})}):r?a.jsx("div",{ref:l,"data-admin-content":!0,children:e}):null},qF=({children:e})=>{const{user:t,loading:n}=at(),{isAdmin:r,loading:s}=Go(),{subscription:o,loading:i}=Al(),l=Rt(),c=n||s||i,d=!!o&&o.plan_id!=="free",u=r||d&&S_(o);return m.useEffect(()=>{if(!n&&!t){l("/auth",{replace:!0});return}!c&&t&&!u&&(rt.error("Assine um plano (a partir do Iniciante) para usar o DisparaZap Oficial"),l("/subscription",{replace:!0}))},[c,t,n,u,l]),c?a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:a.jsxs("div",{className:"text-center space-y-4",children:[a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto"}),a.jsx("p",{className:"text-lg text-muted-foreground",children:"Verificando acesso..."})]})}):u?!r&&yo(window.location.pathname)?a.jsx(W_,{}):a.jsx(a.Fragment,{children:e}):null},GF=["/lp","/auth","/termos","/privacidade","/unsubscribe","/tutorial","/flow-preview","/s/"],vx=()=>{if(typeof window>"u")return!1;const e=window.location.pathname||"/";return GF.some(t=>e===t||e.startsWith(t+"/")||e.startsWith(t))},H_="is_free_trial_user_v2:",yx=e=>{if(!e)return null;try{const t=rr.getItem(`${H_}${e}`);if(t==="1")return!0;if(t==="0")return!1}catch{}try{if(Mt.getItem("is_free_trial_user")==="1")return!0}catch{}return null},KF=(e,t)=>{try{rr.setItem(`${H_}${e}`,t?"1":"0")}catch{}},zh=m.createContext({isBlocking:!1}),YF=()=>m.useContext(zh),XF=({children:e})=>{const t=$n();return t!=null&&t.scope?a.jsx(zh.Provider,{value:{isBlocking:!1},children:e}):a.jsx(ZF,{children:e})},ZF=({children:e})=>{const{user:t,loading:n}=at(),{needsPlanSelection:r,isTrialExpired:s,loading:o,refresh:i,subscription:l}=Xr(),{isAdmin:c,loading:d}=Tf(),{isCollaborator:u,loading:f}=Da(),[h,p]=m.useState(!1),[y,g]=m.useState(null),[x,v]=m.useState(()=>yx(void 0)),[b,w]=m.useState(()=>vx());m.useEffect(()=>{const P=()=>w(vx());return window.addEventListener("hashchange",P),window.addEventListener("popstate",P),()=>{window.removeEventListener("hashchange",P),window.removeEventListener("popstate",P)}},[]),m.useEffect(()=>{if(!t){p(!1);return}try{Mt.getItem(`plan_gate_dismissed_${t.id}`)==="1"&&p(!0)}catch{}},[t]),m.useEffect(()=>{if(!t){Mt.getItem("is_free_trial_user")!=="1"&&v(null);return}const P=yx(t.id);P!==null&&v(P)},[t]),m.useEffect(()=>{if(!t)return;let P=!1;return(async()=>{const{data:T,error:D}=await he.rpc("is_current_user_free_trial_signup");if(P)return;if(D){console.error("[FREE-TRIAL] check error:",D);return}const E=T===!0;if(KF(t.id,E),E){try{Mt.setItem("is_free_trial_user","1")}catch{}v(!0)}else v(!1)})(),()=>{P=!0}},[t]),m.useEffect(()=>{if(!t||!s){g(null);return}(async()=>{const{data:A}=await he.from("sms_transactions").select("id").eq("user_id",t.id).eq("type","deposit").eq("status","completed").limit(1).maybeSingle();g(!!A)})()},[t,s]),m.useEffect(()=>
473{if(s&&(p(!1),t))try{Mt.removeItem(`plan_gate_dismissed_${t.id}`)}catch{}},[s,t]);const _=async()=>{if(await i(),t)try{Mt.setItem(`plan_gate_dismissed_${t.id}`,"1")}catch{}p(!0)},C=!t||n||o||d||f||x===null;let N=null,k=!b&&C;if(!b&&!C){const P=u||c||x,A=!!l&&l.plan_id!=="free"&&l.status==="active";!P&&!A&&(s?y===null?k=!0:y||(k=!0,N=a.jsx(pr,{open:!0,onOpenChange:_,hideFreePlan:!0,forceSelection:!0})):!h&&r&&(k=!0,N=a.jsx(pr,{open:!0,onOpenChange:_,forceSelection:!0})))}return a.jsxs(zh.Provider,{value:{isBlocking:k},children:[e,N]})},QF=({videoCode:e,optimizationCode:t,isVisible:n})=>{const r=m.useRef(null);return m.useEffect(()=>{if(!e||!r.current||!n)return;const s=r.current,o=d=>d.replace(/<script[^>]*>/gi,"").replace(/<\/script>/gi,"").trim();s.innerHTML="";const i=document.createElement("div");i.innerHTML=e;const l=Array.from(i.querySelectorAll("script"));for(l.forEach(d=>d.remove());i.firstChild;)s.appendChild(i.firstChild);const c=d=>{const u=document.createElement("script");if(Array.from(d.attributes).forEach(f=>{u.setAttribute(f.name,f.value)}),d.src)u.src=d.src;else{const f=d.textContent??"";u.textContent=o(f)}s.appendChild(u)};if(l.forEach(d=>c(d)),t){const d=document.createElement("script");d.type="text/javascript",d.textContent=o(t),s.appendChild(d)}return()=>{r.current&&(r.current.innerHTML="")}},[e,t,n]),e?a.jsx("div",{ref:r,className:"w-full rounded-lg overflow-hidden relative",style:{position:"relative",zIndex:1,maxWidth:"100%",contain:"layout paint"}}):null},bx=[{id:"metricas",name:"Sistema de Métricas",emoji:"📊",route:"/metricas"},{id:"organizador-numeros",name:"Organizador de Números",emoji:"📱",route:"/organizador-numeros"},{id:"track-ofertas",name:"Track Ofertas",emoji:"🎯",route:"/track-ofertas"},{id:"gerador-audio",name:"Gerador de Áudio",emoji:"🎙️",route:"/gerador-audio"},{id:"transcricao-audio",name:"Transcrição de Áudio",emoji:"📝",route:"/transcricao-audio"},{id:"painel-marketing",name:"Painel Marketing",emoji:"📈",route:"/smm-panel"},{id:"numeros-virtuais",name:"Números Virtuais",emoji:"📞",route:"/sms-bot"}],JF=()=>{var y;const{user:e}=at(),t=!!((y=$n())!=null&&y.scope),n=t?aC:he,r=Rt(),{isBlocking:s}=YF(),[o,i]=m.useState(null),[l,c]=m.useState(!1);m.useEffect(()=>{e&&!s&&d()},[e,s]),m.useEffect(()=>{s&&l&&c(!1)},[s,l]);const d=async()=>{try{const{data:g,error:x}=await he.from("admin_announcements").select("*").eq("is_active",!0).order("created_at",{ascending:!1});if(x)throw x;if(!g||g.length===0)return;const{data:v,error:b}=await n.from("user_announcement_views").select("announcement_id").eq("user_id",e==null?void 0:e.id);if(b)throw b;const w=new Set((v==null?void 0:v.map(N=>N.announcement_id))||[]),_=new Date,C=g.find(N=>!(w.has(N.id)||N.scheduled_at&&new Date(N.scheduled_at)>_));C&&(i(C),c(!0),await u(C.id))}catch(g){console.error("Error checking announcements:",g)}},u=async g=>{try{if(await n.from("user_announcement_views").upsert({user_id:e==null?void 0:e.id,announcement_id:g},{onConflict:"user_id,announcement_id",ignoreDuplicates:!0}),!t){const{count:x}=await n.from("user_announcement_views").select("*",{count:"exact",head:!0}).eq("announcement_id",g);await he.from("admin_announcements").update({views_count:x||0}).eq("id",g)}}catch(x){console.error("Error registering view:",x)}},f=async(g,x)=>{if(o){try{if(await n.from("user_announcement_views").update({clicked:!0}).eq("user_id",e==null?void 0:e.id).eq("announcement_id",o.id),!t){const{count:v}=await n.from("user_announcement_views").select("*",{count:"exact",head:!0}).eq("announcement_id",o.id).eq("clicked",!0);await he.from("admin_announcements").update({clicks_count:v||0}).eq("id",o.id)}}catch(v){console.error("Error registering click:",v)}if(g==="redirect"&&o.redirect_url)window.open(o.redirect_url,"_blank");else if(g==="system"&&x){const v=bx.find(b=>b.id===x);v&&r(v.route)}c(!1)}};if(!o)return null;const h=o.redirect_system?o.redirect_system.split(",").map(g=>g.trim()):[],p=!!o.video_code;return a.jsx(cn,{open:l,onOpenChange:c,children:a.jsxs(Qt,{className:"max-w-lg border-accent max-h-[90vh] overflow-y-auto",children:[a.jsx(qt,{children:o.title&&a.jsx(Gt,{className:"text-xl text-center",dangerouslySetInnerHTML:{__html:o.title}})}),a.jsxs("div",{className:"space-y-4",children:[p&&a.jsx(QF,{videoCode:o.video_code||"",optimizationCode:o.video_optimization_code,isVisible:l}),!p&&o.image_url&&a.jsx("div",{className:"w-full rounded-lg overflow-hidden",children:a.jsx("img",{src:o.image_url,alt:"Aviso",className:"w-full h-auto object-contain max-h-[70vh]"})}),a.jsx("div",{className:"text-center text-muted-foreground whitespace-pre-wrap",dangerouslySetInnerHTML:{__html:o.content}}),o.redirect_type==="system"&&h.length>0&&a.jsx("div",{className:"flex flex-wrap justify-center gap-3 pt-2",children:h.map(g=>{const x=bx.find(v=>v.id===g);return x?a.jsxs(pe,{variant:"outline",className:"flex flex-col items-center gap-1 h-auto py-3 px-4 border-accent hover:bg-accent/10",onClick:()=>f("system",g),children:[a.jsx("span",{className:"text-2xl",children:x.emoji}),a.jsx("span",{className:"text-xs",children:x.name})]},g):null})}),o.redirect_type==="custom_link"&&o.redirect_url&&a.jsx("div",{className:"flex justify-center pt-2",children:a.jsxs(pe,{onClick:()=>f("redirect"),className:"bg-accent hover:bg-accent/90 text-accent-foreground",children:[a.jsx(HC,{className:"mr-2 h-4 w-4"}),o.redirect_button_text||"Acessar"]})})]})]})})},e6=({userEmail:e,onExit:t})=>a.jsx(ht.div,{initial:{y:-50,opacity:0}
473,animate:{y:0,opacity:1},className:"sticky top-0 left-0 right-0 z-[60] bg-destructive text-destructive-foreground py-2 px-4 shadow-lg",children:a.jsxs("div",{className:"container mx-auto flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(VC,{className:"h-5 w-5"}),a.jsxs("span",{className:"font-medium",children:["Você está logado como: ",a.jsx("span",{className:"font-bold",children:e})]})]}),a.jsxs(pe,{variant:"secondary",size:"sm",onClick:t,className:"bg-white/20 hover:bg-white/30 text-white border-white/30",children:[a.jsx(qu,{className:"h-4 w-4 mr-2"}),"Sair da Conta"]})]})}),t6=()=>{const{t:e}=Qe("billing"),{isAdminTesting:t,isSimulatingPartial:n,systemStatus:r,updateStatus:s,loading:o}=V_(),i=t||n,l=async()=>{await s("inactive")&&rt.success(e("creditsBanner.testModeDeactivated"))};return a.jsx($l,{children:i&&!o&&a.jsx(ht.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2},className:"fixed top-14 md:top-16 left-0 right-0 z-50",children:a.jsx("div",{className:`w-full py-2.5 px-4 ${n?"bg-gradient-to-r from-purple-600 to-purple-500":"bg-gradient-to-r from-amber-500 to-orange-500"} shadow-lg`,children:a.jsxs("div",{className:"container mx-auto flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3 text-white",children:[a.jsx("div",{className:`p-1.5 rounded-full ${n?"bg-purple-700/50":"bg-amber-600/50"}`,children:n?a.jsx(mj,{className:"h-4 w-4"}):a.jsx(qC,{className:"h-4 w-4"})}),a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-1 sm:gap-3",children:[a.jsx("span",{className:"font-semibold text-sm",children:e(n?"creditsBanner.partialSimulationTitle":"creditsBanner.testModeTitle")}),a.jsx("span",{className:"text-xs text-white/80 hidden sm:inline",children:e(n?"creditsBanner.partialDescription":"creditsBanner.testDescription")})]})]}),a.jsxs(pe,{variant:"secondary",size:"sm",onClick:l,className:"h-7 text-xs font-medium bg-white/20 hover:bg-white/30 text-white border-0",children:[a.jsx(sr,{className:"h-3 w-3 mr-1"}),e("creditsBanner.deactivate")]})]})})})})},n6=()=>{const{t:e}=Qe(["affiliate","common"]),{user:t}=at(),n=Rt(),r=or(),[s,o]=m.useState(null),[i,l]=m.useState(()=>Mt.getItem("affiliate_widget_dismissed")==="true");m.useEffect(()=>{t!=null&&t.id&&oC.from("affiliates").select("id").eq("user_id",t.id).maybeSingle().then(({data:f})=>o(!!f),()=>o(null))},[t==null?void 0:t.id]);const c=["/auth","/affiliate"],d=/^\/criativos\/[^/]+/.test(r.pathname);if(i||d||c.some(f=>r.pathname===f)||r.pathname.startsWith("/inbox/chat")||s===null)return null;const u=f=>{f.stopPropagation(),Mt.setItem("affiliate_widget_dismissed","true"),l(!0)};return a.jsx($l,{children:a.jsxs(ht.div,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:{type:"spring",stiffness:260,damping:20,delay:2},"data-affiliate-widget":"",className:"fixed bottom-24 right-6 z-40 flex items-center gap-2",children:[a.jsx(ht.button,{onClick:()=>n("/affiliate"),initial:{opacity:0,x:20},animate:{opacity:1,x:0},transition:{delay:2.3},className:"affiliate-shimmer relative overflow-hidden bg-gradient-to-r from-accent/90 to-yellow-500/80 text-primary-foreground rounded-full px-4 py-2.5 shadow-lg border border-accent/40 hover:scale-105 transition-transform duration-200",children:a.jsx("span",{className:"relative z-10 text-xs font-bold whitespace-nowrap",children:e(s?"widget.panel":"widget.cta")})}),a.jsxs("div",{className:"relative",children:[a.jsxs("button",{onClick:()=>n("/affiliate"),className:xe("relative w-16 h-16 rounded-full flex items-center justify-center shadow-lg transition-all duration-300 hover:scale-110 animate-bounce-subtle",s?"bg-accent/20 border border-accent/30 text-accent hover:bg-accent/30":"bg-gradient-to-br from-accent to-yellow-500 border border-accent/40 text-primary-foreground affiliate-glow-pulse"),children:[!s&&a.jsx("span",{className:"absolute inset-0 rounded-full animate-ping bg-accent/20"}),a.jsx(zv,{className:"w-7 h-7 relative z-10"})]}),a.jsx("button",{onClick:u,className:"absolute -top-1 -right-1 w-5 h-5 rounded-full bg-muted border border-border flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-colors z-20",children:a.jsx(sr,{className:"w-3 h-3"})})]})]})})},r6=()=>{const{user:e}=at(),{isFreePlan:t,isPastDue:n,isSubscriptionExpired:r,isInGracePeriod:s,loading:o,subscription:i}=Xr(),{isAdmin:l}=Go(),{isFullMember:c}=Tf(),{isImpersonating:d}=qo(),{isCollaborator:u}=Da(),[f,h]=m.useState(!1),[p,y]=m.useState(!1);if(!e||o||!i||l||c||u||p)return null;const g=(n||r)&&s;if(!(t&&!g)&&!g)return null;const v=d?"top-24":"top-14";return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:xe("fixed left-0 right-0 z-40 px-4 py-2 flex items-center justify-center gap-3 text-sm shadow-md",g?"bg-destructive text-destructive-foreground":"bg-gradient-to-r from-accent/90 to-primary/90 text-primary-foreground",v),children:[a.jsx(bl,{className:"h-4 w-4 flex-shrink-0"}),a.jsx("span",{className:"font-medium",children:g?"⚠️ Pagamento pendente — regularize para manter o acesso às suas instâncias!":"Você está no plano Recarga. Assine um plano e desbloqueie todos os recursos!"}),a.jsx(pe,{size:"sm",variant:"secondary",onClick:()=>h(!0),className:"h-7 px-3 text-xs font-semibold",neon:!1,children:g?"Regularizar":"Ver Planos"}),a.jsx("button",{onClick:()=>y(!0),className:"absolute right-3 p-1 rounded hover:bg-white/20 transition-colors",children:a.jsx(sr,{className:"h-3.5 w-3.5"})})]}),a.jsx(pr,{open:f,onOpenChange:h,hideFreePlan:!0,mode:g?"regularize":void 0})]})};function s6(){const{t:e}=Qe(["notifications","common"]),t=j_(),[n,r]=m.useState([]),s=m.useCallback(o=>{r(i=>i.filter(l=>l.id!==o))},[]);return t||n.length===0?null:a.jsx("div",{className:"fixed top-16 right-4 z-[9999] flex flex-col gap-2 max-w-sm w-full pointer-events-none",children:a.jsx($l,{children:n.map(o=>a.jsx(ht.div,{initial:{opacity:0,x:60,scale:.97}
473,animate:{opacity:1,x:0,scale:1},exit:{opacity:0,x:60,scale:.97},transition:{duration:.25,ease:"easeOut"},className:"pointer-events-auto",children:a.jsxs("div",{className:"rounded-2xl bg-[#1a1a1e] border border-white/[0.04] p-3 flex items-start gap-3",children:[a.jsx("img",{src:N_(o.icon_url,pl),alt:e("iconAlt"),className:"w-10 h-10 rounded-xl object-cover flex-shrink-0",onError:i=>{i.target.src=pl}}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-semibold text-foreground truncate",children:o.title}),a.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 mt-0.5",children:o.message})]}),a.jsx("button",{onClick:()=>s(o.id),className:"text-muted-foreground hover:text-foreground transition-colors flex-shrink-0 mt-1",children:a.jsx(sr,{className:"w-3.5 h-3.5"})})]})},o.id))})})}const a6=10*60*1e3,o6=5*60*1e3,Tu="zapdata_update_attempts_v2",i6=3,l6=5*60*1e3,wx=30*1e3,c6=5*60*1e3,rd="1790891879902";function _x(){try{const e=localStorage.getItem(Tu);return e?JSON.parse(e):null}catch{return null}}function Sx(e){try{e===null?localStorage.removeItem(Tu):localStorage.setItem(Tu,JSON.stringify(e))}catch{}}const d6=()=>{const[e,t]=m.useState(!1),n=m.useRef(null),r=m.useRef(!1),s=m.useRef(0),o=m.useRef(null),i=m.useCallback(async d=>{if(r.current)return;r.current=!0;const u=Date.now(),f=_x();let h;if(f&&f.buildId===d)if(u-f.firstAttemptAt>l6)h={buildId:d,attempts:1,firstAttemptAt:u};else if(f.attempts>=i6){r.current=!1;try{window.dispatchEvent(new CustomEvent("zapdata:update-stuck"))}catch{}return}else h={...f,attempts:f.attempts+1};else h={buildId:d||`unknown-${u}`,attempts:1,firstAttemptAt:u};Sx(h),t(!0);try{if("caches"in window){const y=await caches.keys();await Promise.all(y.map(g=>caches.delete(g)))}}catch{}try{if("serviceWorker"in navigator){const y=await navigator.serviceWorker.getRegistrations();await Promise.all(y.map(g=>g.unregister().catch(()=>{})))}}catch{}const p=d||String(Date.now());window.location.replace(`/?v=${encodeURIComponent(p)}`)},[]),l=m.useCallback(()=>{if(o.current)return;const d=wx+Math.random()*(c6-wx),u=async()=>{if(o.current=null,!r.current){if($2()){o.current=setTimeout(u,3e4);return}try{const f=await fetch(`/version.json?t=${Date.now()}`,{cache:"no-store"});if(!f.ok)return;const h=await f.json();if(!(h!=null&&h.buildId)||h.buildId==="dev"||h.buildId===rd)return;i(h.buildId)}catch{}}};o.current=setTimeout(u,d)},[i]),c=m.useCallback(async()=>{if(r.current)return;const d=Date.now();if(!(d-s.current<o6)){s.current=d;try{const u=await fetch(`/version.json?t=${Date.now()}`,{cache:"no-store"});if(!u.ok)return;const f=await u.json();if(!(f!=null&&f.buildId)||rd==="dev"||f.buildId==="dev")return;if(f.buildId!==rd){try{window.dispatchEvent(new CustomEvent("zapdata:update-stuck"))}catch{}l()}else{o.current&&(clearTimeout(o.current),o.current=null);const h=_x();h&&h.buildId===f.buildId&&Sx(null)}}catch{}}},[l]);return m.useEffect(()=>{c(),n.current=setInterval(c,a6);const d=()=>{document.hidden||c()};return document.addEventListener("visibilitychange",d),()=>{n.current&&clearInterval(n.current),o.current&&(clearTimeout(o.current),o.current=null),document.removeEventListener("visibilitychange",d)}},[c]),{applying:e}},u6=()=>{const{applying:e}=d6();return e?a.jsx("div",{className:"fixed top-3 left-1/2 -translate-x-1/2 z-[80] px-3",role:"status",children:a.jsxs("div",{className:xe("flex items-center gap-2.5 px-4 py-2 rounded-full","border border-primary/30 bg-primary/15 backdrop-blur-xl","shadow-[0_8px_32px_-8px_hsl(var(--primary)/0.4)] text-foreground"),children:[a.jsx(bl,{className:"h-4 w-4 text-primary"}),a.jsx("span",{className:"text-sm font-semibold",children:"Atualizando para nova versão"}),a.jsx(st,{className:"h-4 w-4 animate-spin text-primary"})]})}):null};var Zl="Switch",[f6,uU]=Vn(Zl),[h6,p6]=f6(Zl),q_=m.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:o,required:i,disabled:l,value:c="on",onCheckedChange:d,form:u,...f}=e,[h,p]=m.useState(null),y=Ze(t,w=>p(w)),g=m.useRef(!1),x=h?u||!!h.closest("form"):!0,[v,b]=As({prop:s,defaultProp:o??!1,onChange:d,caller:Zl});return a.jsxs(h6,{scope:n,checked:v,disabled:l,children:[a.jsx(Ie.button,{type:"button",role:"switch","aria-checked":v,"aria-required":i,"data-state":X_(v),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:y,onClick:ze(e.onClick,w=>{b(_=>!_),x&&(g.current=w.isPropagationStopped(),g.current||w.stopPropagation())})}),x&&a.jsx(Y_,{control:h,bubbles:!g.current,name:r,value:c,checked:v,required:i,disabled:l,form:u,style:{transform:"translateX(-100%)"}})]})});q_.displayName=Zl;var G_="SwitchThumb",K_=m.forwardRef((e,t)=>
473{const{__scopeSwitch:n,...r}=e,s=p6(G_,n);return a.jsx(Ie.span,{"data-state":X_(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:t})});K_.displayName=G_;var m6="SwitchBubbleInput",Y_=m.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...s},o)=>{const i=m.useRef(null),l=Ze(i,o),c=kh(n),d=af(t);return m.useEffect(()=>{const u=i.current;if(!u)return;const f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(c!==n&&p){const y=new Event("click",{bubbles:r});p.call(u,n),u.dispatchEvent(y)}},[c,n,r]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:l,style:{...s.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Y_.displayName=m6;function X_(e){return e?"checked":"unchecked"}var Z_=q_,g6=K_;const yn=m.forwardRef(({className:e,...t},n)=>a.jsx(Z_,{className:xe("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",e),...t,ref:n,children:a.jsx(g6,{className:xe("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));yn.displayName=Z_.displayName;const x6=()=>{const[e,t]=m.useState(!1),[n,r]=m.useState(!1),[s,o]=m.useState(!0);if(m.useEffect(()=>{t(!G4()),o(!ul())},[]),!e)return null;const i=()=>{K4(),t(!1)},l=c=>{o(c),q4(!c)};return a.jsx("div",{className:"fixed bottom-3 inset-x-3 sm:inset-x-auto sm:right-4 sm:max-w-sm z-50",children:a.jsx("div",{className:"bg-background border border-border/60 rounded-xl shadow-lg p-4",children:n?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("p",{className:"text-xs font-medium text-foreground",children:"Preferências de cookies"}),a.jsx("button",{type:"button","aria-label":"Fechar aviso",onClick:i,className:"text-muted-foreground/60 hover:text-foreground transition-colors",children:a.jsx(sr,{className:"h-3.5 w-3.5"})})]}),a.jsxs("div",{className:"flex items-center justify-between gap-3 py-1.5",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-foreground",children:"Necessários"}),a.jsx("p",{className:"text-[11px] text-muted-foreground/70",children:"Login, segurança e funcionamento básico. Sempre ativos."})]}),a.jsx(yn,{checked:!0,disabled:!0})]}),a.jsxs("div",{className:"flex items-center justify-between gap-3 py-1.5",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-foreground",children:"Marketing e personalização"}),a.jsx("p",{className:"text-[11px] text-muted-foreground/70",children:"Anúncios e medição de campanhas (Meta, Google, TikTok)."})]}),a.jsx(yn,{checked:s,onCheckedChange:l})]}),a.jsx("button",{type:"button",onClick:i,className:"mt-3 w-full text-xs font-medium text-accent hover:text-accent/80 transition-colors text-center",children:"Salvar preferências"})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-start gap-2.5",children:[a.jsx(UC,{className:"h-4 w-4 text-accent mt-0.5 shrink-0"}),a.jsxs("p",{className:"text-xs leading-relaxed text-muted-foreground",children:["Usamos cookies para melhorar sua experiência e personalizar anúncios. Ao continuar navegando, você concorda com isso, conforme nosso"," ",a.jsx(_a,{to:"/privacidade",className:"underline hover:text-foreground transition-colors",children:"Aviso de Privacidade"}),"."]}),a.jsx("button",{type:"button","aria-label":"Fechar aviso",onClick:i,className:"text-muted-foreground/60 hover:text-foreground transition-colors shrink-0",children:a.jsx(sr,{className:"h-3.5 w-3.5"})})]}),a.jsxs("div",{className:"flex items-center gap-3 mt-3",children:[a.jsx("button",{type:"button",onClick:()=>r(!0),className:"text-xs underline text-muted-foreground hover:text-foreground transition-colors",children:"Preferências de cookies"}),a.jsx("button",{type:"button",onClick:i,className:"text-xs font-medium text-accent hover:text-accent/80 transition-colors ml-auto",children:"Entendi"})]})]})})})};function v6(){const e=Rt();return m.useEffect(()=>{const t=iC(window.location.hash);if(!t)return;const n=new URL(t,window.location.origin);e({pathname:n.pathname,search:n.search,hash:""},{replace:!0})},[e]),null}const y6=()=>{const[e,t]=m.useState(!1);return m.useEffect(()=>{const n=()=>t(!0);return window.addEventListener("zapdata:update-stuck",n),()=>window.removeEventListener("zapdata:update-stuck",n)},[]),e?a.jsx("div",{className:"fixed bottom-4 left-1/2 -translate-x-1/2 z-[90] px-3 w-[min(440px,calc(100vw-24px))]",children:a.jsxs("button",{type:"button",onClick:()=>lC("stuck-toast"),className:"w-full flex items-center gap-3 px-4 py-3 rounded-2xl border border-primary/40 bg-background/95 backdrop-blur-xl shadow-[0_12px_40px_-8px_hsl(var(--primary)/0.5)] text-left hover:bg-primary/10 transition-colors",children:[a.jsx(bl,{className:"h-5 w-5 text-primary shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-sm font-semibold text-foreground",children:"Nova versão disponível"}),a.jsx("div",{className:"text-xs text-muted-foreground",children:"Clique para atualizar agora e liberar funções novas."})]}),a.jsx(nj,{className:"h-4 w-4 text-primary shrink-0"})]})}):null},b6=6e4,w6=2*6e4;let Cx=0;const _6=e=>{const t=(e==null?void 0:e.code)??"";return t==="42883"||t==="PGRST202"?!0:/upsert_realtime_presence/i.test((e==null?void 0:e.message)??"")&&/not (?:exist|find|found)|does not exist|schema cache/i.test((e==null?void 0:e.message)??"")},S6=()=>{const{user:e}=at(),{effectiveUserId:t}=ti(),n=t||(e==null?void 0:e.id)||null;m.useEffect(()=>{if(!n)return;let r=!1,s=!1;const o=async()=>
473{if(!(r||s)&&!(Date.now()<Cx)){s=!0;try{const{error:l}=await he.rpc("upsert_realtime_presence",{p_owner_user_id:n});l&&_6(l)&&(Cx=Date.now()+w6)}catch{}finally{s=!1}}};o();const i=setInterval(o,b6);return()=>{r=!0,clearInterval(i)}},[n])},C6={default:"bg-zinc-950 border-primary text-white",success:"bg-zinc-950 border-primary text-white",error:"bg-zinc-950 border-destructive text-white",warning:"bg-zinc-950 border-amber-500 text-white"},j6={default:"text-white",success:"text-primary",error:"text-destructive",warning:"text-amber-500"},k6={default:"text-primary",success:"text-primary",error:"text-destructive",warning:"text-amber-500"},E6={default:Hu,success:zC,error:FC,warning:Jn},N6={initial:{opacity:0,y:50,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:50,scale:.95}},Q_=m.forwardRef(({defaultPosition:e="bottom-right"},t)=>{const n=m.useRef(null);return m.useImperativeHandle(t,()=>({show({title:r,message:s,variant:o="default",duration:i=4e3,position:l=e,actions:c,onDismiss:d,highlightTitle:u}){const f=E6[o];n.current=rt.custom(h=>a.jsxs(ht.div,{...N6,transition:{type:"spring",stiffness:350,damping:25},className:xe("flex w-[22rem] items-start justify-between gap-3 rounded-lg border p-4 shadow-lg",C6[o]),children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(f,{className:xe("mt-0.5 h-5 w-5",k6[o])}),a.jsxs("div",{className:"flex flex-col gap-1",children:[r&&a.jsx("p",{className:xe("text-sm font-semibold",u?j6[o]:"text-foreground"),children:r}),a.jsx("p",{className:"text-sm text-zinc-300",children:s})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[(c==null?void 0:c.label)&&a.jsx(pe,{size:"sm",variant:"outline",onClick:()=>{c.onClick(),rt.dismiss(h)},className:xe("cursor-pointer",o==="success"?"text-green-600 border-green-600 hover:bg-green-600/10 dark:hover:bg-green-400/20":o==="error"?"text-destructive border-destructive hover:bg-destructive/10 dark:hover:bg-destructive/20":o==="warning"?"text-amber-600 border-amber-600 hover:bg-amber-600/10 dark:hover:bg-amber-400/20":"text-foreground border-border hover:bg-muted/10 dark:hover:bg-muted/20"),children:c.label}),a.jsx("button",{onClick:()=>{rt.dismiss(h),d==null||d()},className:"rounded-full p-1 hover:bg-muted/50 dark:hover:bg-muted/30 transition-colors focus:outline-none focus:ring-2 focus:ring-ring","aria-label":"Dismiss notification",children:a.jsx(sr,{className:"h-4 w-4 text-muted-foreground"})})]})]}),{duration:i,position:l})}})),a.jsx(VP,{position:e,visibleToasts:5,style:{zIndex:2147483647}})});Q_.displayName="Toaster";const ml="affiliate_attribution",J_=30*24*60*60*1e3,eS=["affiliate_ref","affiliate_free_trial","affiliate_flow_link"];function P6(){try{const e=sessionStorage.getItem("affiliate_ref");if(!e)return;localStorage.setItem(ml,JSON.stringify({ref:e,trial:sessionStorage.getItem("affiliate_free_trial")==="1",gift:sessionStorage.getItem("affiliate_flow_link"),expiresAt:Date.now()+J_}))}catch{}}function A6(){try{const e=localStorage.getItem(ml);if(!e)return;const t=JSON.parse(e);if(!t||typeof t.ref!="string"||!t.ref||typeof t.expiresAt!="number"||t.expiresAt<=Date.now()||t.expiresAt>Date.now()+J_||typeof t.trial!="boolean"||t.gift!==null&&typeof t.gift!="string"){tS();return}eS.forEach(n=>sessionStorage.removeItem(n)),sessionStorage.setItem("affiliate_ref",t.ref),t.trial&&sessionStorage.setItem("affiliate_free_trial","1"),t.gift&&sessionStorage.setItem("affiliate_flow_link",t.gift)}catch{try{localStorage.removeItem(ml)}catch{}}}function tS(){try{localStorage.removeItem(ml)}catch{}eS.forEach(e=>
473{try{sessionStorage.removeItem(e)}catch{}})}var T6=Object.defineProperty,I6=Object.defineProperties,M6=Object.getOwnPropertyDescriptors,gl=Object.getOwnPropertySymbols,nS=Object.prototype.hasOwnProperty,rS=Object.prototype.propertyIsEnumerable,jx=(e,t,n)=>t in e?T6(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,R6=(e,t)=>{for(var n in t||(t={}))nS.call(t,n)&&jx(e,n,t[n]);if(gl)for(var n of gl(t))rS.call(t,n)&&jx(e,n,t[n]);return e},D6=(e,t)=>I6(e,M6(t)),O6=(e,t)=>{var n={};for(var r in e)nS.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&gl)for(var r of gl(e))t.indexOf(r)<0&&rS.call(e,r)&&(n[r]=e[r]);return n};function L6(e){let t=setTimeout(e,0),n=setTimeout(e,10),r=setTimeout(e,50);return[t,n,r]}function F6(e){let t=m.useRef();return m.useEffect(()=>{t.current=e}),t.current}var z6=18,sS=40,B6=`${sS}px`,V6=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function $6({containerRef:e,inputRef:t,pushPasswordManagerStrategy:n,isFocused:r}){let[s,o]=m.useState(!1),[i,l]=m.useState(!1),[c,d]=m.useState(!1),u=m.useMemo(()=>n==="none"?!1:(n==="increase-width"||n==="experimental-no-flickering")&&s&&i,[s,i,n]),f=m.useCallback(()=>{let h=e.current,p=t.current;if(!h||!p||c||n==="none")return;let y=h,g=y.getBoundingClientRect().left+y.offsetWidth,x=y.getBoundingClientRect().top+y.offsetHeight/2,v=g-z6,b=x;document.querySelectorAll(V6).length===0&&document.elementFromPoint(v,b)===h||(o(!0),d(!0))},[e,t,c,n]);return m.useEffect(()=>{let h=e.current;if(!h||n==="none")return;function p(){let g=window.innerWidth-h.getBoundingClientRect().right;l(g>=sS)}p();let y=setInterval(p,1e3);return()=>{clearInterval(y)}},[e,n]),m.useEffect(()=>{let h=r||document.activeElement===t.current;if(n==="none"||!h)return;let p=setTimeout(f,0),y=setTimeout(f,2e3),g=setTimeout(f,5e3),x=setTimeout(()=>{d(!0)},6e3);return()=>{clearTimeout(p),clearTimeout(y),clearTimeout(g),clearTimeout(x)}},[t,r,n,f]),{hasPWMBadge:s,willPushPWMBadge:u,PWM_BADGE_SPACE_WIDTH:B6}}var aS=m.createContext({}),oS=m.forwardRef((e,t)=>{var n=e,{value:r,onChange:s,maxLength:o,textAlign:i="left",pattern:l,placeholder:c,inputMode:d="numeric",onComplete:u,pushPasswordManagerStrategy:f="increase-width",pasteTransformer:h,containerClassName:p,noScriptCSSFallback:y=U6,render:g,children:x}=n,v=O6(n,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),b,w,_,C,N;let[k,P]=m.useState(typeof v.defaultValue=="string"?v.defaultValue:""),A=r??k,T=F6(A),D=m.useCallback(j=>{s==null||s(j),P(j)},[s]),E=m.useMemo(()=>l?typeof l=="string"?new RegExp(l):l:null,[l]),I=m.useRef(null),S=m.useRef(null),L=m.useRef({value:A,onChange:D,isIOS:typeof window<"u"&&((w=(b=window==null?void 0:window.CSS)==null?void 0:b.supports)==null?void 0:w.call(b,"-webkit-touch-callout","none"))}),Y=m.useRef({prev:[(_=I.current)==null?void 0:_.selectionStart,(C=I.current)==null?void 0:C.selectionEnd,(N=I.current)==null?void 0:N.selectionDirection]});m.useImperativeHandle(t,()=>I.current,[]),m.useEffect(()=>{let j=I.current,H=S.current;if(!j||!H)return;L.current.value!==j.value&&L.current.onChange(j.value),Y.current.prev=[j.selectionStart,j.selectionEnd,j.selectionDirection];function G(){if(document.activeElement!==j){M(null),K(null);return}let U=j.selectionStart,V=j.selectionEnd,Q=j.selectionDirection,W=j.maxLength,se=j.value,fe=Y.current.prev,ce=-1,me=-1,ke;if(se.length!==0&&U!==null&&V!==null){let ye=U===V,Re=U===se.length&&se.length<W;if(ye&&!Re){let Ce=U;if(Ce===0)ce=0,me=1,ke="forward";else if(Ce===W)ce=Ce-1,me=Ce,ke="backward";else if(W>1&&se.length>1){let De=0;if(fe[0]!==null&&fe[1]!==null){ke=Ce<fe[1]?"backward":"forward";let Ue=fe[0]===fe[1]&&fe[0]<W;ke==="backward"&&!Ue&&(De=-1)}ce=De+Ce,me=De+Ce+1}}ce!==-1&&me!==-1&&ce!==me&&I.current.setSelectionRange(ce,me,ke)}let Ne=ce!==-1?ce:U,Je=me!==-1?me:V,ct=ke??Q;M(Ne),K(Je),Y.current.prev=[Ne,Je,ct]}if(document.addEventListener("selectionchange",G,{capture:!0}),G(),document.activeElement===j&&ee(!0),!document.getElementById("input-otp-style")){let U=document.createElement("style");if(U.id="input-otp-style",document.head.appendChild(U),U.sheet){let V="background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;";Za(U.sheet,"[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"),Za(U.sheet,`[data-input-otp]:autofill { ${V} }`),Za(U.sheet,`[data-input-otp]:-webkit-autofill { ${V} }
473`),Za(U.sheet,"@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"),Za(U.sheet,"[data-input-otp] + * { pointer-events: all !important; }")}}let O=()=>{H&&H.style.setProperty("--root-height",`${j.clientHeight}px`)};O();let R=new ResizeObserver(O);return R.observe(j),()=>{document.removeEventListener("selectionchange",G,{capture:!0}),R.disconnect()}},[]);let[B,q]=m.useState(!1),[F,ee]=m.useState(!1),[$,M]=m.useState(null),[J,K]=m.useState(null);m.useEffect(()=>{L6(()=>{var j,H,G,O;(j=I.current)==null||j.dispatchEvent(new Event("input"));let R=(H=I.current)==null?void 0:H.selectionStart,U=(G=I.current)==null?void 0:G.selectionEnd,V=(O=I.current)==null?void 0:O.selectionDirection;R!==null&&U!==null&&(M(R),K(U),Y.current.prev=[R,U,V])})},[A,F]),m.useEffect(()=>{T!==void 0&&A!==T&&T.length<o&&A.length===o&&(u==null||u(A))},[o,u,T,A]);let X=$6({containerRef:S,inputRef:I,pushPasswordManagerStrategy:f,isFocused:F}),de=m.useCallback(j=>{let H=j.currentTarget.value.slice(0,o);if(H.length>0&&E&&!E.test(H)){j.preventDefault();return}typeof T=="string"&&H.length<T.length&&document.dispatchEvent(new Event("selectionchange")),D(H)},[o,D,T,E]),te=m.useCallback(()=>{var j;if(I.current){let H=Math.min(I.current.value.length,o-1),G=I.current.value.length;(j=I.current)==null||j.setSelectionRange(H,G),M(H),K(G)}ee(!0)},[o]),ae=m.useCallback(j=>{var H,G;let O=I.current;if(!h&&(!L.current.isIOS||!j.clipboardData||!O))return;let R=j.clipboardData.getData("text/plain"),U=h?h(R):R;j.preventDefault();let V=(H=I.current)==null?void 0:H.selectionStart,Q=(G=I.current)==null?void 0:G.selectionEnd,W=(V!==Q?A.slice(0,V)+U+A.slice(Q):A.slice(0,V)+U+A.slice(V)).slice(0,o);if(W.length>0&&E&&!E.test(W))return;O.value=W,D(W);let se=Math.min(W.length,o-1),fe=W.length;O.setSelectionRange(se,fe),M(se),K(fe)},[o,D,E,A]),re=m.useMemo(()=>({position:"relative",cursor:v.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[v.disabled]),le=m.useMemo(()=>({position:"absolute",inset:0,width:X.willPushPWMBadge?`calc(100% + ${X.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:X.willPushPWMBadge?`inset(0 ${X.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:i,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[X.PWM_BADGE_SPACE_WIDTH,X.willPushPWMBadge,i]),ue=m.useMemo(()=>m.createElement("input",D6(R6({autoComplete:v.autoComplete||"one-time-code"},v),{"data-input-otp":!0,"data-input-otp-placeholder-shown":A.length===0||void 0,"data-input-otp-mss":$,"data-input-otp-mse":J,inputMode:d,pattern:E==null?void 0:E.source,"aria-placeholder":c,style:le,maxLength:o,value:A,ref:I,onPaste:j=>{var H;ae(j),(H=v.onPaste)==null||H.call(v,j)},onChange:de,onMouseOver:j=>{var H;q(!0),(H=v.onMouseOver)==null||H.call(v,j)},onMouseLeave:j=>{var H;q(!1),(H=v.onMouseLeave)==null||H.call(v,j)},onFocus:j=>{var H;te(),(H=v.onFocus)==null||H.call(v,j)},onBlur:j=>{var H;ee(!1),(H=v.onBlur)==null||H.call(v,j)}})),[de,te,ae,d,le,o,J,$,v,E==null?void 0:E.source,A]),z=m.useMemo(()=>({slots:Array.from({length:o}).map((j,H)=>{var G;let O=F&&$!==null&&J!==null&&($===J&&H===$||H>=$&&H<J),R=A[H]!==void 0?A[H]:null,U=A[0]!==void 0?null:(G=c==null?void 0:c[H])!=null?G:null;return{char:R,placeholderChar:U,isActive:O,hasFakeCaret:O&&R===null}}),isFocused:F,isHovering:!v.disabled&&B}),[F,B,o,J,$,v.disabled,A]),ie=m.useMemo(()=>g?g(z):m.createElement(aS.Provider,{value:z},x),[x,z,g]);return m.createElement(m.Fragment,null,y!==null&&m.createElement("noscript",null,m.createElement("style",null,y)),m.createElement("div",{ref:S,"data-input-otp-container":!0,style:re,className:p},ie,m.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},ue)))});oS.displayName="Input";function Za(e,t){try{e.insertRule(t)}catch{console.error("input-otp could not insert CSS rule:",t)}}var U6=`
474[data-input-otp] {
475  --nojs-bg: white !important;
476  --nojs-fg: black !important;
477
478  background-color: var(--nojs-bg) !important;
479  color: var(--nojs-fg) !important;
480  caret-color: var(--nojs-fg) !important;
481  letter-spacing: .25em !important;
482  text-align: center !important;
483  border: 1px solid var(--nojs-fg) !important;
484  border-radius: 4px !important;
485  width: 100% !important;
486}
487@media (prefers-color-scheme: dark) {
488  [data-input-otp] {
489    --nojs-bg: black !important;
490    --nojs-fg: white !important;
491  }
492}`;const iS=m.forwardRef(({className:e,containerClassName:t,...n},r)=>a.jsx(oS,{ref:r,containerClassName:xe("flex items-center gap-2 has-[:disabled]:opacity-50",t),className:xe("disabled:cursor-not-allowed",e),...n}));iS.displayName="InputOTP";const lS=m.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:xe("flex items-center",e),...t}));lS.displayName="InputOTPGroup";const as=m.forwardRef(({index:e,className:t,...n},r)=>{const s=m.useContext(aS),{char:o,hasFakeCaret:i,isActive:l}=s.slots[e];return a.jsxs("div",{ref:r,className:xe("relative flex h-10 w-10 items-center justify-center border-y border-r border-input text-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md",l&&"z-10 ring-2 ring-ring ring-offset-background",t),...n,children:[o,i&&a.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:a.jsx("div",{className:"animate-caret-blink h-4 w-px bg-foreground duration-1000"})})]})});as.displayName="InputOTPSlot";const W6=m.forwardRef(({...e},t)=>a.jsx("div",{ref:t,role:"separator",...e,children:a.jsx(WC,{})}));W6.displayName="InputOTPSeparator";const H6="/_releases/admin/assets/zapdata-logo-auth-DiXjtKTO.webp",kx="cf-turnstile-script",q6="https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit";let Qa=null;const G6=()=>typeof window>"u"||window.turnstile?Promise.resolve():Qa||(Qa=new Promise((e,t)=>
492{const n=document.getElementById(kx);if(n){n.addEventListener("load",()=>e(),{once:!0}),n.addEventListener("error",()=>t(new Error("Turnstile script failed")),{once:!0});return}const r=document.createElement("script");r.id=kx,r.src=q6,r.async=!0,r.defer=!0,r.onload=()=>e(),r.onerror=()=>{Qa=null,t(new Error("Turnstile script failed"))},document.head.appendChild(r)}),Qa),K6="1x00000000000000000000AA",Y6=()=>{if(typeof window>"u")return!1;const e=window.location.hostname;return e==="localhost"||e==="127.0.0.1"},Ex=({onVerify:e,onExpire:t,onError:n,action:r,className:s})=>{const{t:o}=Qe("auth"),i=m.useRef(null),l=m.useRef(null),[c,d]=m.useState(null),f=Y6()?K6:"0x4AAAAAAC_HWREccNQ_KU7G";return m.useEffect(()=>{let h=!1;if(!f){d(o("errors.turnstileNotConfigured"));return}return G6().then(()=>{if(!(h||!i.current||!window.turnstile)){if(l.current){try{window.turnstile.remove(l.current)}catch{}l.current=null}l.current=window.turnstile.render(i.current,{sitekey:f,theme:"dark",size:"flexible",action:r,callback:p=>e(p),"expired-callback":()=>t==null?void 0:t(),"timeout-callback":()=>t==null?void 0:t(),"error-callback":()=>n==null?void 0:n()})}}).catch(()=>{h||d(o("errors.turnstileLoadFailed"))}),()=>{if(h=!0,l.current&&window.turnstile){try{window.turnstile.remove(l.current)}catch{}l.current=null}}},[f]),c?a.jsx("p",{className:`text-xs text-destructive ${s??""}`,children:c}):a.jsx("div",{className:`flex justify-center w-full overflow-hidden ${s??""}`,children:a.jsx("div",{ref:i,className:"origin-center scale-[0.85] sm:scale-100 min-h-[56px] sm:min-h-[65px] w-full"})})},Nx=()=>{if(typeof window<"u"&&window.turnstile)try{window.turnstile.reset()}catch{}},X6=()=>{const{t:e}=Qe(["auth","common"]),{intlLocale:t}=$_(),[n,r]=m.useState(null);return m.useEffect(()=>{(async()=>{try{const{data:o,error:i}=await Ln.rpc("get_public_user_count");!i&&typeof o=="number"&&r(o)}catch(o){console.error("Error fetching user count:",o)}})()},[]),n===null?a.jsx("p",{className:"text-xs text-muted-foreground text-center mt-4",children:e("userCount.joinCommunity")}):a.jsxs("p",{className:"text-xs text-muted-foreground text-center mt-4",children:[e("userCount.prefix")," ",a.jsx("span",{className:"text-accent font-semibold",children:n.toLocaleString(t)})," ",e("userCount.suffix")]})};function Ja(e){const t=new URLSearchParams(e).get("next");return!t||!t.startsWith("/")||t.startsWith("//")||t.includes("\\")?"/":t}const cS=()=>{const{t:e}=Qe(["auth","common"]),[t,n]=m.useState(""),[r,s]=m.useState(""),[o,i]=m.useState(""),[l,c]=m.useState(""),[d,u]=m.useState(""),[f,h]=m.useState(!1),[p,y]=m.useState(!1),[g,x]=m.useState(!1),[v,b]=m.useState(!1),[w,_]=m.useState("login"),[C,N]=m.useState(null),[k,P]=m.useState(!1),[A,T]=m.useState(!1),[D,E]=m.useState(""),[I,S]=m.useState(null),[L,Y]=m.useState(!1),[B,q]=m.useState(!1),[F,ee]=m.useState(null),[$,M]=m.useState(!1),[J,K]=m.useState(""),[X,de]=m.useState(!1),[te,ae]=m.useState(null),[re,le]=m.useState(null),{signIn:ue,signUp:z,user:ie}=at(),j=Rt(),[H,G]=m.useState(null),[O,R]=m.useState(!1);m.useEffect(()=>{const ye=new URLSearchParams(window.location.search),Re=new URLSearchParams(window.location.hash.split("?")[1]||""),Ce=ye.get("ref")||Re.get("ref"),De=ye.get("trial")||Re.get("trial"),Ue=ye.get("gift")||Re.get("gift");if(Ce){Ue?sessionStorage.setItem("affiliate_flow_link",Ue):sessionStorage.removeItem("affiliate_flow_link"),De!=="1"&&sessionStorage.removeItem("affiliate_free_trial"),G(Ce),sessionStorage.setItem("affiliate_ref",Ce);const Ve=`aff_click_${Ce}`;sessionStorage.getItem(Ve)||(sessionStorage.setItem(Ve,"1"),Ln.trackAffiliateClick(Ce,navigator.userAgent).then(()=>{}))}else{A6();const Ve=sessionStorage.getItem("affiliate_ref");Ve&&G(Ve)}De==="1"?(R(!0),sessionStorage.setItem("affiliate_free_trial","1")):sessionStorage.getItem("affiliate_free_trial")==="1"&&R(!0),Ce&&P6()},[]),m.useEffect(()=>{const ye=window.matchMedia("(hover: hover) and (pointer: fine)");P(ye.matches);const Re=Ce=>P(Ce.matches);return ye.addEventListener("change",Re),()=>ye.removeEventListener("change",Re)},[]),m.useEffect(()=>{cC()},[]);const U=hu(0),V=hu(0),Q=Fg(V,[-300,300],[8,-8]),W=Fg(U,[-300,300],[-8,8]),se=ye=>{if(!k)return;const Re=ye.currentTarget.getBoundingClientRect();U.set(ye.clientX-Re.left-Re.width/2),V.set(ye.clientY-Re.top-Re.height/2)},fe=()=>{U.set(0),V.set(0)};m.useEffect(()=>{ie&&j(Ja(window.location.search))},[ie,j]);const ce=async(ye,Re,Ce)=>{let De;const Ue=new Promise((Ve,pt)=>{De=window.setTimeout(()=>{pt(new Error(e("errors.timeoutGeneric",{label:Ce})))},Re)});try{return await Promise.race([ye,Ue])}finally{De&&window.clearTimeout(De)}},me=async ye=>{var Re;if(ye.preventDefault(),!t||!r){Ye.error(e("errors.requiredFields.title"),e("errors.requiredFields.description"));return}if(!te){Ye.error(e("errors.verificationRequired.title"),e("errors.verificationRequired.description"));return}y(!0);try{const{error:Ce,data:De}=await ce(ue(t,r,te??void 0),15e3,e("timeouts.login"));if(Ce){ae(null),Nx(),Ye.error(e("errors.loginError.title"),Ce.message);return}const Ue=(Re=De==null?void 0:De.user)==null?void 0:Re.id;ee(Ue||null);let Ve=!1;
492if(Ue)try{const{data:pt}=await fp.isBlocked(Ue);Ve=!!pt}catch{}if(!Ve)try{const{data:pt}=await ce(he.auth.mfa.listFactors(),8e3,e("timeouts.twoFactorCheck")),jt=((pt==null?void 0:pt.totp)||[]).find(Bt=>Bt.status==="verified");if(jt){let Bt={};try{Bt=JSON.parse(localStorage.getItem("mfa_trusted_devices")||"{}")}catch{Bt={}}if(Bt[Ue||""]){Ye.success(e("success.title"),e("success.loginSuccess")),j(Ja(window.location.search));return}S(jt.id),T(!0);return}}catch(pt){console.log("MFA check skipped:",pt)}Ye.success(e("success.title"),e("success.loginSuccess")),j(Ja(window.location.search))}catch(Ce){Ye.error(e("errors.loginError.title"),(Ce==null?void 0:Ce.message)||e("errors.loginError.fallback"))}finally{y(!1)}},ke=async()=>{if(!(!I||D.length!==6)){Y(!0);try{const{data:ye,error:Re}=await he.auth.mfa.challenge({factorId:I});if(Re)throw Re;const{error:Ce}=await he.auth.mfa.verify({factorId:I,challengeId:ye.id,code:D});if(Ce)throw Ce;if(B&&F){const De=JSON.parse(localStorage.getItem("mfa_trusted_devices")||"{}");De[F]=Date.now().toString(),localStorage.setItem("mfa_trusted_devices",JSON.stringify(De))}T(!1),E(""),q(!1),Ye.success(e("success.title"),e("success.loginSuccess")),j(Ja(window.location.search))}catch(ye){console.error("MFA verification error:",ye),Ye.error(e("errors.invalidCode.title"),e("errors.invalidCode.description")),E("")}finally{Y(!1)}}},Ne=async()=>{await he.auth.signOut(),T(!1),E(""),S(null),q(!1)},Je=async ye=>{if(ye.preventDefault(),!o||!l||!d){Ye.error(e("errors.requiredFields.title"),e("errors.requiredFields.description"));return}if(!o.includes("@")||!o.includes(".")){Ye.error(e("errors.invalidEmail.title"),e("errors.invalidEmail.description"));return}if(l!==d){Ye.error(e("errors.passwordMismatch.title"),e("errors.passwordMismatch.description"));return}if(l.length<6){Ye.error(e("errors.passwordTooShort.title"),e("errors.passwordTooShort.description"));return}if(!re){Ye.error(e("errors.verificationRequired.title"),e("errors.verificationRequired.description"));return}if(!f){Ye.error(e("errors.termsNotAccepted.title"),e("errors.termsNotAccepted.description"));return}y(!0);const Re=H||sessionStorage.getItem("affiliate_ref"),Ce=O||sessionStorage.getItem("affiliate_free_trial")==="1";try{const{error:De,data:Ue}=await ce(z(o,l,re??void 0,Re?{ref:Re,linkId:sessionStorage.getItem("affiliate_flow_link")||void 0,isFreeTrial:Ce}:void 0),2e4,e("timeouts.accountCreation"));if(De){le(null),Nx(),Ye.error(e("errors.signupError.title"),De.message);return}tS();try{dC(o)}catch(Ve){console.warn("Registration tracking failed:",Ve)}if(Ue!=null&&Ue.user&&!(Ue!=null&&Ue.session)){Ye.success(e("success.accountCreated.title"),e("success.accountCreated.confirmEmailDescription"));return}if(Ye.success(e("success.accountCreated.title"),e("success.accountCreated.description")),Ue!=null&&Ue.user){const Ve=Re;if(Ce){sessionStorage.setItem("is_free_trial_user","1");try{const{data:At,error:jt}=await fp.provisionTrial(Ue.user.id,Ve||null);jt?console.error("[FREE-TRIAL] Provision RPC error:",jt):At!=null&&At.success?console.log("[FREE-TRIAL] Provisioned successfully via RPC",At):console.error("[FREE-TRIAL] Provision RPC failed:",At)}catch(At){console.error("Error provisioning free trial:",At)}sessionStorage.removeItem("affiliate_free_trial")}j(Ja(window.location.search))}}catch(De){Ye.error(e("errors.generic"),(De==null?void 0:De.message)||e("errors.signupError.fallback"))}finally{y(!1)}},ct=async()=>{if(!J){Ye.error(e("errors.emailRequired.title"),e("errors.emailRequired.description"));return}if(!J.includes("@")||!J.includes(".")){Ye.error(e("errors.invalidEmail.title"),e("errors.invalidEmail.description"));return}de(!0);try{const{data:ye,error:Re}=await Ln.functions.invoke("forgot-password",{body:{email:J,redirectTo:`${window.location.origin}/reset-password`}});if(Re){const Ce=await Tv(Re,e("errors.sendEmailFailed"));Ye.error(e("errors.generic"),Ce);return}if(ye&&ye.success===!1&&ye.error){Ye.error(e("errors.userNotFound.title"),ye.error);return}Ye.success(e("success.emailSent.title"),(ye==null?void 0:ye.message)||e("success.emailSent.fallback")),M(!1),K("")}catch{Ye.error(e("errors.generic"),e("errors.sendEmailFailed"))}finally{de(!1)}};return a.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-background overflow-hidden relative isolate",children:[a.jsx("div",{className:"fixed inset-0 z-0 pointer-events-none bg-gradient-to-b from-background via-background to-background",children:a.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-[800px] h-[600px] bg-[radial-gradient(ellipse_at_center,hsl(var(--accent)/0.15)_0%,transparent_70%)]"})}),a.jsx("div",{className:"fixed inset-0 z-0 pointer-events-none bg-[url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMDAiIGhlaWdodD0iMzAwIj48ZmlsdGVyIGlkPSJhIiB4PSIwIiB5PSIwIj48ZmVUdXJidWxlbmNlIGJhc2VGcmVxdWVuY3k9Ii43NSIgc3RpdGNoVGlsZXM9InN0aXRjaCIgdHlwZT0iZnJhY3RhbE5vaXNlIi8+PGZlQ29sb3JNYXRyaXggdHlwZT0ic2F0dXJhdGUiIHZhbHVlcz0iMCIvPjwvZmlsdGVyPjxwYXRoIGQ9Ik0wIDBoMzAwdjMwMEgweiIgZmlsdGVyPSJ1cmwoI2EpIiBvcGFjaXR5PSIuMDUiLz48L3N2Zz4=')] opacity-50"}),a.jsx("div",{className:"fixed top-0 left-0 right-0 h-64 z-0 pointer-events-none bg-gradient-to-b from-accent/5 to-transparent"}),a.jsx(ht.div,{className:"fixed top-1/4 left-1/4 w-96 h-96 z-0 pointer-events-none bg-accent/10 rounded-full blur-3xl",animate:{x:[0,50,0],y:[0,-30,0],scale:[1,1.1,1]},transition:{duration:8,repeat:1/0,ease:"easeInOut"}}),a.jsx(ht.div,{className:"fixed bottom-1/4 right-1/4 w-96 h-96 z-0 pointer-events-none bg-accent/8 rounded-full blur-3xl",animate:{x:[0,-30,0],y:[0,50,0],scale:[1.1,1,1.1]},transition:{duration:10,repeat:1/0,ease:"easeInOut"}}),a.jsx("div",{className:"relative z-10 w-full max-w-md px-4",style:k?{perspective:"1000px"}:void 0,children:a.jsxs(ht.div,{onMouseMove:k?se:void 0,onMouseLeave:k?fe:void 0,style:k?{rotateX:Q,rotateY:W,transformStyle:"preserve-3d"}:void 0,className:"relative",children:[a.jsxs("div",{className:"absolute -inset-1 rounded-2xl overflow-hidden pointer-events-none",children:[a.jsxs("div",{className:"absolute inset-0",children:[a.jsx(ht.div,{className:"absolute top-0 left-0 right-0 h-[2px]",style:{background:"linear-gradient(90deg, transparent, hsl(var(--accent)), transparent)",boxShadow:"0 0 20px 5px hsl(var(--accent) / 0.5)"},animate:{x:["-100%","100%"]},transition:{duration:3,repeat:1/0,ease:"linear"}}),a.jsx(ht.div,{className:"absolute top-0 right-0 bottom-0 w-[2px]",style:{background:"linear-gradient(180deg, transparent, hsl(var(--accent)), transparent)",boxShadow:"0 0 20px 5px hsl(var(--accent) / 0.5)"},animate:{y:["-100%","100%"]},transition:{duration:3,repeat:1/0,ease:"linear",delay:.75}}),a.jsx(ht.div,{className:"absolute bottom-0 left-0 right-0 h-[2px]",style:{background:"linear-gradient(90deg, transparent, hsl(var(--accent)), transparent)",boxShadow:"0 0 20px 5px hsl(var(--accent) / 0.5)"},animate:{x:["100%","-100%"]},transition:{duration:3,repeat:1/0,ease:"linear",delay:1.5}}),a.jsx(ht.div,{className:"absolute top-0 left-0 bottom-0 w-[2px]",style:{background:"linear-gradient(180deg, transparent, hsl(var(--accent)), transparent)",boxShadow:"0 0 20px 5px hsl(var(--accent) / 0.5)"},animate:{y:["100%","-100%"]},transition:{duration:3,repeat:1/0,ease:"linear",delay:2.25}})]}),a.jsx("div",{className:"absolute inset-0 rounded-2xl border border-accent/20"})]}),a.jsxs("div",{className:"relative bg-card/80 backdrop-blur-xl rounded-2xl border border-border/50 p-8 shadow-2xl",children:[a.jsx("div",{className:"absolute inset-0 rounded-2xl bg-gradient-to-br from-accent/5 via-trans
492parent to-accent/5 opacity-50 pointer-events-none"}),a.jsxs("div",{className:"relative flex flex-col items-center mb-8",children:[a.jsx(ht.div,{className:"mb-4",whileHover:{scale:1.05},transition:{type:"spring",stiffness:400,damping:10},children:a.jsx("img",{src:H6,alt:"Zapdata",width:203,height:48,fetchPriority:"high",decoding:"async",className:"h-12 w-auto object-contain"})}),a.jsx("h1",{className:"text-2xl font-bold text-foreground",children:e(w==="login"?"welcomeBack":"welcome")}),a.jsx("p",{className:"text-muted-foreground text-sm mt-1",children:e(w==="login"?"loginSubtitle":"signupSubtitle")})]}),a.jsxs("div",{className:"relative flex mb-6 bg-muted/50 rounded-lg p-1",children:[a.jsx("button",{type:"button",onClick:()=>_("login"),className:xe("flex-1 py-2 px-4 rounded-md text-sm font-medium transition-all duration-200",w==="login"?"bg-accent text-accent-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:e("tabs.login")}),a.jsx("button",{type:"button",onClick:()=>_("signup"),className:xe("flex-1 py-2 px-4 rounded-md text-sm font-medium transition-all duration-200",w==="signup"?"bg-accent text-accent-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:e("tabs.signup")})]}),w==="login"&&a.jsxs(ht.form,{onSubmit:me,className:"relative space-y-4",initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{duration:.2},children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(Be,{htmlFor:"login-email",className:"text-foreground/80 text-sm",children:e("common:fields.email")}),a.jsxs("div",{className:"relative",children:[a.jsx(li,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),a.jsx(et,{id:"login-email",type:"text",placeholder:e("placeholders.email"),value:t,onChange:ye=>n(ye.target.value),onFocus:()=>N("login-email"),onBlur:()=>N(null),disabled:p,className:"pl-10 bg-muted/30 border-border/50 focus:border-accent focus:bg-muted/50 transition-all"}),C==="login-email"&&a.jsx(ht.div,{className:"absolute inset-0 rounded-md border-2 border-accent pointer-events-none",layoutId:"input-focus",initial:{opacity:0}
492,animate:{opacity:1},exit:{opacity:0}})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Be,{htmlFor:"login-password",className:"text-foreground/80 text-sm",children:e("common:fields.password")}),a.jsxs("div",{className:"relative",children:[a.jsx(fo,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),a.jsx(et,{id:"login-password",type:g?"text":"password",placeholder:e("placeholders.password"),value:r,onChange:ye=>s(ye.target.value),onFocus:()=>N("login-password"),onBlur:()=>N(null),disabled:p,className:"pl-10 pr-10 bg-muted/30 border-border/50 focus:border-accent focus:bg-muted/50 transition-all"}),a.jsx("button",{type:"button",onClick:()=>x(!g),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",children:g?a.jsx(md,{className:"h-4 w-4"}):a.jsx(gd,{className:"h-4 w-4"})}),C==="login-password"&&a.jsx(ht.div,{className:"absolute inset-0 rounded-md border-2 border-accent pointer-events-none",layoutId:"input-focus",initial:{opacity:0}
492,animate:{opacity:1},exit:{opacity:0}})]})]}),a.jsx("div",{className:"text-center",children:a.jsx("button",{type:"button",onClick:()=>M(!0),className:"text-sm text-muted-foreground hover:text-accent transition-colors",children:e("forgotPassword.link")})}),a.jsx(Ex,{action:"login",onVerify:ye=>ae(ye),onExpire:()=>ae(null),onError:()=>ae(null)}),a.jsxs("div",{className:"relative pt-2",children:[a.jsx("div",{className:"absolute -inset-1 rounded-lg bg-gradient-to-r from-accent/50 to-accent/30 opacity-50 blur-sm animate-pulse pointer-events-none"}),a.jsx("button",{type:"submit",disabled:p,className:"relative w-full py-3 px-4 bg-accent hover:bg-accent/90 text-accent-foreground font-medium rounded-lg flex items-center justify-center gap-2 transition-all disabled:opacity-50 hover:scale-[1.02] active:scale-[0.98]",children:p?a.jsx("div",{className:"w-5 h-5 border-2 border-accent-foreground/30 border-t-accent-foreground rounded-full animate-spin"}):a.jsxs(a.Fragment,{children:[e("tabs.login"),a.jsx(Ca,{className:"h-4 w-4"})]})})]})]}),w==="signup"&&a.jsxs(ht.form,{onSubmit:Je,className:"relative space-y-4",initial:{opacity:0,x:20},animate:{opacity:1,x:0},transition:{duration:.2},children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(Be,{htmlFor:"signup-email",className:"text-foreground/80 text-sm",children:e("common:fields.email")}),a.jsxs("div",{className:"relative",children:[a.jsx(li,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),a.jsx(et,{id:"signup-email",type:"email",placeholder:e("placeholders.email"),value:o,onChange:ye=>i(ye.target.value),onFocus:()=>N("signup-email"),onBlur:()=>N(null),disabled:p,className:"pl-10 bg-muted/30 border-border/50 focus:border-accent focus:bg-muted/50 transition-all"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Be,{htmlFor:"signup-password",className:"text-foreground/80 text-sm",children:e("common:fields.password")}),a.jsxs("div",{className:"relative",children:[a.jsx(fo,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),a.jsx(et,{id:"signup-password",type:v?"text":"password",placeholder:e("placeholders.createPassword"),value:l,onChange:ye=>c(ye.target.value),onFocus:()=>N("signup-password"),onBlur:()=>N(null),disabled:p,className:"pl-10 pr-10 bg-muted/30 border-border/50 focus:border-accent focus:bg-muted/50 transition-all"}),a.jsx("button",{type:"button",onClick:()=>b(!v),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",children:v?a.jsx(md,{className:"h-4 w-4"}):a.jsx(gd,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Be,{htmlFor:"signup-confirm-password",className:"text-foreground/80 text-sm",children:e("common:fields.confirmPassword")}),a.jsxs("div",{className:"relative",children:[a.jsx(fo,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),a.jsx(et,{id:"signup-confirm-password",type:v?"text":"password",placeholder:e("placeholders.confirmPassword"),value:d,onChange:ye=>u(ye.target.value),onFocus:()=>N("signup-confirm"),onBlur:()=>N(null),disabled:p,className:"pl-10 bg-muted/30 border-border/50 focus:border-accent focus:bg-muted/50 transition-all"})]})]}),a.jsx(Ex,{action:"signup",onVerify:ye=>le(ye),onExpire:()=>le(null),onError:()=>le(null)}),a.jsxs("div",{className:"relative pt-2",children:[a.jsx("div",{className:"absolute -inset-1 rounded-lg bg-gradient-to-r from-accent/50 to-accent/30 opacity-50 blur-sm animate-pulse pointer-events-none"}),a.jsx("button",{type:"submit",disabled:p||!f,className:"relative w-full py-3 px-4 bg-accent hover:bg-accent/90 text-accent-foreground font-medium rounded-lg flex items-center justify-center gap-2 transition-all disabled:opacity-50 hover:scale-[1.02] active:scale-[0.98]",children:p?a.jsx("div",{className:"w-5 h-5 border-2 border-accent-foreground/30 border-t-accent-foreground rounded-full animate-spin"}):a.jsxs(a.Fragment,{children:[e("tabs.signup"),a.jsx(Ca,{className:"h-4 w-4"})]})})]}),a.jsxs("div",{className:"flex items-start gap-2 mt-3",children:[a.jsx("input",{type:"checkbox",id:"privacy-accept",checked:f,onChange:ye=>h(ye.target.checked),required:!0,className:"mt-0.5 h-3.5 w-3.5 rounded border-border accent-accent"}),a.jsxs("label",{htmlFor:"privacy-accept",className:"text-[11px] leading-tight text-muted-foreground
492/70",children:[e("terms.agreement")," ",a.jsx("a",{href:"/termos",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-muted-foreground transition-colors",children:e("terms.termsOfService")})," ",e("terms.and")," ",a.jsx("a",{href:"/privacidade",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-muted-foreground transition-colors",children:e("terms.privacyPolicy")})]})]}),a.jsx(X6,{})]})]})]})}),a.jsx(cn,{open:A,children:a.jsxs(Qt,{className:"sm:max-w-md [&>button]:hidden",onPointerDownOutside:ye=>ye.preventDefault(),onEscapeKeyDown:ye=>ye.preventDefault(),onInteractOutside:ye=>ye.preventDefault(),children:[a.jsxs(qt,{children:[a.jsxs(Gt,{className:"flex items-center gap-2",children:[a.jsx(Yu,{className:"h-5 w-5 text-accent"}),e("mfaDialog.title")]}),a.jsx(En,{children:e("mfaDialog.description")})]}),a.jsxs("div",{className:"space-y-6 py-4",children:[a.jsx("div",{className:"flex justify-center",children:a.jsx(iS,{maxLength:6,value:D,onChange:E,autoFocus:!0,inputMode:"numeric",pattern:"[0-9]*",children:a.jsxs(lS,{className:"gap-2",children:[a.jsx(as,{index:0,className:"w-12 h-12 text-lg border-2"}),a.jsx(as,{index:1,className:"w-12 h-12 text-lg border-2"}),a.jsx(as,{index:2,className:"w-12 h-12 text-lg border-2"}),a.jsx(as,{index:3,className:"w-12 h-12 text-lg border-2"}),a.jsx(as,{index:4,className:"w-12 h-12 text-lg border-2"}),a.jsx(as,{index:5,className:"w-12 h-12 text-lg border-2"})]})})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(qr,{id:"remember-device",checked:B,onCheckedChange:ye=>q(ye)}),a.jsx(Be,{htmlFor:"remember-device",className:"text-sm cursor-pointer",children:e("mfaDialog.rememberDevice")})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx(pe,{onClick:ke,disabled:D.length!==6||L,className:"flex-1",children:L?a.jsxs(a.Fragment,{children:[a.jsx(st,{className:"h-4 w-4 mr-2 animate-spin"}),e("mfaDialog.verifying")]}):e("mfaDialog.verify")}),a.jsx(pe,{variant:"outline",onClick:Ne,children:e("common:actions.cancel")})]})]})]})}),a.jsx(cn,{open:$,onOpenChange:M,children:a.jsxs(Qt,{className:"sm:max-w-md bg-card/95 backdrop-blur-xl border-border/50",children:[a.jsxs(qt,{children:[a.jsxs(Gt,{className:"flex items-center gap-2 text-lg",children:[a.jsx(li,{className:"h-5 w-5 text-accent"}),e("forgotPassword.dialogTitle")]}),a.jsx(En,{children:e("forgotPassword.dialogDescription")})]}),a.jsxs("div",{className:"space-y-4 py-2",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(Be,{htmlFor:"forgot-email",className:"text-foreground/80 text-sm",children:e("common:fields.email")}),a.jsxs("div",{className:"relative",children:[a.jsx(li,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),a.jsx(et,{id:"forgot-email",type:"email",placeholder:e("placeholders.email"),value:J,onChange:ye=>K(ye.target.value),disabled:X,className:"pl-10 bg-muted/30 border-border/50 focus:border-accent focus:bg-muted/50 transition-all",onKeyDown:ye=>{ye.key==="Enter"&&(ye.preventDefault(),ct())}})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(pe,{onClick:ct,disabled:X||!J.trim(),className:"flex-1 bg-accent hover:bg-accent/90 text-accent-foreground",children:X?a.jsxs(a.Fragment,{children:[a.jsx(st,{className:"h-4 w-4 mr-2 animate-spin"}),e("forgotPassword.sending")]}):e("forgotPassword.sendButton")}),a.jsx(pe,{variant:"outline",onClick:()=>{M(!1),K("")},children:e("common:actions.cancel")})]})]})]})})]})},Z6=()=>{const{t:e}=Qe(["dashboard","common"]),t=or(),n=Rt(),[r,s]=m.useState(!1);return m.useEffect(()=>{const o=new URLSearchParams(window.location.search),i=new URLSearchParams(window.location.hash.replace("#","").split("?")[1]||""),l=o.has("code")||i.has("code");if(o.has("state")||i.has("state"),l||window.location.href.includes("code=")){s(!0),setTimeout(()=>{n("/ads/settings")},2e3);return}console.error("404 Error: User attempted to access non-existent route:",t.pathname)},[t.pathname,n]),r?a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:a.jsxs("div",{className:"text-center space-y-4",children:[a.jsx(st,{className:"h-12 w-12 animate-spin text-primary mx-auto"}),a.jsx("p",{className:"text-lg text-muted-foreground",children:e("notFound.connectingFacebook")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:e("notFound.processingAuth")})]})}):a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"mb-4 text-4xl font-bold text-foreground",children:"404"}),a.jsx("p",{className:"mb-4 text-xl text-muted-foreground",children:e("notFound.title")}),a.jsx("a",{href:"/",className:"text-primary underline hover:text-primary/80",children:e("notFound.backHome")})]})})};var Bh="Progress",Vh=100,[Q6,fU]=Vn(Bh),[J6,ez]=Q6(Bh),dS=m.forwardRef((e,t)=>
492{const{__scopeProgress:n,value:r=null,max:s,getValueLabel:o=tz,...i}=e;(s||s===0)&&!Px(s)&&console.error(nz(`${s}`,"Progress"));const l=Px(s)?s:Vh;r!==null&&!Ax(r,l)&&console.error(rz(`${r}`,"Progress"));const c=Ax(r,l)?r:null,d=xl(c)?o(c,l):void 0;return a.jsx(J6,{scope:n,value:c,max:l,children:a.jsx(Ie.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":xl(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":hS(c,l),"data-value":c??void 0,"data-max":l,...i,ref:t})})});dS.displayName=Bh;var uS="ProgressIndicator",fS=m.forwardRef((e,t)=>{const{__scopeProgress:n,...r}=e,s=ez(uS,n);return a.jsx(Ie.div,{"data-state":hS(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:t})});fS.displayName=uS;function tz(e,t){return`${Math.round(e/t*100)}%`}function hS(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function xl(e){return typeof e=="number"}function Px(e){return xl(e)&&!isNaN(e)&&e>0}function Ax(e,t){return xl(e)&&!isNaN(e)&&e<=t&&e>=0}function nz(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Vh}\`.`}function rz(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
493  - a positive number
494  - less than the value passed to \`max\` (or ${Vh} if no \`max\` prop is set)
495  - \`null\` or \`undefined\` if the progress is indeterminate.
496
497Defaulting to \`null\`.`}var pS=dS,sz=fS;const mS=m.forwardRef(({className:e,value:t,...n},r)=>a.jsx(pS,{ref:r,className:xe("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...n,children:a.jsx(sz,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));mS.displayName=pS.displayName;const Et=(e="fields.labels.prompt",t="fields.placeholders.promptDefault")=>({key:"prompt",label:e,type:"textarea",placeholder:t}),gS=[{id:"criar-imagem",label:"models.criarImagem.label",instruction:"models.criarImagem.instruction",instructionColor:"blue",maxImages:16,maxVideos:0,requiresMedia:!1,creditCost:0,edgeFunction:"creative-gen-image",resultType:"image",defaultLlm:"nano-banana-pro",llms:[{id:"nano-banana-pro",label:"Nano Banana Pro",description:"models.criarImagem.llms.nanoBananaPro.description",maxImages:8},{id:"seedream/4.5-edit",label:"Nano Banana 2 (Seedream 4.5 Edit)",description:"models.criarImagem.llms.seedream45Edit.description",maxImages:14},{id:"grok-imagine/image-to-image",label:"Grok Imagine",description:"models.criarImagem.llms.grokImagineImageToImage.description",maxImages:1},{id:"gpt-image-2",label:"GPT Image 2",description:"models.criarImagem.llms.gptImage2.description",maxImages:16}]},{id:"produto-video",label:"models.produtoVideo.label",instruction:"models.produtoVideo.instruction",instructionColor:"blue",maxImages:1,maxVideos:0,requiresMedia:!0,creditCost:0,edgeFunction:"creative-gen-product-video",resultType:"video",defaultLlm:"sora-2",llms:[{id:"sora-2",label:"Sora 2",description:"models.produtoVideo.llms.sora2.description"}]},{id:"texto-video",label:"models.textoVideo.label",instruction:"models.textoVideo.instruction",instructionColor:"blue",maxImages:0,maxVideos:0,requiresMedia:!1,creditCost:0,edgeFunction:"creative-gen-text-video",resultType:"video",defaultLlm:"veo3_fast",llms:[{id:"veo3_fast",label:"Veo 3.1 Fast",description:"models.textoVideo.llms.veo3Fast.description"},{id:"veo3",label:"Veo 3.1 Quality",description:"models.textoVideo.llms.veo3.description"},{id:"gemini-omni-video",label:"Gemini Omni Video",description:"models.textoVideo.llms.geminiOmniVideo.description"},{id:"kling-3.0",label:"Kling 3.0",description:"models.textoVideo.llms.kling30.description"},{id:"grok-imagine/text-to-video",label:"Grok Imagine",description:"models.textoVideo.llms.grokImagineTextToVideo.description"},{id:"wan/2-7-text-to-video",label:"Wan 2.7",description:"models.textoVideo.llms.wan27TextToVideo.description"}]},{id:"animar-imagem",label:"models.animarImagem.label",instruction:"models.animarImagem.instruction",instructionColor:"blue",maxImages:7,maxVideos:0,requiresMedia:!0,creditCost:0,edgeFunction:"creative-gen-animate",resultType:"video",defaultLlm:"veo3_fast",llms:[{id:"veo3_fast",label:"Veo 3.1 Fast",description:"models.animarImagem.llms.veo3Fast.description",maxImages:2},{id:"veo3",label:"Veo 3.1 Quality",description:"models.animarImagem.llms.veo3.description",maxImages:2},{id:"gemini-omni-video",label:"Gemini Omni Video",description:"models.animarImagem.llms.geminiOmniVideo.description",maxImages:7},{id:"kling-3.0",label:"Kling 3.0",description:"models.animarImagem.llms.kling30.description",maxImages:2}
497,{id:"grok-imagine/image-to-video",label:"Grok Imagine",description:"models.animarImagem.llms.grokImagineImageToVideo.description",maxImages:1},{id:"wan/2-7-image-to-video",label:"Wan 2.7",description:"models.animarImagem.llms.wan27ImageToVideo.description",maxImages:2}]},{id:"sincronizacao-labial",label:"models.sincronizacaoLabial.label",instruction:"models.sincronizacaoLabial.instruction",instructionColor:"blue",warning:"models.sincronizacaoLabial.warning",warningColor:"yellow",maxImages:1,maxVideos:0,maxAudios:1,requiresMedia:!0,creditCost:0,edgeFunction:"creative-gen-lipsync",resultType:"video",defaultLlm:"kling/ai-avatar-pro",llms:[{id:"kling/ai-avatar-pro",label:"Kling AI Avatar Pro",description:"models.sincronizacaoLabial.llms.klingAiAvatarPro.description",maxImages:1},{id:"infinitalk/from-audio",label:"InfiniteTalk From Audio",description:"models.sincronizacaoLabial.llms.infinitalkFromAudio.description",maxImages:1}]},{id:"imitar-movimento",label:"models.imitarMovimento.label",instruction:"models.imitarMovimento.instruction",instructionColor:"blue",warning:"models.imitarMovimento.warning",warningColor:"yellow",maxImages:1,maxVideos:1,requiresMedia:!0,creditCost:0,edgeFunction:"creative-gen-imitate",resultType:"video",defaultLlm:"kling-2.6/motion-control",llms:[{id:"kling-2.6/motion-control",label:"Kling 2.6 Motion Control",description:"models.imitarMovimento.llms.kling26MotionControl.description"},{id:"kling-3.0/motion-control",label:"Kling 3.0 Motion Control",description:"models.imitarMovimento.llms.kling30MotionControl.description"}]},{id:"criar-musica",label:"models.criarMusica.label",instruction:"models.criarMusica.instruction",instructionColor:"blue",warning:"models.criarMusica.warning",warningColor:"yellow",maxImages:0,maxVideos:0,maxAudios:0,requiresMedia:!1,creditCost:0,edgeFunction:"creative-gen-music",resultType:"audio",defaultLlm:"V5",llms:[{id:"V5_5",label:"Suno V5.5",description:"models.criarMusica.llms.v55.description"},{id:"V5",label:"Suno V5",description:"models.criarMusica.llms.v5.description"},{id:"V4_5PLUS",label:"Suno V4.5+",description:"models.criarMusica.llms.v45Plus.description"},{id:"V4_5",label:"Suno V4.5",description:"models.criarMusica.llms.v45.description"},{id:"V4_5ALL",label:"Suno V4.5 ALL",description:"models.criarMusica.llms.v45All.description"},{id:"V4",label:"Suno V4",description:"models.criarMusica.llms.v4.description"}]}];function hU(e,t){if(e==="criar-imagem"){if(t==="nano-banana-pro")return[{key:"aspect_ratio",label:"fields.labels.proporcao",type:"select",defaultValue:"1:1",options:[{label:"1:1",value:"1:1"},{label:"2:3",value:"2:3"},{label:"3:2",value:"3:2"},{label:"3:4",value:"3:4"},{label:"4:3",value:"4:3"},{label:"4:5",value:"4:5"},{label:"5:4",value:"5:4"},{label:"fields.options.ratio916Vertical",value:"9:16"},{label:"fields.options.ratio169Horizontal",value:"16:9"},{label:"fields.options.ratio219UltraWide",value:"21:9"},{label:"fields.options.auto",value:"auto"}]},{key:"resolution",label:"fields.labels.resolucao",type:"select",defaultValue:"1k",options:[{label:"1K",value:"1k"},{label:"2K",value:"2k"},{label:"4K",value:"4k"}]},{key:"format",label:"fields.labels.formato",type:"select",defaultValue:"png",options:[{label:"PNG",value:"png"},{label:"JPG",value:"jpg"}]},Et()];if(t==="seedream/4.5-edit")return[{key:"aspect_ratio",label:"fields.labels.proporcao",type:"select",defaultValue:"1:1",options:[{label:"1:1",value:"1:1"},{label:"4:3",value:"4:3"},{label:"3:4",value:"3:4"},{label:"16:9",value:"16:9"},{label:"9:16",value:"9:16"},{label:"2:3",value:"2:3"},{label:"3:2",value:"3:2"},{label:"21:9",value:"21:9"}]},{key:"quality",label:"fields.labels.qualidade",type:"select",defaultValue:"basic",description:"fields.descriptions.basic2kHigh4k",options:[{label:"fields.options.basic2k",value:"basic"},{label:"fields.options.high4k",value:"high"}]},Et("fields.labels.prompt","fields.placeholders.promptEditDesired")];if(t==="grok-imagine/image-to-image")return[Et("fields.labels.prompt","fields.placeholders.promptEditDesiredSingleImage")];if(t==="gpt-image-2"||t==="gpt-image-2-text-to-image")return[{key:"aspect_ratio",label:"fields.labels.proporcao",type:"select",defaultValue:"auto",description:"fields.descriptions.gptImageRatio",options:[{label:"fields.options.auto",value:"auto"},{label:"1:1",value:"1:1"},{label:"16:9",value:"16:9"},{label:"9:16",value:"9:16"},{label:"3:2",value:"3:2"},{label:"2:3",value:"2:3"},{label:"4:3",value:"4:3"},{label:"3:4",value:"3:4"},{label:"5:4",value:"5:4"},{label:"4:5",value:"4:5"},{label:"21:9",value:"21:9"},{label:"9:21",value:"9:21"},{label:"2:1",value:"2:1"},{label:"1:2",value:"1:2"},{label:"3:1",value:"3:1"},{label:"1:3",value:"1:3"}]},{key:"resolution",label:"fields.labels.resolucao",type:"select",defaultValue:"1K",description:"fields.descriptions.gptImageResolution",options:[{label:"1K",value:"1K"},{label:"2K",value:"2K"},{label:"4K",value:"4K"}]},Et()]}if(e==="produto-video")return[{key:"quality_tier",label:"fields.labels.qualidade",type:"select",defaultValue:"normal",options:[{label:"fields.options.normal",value:"normal"},{label:"fields.options.profissional",value:"pro"}]},{key:"resolution",label:"fields.labels.resolucao",type:"select",defaultValue:"720p",options:[{label:"720p HD",value:"720p"},{label:"1080p Full HD",value:"1080p"}]},{key:"aspect_ratio",label:"fields.labels.proporcao",type:"select",defaultValue:"landscape",options:[{label:"fields.options.horizontal",value:"landscape"},{label:"fields.options.vertical",value:"portrait"}]},{key:"duration",label:"fields.labels.duracao",type:"select",defaultValue:"10",options:[{label:"fields.options.tenSeconds",value:"10"},{label:"fields.options.fifteenSeconds",value:"15"}]},Et()];if(e==="texto-video"){if(t==="veo3"||t==="veo3_fast")return[{key:"aspect_ratio",label:"fields.labels.proporcao",type:"select",defaultValue:"16:9",options:[{label:"fields.options.ratio169Horizontal",value:"16:9"},{label:"fields.options.ratio916Vertical",value:"9:16"},{label:"fields.options.auto",value:"Auto"}]},{key:"resolution",label:"fields.labels.resolucao",type:"select",defaultValue:"720p",options:[{label:"720p",value:"720p"},{label:"1080p",value:"1080p"}]},Et()];if(t==="gemini-omni-video")return[{key:"aspect_ratio",label:"fields.labels.proporcao",type:"select",defaultValue:"16:9",options:[{label:"fields.options.ratio169Horizontal",value:"16:9"},{label:"fields.options.ratio916Vertical",value:"9:16"}]},{key:"resolution",label:"fields.labels.resolucao",type:"select",defaultValue:"720p",options:[{label:"720p",value:"720p"},{label:"1080p",value:"1080p"},{label:"4K",value:"4k"}]},{key:"duration",label:"fields.labels.duracaoSegundos",type:"select",defaultValue:"8",options:[{label:"4s",value:"4"},{label:"6s",value:"6"},{label:"8s",value:"8"},{label:"10s",value:"10"}]},Et()];if(t==="kling-3.0")return[{key:"kling_mode",label:"fields.labels.modo",type:"select",defaultValue:"std",options:[{label:"fields.options.standardFast",value:"std"},{label:"fields.options.proQuality",value:"pro"}]},{key:"aspect_ratio",label:"fields.labels.proporcao",type:"select",defaultValue:"16:9",options:[{label:"fields.options.ratio169Horizontal",value:"16:9"},{label:"fields.options.ratio916Vertical",value:"9:16"},{label:"fields.options.ratio11Quadrado",value:"1:1"}]},{key:"duration",label:"fields.labels.duracaoSegundos",type:"select",defaultValue:"5",options:[{label:"3s",value:"3"},{label:"5s",value:"5"},{label:"8s",value:"8"},{label:"10s",value:"10"},{label:"15s",value:"15"}]},{key:"sound",label:"fields.labels.som",type:"select",defaultValue:"true",options:[{label:"fields.options.comSom",value:"true"},{label:"fields.options.semSom",value:"false"}]},Et()];
497if(t==="grok-imagine/text-to-video")return[{key:"aspect_ratio",label:"fields.labels.proporcao",type:"select",defaultValue:"16:9",options:[{label:"fields.options.ratio23Vertical",value:"2:3"},{label:"fields.options.ratio32Horizontal",value:"3:2"},{label:"fields.options.ratio11Quadrado",value:"1:1"},{label:"16:9",value:"16:9"},{label:"9:16",value:"9:16"}]},{key:"grok_mode",label:"fields.labels.modo",type:"select",defaultValue:"normal",options:[{label:"fields.options.funCriativo",value:"fun"},{label:"fields.options.normal",value:"normal"},{label:"fields.options.spicyIntenso",value:"spicy"}]},{key:"resolution",label:"fields.labels.resolucao",type:"select",defaultValue:"720p",options:[{label:"480p",value:"480p"},{label:"720p",value:"720p"}]},{key:"duration",label:"fields.labels.duracaoSegundos",type:"select",defaultValue:"6",options:[{label:"6s",value:"6"},{label:"10s",value:"10"},{label:"15s",value:"15"},{label:"20s",value:"20"},{label:"30s",value:"30"}]},Et()];if(t==="wan/2-7-text-to-video")return[{key:"ratio",label:"fields.labels.proporcao",type:"select",defaultValue:"16:9",options:[{label:"16:9",value:"16:9"},{label:"9:16",value:"9:16"},{label:"1:1",value:"1:1"},{label:"4:3",value:"4:3"},{label:"3:4",value:"3:4"}]},{key:"resolution",label:"fields.labels.resolucao",type:"select",defaultValue:"1080p",options:[{label:"720p",value:"720p"},{label:"1080p",value:"1080p"}]},{key:"duration",label:"fields.labels.duracaoSegundos",type:"select",defaultValue:"5",options:[{label:"2s",value:"2"},{label:"5s",value:"5"},{label:"8s",value:"8"},{label:"10s",value:"10"},{label:"15s",value:"15"}]},Et()]}if(e==="animar-imagem"){if(t==="veo3"||t==="veo3_fast")return[{key:"aspect_ratio",label:"fields.labels.proporcao",type:"select",defaultValue:"16:9",options:[{label:"fields.options.ratio169Horizontal",value:"16:9"},{label:"fields.options.ratio916Vertical",value:"9:16"},{label:"fields.options.auto",value:"Auto"}]},{key:"resolution",label:"fields.labels.resolucao",type:"select",defaultValue:"720p",options:[{label:"720p",value:"720p"},{label:"1080p",value:"1080p"}]},Et("fields.labels.prompt","fields.placeholders.promptAnimacao")];if(t==="gemini-omni-video")return[{key:"aspect_ratio",label:"fields.labels.proporcao",type:"select",defaultValue:"16:9",options:[{label:"fields.options.ratio169Horizontal",value:"16:9"},{label:"fields.options.ratio916Vertical",value:"9:16"}]},{key:"resolution",label:"fields.labels.resolucao",type:"select",defaultValue:"720p",options:[{label:"720p",value:"720p"},{label:"1080p",value:"1080p"},{label:"4K",value:"4k"}]},{key:"duration",label:"fields.labels.duracaoSegundos",type:"select",defaultValue:"8",options:[{label:"4s",value:"4"},{label:"6s",value:"6"},{label:"8s",value:"8"},{label:"10s",value:"10"}]},Et("fields.labels.prompt","fields.placeholders.promptAnimacao7Refs")];if(t==="kling-3.0")return[{key:"kling_mode",label:"fields.labels.modo",type:"select",defaultValue:"std",options:[{label:"fields.options.standard",value:"std"},{label:"fields.options.pro",value:"pro"}]},{key:"aspect_ratio",label:"fields.labels.proporcao",type:"select",defaultValue:"16:9",description:"fields.descriptions.klingAutoAdapt",options:[{label:"16:9",value:"16:9"},{label:"9:16",value:"9:16"},{label:"1:1",value:"1:1"}]},{key:"duration",label:"fields.labels.duracaoSegundos",type:"select",defaultValue:"5",options:[{label:"3s",value:"3"},{label:"5s",value:"5"},{label:"8s",value:"8"},{label:"10s",value:"10"},{label:"15s",value:"15"}]},{key:"sound",label:"fields.labels.som",type:"select",defaultValue:"true",options:[{label:"fields.options.comSom",value:"true"},{label:"fields.options.semSom",value:"false"}]},Et("fields.labels.prompt","fields.placeholders.promptAnimacao")];if(t==="grok-imagine/image-to-video")return[{key:"aspect_ratio",label:"fields.labels.proporcao",type:"select",defaultValue:"16:9",options:[{label:"2:3",value:"2:3"},{label:"3:2",value:"3:2"},{label:"1:1",value:"1:1"},{label:"16:9",value:"16:9"},{label:"9:16",value:"9:16"}]},{key:"grok_mode",label:"fields.labels.modo",type:"select",defaultValue:"normal",description:"fields.descriptions.grokSpicyUnavailable",options:[{label:"fields.options.fun",value:"fun"},{label:"fields.options.normal",value:"normal"}]},{key:"resolution",label:"fields.labels.resolucao",type:"select",defaultValue:"720p",options:[{label:"480p",value:"480p"},{label:"720p",value:"720p"}]},{key:"duration",label:"fields.labels.duracaoSegundos",type:"select",defaultValue:"6",options:[{label:"6s",value:"6"},{label:"10s",value:"10"},{label:"15s",value:"15"},{label:"20s",value:"20"},{label:"30s",value:"30"}]},Et("fields.labels.prompt","fields.placeholders.promptAnimacaoDesejada")];
497if(t==="wan/2-7-image-to-video")return[{key:"resolution",label:"fields.labels.resolucao",type:"select",defaultValue:"1080p",options:[{label:"720p",value:"720p"},{label:"1080p",value:"1080p"}]},{key:"duration",label:"fields.labels.duracaoSegundos",type:"select",defaultValue:"5",options:[{label:"2s",value:"2"},{label:"5s",value:"5"},{label:"8s",value:"8"},{label:"10s",value:"10"},{label:"15s",value:"15"}]},Et("fields.labels.prompt","fields.placeholders.promptFrameInicialFinal")]}return e==="imitar-movimento"?[{key:"character_orientation",label:"fields.labels.modoGeracao",type:"select",defaultValue:"video",description:"fields.descriptions.characterOrientation",options:[{label:"fields.options.personagemNoVideo",value:"video"},{label:"fields.options.animarImagemOption",value:"image"}]},{key:"mode",label:"fields.labels.resolucaoModo",type:"select",defaultValue:"720p",options:[{label:"fields.options.standard720p",value:"720p"},{label:"fields.options.pro1080p",value:"1080p"}]},Et("fields.labels.prompt","fields.placeholders.promptImitarMovimento")]:e==="sincronizacao-labial"?t==="kling/ai-avatar-pro"?[Et("fields.labels.prompt","fields.placeholders.promptLipsyncKling")]:t==="infinitalk/from-audio"?[{key:"resolution",label:"fields.labels.resolucao",type:"select",defaultValue:"480p",description:"fields.descriptions.infinitalkResolution",options:[{label:"fields.options.p480Fast",value:"480p"},{label:"fields.options.p720Quality",value:"720p"}]},Et("fields.labels.prompt","fields.placeholders.promptLipsyncInfinitalk")]:[]:e==="criar-musica"?[{key:"custom_mode",label:"fields.labels.modo",type:"select",defaultValue:"false",description:"fields.descriptions.customModeMusic",options:[{label:"fields.options.simplesRecomendado",value:"false"},{label:"fields.options.custom",value:"true"}]},{key:"instrumental",label:"fields.labels.instrumental",type:"select",defaultValue:"false",description:"fields.descriptions.instrumental",options:[{label:"fields.options.comVocais",value:"false"},{label:"fields.options.apenasInstrumental",value:"true"}]},{key:"vocal_gender",label:"fields.labels.vozPreferida",type:"select",defaultValue:"auto",description:"fields.descriptions.vocalGender",options:[{label:"fields.options.automatico",value:"auto"},{label:"fields.options.masculino",value:"m"},{label:"fields.options.feminino",value:"f"}]},{key:"style",label:"fields.labels.estiloCustom",type:"textarea",placeholder:"fields.placeholders.styleExample",description:"fields.descriptions.styleCustom"},{key:"title",label:"fields.labels.tituloCustom",type:"textarea",placeholder:"fields.placeholders.titleExample",description:"fields.descriptions.titleCustom"},{key:"negative_tags",label:"fields.labels.tagsNegativasCustom",type:"textarea",placeholder:"fields.placeholders.negativeTagsExample",description:"fields.descriptions.negativeTags"},Et("fields.labels.prompt","fields.placeholders.promptMusica")]:[]}function pU(e,t){const n=gS.find(s=>s.id===e);if(!n)return 0;if(!t)return n.maxImages;const r=n.llms.find(s=>s.id===t);return r&&typeof r.maxImages=="number"?r.maxImages:n.maxImages}const xS="criar-imagem::nano-banana-pro",az={formats:["original","1:1","4:5","9:16"],grades:["warm","cool","vibrant","faded","mono","cinema"],styles:["clean","grain","vignette","frame","polaroid","note","headline"],title:"",subtitle:"",llmId:xS},Tx={"1:1":[1080,1080],"4:5":[1080,1350],"9:16":[1080,1920]},vS={warm:"quente",cool:"fria",vibrant:"vibrante",faded:"desbotada",mono:"monocromática",cinema:"cinema"},yS={clean:"limpo",grain:"grão de filme",vignette:"vinheta",frame:"moldura",polaroid:"polaroid",note:"recado com seta",headline:"manchete"},Ix=[{name:"centro",x:.5,y:.5},{name:"superior",x:.5,y:.35},{name:"esquerda",x:.35,y:.5},{name:"direita",x:.65,y:.5},{name:"inferior",x:.5,y:.65}];function Iu(e,t){if(!Number.isInteger(e)||!Number.isInteger(t)||e<1||t<1)throw new Error("Dimensões de imagem inválidas.");if(e*t>4e7)throw new Error("A imagem excede o limite de 40 megapixels. Reduza suas dimensões.")}async function oz(e){if(e.size>50*1024*1024)throw new Error("A imagem excede o limite de 50 MB.");const t=new Uint8Array(await e.arrayBuffer()),n=new DataView(t.buffer);if(t.length>=24&&t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71&&t[4]===13&&t[5]===10&&t[6]===26&&t[7]===10&&n.getUint32(8)===13&&n.getUint32(12)===1229472850){Iu(n.getUint32(16),n.getUint32(20));return}if(t[0]===255&&t[1]===216){let r=2,s=!1;for(;r+3<t.length&&t[r++]===255;){for(;t[r]===255;)r++;const o=t[r++];if(o===218||o===217||r+2>t.length)break;if(o===1||o>=208&&o<=215)continue;const i=n.getUint16(r);if(i<2||r+i>t.length)break;if([192,193,194,195,197,198,199,201,202,203,205,206,207].includes(o)){if(i<8)break;Iu(n.getUint16(r+5),n.getUint16(r+3)),s=!0}r+=i}if(s)return}throw new Error("Não foi possível ler as dimensões. Use uma imagem JPG ou PNG válida.")}
497function iz(e,t,n,r){if(Iu(e,t),!Number.isInteger(n)||n<0)throw new Error("Índice da variação inválido.");if(!r.formats.length||!r.grades.length||!r.styles.length)throw new Error("Escolha ao menos um formato, uma cor e um estilo.");if(r.title.length>100||r.subtitle.length>180)throw new Error("Use até 100 caracteres no título e 180 no subtítulo.");const s=r.formats[n%r.formats.length],o=r.grades[n%r.grades.length],i=r.styles[n%r.styles.length],l=(b,w)=>Object.prototype.hasOwnProperty.call(b,w);if(!(s==="original"||l(Tx,s))||!l(vS,o)||!l(yS,i))throw new Error("Opção de criativo inválida.");const c=Math.min(1,2048/Math.max(e,t)),[d,u]=s==="original"?[Math.max(1,Math.round(e*c)),Math.max(1,Math.round(t*c))]:Tx[s],f=1.06+n%20*.011,h=Ix[n%Ix.length],p=e/f,y=t/f,g=Math.max(0,Math.min(e-p,e*h.x-p/2)),x=Math.max(0,Math.min(t-y,t*h.y-y/2)),v=.96+n%5*.022;return{width:d,height:u,format:s,grade:o,style:i,zoom:f,focus:h,cropX:g,cropY:x,cropWidth:p,cropHeight:y,tone:v}}function lz(e,t){const n=document.createElement("canvas");n.width=e,n.height=t;const r=n.getContext("2d",{willReadFrequently:!0});if(!r)throw n.width=0,n.height=0,new Error("Este navegador não oferece Canvas 2D. Use um navegador atualizado.");return r.imageSmoothingEnabled=!0,r.imageSmoothingQuality="high",{canvas:n,context:r}}function cz(e,t,n,r,s,o,i){const l=e.getImageData(0,0,t,n);let c=i+937;for(let d=0;d<l.data.length;d+=4){let u=l.data[d],f=l.data[d+1],h=l.data[d+2];const p=u*.2126+f*.7152+h*.0722;switch(r){case"warm":u=u*1.09+7,h*=.87;break;case"cool":u*=.89,h=h*1.1+7;break;case"vibrant":u=p+(u-p)*1.4,f=p+(f-p)*1.4,h=p+(h-p)*1.4;break;case"faded":u=(p+(u-p)*.7)*.85+29,f=(p+(f-p)*.7)*.85+29,h=(p+(h-p)*.7)*.85+29;break;case"mono":u=f=h=(p-128)*1.1+128;break;case"cinema":u=(u-128)*1.15+125,f=(f-128)*1.1+129,h=(h-128)*1.13+140;break}let y=0;o&&(c=Math.imul(c,1664525)+1013904223>>>0,y=(c/4294967296-.5)*34),l.data[d]=u*s+y,l.data[d+1]=f*s+y,l.data[d+2]=h*s+y}e.putImageData(l,0,0)}function dz(e,t,n){const r=[];let s="";
497for(const o of t.trim().split(/\s+/u).filter(Boolean)){if(e.measureText(s?`${s} ${o}`:o).width<=n){s=s?`${s} ${o}`:o;continue}s&&(r.push(s),s="");for(const i of o)s&&e.measureText(s+i).width>n&&(r.push(s),s=""),s+=i}return s&&r.push(s),r}function Mx(e,t,n,r,s,o,i,l,c,d=!1){if(!t.trim())return;let u=i,f;const h=d?'"Segoe Print", "Comic Sans MS", cursive':"Arial, sans-serif";do{if(e.font=`${c?700:400} ${u}px ${h}`,f=dz(e,t,s),f.length*u*1.22<=o)break;u*=.9}while(u>1);e.fillStyle=l,e.textBaseline="top";for(const[p,y]of f.entries())e.fillText(y,n,r+p*u*1.22,s)}function uz(e,t,n,r,s,o){if(!s.trim()&&!o.trim()){r==="headline"&&(e.fillStyle="#111827",e.fillRect(0,0,t,n*.035),e.fillStyle="#fbbf24",e.fillRect(0,n*.035,t,n*.008));return}const i=t*.065,l=t-i*2,c=r==="polaroid",d=r==="headline",u=c?n*.72:n*.075,f=Math.min(n*(c?.23:.35),t*.5);e.fillStyle=c?"#fcfaf3":d?"#111827":"rgba(9, 15, 27, 0.86)",e.fillRect(d?0:i*.6,u-i*.3,d?t:t-i*1.2,f+i*.6);const h=s.trim()?f*(o.trim()?.55:1):0;if(Mx(e,s,i,u,l,h,t*.063,c?"#202028":"#ffffff",!0,c||r==="note"),o.trim()){const p=u+(s.trim()?h+f*.045:0),y=s.trim()?f*.405:f;Mx(e,o,i,p,l,y,t*.037,c?"#40404c":d?"#fde68a":"#ffffff",!1)}}async function fz(e,t,n){if(typeof document>"u"||typeof createImageBitmap!="function")throw new Error("Este navegador não oferece processamento de imagens. Use um navegador atualizado.");await oz(e);let r;try{r=await createImageBitmap(e,{imageOrientation:"from-image"})}catch{throw new Error("Não foi possível abrir a imagem. Verifique se o JPG ou PNG está íntegro.")}let s;try{const o=iz(r.width,r.height,t,n),{width:i,height:l,format:c,style:d,grade:u,cropX:f,cropY:h,cropWidth:p,cropHeight:y}=o,g=lz(i,l);s=g.canvas;const x=g.context;if(x.fillStyle="#ffffff",x.fillRect(0,0,i,l),c!=="original"){if(!("filter"in x))throw new Error("Este navegador não oferece o desfoque necessário. Use um navegador atualizado.");const T=Math.max(i/p,l/y)*1.12,D=p*T,E=y*T;x.save(),x.filter=`blur(${Math.max(i,l)*.018}px) brightness(0.66)`,x.drawImage(r,f,h,p,y,(i-D)/2,(l-E)/2,D,E),x.restore()}const v=d==="polaroid"?l*.65:l,b=d==="polaroid"?.84:c==="original"?1:.91,w=Math.min(i/p,v/y)*b,_=p*w,C=y*w;let N=(i-_)/2,k=(v-C)*.46;if(d==="polaroid"){x.fillStyle="#e6dfd1",x.fillRect(0,0,i,l),x.save(),x.translate(i/2,v/2),x.rotate((t%2?1:-1)*2.2*Math.PI/180),N=-_/2,k=-C/2,x.fillStyle="#fcfaf3";const T=i*.032;x.shadowColor="rgba(0,0,0,0.22)",x.shadowBlur=i*.025,x.fillRect(N-T,k-T,_+T*2,C+T*2),x.shadowBlur=0}if(x.fillStyle="#ffffff",x.fillRect(N,k,_,C),x.drawImage(r,f,h,p,y,N,k,_,C),d==="polaroid"&&x.restore(),cz(x,i,l,u,o.tone,d==="grain",t),d==="vignette"){const T=x.createRadialGradient(i/2,l/2,Math.min(i,l)*.16,i/2,l/2,Math.hypot(i,l)/2);T.addColorStop(0,"rgba(0,0,0,0)"),T.addColorStop(1,"rgba(0,0,0,0.66)"),x.fillStyle=T,x.fillRect(0,0,i,l)}if(d==="frame"&&(x.strokeStyle=t%2?"#151722":"#fffaf0",x.lineWidth=Math.min(i,l)*.065,x.strokeRect(0,0,i,l)),d==="note"){const T=i*(t%2?.64:.4),D=l*.58;x.strokeStyle="#ffca28",x.lineWidth=i*.012,x.lineCap="round",x.lineJoin="round",x.shadowColor="rgba(0,0,0,0.55)",x.shadowBlur=i*.004,x.beginPath(),x.moveTo(i*.18,l*.78),x.bezierCurveTo(i*.18,l*.62,T-i*.15,D+l*.16,T,D),x.lineTo(T-i*.1,D+l*.015),x.moveTo(T,D),x.lineTo(T-i*.018,D+l*.07),x.stroke(),x.shadowBlur=0}uz(x,i,l,d,n.title,n.subtitle);const P=await new Promise((T,D)=>{s.toBlob(E=>E?T(E):D(new Error("Não foi possível exportar o criativo PNG.")),"image/png")});if(P.type!=="image/png")throw new Error("O navegador não exportou um PNG válido.");const A=`formato ${c} (${i}x${l}); zoom ${((o.zoom-1)*100).toFixed(1)}%; foco ${o.focus.name}; cor ${vS[u]}; luminosidade ${o.tone.toFixed(3)}; estilo ${yS[d]}${c!=="original"&&d!=="polaroid"?"; fundo desfocado":""}${n.title.trim()?`; título: ${n.title.trim()}`:""}${n.subtitle.trim()?`; subtítulo: ${n.subtitle.trim()}`:""}`;return{blob:P,recipe:A,width:i,height:l}}finally{r.close(),s&&(s.width=0,s.height=0)}}const hz=[{category:"Promessa de renda",patterns:[/\b(?:ganhe|ganhar|ganhando|fature|faturar|receba|receber|lucre|lucrar)\s+(?:at[ée]\s+)?(?:r\$\s*)?\d[\d.,]*(?:\s*(?:mil|reais))?/iu,/\br\$\s*\d[\d.,]*\s*(?:por|ao|a|na|no)\s+(?:dia|semana|m[êe]s|hora)\b/iu,/\b(?:renda(?: extra)?|lucro|ganhos?|retorno|resultado financeiro)\s+(?:f[áa]cil|garantid[oa]s?|r[áa]pid[oa]|sem esfor[çc]o)\b/iu,/\b(?:dinheiro f[áa]cil|fique (?:rico|milion[áa]rio)|enrique[çc]a|sem esfor[çc]o)\b/iu],suggestion:"Descreva o processo, o conteúdo e o trabalho necessário; retire valores de ganho e promessas de renda garantida."},{category:"Atributo pessoal",patterns:[/\b(?:voc[êe]|voc[êe] que)\s+(?:(?:[ée]|est[áa]|tem|sofre de|se sente|anda)\s+)(?:com\s+)?(?:ansios[oa]|deprimid[oa]|depress[ãa]o|ansiedade|diabetes|obes[oa]|gord[oa]|endividad[oa]|d[íi]vidas?|desempregad[oa]|doente|gr[áa]vida|gay|homossexual|crist[ãa]o|evang[ée]lic[oa]|mu[çc]ulman[oa]|negro|negra|branco|branca|\d+\s+anos)\b/iu,/\b(?:seu|sua|seus|suas)\s+(?:peso|barriga|d[íi]vidas?|diabetes|depress[ãa]o|ansiedade|doen[çc]a|defici[êe]ncia|religi[ãa]o|orienta[çc][ãa]o sexual)\b/iu],suggestion:"Fale sobre o produto e seu público de forma geral, sem presumir a saúde, identidade ou situação financeira de quem lê."},{category:"Alegação de saúde",patterns:[/\b(?:cur[ae]|curar|cura garantida|emagre[çc]a|emagrecer|emagrecimento garantido)\b/iu,/\b(?:perca|perder|elimine|eliminar)\s+(?:(?:at[ée]|o|a)\s+)?(?:peso|barriga|gordura|\d+(?:[.,]\d+)?\s*(?:kg|quilos))\b/iu,/\b(?:acabe com|elimine)\s+(?:a\s+)?(?:ansiedade|depress[ãa]o|diabetes)\b/iu,/\b(?:sem dieta|queima de gordura|resultado garantido|resultados garantidos)\b/iu],suggestion:"Retire promessas de cura ou transformação física. Descreva 
497informações e hábitos com limites claros e orientação profissional, quando cabível."},{category:"Notificação falsa",patterns:[/\bvoc[êe]\s+(?:tem|recebeu)\s+(?:(?:\d+|uma?|novas?|uma nova)\s+)*(?:mensage(?:m|ns)|notifica[çc][ãaõo]es?|notifica[çc][ãa]o)\b/iu,/\b(?:nova mensagem|nova notifica[çc][ãa]o|mensagem n[ãa]o lida|notifica[çc][ãa]o pendente)\b/iu,/\bnovo (?:amigo|seguidor)\s+(?:te\s+)?(?:adicionou|quer)\b/iu],suggestion:"Use uma chamada editorial como “Conheça a novidade”, sem simular mensagens, notificações ou controles da plataforma."},{category:"Antes e depois sensível",patterns:[/\bantes\s+(?:e|\/)\s+depois\b/iu],suggestion:"Revise o contexto: comparações de corpo, saúde ou renda podem sugerir resultados irreais. Prefira explicar o processo."},{category:"Urgência a confirmar",patterns:[new RegExp("(?<![\\p{L}\\p{N}_])(?:[úu]ltimas? vagas|vagas limitadas|s[óo] hoje|somente hoje|termina (?:hoje|em \\d+))\\b","iu")],suggestion:"Confirme que o prazo e a disponibilidade são reais; se a oferta for contínua, use “Inscrições abertas”."}];function pz(e){const t=(e||"").normalize("NFC").replace(/\s+/gu," ").trim();return t?hz.flatMap(({category:n,patterns:r,suggestion:s})=>{const o=r.map(i=>t.match(i)).find(Boolean);return o?[{category:n,excerpt:o[0],suggestion:s}]:[]}):[]}function Ei(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var bS={exports:{}};/*!
498
499JSZip v3.10.1 - A JavaScript class for generating and reading zip files
500<http://stuartk.com/jszip>
501
502(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
503Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
504
505JSZip uses the library pako released under the MIT license :
506https://github.com/nodeca/pako/blob/main/LICENSE
507*/(function(e,t){(function(n){e.exports=n()})(function(){return function n(r,s,o){function i(d,u){if(!s[d]){if(!r[d]){var f=typeof Ei=="function"&&Ei;if(!u&&f)return f(d,!0);if(l)return l(d,!0);var h=new Error("Cannot find module '"+d+"'");throw h.code="MODULE_NOT_FOUND",h}var p=s[d]={exports:{}};r[d][0].call(p.exports,function(y){var g=r[d][1][y];return i(g||y)},p,p.exports,n,r,s,o)}return s[d].exports}for(var l=typeof Ei=="function"&&Ei,c=0;c<o.length;c++)i(o[c]);return i}({1:[function(n,r,s){var o=n("./utils"),i=n("./support"),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";s.encode=function(c){for(var d,u,f,h,p,y,g,x=[],v=0,b=c.length,w=b,_=o.getTypeOf(c)!=="string";v<c.length;)w=b-v,f=_?(d=c[v++],u=v<b?c[v++]:0,v<b?c[v++]:0):(d=c.charCodeAt(v++),u=v<b?c.charCodeAt(v++):0,v<b?c.charCodeAt(v++):0),h=d>>2,p=(3&d)<<4|u>>4,y=1<w?(15&u)<<2|f>>6:64,g=2<w?63&f:64,x.push(l.charAt(h)+l.charAt(p)+l.charAt(y)+l.charAt(g));return x.join("")},s.decode=function(c){var d,u,f,h,p,y,g=0,x=0,v="data:";if(c.substr(0,v.length)===v)throw new Error("Invalid base64 input, it looks like a data url.");var b,w=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===l.charAt(64)&&w--,c.charAt(c.length-2)===l.charAt(64)&&w--,w%1!=0)throw new Error("Invalid base64 input, bad content length.");for(b=i.uint8array?new Uint8Array(0|w):new Array(0|w);g<c.length;)d=l.indexOf(c.charAt(g++))<<2|(h=l.indexOf(c.charAt(g++)))>>4,u=(15&h)<<4|(p=l.indexOf(c.charAt(g++)))>>2,f=(3&p)<<6|(y=l.indexOf(c.charAt(g++))),b[x++]=d,p!==64&&(b[x++]=u),y!==64&&(b[x++]=f);return b}},{"./support":30,"./utils":32}],2:[function(n,r,s){var o=n("./external"),i=n("./stream/DataWorker"),l=n("./stream/Crc32Probe"),c=n("./stream/DataLengthProbe");function d(u,f,h,p,y){this.compressedSize=u,this.uncompressedSize=f,this.crc32=h,this.compression=p,this.compressedContent=y}d.prototype={getContentWorker:function(){var u=new i(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),f=this;return u.on("end",function(){if(this.streamInfo.data_length!==f.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),u},getCompressedWorker:function(){return new i(o.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},d.createWorkerFrom=function(u,f,h){return u.pipe(new l).pipe(new c("uncompressedSize")).pipe(f.compressWorker(h)).pipe(new c("compressedSize")).withStreamInfo("compression",f)},r.exports=d},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,s){var o=n("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},s.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,s){var o=n("./utils"),i=function(){for(var l,c=[],d=0;d<256;d++){l=d;for(var u=0;u<8;u++)l=1&l?3988292384^l>>>1:l>>>1;c[d]=l}return c}();r.exports=function(l,c){return l!==void 0&&l.length?o.getTypeOf(l)!=="str
507ing"?function(d,u,f,h){var p=i,y=h+f;d^=-1;for(var g=h;g<y;g++)d=d>>>8^p[255&(d^u[g])];return-1^d}(0|c,l,l.length,0):function(d,u,f,h){var p=i,y=h+f;d^=-1;for(var g=h;g<y;g++)d=d>>>8^p[255&(d^u.charCodeAt(g))];return-1^d}(0|c,l,l.length,0):0}},{"./utils":32}],5:[function(n,r,s){s.base64=!1,s.binary=!1,s.dir=!1,s.createFolders=!0,s.date=null,s.compression=null,s.compressionOptions=null,s.comment=null,s.unixPermissions=null,s.dosPermissions=null},{}],6:[function(n,r,s){var o=null;o=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:o}},{lie:37}],7:[function(n,r,s){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",i=n("pako"),l=n("./utils"),c=n("./stream/GenericWorker"),d=o?"uint8array":"array";function u(f,h){c.call(this,"FlateWorker/"+f),this._pako=null,this._pakoAction=f,this._pakoOptions=h,this.meta={}}s.magic="\b\0",l.inherits(u,c),u.prototype.processChunk=function(f){this.meta=f.meta,this._pako===null&&this._createPako(),this._pako.push(l.transformTo(d,f.data),!1)},u.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},u.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},u.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var f=this;this._pako.onData=function(h){f.push({data:h,meta:f.meta})}},s.compressWorker=function(f){return new u("Deflate",f)},s.uncompressWorker=function(){return new u("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,s){function o(p,y){var g,x="";for(g=0;g<y;g++)x+=String.fromCharCode(255&p),p>>>=8;return x}function i(p,y,g,x,v,b){var w,_,C=p.file,N=p.compression,k=b!==d.utf8encode,P=l.transformTo("string",b(C.name)),A=l.transformTo("string",d.utf8encode(C.name)),T=C.comment,D=l.transformTo("string",b(T)),E=l.transformTo("string",d.utf8encode(T)),I=A.length!==C.name.length,S=E.length!==T.length,L="",Y="",B="",q=C.dir,F=C.date,ee={crc32:0,compressedSize:0,uncompressedSize:0};y&&!g||(ee.crc32=p.crc32,ee.compressedSize=p.compressedSize,ee.uncompressedSize=p.uncompressedSize);var $=0;y&&($|=8),k||!I&&!S||($|=2048);var M=0,J=0;q&&(M|=16),v==="UNIX"?(J=798,M|=function(X,de){var te=X;return X||(te=de?16893:33204),(65535&te)<<16}(C.unixPermissions,q)):(J=20,M|=function(X){return 63&(X||0)}(C.dosPermissions)),w=F.getUTCHours(),w<<=6,w|=F.getUTCMinutes(),w<<=5,w|=F.getUTCSeconds()/2,_=F.getUTCFullYear()-1980,_<<=4,_|=F.getUTCMonth()+1,_<<=5,_|=F.getUTCDate(),I&&(Y=o(1,1)+o(u(P),4)+A,L+="up"+o(Y.length,2)+Y),S&&(B=o(1,1)+o(u(D),4)+E,L+="uc"+o(B.length,2)+B);var K="";return K+=`
508\0`,K+=o($,2),K+=N.magic,K+=o(w,2),K+=o(_,2),K+=o(ee.crc32,4),K+=o(ee.compressedSize,4),K+=o(ee.uncompressedSize,4),K+=o(P.length,2),K+=o(L.length,2),{fileRecord:f.LOCAL_FILE_HEADER+K+P+L,dirRecord:f.CENTRAL_FILE_HEADER+o(J,2)+K+o(D.length,2)+"\0\0\0\0"+o(M,4)+o(x,4)+P+L+D}}var l=n("../utils"),c=n("../stream/GenericWorker"),d=n("../utf8"),u=n("../crc32"),f=n("../signature");function h(p,y,g,x){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=y,this.zipPlatform=g,this.encodeFileName=x,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}l.inherits(h,c),h.prototype.push=function(p){var y=p.meta.percent||0,g=this.entriesCount,x=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,c.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:g?(y+100*(g-x-1))/g:100}}))},h.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var y=this.streamFiles&&!p.file.dir;if(y){var g=i(p,y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:g.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(p){this.accumulate=!1;var y=this.streamFiles&&!p.file.dir,g=i(p,y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(g.dirRecord),y)this.push({data:function(x){return f.DATA_DESCRIPTOR+o(x.crc32,4)+o(x.c
vendor: 42,640 bytes, line 508
508ompressedSize,4)+o(x.uncompressedSize,4)}(p),meta:{percent:100}});else for(this.push({data:g.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var p=this.bytesWritten,y=0;y<this.dirRecords.length;y++)this.push({data:this.dirRecords[y],meta:{percent:100}});var g=this.bytesWritten-p,x=function(v,b,w,_,C){var N=l.transformTo("string",C(_));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+o(v,2)+o(v,2)+o(b,4)+o(w,4)+o(N.length,2)+N}(this.dirRecords.length,g,p,this.zipComment,this.encodeFileName);this.push({data:x,meta:{percent:100}})},h.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},h.prototype.registerPrevious=function(p){this._sources.push(p);var y=this;return p.on("data",function(g){y.processChunk(g)}),p.on("end",function(){y.closedSource(y.previous.streamInfo),y._sources.length?y.prepareNextSource():y.end()}),p.on("error",function(g){y.error(g)}),this},h.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},h.prototype.error=function(p){var y=this._sources;if(!c.prototype.error.call(this,p))return!1;for(var g=0;g<y.length;g++)try{y[g].error(p)}catch{}return!0},h.prototype.lock=function(){c.prototype.lock.call(this);for(var p=this._sources,y=0;y<p.length;y++)p[y].lock()},r.exports=h},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,s){var o=n("../compressions"),i=n("./ZipFileWorker");s.generateWorker=function(l,c,d){var u=new i(c.streamFiles,d,c.platform,c.encodeFileName),f=0;try{l.forEach(function(h,p){f++;var y=function(b,w){var _=b||w,C=o[_];if(!C)throw new Error(_+" is not a valid compression method !");return C}(p.options.compression,c.compression),g=p.options.compressionOptions||c.compressionOptions||{},x=p.dir,v=p.date;p._compressWorker(y,g).withStreamInfo("file",{name:h,dir:x,date:v,comment:p.comment||"",unixPermissions:p.unixPermissions,dosPermissions:p.dosPermissions}).pipe(u)}),u.entriesCount=f}catch(h){u.error(h)}return u}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,s){function o(){if(!(this instanceof o))return new o;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var i=new o;for(var l in this)typeof this[l]!="function"&&(i[l]=this[l]);return i}}(o.prototype=n("./object")).loadAsync=n("./load"),o.support=n("./support"),o.defaults=n("./defaults"),o.version="3.10.1",o.loadAsync=function(i,l){return new o().loadAsync(i,l)},o.external=n("./external"),r.exports=o},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,s){var o=n("./utils"),i=n("./external"),l=n("./utf8"),c=n("./zipEntries"),d=n("./stream/Crc32Probe"),u=n("./nodejsUtils");function f(h){return new i.Promise(function(p,y){var g=h.decompressed.getContentWorker().pipe(new d);g.on("error",function(x){y(x)}).on("end",function(){g.streamInfo.crc32!==h.decompressed.crc32?y(new Error("Corrupted zip : CRC32 mismatch")):p()}).resume()})}r.exports=function(h,p){var y=this;return p=o.extend(p||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:l.utf8decode}),u.isNode&&u.isStream(h)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):o.prepareContent("the loaded zip file",h,!0,p.optimizedBinaryString,p.base64).then(function(g){var x=new c(p);return x.load(g),x}).then(function(g){var x=[i.Promise.resolve(g)],v=g.files;if(p.checkCRC32)for(var b=0;b<v.length;b++)x.push(f(v[b]));return i.Promise.all(x)}).then(function(g){for(var x=g.shift(),v=x.files,b=0;b<v.length;b++){var w=v[b],_=w.fileNameStr,C=o.resolve(w.fileNameStr);y.file(C,w.decompressed,{binary:!0,optimizedBinaryString:!0,date:w.date,dir:w.dir,comment:w.fileCommentStr.length?w.fileCommentStr:null,unixPermissions:w.unixPermissions,dosPermissions:w.dosPermissions,createFolders:p.createFolders}),w.dir||(y.file(C).unsafeOriginalName=_)}return x.zipComment.length&&(y.comment=x.zipComment),y})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,s){var o=n("../utils"),i=n("../stream/GenericWorker");function l(c,d){i.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(d)}o.inherits(l,i),l.prototype._bindStream=function(c){var d=this;(this._stream=c).pause(),c.on("data",function(u){d.push({data:u,meta:{percent:0}})}).on("error",function(u){d.isPaused?this.generatedError=u:d.error(u)}).on("end",function(){d.isPaused?d._upstreamEnded=!0:d.end()})},l.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},l.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=l},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,s){var o=n("readable-stream").Readable;function i(l,c,d){o.call(this,c),this._helper=l;var u=this;l.on("data",function(f,h){u.push(f)||u._helper.pause(),d&&d(h)}).on("error",function(f){u.emit("error",f)}).on("end",function(){u.push(null)})}n("../utils").inherits(i,o),i.prototype._read=function(){this._helper.resume()},r.exports=i},{"../utils":32,"readable-stream":16}],14:[function(n,r,s){r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(o,i){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(o,i);if(typeof o=="number")throw new Error('The "data" argument must not be a number');return new Buffer(o,i)},allocBuffer:function(o){if(Buffer.alloc)return Buffer.alloc(o);var i=new Buffer(o);return i.fill(0),i},isBuffer:function(o){return Buffer.isBuffer(o)},isStream:function(o){return o&&typeof o.on=="function"&&typeof o.pause=="function"&&typeof o.resume=="function"}}},{}],15:[function(n,r,s){function o(C,N,k){var P,A=l.getTypeOf(N),T=l.extend(k||{},u);T.date=T.date||new Date,T.compression!==null&&(T.compression=T.compression.toUpperCase()),typeof T.unixPermissions=="string"&&(T.unixPermissions=parseInt(T.unixPermissions,8)),T.unixPermissions&&16384&T.unixPermissions&&(T.dir=!0),T.dosPermissions&&16&T.dosPermissions&&(T.dir=!0),T.dir&&(C=v(C)),T.createFolders&&(P=x(C))&&b.call(this,P,!0);var D=A==="string"&&T.binary===!1&&T.base64===!1;k&&k.binary!==void 0||(T.binary=!D),(N instanceof f&&N.uncompressedSize===0||T.dir||!N||N.length===0)&&(T.base64=!1,T.binary=!0,N="",T.compression="STORE",A="string");var E=null;E=N instanceof f||N instanceof c?N:y.isNode&&y.isStream(N)?new g(C,N):l.prepareContent(C,N,T.binary,T.optimizedBinaryString,T.base64);var I=new h(C,E,T);this.files[C]=I}var i=n("./utf8"),l=n("./utils"),c=n("./stream/GenericWorker"),d=n("./stream/StreamHelper"),u=n("./defaults"),f=n("./compressedObject"),h=n("./zipObject"),p=n("./generate"),y=n("./nodejsUtils"),g=n("./nodejs/NodejsStreamInputAdapter"),x=function(C){C.slice(-1)==="/"&&(C=C.substring(0,C.length-1));var N=C.lastIndexOf("/");return 0<N?C.substring(0,N):""},v=function(C){return C.slice(-1)!=="/"&&(C+="/"),C},b=function(C,N){return N=N!==void 0?N:u.createFolders,C=v(C),this.files[C]||o.call(this,C,null,{dir:!0,createFolders:N}),this.files[C]};function w(C){return Object.prototype.toString.call(C)==="[object RegExp]"}var _={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(C){var N,k,P;for(N in this.files)P=this.files[N],(k=N.slice(this.root.length,N.length))&&N.slice(0,this.root.length)===this.root&&C(k,P)},filter:function(C){var N=[];return this.forEach(function(k,P){C(k,P)&&N.push(P)}),N},file:function(C,N,k){if(arguments.length!==1)return C=this.root+C,o.call(this,C,N,k),this;if(w(C)){var P=C;return this.filter(function(T,D){return!D.dir&&P.test(T)})}var A=this.files[this.root+C];return A&&!A.dir?A:null},folder:function(C){if(!C)return this;if(w(C))return this.filter(function(A,T){return T.dir&&C.test(A)});var N=this.root+C,k=b.call(this,N),P=this.clone();return P.root=k.name,P},remove:function(C){C=this.root+C;var N=this.files[C];if(N||(C.slice(-1)!=="/"&&(C+="/"),N=this.files[C]),N&&!N.dir)delete this.files[C];else for(var k=this.filter(function(A,T){return T.name.slice(0,C.length)===C}),P=0;P<k.length;P++)delete this.files[k[P].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(C){var N,k={};try{if((k=l.extend(C||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=k.type.toLowerCase(),k.compression=k.compression.toUpperCase(),k.type==="binarystring"&&(k.type="string"),!k.type)throw new Error("No output type specified.");l.checkSupport(k.type),k.platform!=="darwin"&&k.platform!=="freebsd"&&k.platform!=="linux"&&k.platform!=="sunos"||(k.platform="UNIX"),k.platform==="win32"&&(k.platform="DOS");var P=k.comment||this.comment||"";N=p.generateWorker(this,k,P)}catch(A){(N=new c("error")).error(A)}return new d(N,k.type||"string",k.mimeType)},generateAsync:function(C,N){return this.generateInternalStream(C).accumulate(N)},generateNodeStream:function(C,N){return(C=C||{}).type||(C.type="nodebuffer"),this.generateInternalStream(C).toNodejsStream(N)}};r.exports=_},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(n,r,s){r.exports=n("stream")},{stream:void 0}],17:[function(n,r,s){var o=n("./DataReader");function i(l){o.call(this,l);for(var c=0;c<this.data.length;c++)l[c]=255&l[c]}n("../utils").inherits(i,o),i.prototype.byteAt=function(l){return this.data[this.zero+l]},i.prototype.lastIndexOfSignature=function(l){for(var c=l.charCodeAt(0),d=l.charCodeAt(1),u=l.charCodeAt(2),f=l.charCodeAt(3),h=this.length-4;0<=h;--h)if(this.data[h]===c&&this.data[h+1]===d&&this.data[h+2]===u&&this.data[h+3]===f)return h-this.zero;return-1},i.prototype.readAndCheckSignature=function(l){var c=l.charCodeAt(0),d=l.charCodeAt(1),u=l.charCodeAt(2),f=l.charCodeAt(3),h=this.readData(4);return c===h[0]&&d===h[1]&&u===h[2]&&f===h[3]},i.prototype.readData=function(l){if(this.checkOffset(l),l===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=i},{"../utils":32,"./DataReader":18}],18:[function(n,r,s){var o=n("../utils");function i(l){this.data=l,this.length=l.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(l){this.checkIndex(this.index+l)},checkIndex:function(l){if(this.length<this.zero+l||l<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+l+"). Corrupted zip ?")},setIndex:function(l){this.checkIndex(l),this.index=l},skip:function(l){this.setIndex(this.index+l)},byteAt:function(){},readInt:function(l){var c,d=0;for(this.checkOffset(l),c=this.index+l-1;c>=this.index;c--)d=(d<<8)+this.byteAt(c);return this.index+=l,d},readString:function(l){return o.transformTo("string",this.readData(l))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var l=this.readInt(4);return new Date(Date.UTC(1980+(l>>25&127),(l>>21&15)-1,l>>16&31,l>>11&31,l>>5&63,(31&l)<<1))}},r.exports=i},{"../utils":32}],19:[function(n,r,s){var o=n("./Uint8ArrayReader");function i(l){o.call(this,l)}n("../utils").inherits(i,o),i.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,s){var o=n("./DataReader");function i(l){o.call(this,l)}n("../utils").inherits(i,o),i.prototype.byteAt=function(l){return this.data.charCodeAt(this.zero+l)},i.prototype.lastIndexOfSignature=function(l){return this.data.lastIndexOf(l)-this.zero},i.prototype.readAndCheckSignature=function(l){return l===this.readData(4)},i.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=i},{"../utils":32,"./DataReader":18}],21:[function(n,r,s){var o=n("./ArrayReader");function i(l){o.call(this,l)}n("../utils").inherits(i,o),i.prototype.readData=function(l){if(this.checkOffset(l),l===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,s){var o=n("../utils"),i=n("../support"),l=n("./ArrayReader"),c=n("./StringReader"),d=n("./NodeBufferReader"),u=n("./Uint8ArrayReader");r.exports=function(f){var h=o.getTypeOf(f);return o.checkSupport(h),h!=="string"||i.uint8array?h==="nodebuffer"?new d(f):i.uint8array?new u(o.transformTo("uint8array",f)):new l(o.transformTo("array",f)):new c(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,s){s.LOCAL_FILE_HEADER="PK��",s.CENTRAL_FILE_HEADER="PK��",s.CENTRAL_DIRECTORY_END="PK��",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK�\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK��",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,s){var o=n("./GenericWorker"),i=n("../utils");function l(c){o.call(this,"ConvertWorker to "+c),this.destType=c}i.inherits(l,o),l.prototype.processChunk=function(c){this.push({data:i.transformTo(this.destType,c.data),meta:c.meta})},r.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,s){var o=n("./GenericWorker"),i=n("../crc32");function l(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(l,o),l.prototype.processChunk=function(c){this.streamInfo.crc32=i(c.data,this.streamInfo.crc32||0),this.push(c)},r.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,s){var o=n("../utils"),i=n("./GenericWorker");function l(c){i.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}o.inherits(l,i),l.prototype.processChunk=function(c){if(c){var d=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=d+c.data.length}i.prototype.processChunk.call(this,c)},r.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,s){var o=n("../utils"),i=n("./GenericWorker");function l(c){i.call(this,"DataWorker");var d=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(u){d.dataIsReady=!0,d.data=u,d.max=u&&u.length||0,d.type=o.getTypeOf(u),d.isPaused||d._tickAndRepeat()},function(u){d.error(u)})}o.inherits(l,i),l.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},l.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},l.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},l.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,d=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,d);break;case"uint8array":c=this.data.subarray(this.index,d);break;case"array":case"nodebuffer":c=this.data.slice(this.index,d)}return this.index=d,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,s){function o(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}o.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,l){return this._listeners[i].push(l),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,l){if(this._listeners[i])for(var c=0;c<this._listeners[i].length;c++)this._listeners[i][c].call(this,l)},pipe:function(i){return i.registerPrevious(this)},registerPrevious:function(i){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=i.streamInfo,this.mergeStreamInfo(),this.previous=i;var l=this;return i.on("data",function(c){l.processChunk(c)}),i.on("end",function(){l.end()}),i.on("error",function(c){l.error(c)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var i=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),i=!0),this.previous&&this.previous.resume(),!i},flush:function(){},processChunk:function(i){this.push(i)},withStreamInfo:function(i,l){return this.extraStreamInfo[i]=l,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var i in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,i)&&(this.streamInfo[i]=this.extraStreamInfo[i])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var i="Worker "+this.name;return this.previous?this.previous+" -> "+i:i}},r.exports=o},{}],29:[function(n,r,s){var o=n("../utils"),i=n("./ConvertWorker"),l=n("./GenericWorker"),c=n("../base64"),d=n("../support"),u=n("../external"),f=null;if(d.nodestream)try{f=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function h(y,g){return new u.Promise(function(x,v){var b=[],w=y._internalType,_=y._outputType,C=y._mimeType;y.on("data",function(N,k){b.push(N),g&&g(k)}).on("error",function(N){b=[],v(N)}).on("end",function(){try{var N=function(k,P,A){switch(k){case"blob":return o.newBlob(o.transformTo("arraybuffer",P),A);case"base64":return c.encode(P);default:return o.transformTo(k,P)}}(_,function(k,P){var A,T=0,D=null,E=0;for(A=0;A<P.length;A++)E+=P[A].length;switch(k){case"string":return P.join("");case"array":return Array.prototype.concat.apply([],P);case"uint8array":for(D=new Uint8Array(E),A=0;A<P.length;A++)D.set(P[A],T),T+=P[A].length;return D;case"nodebuffer":return Buffer.concat(P);default:throw new Error("concat : unsupported type '"+k+"'")}}(w,b),C);x(N)}catch(k){v(k)}b=[]}).resume()})}function p(y,g,x){var v=g;switch(g){case"blob":case"arraybuffer":v="uint8array";break;case"base64":v="string"}try{this._internalType=v,this._outputType=g,this._mimeType=x,o.checkSupport(v),this._worker=y.pipe(new i(v)),y.lock()}catch(b){this._worker=new l("error"),this._worker.error(b)}}p.prototype={accumulate:function(y){return h(this,y)},on:function(y,g){var x=this;return y==="data"?this._worker.on(y,function(v){g.call(x,v.data,v.meta)}):this._worker.on(y,function(){o.delay(g,arguments,x)}),this},resume:function(){return o.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(y){if(o.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new f(this,{objectMode:this._outputType!=="nodebuffer"},y)}},r.exports=p},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,s){if(s.base64=!0,s.array=!0,s.string=!0,s.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",s.nodebuffer=typeof Buffer<"u",s.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")s.blob=!1;else{var o=new ArrayBuffer(0);try{s.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(o),s.blob=i.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!n("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,s){for(var o=n("./utils"),i=n("./support"),l=n("./nodejsUtils"),c=n("./stream/GenericWorker"),d=new Array(256),u=0;u<256;u++)d[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;d[254]=d[254]=1;function f(){c.call(this,"utf-8 decode"),this.leftOver=null}function h(){c.call(this,"utf-8 encode")}s.utf8encode=function(p){return i.nodebuffer?l.newBufferFrom(p,"utf-8"):function(y){var g,x,v,b,w,_=y.length,C=0;for(b=0;b<_;b++)(64512&(x=y.charCodeAt(b)))==55296&&b+1<_&&(64512&(v=y.charCodeAt(b+1)))==56320&&(x=65536+(x-55296<<10)+(v-56320),b++),C+=x<128?1:x<2048?2:x<65536?3:4;for(g=i.uint8array?new Uint8Array(C):new Array(C),b=w=0;w<C;b++)(64512&(x=y.charCodeAt(b)))==55296&&b+1<_&&(64512&(v=y.charCodeAt(b+1)))==56320&&(x=65536+(x-55296<<10)+(v-56320),b++),x<128?g[w++]=x:(x<2048?g[w++]=192|x>>>6:(x<65536?g[w++]=224|x>>>12:(g[w++]=240|x>>>18,g[w++]=128|x>>>12&63),g[w++]=128|x>>>6&63),g[w++]=128|63&x);return g}(p)},s.utf8decode=function(p){return i.nodebuffer?o.transformTo("nodebuffer",p).toString("utf-8"):function(y){var g,x,v,b,w=y.length,_=new Array(2*w);for(g=x=0;g<w;)if((v=y[g++])<128)_[x++]=v;else if(4<(b=d[v]))_[x++]=65533,g+=b-1;else{for(v&=b===2?31:b===3?15:7;1<b&&g<w;)v=v<<6|63&y[g++],b--;1<b?_[x++]=65533:v<65536?_[x++]=v:(v-=65536,_[x++]=55296|v>>10&1023,_[x++]=56320|1023&v)}return _.length!==x&&(_.subarray?_=_.subarray(0,x):_.length=x),o.applyFromCharCode(_)}(p=o.transformTo(i.uint8array?"uint8array":"array",p))},o.inherits(f,c),f.prototype.processChunk=function(p){var y=o.transformTo(i.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var g=y;(y=new Uint8Array(g.length+this.leftOver.length)).set(this.leftOver,0),y.set(g,this.leftOver.length)}else y=this.leftOver.concat(y);this.leftOver=null}var x=function(b,w){var _;for((w=w||b.length)>b.length&&(w=b.length),_=w-1;0<=_&&(192&b[_])==128;)_--;return _<0||_===0?w:_+d[b[_]]>w?_:w}(y),v=y;x!==y.length&&(i.uint8array?(v=y.subarray(0,x),this.leftOver=y.subarray(x,y.length)):(v=y.slice(0,x),this.leftOver=y.slice(x,y.length))),this.push({data:s.utf8decode(v),meta:p.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=f,o.inherits(h,c),h.prototype.processChunk=function(p){this.push({data:s.utf8encode(p.data),meta:p.meta})},s.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,s){var o=n("./support"),i=n("./base64"),l=n("./nodejsUtils"),c=n("./external");function d(g){return g}function u(g,x){for(var v=0;v<g.length;++v)x[v]=255&g.charCodeAt(v);return x}n("setimmediate"),s.newBlob=function(g,x){s.checkSupport("blob");try{return new Blob([g],{type:x})}catch{try{var v=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return v.append(g),v.getBlob(x)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(g,x,v){var b=[],w=0,_=g.length;if(_<=v)return String.fromCharCode.apply(null,g);for(;w<_;)x==="array"||x==="nodebuffer"?b.push(String.fromCharCode.apply(null,g.slice(w,Math.min(w+v,_)))):b.push(String.fromCharCode.apply(null,g.subarray(w,Math.min(w+v,_)))),w+=v;return b.join("")},stringifyByChar:function(g){for(var x="",v=0;v<g.length;v++)x+=String.fromCharCode(g[v]);return x},applyCanBeUsed:{uint8array:function(){try{return o.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return o.nodebuffer&&String.fromCharCode.apply(null,l.allocBuffer(1)).length===1}catch{return!1}}()}};function h(g){var x=65536,v=s.getTypeOf(g),b=!0;if(v==="uint8array"?b=f.applyCanBeUsed.uint8array:v==="nodebuffer"&&(b=f.applyCanBeUsed.nodebuffer),b)for(;1<x;)try{return f.stringifyByChunk(g,v,x)}catch{x=Math.floor(x/2)}return f.stringifyByChar(g)}function p(g,x){for(var v=0;v<g.length;v++)x[v]=g[v];return x}s.applyFromCharCode=h;var y={};y.string={string:d,array:function(g){return u(g,new Array(g.length))},arraybuffer:function(g){return y.string.uint8array(g).buffer},uint8array:function(g){return u(g,new Uint8Array(g.length))},nodebuffer:function(g){return u(g,l.allocBuffer(g.length))}},y.array={string:h,array:d,arraybuffer:function(g){return new Uint8Array(g).buffer},uint8array:function(g){return new Uint8Array(g)},nodebuffer:function(g){return l.newBufferFrom(g)}},y.arraybuffer={string:function(g){return h(new Uint8Array(g))},array:function(g){return p(new Uint8Array(g),new Array(g.byteLength))},arraybuffer:d,uint8array:function(g){return new Uint8Array(g)},nodebuffer:function(g){return l.newBufferFrom(new Uint8Array(g))}},y.uint8array={string:h,array:function(g){return p(g,new Array(g.length))},arraybuffer:function(g){return g.buffer},uint8array:d,nodebuffer:function(g){return l.newBufferFrom(g)}},y.nodebuffer={string:h,array:function(g){return p(g,new Array(g.length))},arraybuffer:function(g){return y.nodebuffer.uint8array(g).buffer},uint8array:function(g){return p(g,new Uint8Array(g.length))},nodebuffer:d},s.transformTo=function(g,x){if(x=x||"",!g)return x;s.checkSupport(g);var v=s.getTypeOf(x);return y[v][g](x)},s.resolve=function(g){for(var x=g.split("/"),v=[],b=0;b<x.length;b++){var w=x[b];w==="."||w===""&&b!==0&&b!==x.length-1||(w===".."?v.pop():v.push(w))}return v.join("/")},s.getTypeOf=function(g){return typeof g=="string"?"string":Object.prototype.toString.call(g)==="[object Array]"?"array":o.nodebuffer&&l.isBuffer(g)?"nodebuffer":o.uint8array&&g instanceof Uint8Array?"uint8array":o.arraybuffer&&g instanceof ArrayBuffer?"arraybuffer":void 0},s.checkSupport=function(g){if(!o[g.toLowerCase()])throw new Error(g+" is not supported by this platform")},s.MAX_VALUE_16BITS=65535,s.MAX_VALUE_32BITS=-1,s.pretty=function(g){var x,v,b="";for(v=0;v<(g||"").length;v++)b+="\\x"+((x=g.charCodeAt(v))<16?"0":"")+x.toString(16).toUpperCase();return b},s.delay=function(g,x,v){setImmediate(function(){g.apply(v||null,x||[])})},s.inherits=function(g,x){function v(){}v.prototype=x.prototype,g.prototype=new v},s.extend=function(){var g,x,v={};for(g=0;g<arguments.length;g++)for(x in arguments[g])Object.prototype.hasOwnProperty.call(arguments[g],x)&&v[x]===void 0&&(v[x]=arguments[g][x]);return v},s.prepareContent=function(g,x,v,b,w){return c.Promise.resolve(x).then(function(_){return o.blob&&(_ instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(_))!==-1)&&typeof FileReader<"u"?new c.Promise(function(C,N){var k=new FileReader;k.onload=function(P){C(P.target.result)},k.onerror=function(P){N(P.target.error)},k.readAsArrayBuffer(_)}):_}).then(function(_){var C=s.getTypeOf(_);return C?(C==="arraybuffer"?_=s.transformTo("uint8array",_):C==="string"&&(w?_=i.decode(_):v&&b!==!0&&(_=function(N){return u(N,o.uint8array?new Uint8Array(N.length):new Array(N.length))}(_))),_):c.Promise.reject(new Error("Can't read the data of '"+g+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,s){var o=n("./reader/readerFor"),i=n("./utils"),l=n("./signature"),c=n("./zipEntry"),d=n("./support");function u(f){this.files=[],this.loadOptions=f}u.prototype={checkSignature:function(f){if(!this.reader.readAndCheckSignature(f)){this.reader.index-=4;var h=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+i.pretty(h)+", expected "+i.pretty(f)+")")}},isSignature:function(f,h){var p=this.reader.index;this.reader.setIndex(f);var y=this.reader.readString(4)===h;return this.reader.setIndex(p),y},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var f=this.reader.readData(this.zipCommentLength),h=d.uint8array?"uint8array":"array",p=i.transformTo(h,f);this.zipComment=this.loadOptions.decodeFileName(p)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var f,h,p,y=this.zip64EndOfCentralSize-44;0<y;)f=this.reader.readInt(2),h=this.reader.readInt(4),p=this.reader.readData(h),this.zip64ExtensibleData[f]={id:f,length:h,value:p}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var f,h;for(f=0;f<this.files.length;f++)h=this.files[f],this.reader.setIndex(h.localHeaderOffset),this.checkSignature(l.LOCAL_FILE_HEADER),h.readLocalPart(this.reader),h.handleUTF8(),h.processAttributes()},readCentralDir:function(){var f;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(l.CENTRAL_FILE_HEADER);)(f=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(f);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var f=this.reader.lastIndexOfSignature(l.CENTRAL_DIRECTORY_END);if(f<0)throw this.isSignature(0,l.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(f);var h=f;if(this.checkSignature(l.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===i.MAX_VALUE_16BITS||this.diskWithCentralDirStart===i.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===i.MAX_VALUE_16BITS||this.centralDirRecords===i.MAX_VALUE_16BITS||this.centralDirSize===i.MAX_VALUE_32BITS||this.centralDirOffset===i.MAX_VALUE_32BITS){if(this.zip64=!0,(f=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(f),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,l.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var p=this.centralDirOffset+this.centralDirSize;this.zip64&&(p+=20,p+=12+this.zip64EndOfCentralSize);var y=h-p;if(0<y)this.isSignature(h,l.CENTRAL_FILE_HEADER)||(this.reader.zero=y);else if(y<0)throw new Error("Corrupted zip: missing "+Math.abs(y)+" bytes.")},prepareReader:function(f){this.reader=o(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=u},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,s){var o=n("./reader/readerFor"),i=n("./utils"),l=n("./compressedObject"),c=n("./crc32"),d=n("./utf8"),u=n("./compressions"),f=n("./support");function h(p,y){this.options=p,this.loadOptions=y}h.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(p){var y,g;if(p.skip(22),this.fileNameLength=p.readInt(2),g=p.readInt(2),this.fileName=p.readData(this.fileNameLength),p.skip(g),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((y=function(x){for(var v in u)if(Object.prototype.hasOwnProperty.call(u,v)&&u[v].magic===x)return u[v];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+i.pretty(this.compressionMethod)+" unknown (inner file : "+i.transformTo("string",this.fileName)+")");this.decompressed=new l(this.compressedSize,this.uncompressedSize,this.crc32,y,p.readData(this.compressedSize))},readCentralPart:function(p){this.versionMadeBy=p.readInt(2),p.skip(2),this.bitFlag=p.readInt(2),this.compressionMethod=p.readString(2),this.date=p.readDate(),this.crc32=p.readInt(4),this.compressedSize=p.readInt(4),this.uncompressedSize=p.readInt(4);var y=p.readInt(2);if(this.extraFieldsLength=p.readInt(2),this.fileCommentLength=p.readInt(2),this.diskNumberStart=p.readInt(2),this.internalFileAttributes=p.readInt(2),this.externalFileAttributes=p.readInt(4),this.localHeaderOffset=p.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");p.skip(y),this.readExtraFields(p),this.parseZIP64ExtraField(p),this.fileComment=p.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var p=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),p==0&&(this.dosPermissions=63&this.externalFileAttributes),p==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=o(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var y,g,x,v=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4<v;)y=p.readInt(2),g=p.readInt(2),x=p.readData(g),this.extraFields[y]={id:y,length:g,value:x};p.setIndex(v)},handleUTF8:function(){var p=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=d.utf8decode(this.fileName),this.fileCommentStr=d.utf8decode(this.fileComment);else{var y=this.findExtraFieldUnicodePath();if(y!==null)this.fileNameStr=y;else{var g=i.transformTo(p,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(g)}var x=this.findExtraFieldUnicodeComment();if(x!==null)this.fileCommentStr=x;else{var v=i.transformTo(p,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(v)}}},findExtraFieldUnicodePath:function(){var p=this.extraFields[28789];if(p){var y=o(p.value);return y.readInt(1)!==1||c(this.fileName)!==y.readInt(4)?null:d.utf8decode(y.readData(p.length-5))}return null},findExtraFieldUnicodeComment:function(){var p=this.extraFields[25461];if(p){var y=o(p.value);return y.readInt(1)!==1||c(this.fileComment)!==y.readInt(4)?null:d.utf8decode(y.readData(p.length-5))}return null}},r.exports=h},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,s){function o(y,g,x){this.name=y,this.dir=x.dir,this.date=x.date,this.comment=x.comment,this.unixPermissions=x.unixPermissions,this.dosPermissions=x.dosPermissions,this._data=g,this._dataBinary=x.binary,this.options={compression:x.compression,compressionOptions:x.compressionOptions}}var i=n("./stream/StreamHelper"),l=n("./stream/DataWorker"),c=n("./utf8"),d=n("./compressedObject"),u=n("./stream/GenericWorker");o.prototype={internalStream:function(y){var g=null,x="string";try{if(!y)throw new Error("No output type specified.");var v=(x=y.toLowerCase())==="string"||x==="text";x!=="binarystring"&&x!=="text"||(x="string"),g=this._decompressWorker();var b=!this._dataBinary;b&&!v&&(g=g.pipe(new c.Utf8EncodeWorker)),!b&&v&&(g=g.pipe(new c.Utf8DecodeWorker))}catch(w){(g=new u("error")).error(w)}return new i(g,x,"")},async:function(y,g){return this.internalStream(y).accumulate(g)},nodeStream:function(y,g){return this.internalStream(y||"nodebuffer").toNodejsStream(g)},_compressWorker:function(y,g){if(this._data instanceof d&&this._data.compression.magic===y.magic)return this._data.getCompressedWorker();var x=this._decompressWorker();return this._dataBinary||(x=x.pipe(new c.Utf8EncodeWorker)),d.createWorkerFrom(x,y,g)},_decompressWorker:function(){return this._data instanceof d?this._data.getContentWorker():this._data instanceof u?this._data:new l(this._data)}};for(var f=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],h=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},p=0;p<f.length;p++)o.prototype[f[p]]=h;r.exports=o},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,s){(function(o){var i,l,c=o.MutationObserver||o.WebKitMutationObserver;if(c){var d=0,u=new c(y),f=o.document.createTextNode("");u.observe(f,{characterData:!0}),i=function(){f.data=d=++d%2}}else if(o.setImmediate||o.MessageChannel===void 0)i="document"in o&&"onreadystatechange"in o.document.createElement("script")?function(){var g=o.document.createElement("script");g.onreadystatechange=function(){y(),g.onreadystatechange=null,g.parentNode.removeChild(g),g=null},o.document.documentElement.appendChild(g)}:function(){setTimeout(y,0)};else{var h=new o.MessageChannel;h.port1.onmessage=y,i=function(){h.port2.postMessage(0)}}var p=[];function y(){var g,x;l=!0;for(var v=p.length;v;){for(x=p,p=[],g=-1;++g<v;)x[g]();v=p.length}l=!1}r.exports=function(g){p.push(g)!==1||l||i()}}).call(this,typeof ii<"u"?ii:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,s){var o=n("immediate");function i(){}var l={},c=["REJECTED"],d=["FULFILLED"],u=["PENDING"];function f(v){if(typeof v!="function")throw new TypeError("resolver must be a function");this.state=u,this.queue=[],this.outcome=void 0,v!==i&&g(this,v)}function h(v,b,w){this.promise=v,typeof b=="function"&&(this.onFulfilled=b,this.callFulfilled=this.otherCallFulfilled),typeof w=="function"&&(this.onRejected=w,this.callRejected=this.otherCallRejected)}function p(v,b,w){o(function(){var _;try{_=b(w)}catch(C){return l.reject(v,C)}_===v?l.reject(v,new TypeError("Cannot resolve promise with itself")):l.resolve(v,_)})}function y(v){var b=v&&v.then;if(v&&(typeof v=="object"||typeof v=="function")&&typeof b=="function")return function(){b.apply(v,arguments)}}function g(v,b){var w=!1;function _(k){w||(w=!0,l.reject(v,k))}function C(k){w||(w=!0,l.resolve(v,k))}var N=x(function(){b(C,_)});N.status==="error"&&_(N.value)}function x(v,b){var w={};try{w.value=v(b),w.status="success"}catch(_){w.status="error",w.value=_}return w}(r.exports=f).prototype.finally=function(v){if(typeof v!="function")return this;var b=this.constructor;return this.then(function(w){return b.resolve(v()).then(function(){return w})},function(w){return b.resolve(v()).then(function(){throw w})})},f.prototype.catch=function(v){return this.then(null,v)},f.prototype.then=function(v,b){if(typeof v!="function"&&this.state===d||typeof b!="function"&&this.state===c)return this;var w=new this.constructor(i);return this.state!==u?p(w,this.state===d?v:b,this.outcome):this.queue.push(new h(w,v,b)),w},h.prototype.callFulfilled=function(v){l.resolve(this.promise,v)},h.prototype.otherCallFulfilled=function(v){p(this.promise,this.onFulfilled,v)},h.prototype.callRejected=function(v){l.reject(this.promise,v)},h.prototype.otherCallRejected=function(v){p(this.promise,this.onRejected,v)},l.resolve=function(v,b){var w=x(y,b);if(w.status==="error")return l.reject(v,w.value);var _=w.value;if(_)g(v,_);else{v.state=d,v.outcome=b;for(var C=-1,N=v.queue.length;++C<N;)v.queue[C].callFulfilled(b)}return v},l.reject=function(v,b){v.state=c,v.outcome=b;for(var w=-1,_=v.queue.length;++w<_;)v.queue[w].callRejected(b);return v},f.resolve=function(v){return v instanceof this?v:l.resolve(new this(i),v)},f.reject=function(v){var b=new this(i);return l.reject(b,v)},f.all=function(v){var b=this;if(Object.prototype.toString.call(v)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=v.length,_=!1;if(!w)return this.resolve([]);for(var C=new Array(w),N=0,k=-1,P=new this(i);++k<w;)A(v[k],k);return P;function A(T,D){b.resolve(T).then(function(E){C[D]=E,++N!==w||_||(_=!0,l.resolve(P,C))},function(E){_||(_=!0,l.reject(P,E))})}},f.race=function(v){var b=this;if(Object.prototype.toString.call(v)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=v.length,_=!1;if(!w)return this.resolve([]);for(var C=-1,N=new this(i);++C<w;)k=v[C],b.resolve(k).then(function(P){_||(_=!0,l.resolve(N,P))},function(P){_||(_=!0,l.reject(N,P))});var k;return N}},{immediate:36}],38:[function(n,r,s){var o={};(0,n("./lib/utils/common").assign)(o,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=o},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,s){var o=n("./zlib/deflate"),i=n("./utils/common"),l=n("./utils/strings"),c=n("./zlib/messages"),d=n("./zlib/zstream"),u=Object.prototype.toString,f=0,h=-1,p=0,y=8;function g(v){if(!(this instanceof g))return new g(v);this.options=i.assign({level:h,method:y,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:""},v||{});var b=this.options;
vendor: 4,869 bytes, line 508
508b.raw&&0<b.windowBits?b.windowBits=-b.windowBits:b.gzip&&0<b.windowBits&&b.windowBits<16&&(b.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var w=o.deflateInit2(this.strm,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(w!==f)throw new Error(c[w]);if(b.header&&o.deflateSetHeader(this.strm,b.header),b.dictionary){var _;if(_=typeof b.dictionary=="string"?l.string2buf(b.dictionary):u.call(b.dictionary)==="[object ArrayBuffer]"?new Uint8Array(b.dictionary):b.dictionary,(w=o.deflateSetDictionary(this.strm,_))!==f)throw new Error(c[w]);this._dict_set=!0}}function x(v,b){var w=new g(b);if(w.push(v,!0),w.err)throw w.msg||c[w.err];return w.result}g.prototype.push=function(v,b){var w,_,C=this.strm,N=this.options.chunkSize;if(this.ended)return!1;_=b===~~b?b:b===!0?4:0,typeof v=="string"?C.input=l.string2buf(v):u.call(v)==="[object ArrayBuffer]"?C.input=new Uint8Array(v):C.input=v,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new i.Buf8(N),C.next_out=0,C.avail_out=N),(w=o.deflate(C,_))!==1&&w!==f)return this.onEnd(w),!(this.ended=!0);C.avail_out!==0&&(C.avail_in!==0||_!==4&&_!==2)||(this.options.to==="string"?this.onData(l.buf2binstring(i.shrinkBuf(C.output,C.next_out))):this.onData(i.shrinkBuf(C.output,C.next_out)))}while((0<C.avail_in||C.avail_out===0)&&w!==1);return _===4?(w=o.deflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===f):_!==2||(this.onEnd(f),!(C.avail_out=0))},g.prototype.onData=function(v){this.chunks.push(v)},g.prototype.onEnd=function(v){v===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=v,this.msg=this.strm.msg},s.Deflate=g,s.deflate=x,s.deflateRaw=function(v,b){return(b=b||{}).raw=!0,x(v,b)},s.gzip=function(v,b){return(b=b||{}).gzip=!0,x(v,b)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,s){var o=n("./zlib/inflate"),i=n("./utils/common"),l=n("./utils/strings"),c=n("./zlib/constants"),d=n("./zlib/messages"),u=n("./zlib/zstream"),f=n("./zlib/gzheader"),h=Object.prototype.toString;function p(g){if(!(this instanceof p))return new p(g);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},g||{});var x=this.options;x.raw&&0<=x.windowBits&&x.windowBits<16&&(x.windowBits=-x.windowBits,x.windowBits===0&&(x.windowBits=-15)),!(0<=x.windowBits&&x.windowBits<16)||g&&g.windowBits||(x.windowBits+=32),15<x.windowBits&&x.windowBits<48&&!(15&x.windowBits)&&(x.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var v=o.inflateInit2(this.strm,x.windowBits);if(v!==c.Z_OK)throw new Error(d[v]);this.header=new f,o.inflateGetHeader(this.strm,this.header)}function y(g,x){var v=new p(x);if(v.push(g,!0),v.err)throw v.msg||d[v.err];return v.result}p.prototype.push=function(g,x){var v,b,w,_,C,N,k=this.strm,P=this.options.chunkSize,A=this.options.dictionary,T=!1;if(this.ended)return!1;b=x===~~x?x:x===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof g=="string"?k.input=l.binstring2buf(g):h.call(g)==="[object ArrayBuffer]"?k.input=new Uint8Array(g):k.input=g,k.next_in=0,k.avail_in=k.input.length;do{if(k.avail_out===0&&(k.output=new i.Buf8(P),k.next_out=0,k.avail_out=P),(v=o.inflate(k,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&A&&(N=typeof A=="string"?l.string2buf(A):h.call(A)==="[object ArrayBuffer]"?new Uint8Array(A):A,v=o.inflateSetDictionary(this.strm,N)),v===c.Z_BUF_ERROR&&T===!0&&(v=c.Z_OK,T=!1),v!==c.Z_STREAM_END&&v!==c.Z_OK)return this.onEnd(v),!(this.ended=!0);k.next_out&&(k.avail_out!==0&&v!==c.Z_STREAM_END&&(k.avail_in!==0||b!==c.Z_FINISH&&b!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(w=l.utf8border(k.output,k.next_out),_=k.next_out-w,C=l.buf2string(k.output,w),k.next_out=_,k.avail_out=P-_,_&&i.arraySet(k.output,k.output,w,_,0),this.onData(C)):this.onData(i.shrinkBuf(k.output,k.next_out)))),k.avail_in===0&&k.avail_out===0&&(T=!0)}while((0<k.avail_in||k.avail_out===0)&&v!==c.Z_STREAM_END);return v===c.Z_STREAM_END&&(b=c.Z_FINISH),b===c.Z_FINISH?(v=o.inflateEnd(this.strm),this.onEnd(v),this.ended=!0,v===c.Z_OK):b!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(k.avail_out=0))},p.prototype.onData=function(g){this.chunks.push(g)},p.prototype.onEnd=function(g){g===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=g,this.msg=this.strm.msg},s.Inflate=p,s.inflate=y,s.inflateRaw=function(g,x){return(x=x||{}).raw=!0,y(g,x)},s.ungzip=y},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,s){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";s.assign=function(c){for(var d=Array.prototype.slice.call(arguments,1
vendor: 16,897 bytes, line 508
508);d.length;){var u=d.shift();if(u){if(typeof u!="object")throw new TypeError(u+"must be non-object");for(var f in u)u.hasOwnProperty(f)&&(c[f]=u[f])}}return c},s.shrinkBuf=function(c,d){return c.length===d?c:c.subarray?c.subarray(0,d):(c.length=d,c)};var i={arraySet:function(c,d,u,f,h){if(d.subarray&&c.subarray)c.set(d.subarray(u,u+f),h);else for(var p=0;p<f;p++)c[h+p]=d[u+p]},flattenChunks:function(c){var d,u,f,h,p,y;for(d=f=0,u=c.length;d<u;d++)f+=c[d].length;for(y=new Uint8Array(f),d=h=0,u=c.length;d<u;d++)p=c[d],y.set(p,h),h+=p.length;return y}},l={arraySet:function(c,d,u,f,h){for(var p=0;p<f;p++)c[h+p]=d[u+p]},flattenChunks:function(c){return[].concat.apply([],c)}};s.setTyped=function(c){c?(s.Buf8=Uint8Array,s.Buf16=Uint16Array,s.Buf32=Int32Array,s.assign(s,i)):(s.Buf8=Array,s.Buf16=Array,s.Buf32=Array,s.assign(s,l))},s.setTyped(o)},{}],42:[function(n,r,s){var o=n("./common"),i=!0,l=!0;try{String.fromCharCode.apply(null,[0])}catch{i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{l=!1}for(var c=new o.Buf8(256),d=0;d<256;d++)c[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;function u(f,h){if(h<65537&&(f.subarray&&l||!f.subarray&&i))return String.fromCharCode.apply(null,o.shrinkBuf(f,h));for(var p="",y=0;y<h;y++)p+=String.fromCharCode(f[y]);return p}c[254]=c[254]=1,s.string2buf=function(f){var h,p,y,g,x,v=f.length,b=0;for(g=0;g<v;g++)(64512&(p=f.charCodeAt(g)))==55296&&g+1<v&&(64512&(y=f.charCodeAt(g+1)))==56320&&(p=65536+(p-55296<<10)+(y-56320),g++),b+=p<128?1:p<2048?2:p<65536?3:4;for(h=new o.Buf8(b),g=x=0;x<b;g++)(64512&(p=f.charCodeAt(g)))==55296&&g+1<v&&(64512&(y=f.charCodeAt(g+1)))==56320&&(p=65536+(p-55296<<10)+(y-56320),g++),p<128?h[x++]=p:(p<2048?h[x++]=192|p>>>6:(p<65536?h[x++]=224|p>>>12:(h[x++]=240|p>>>18,h[x++]=128|p>>>12&63),h[x++]=128|p>>>6&63),h[x++]=128|63&p);return h},s.buf2binstring=function(f){return u(f,f.length)},s.binstring2buf=function(f){for(var h=new o.Buf8(f.length),p=0,y=h.length;p<y;p++)h[p]=f.charCodeAt(p);return h},s.buf2string=function(f,h){var p,y,g,x,v=h||f.length,b=new Array(2*v);for(p=y=0;p<v;)if((g=f[p++])<128)b[y++]=g;else if(4<(x=c[g]))b[y++]=65533,p+=x-1;else{for(g&=x===2?31:x===3?15:7;1<x&&p<v;)g=g<<6|63&f[p++],x--;1<x?b[y++]=65533:g<65536?b[y++]=g:(g-=65536,b[y++]=55296|g>>10&1023,b[y++]=56320|1023&g)}return u(b,y)},s.utf8border=function(f,h){var p;for((h=h||f.length)>f.length&&(h=f.length),p=h-1;0<=p&&(192&f[p])==128;)p--;return p<0||p===0?h:p+c[f[p]]>h?p:h}},{"./common":41}],43:[function(n,r,s){r.exports=function(o,i,l,c){for(var d=65535&o|0,u=o>>>16&65535|0,f=0;l!==0;){for(l-=f=2e3<l?2e3:l;u=u+(d=d+i[c++]|0)|0,--f;);d%=65521,u%=65521}return d|u<<16|0}},{}],44:[function(n,r,s){r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,r,s){var o=function(){for(var i,l=[],c=0;c<256;c++){i=c;for(var d=0;d<8;d++)i=1&i?3988292384^i>>>1:i>>>1;l[c]=i}return l}();r.exports=function(i,l,c,d){var u=o,f=d+c;i^=-1;for(var h=d;h<f;h++)i=i>>>8^u[255&(i^l[h])];return-1^i}},{}],46:[function(n,r,s){var o,i=n("../utils/common"),l=n("./trees"),c=n("./adler32"),d=n("./crc32"),u=n("./messages"),f=0,h=4,p=0,y=-2,g=-1,x=4,v=2,b=8,w=9,_=286,C=30,N=19,k=2*_+1,P=15,A=3,T=258,D=T+A+1,E=42,I=113,S=1,L=2,Y=3,B=4;function q(j,H){return j.msg=u[H],H}function F(j){return(j<<1)-(4<j?9:0)}function ee(j){for(var H=j.length;0<=--H;)j[H]=0}function $(j){var H=j.state,G=H.pending;G>j.avail_out&&(G=j.avail_out),G!==0&&(i.arraySet(j.output,H.pending_buf,H.pending_out,G,j.next_out),j.next_out+=G,H.pending_out+=G,j.total_out+=G,j.avail_out-=G,H.pending-=G,H.pending===0&&(H.pending_out=0))}function M(j,H){l._tr_flush_block(j,0<=j.block_start?j.block_start:-1,j.strstart-j.block_start,H),j.block_start=j.strstart,$(j.strm)}function J(j,H){j.pending_buf[j.pending++]=H}function K(j,H){j.pending_buf[j.pending++]=H>>>8&255,j.pending_buf[j.pending++]=255&H}function X(j,H){var G,O,R=j.max_chain_length,U=j.strstart,V=j.prev_length,Q=j.nice_match,W=j.strstart>j.w_size-D?j.strstart-(j.w_size-D):0,se=j.window,fe=j.w_mask,ce=j.prev,me=j.strstart+T,ke=se[U+V-1],Ne=se[U+V];j.prev_length>=j.good_match&&(R>>=2),Q>j.lookahead&&(Q=j.lookahead);do if(se[(G=H)+V]===Ne&&se[G+V-1]===ke&&se[G]===se[U]&&se[++G]===se[U+1]){U+=2,G++;do;while(se[++U]===se[++G]&&se[++U]===se[++G]&&se[++U]===se[++G]&&se[++U]===se[++G]&&se[++U]===se[++G]&&se[++U]===se[++G]&&se[++U]===se[++G]&&se[++U]===se[++G]&&U<me);if(O=T-(me-U),U=me-T,V<O){if(j.match_start=H,Q<=(V=O))break;ke=se[U+V-1],Ne=se[U+V]}}while((H=ce[H&fe])>W&&--R!=0);return V<=j.lookahead?V:j.lookahead}function de(j){var H,G,O,R,U,V,Q,W,se,fe,ce=j.w_size;do{if(R=j.window_size-j.lookahead-j.strstart,j.strstart>=ce+(ce-D)){for(i.arraySet(j.window,j.window,ce,ce,0),j.match_start-=ce,j.strstart-=ce,j.block_start-=ce,H=G=j.hash_size;O=j.head[--H],j.head[H]=ce<=O?O-ce:0,--G;);for(H=G=ce;O=j.prev[--H],j.prev[H]=ce<=O?O-ce:0,--G;);R+=ce}if(j.strm.avail_in===0)break;if(V=j.strm,Q=j.window,W=j.strstart+j.lookahead,se=R,fe=void 0,fe=V.avail_in,se<fe&&(fe=se),G=fe===0?0:(V.avail_in-=fe,i.arraySet(Q,V.input,V.next_in,fe,W),V.state.wrap===1?V.adler=c(V.adler,Q,fe,W):V.state.wrap===2&&(V.adler=d(V.adler,Q,fe,W)),V.next_in+=fe,V.total_in+=fe,fe),j.lookahead+=G,j.lookahead+j.insert>=A)for(U=j.strstart-j.insert,j.ins_h=j.window[U],j.ins_h=(j.ins_h<<j.hash_shift^j.window[U+1])&j.hash_mask;j.insert&&(j.ins_h=(j.ins_h<<j.hash_shift^j.window[U+A-1])&j.hash_mask,j.prev[U&j.w_mask]=j.head[j.ins_h],j.head[j.ins_h]=U,U++,j.insert--,!(j.lookahead+j.insert<A)););}while(j.lookahead<D&&j.strm.avail_in!==0)}function te(j,H){for(var G,O;;){if(j.lookahead<D){if(de(j),j.lookahead<D&&H===f)return S;if(j.lookahead===0)break}if(G=0,j.lookahead>=A&&(j.ins_h=(j.ins_h<<j.hash_shift^j.window[j.strstart+A-1])&j.hash_mask,G=j.prev[j.strstart&j.w_mask]=j.head[j.ins_h],j.head[j.ins_h]=j.strstart),G!==0&&j.strstart-G<=j.w_size-D&&(j.match_length=X(j,G)),j.match_length>=A)if(O=l._tr_tally(j,j.strstart-j.match_start,j.match_length-A),j.lookahead-=j.match_length,j.match_length<=j.max_lazy_match&&j.lookahead>=A){for(j.match_length--;j.strstart++,j.ins_h=(j.ins_h<<j.hash_shift^j.window[j.strstart+A-1])&j.hash_mask,G=j.prev[j.strstart&j.w_mask]=j.head[j.ins_h],j.head[j.ins_h]=j.strstart,--j.match_length!=0;);j.strstart++}else j.strstart+=j.match_length,j.match_length=0,j.ins_h=j.window[j.strstart],j.ins_h=(j.ins_h<<j.hash_shift^j.window[j.strstart+1])&j.hash_mask;else O=l._tr_tally(j,0,j.window[j.strstart]),j.lookahead--,j.strstart++;if(O&&(M(j,!1),j.strm.avail_out===0))return S}return j.insert=j.strstart<A-1?j.strstart:A-1,H===h?(M(j,!0),j.strm.avail_out===0?Y:B):j.last_lit&&(M(j,!1),j.strm.avail_out===0)?S:L}function ae(j,H){for(var G,O,R;;){if(j.lookahead<D){if(de(j),j.lookahead<D&&H===f)return S;if(j.lookahead===0)break}if(G=0,j.lookahead>=A&&(j.ins_h=(j.ins_h<<j.hash_shift^j.window[j.strstart+A-1])&j.hash_mask,G=j.prev[j.strstart&j.w_mask]=j.head[j.ins_h],j.head[j.ins_h]=j.strstart),j.prev_length=j.match_length,j.prev_match=j.match_start,j.match_length=A-1,G!==0&&j.prev_length<j.max_lazy_match&&j.strstart-G<=j.w_size-D&&(j.match_length=X(j,G),j.match_length<=5&&(j.strategy===1||j.match_length===A&&4096<j.strstart-j.match_start)&&(j.match_length=A-1)),j.prev_length>=A&&j.match_length<=j.prev_length){for(R=j.strstart+j.lookahead-A,O=l._tr_tally(j,j.strstart-1-j.prev_match,j.prev_length-A),j.lookahead-=j.prev_length-1,j.prev_length-=2;++j.strstart<=R&&(j.ins_h=(j.ins_h<<j.hash_shift^j.window[j.strstart+A-1])&j.hash_mask,G=j.prev[j.strstart&j.w_mask]=j.head[j.ins_h],j.head[j.ins_h]=j.strstart),--j.prev_length!=0;);if(j.match_available=0,j.match_length=A-1,j.strstart++,O&&(M(j,!1),j.strm.avail_out===0))return S}else if(j.match_available){if((O=l._tr_tally(j,0,j.window[j.strstart-1]))&&M(j,!1),j.strstart++,j.lookahead--,j.strm.avail_out===0)return S}else j.match_available=1,j.strstart++,j.lookahead--}return j.match_available&&(O=l._tr_tally(j,0,j.window[j.strstart-1]),j.match_available=0),j.insert=j.strstart<A-1?j.strstart:A-1,H===h?(M(j,!0),j.strm.avail_out===0?Y:B):j.last_lit&&(M(j,!1),j.strm.avail_out===0)?S:L}function re(j,H,G,O,R){this.good_length=j,this.max_lazy=H,this.nice_length=G,this.max_chain=O,this.func=R}function le(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=b,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(2*k),this.dyn_dtree=new i.Buf16(2*(2*C+1)),this.bl_tree=new i.Buf16(2*(2*N+1)),ee(this.dyn_ltree),ee(this.dyn_dtree),ee(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(P+1),this.heap=new i.Buf16(2*_+1),ee(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*_+1),ee(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function ue(j){var H;return j&&j.state?(j.total_in=j.total_out=0,j.data_type=v,(H=j.state).pending=0,H.pending_out=0,H.wrap<0&&(H.wrap=-H.wrap),H.status=H.wrap?E:I,j.adler=H.wrap===2?0:1,H.last_flush=f,l._tr_init(H),p):q(j,y)}function z(j){var H=ue(j);return H===p&&function(G){G.window_size=2*G.w_size,ee(G.head),G.max_lazy_match=o[G.level].max_lazy,G.good_match=o[G.level].good_length,G.nice_match=o[G.level].nice_length,G.max_chain_length=o[G.level].max_chain,G.strstart=0,G.block_start=0,G.lookahead=0,G.insert=0,G.match_length=G.prev_length=A-1,G.match_available=0,G.ins_h=0}(j.state),H}function ie(j,H,G,O,R,U){if(!j)return y;var V=1;if(H===g&&(H=6),O<0?(V=0,O=-O):15<O&&(V=2,O-=16),R<1||w<R||G!==b||O<8||15<O||H<0||9<H||U<0||x<U)return q(j,y);O===8&&(O=9);var Q=new le;return(j.state=Q).strm=j,Q.wrap=V,Q.gzhead=null,Q.w_bits=O,Q.w_size=1<<Q.w_bits,Q.w_mask=Q.w_size-1,Q.hash_bits=R+7,Q.hash_size=1<<Q.hash_bits,Q.hash_mask=Q.hash_size-1,Q.hash_shift=~~((Q.hash_bits+A-1)/A),Q.window=new i.Buf8(2*Q.w_size),Q.head=new i.Buf16(Q.hash_size),Q.prev=new i.Buf16(Q.w_size),Q.lit_bufsize=1<<R+6,Q.pending_buf_size=4*Q.lit_bufsize,Q.pending_buf=new i.Buf8(Q.pending_buf_size),Q.d_buf=1*Q.lit_bufsize,Q.l_buf=3*Q.lit_bufsize,Q.level=H,Q.strategy=U,Q.method=G,z(j)}o=[new re(0,0,0,0,function(j,H){var G=65535;for(G>j.pending_buf_size-5&&(G=j.pending_buf_size-5);;){if(j.lookahead<=1){if(de(j),j.lookahead===0&&H===f)return S;if(j.lookahead===0)break}j.strstart+=j.lookahead,j.lookahead=0;var O=j.block_start+G;if((j.strstart===0||j.strstart>=O)&&(j.lookahead=j.strstart-O,j.strstart=O,M(j,!1),j.strm.avail_out===0)||j.strstart-j.block_start>=j.w_size-D&&(M(j,!1),j.strm.avail_out===0))return S}return j.insert=0,H===h?(M(j,!0),j.strm.avail_out===0?Y:B):(j.strstart>j.block_start&&(M(j,!1),j.strm.avail_out),S)}),new re(4,4,8,4,te),new re(4,5,16,8,te),new re(4,6,32,32,te),new re(4,4,16,16,ae),new re(8,16,32,32,ae),new re(8,16,128,128,ae),new re(8,32,128,256,ae),new re(32,128,258,1024,ae),new re(32,258,258,4096,ae)],s.deflateInit=function(j,H){return ie(j,H,b,15,8,0)},s.deflateInit2=ie,s.deflateReset=z,s.deflateResetKeep=ue,s.deflateSetHeader=function(j,H){return j&&j.state?j.state.wrap!==2?y:(j.state.gzhead=H,p):y},s.deflate=function(j,H){var G,O,R,U;if(!j||!j.state||5<H||H<0)return j?q(j,y):y;if(O=j.state,!j.output||!j.input&&j.avail_in!==0||O.status===666&&H!==h)return q(j,j.avail_out===0?-5:y);if(O.strm=j,G=O.last_flush,O.last_flush=H,O.status===E)if(O.wrap===2)j.adler=0,J(O,31),J(O,139),J(O,8),O.gzhead?(J(O,(O.gzhead.text?1:0)+(O.gzhead.hcrc?2:0)+(O.gzhead.extra?4:0)+(O.gzhead.name?8:0)+(O.gzhead.comment?16:0)),J(O,255&O.gzhead.time),J(O,O.gzhead.time>>8&255),J(O,O.gzhead.time>>16&255),J(O,O.gzhead.time>>24&255),J(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),J(O,255&O.gzhead.os),O.gzhead.extra&&O.gzhead.extra.length&&(J(O,255&O.gzhead.extra.length),J(O,O.gzhead.extra.length>>8&255)),O.gzhead.hcrc&&(j.adler=d(j.adler,O.pending_buf,O.pending,0)),O.gzindex=0,O.status=69):(J(O,0),J(O,0),J(O,0),J(O,0),J(O,0),J(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),J(O,3),O.status=I);else{var V=b+(O.w_bits-8<<4)<<8;V|=(2<=O.strategy||O.level<2?0:O.level<6?1:O.level===6?2:3)<<6,O.strstart!==0&&(V|=32),V+=31-V%31,O.status=I,K(O,V),O.strstart!==0&&(K(O,j.adler>>>16),K(O,65535&j.adler)),j.adler=1}if(O.status===69)if(O.gzhead.extra){for(R=O.pending;O.gzindex<(65535&O.gzhead.extra.length)&&(O.pending!==O.pending_buf_size||(O.gzhead.hcrc&&O.pending>R&&(j.adler=d(j.adler,O.pending_buf,O.pending-R,R)),$(j),R=O.pending,O.pending!==O.pending_buf_size));)J(O,255&O.gzhead.extra[O.gzindex]),O.gzindex++;O.gzhead.hcrc&&O.pending>R&&(j.adler=d(j.adler,O.pending_buf,O.pending-R,R)),O.gzindex===O.gzhead.extra.length&&(O.gzindex=0,O.status=73)}else O.status=73;if(O.status===73)if(O.gzhead.name){R=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>R&&(j.adler=d(j.adler,O.pending_buf,O.pending-R,R)),$(j),R=O.pending,O.pending===O.pending_buf_size)){U=1;break}U=O.gzindex<O.gzhead.name.length?255&O.gzhead.name.charCodeAt(O.gzindex++):0,J(O,U)}while(U!==0);O.gzhead.hcrc&&O.pending>R&&(j.adler=d(j.adler,O.pending_buf,O.pending-R,R)),U===0&&(O.gzindex=0,O.status=91)}else O.status=91;if(O.status===91)if(O.gzhead.comment){R=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>R&&(j.adler=d(j.adler,O.pending_buf,O.pending-R,R)),$(j),R=O.pending,O.pending===O.pending_buf_size)){U=1;break}U=O.gzindex<O.gzhead.comment.length?255&O.gzhead.comment.charCodeAt(O.gzindex++):0,J(O,U)}while(U!==0);O.gzhead.hcrc&&O.pending>R&&(j.adler=d(j.adler,O.pending_buf,O.pending-R,R)),U===0&&(O.status=103)}else O.status=103;if(O.status===103&&(O.gzhead.hcrc?(O.pending+2>O.pending_buf_size&&$(j),O.pending+2<=O.pending_buf_size&&(J(O,255&j.adler),J(O,j.adler>>8&255),j.adler=0,O.status=I)):O.status=I),O.pending!==0){if($(j),j.avail_out===0)return O.last_flush=-1,p}else if(j.avail_in===0&&F(H)<=F(G)&&H!==h)return q(j,-5);if(O.status===666&&j.avail_in!==0)return q(j,-5);if(j.avail_in!==0||O.lookahead!==0||H!==f&&O.status!==666){var Q=O.strategy===2?function(W,se){for(var fe;;){if(W.lookahead===0&&(de(W),W.lookahead===0)){if(se===f)return S;break}if(W.match_length=0,fe=l._tr_tally(W,0,W.window[W.strstart]),W.lookahead--,W.strstart++,fe&&(M(W,!1),W.strm.avail_out===0))return S}return W.insert=0,se===h?(M(W,!0),W.strm.avail_out===0?Y:B):W.last_lit&&(M(W,!1),W.strm.avail_out===0)?S:L}(O,H):O.strategy===3?function(W,se){for(var fe,ce,me,ke,Ne=W.window;;){if(W.lookahead<=T){if(de(W),W.lookahead<=T&&se===f)return S;if(W.lookahead===0)break}if(W.match_length=0,W.lookahead>=A&&0<W.strstart&&(ce=Ne[me=W.strstart-1])===Ne[++me]&&ce===Ne[++me]&&ce===Ne[++me]){ke=W.strstart+T;do;while(ce===Ne[++me]&&ce===Ne[++me]&&ce===Ne[++me]&&ce===Ne[++me]&&ce===Ne[++me]&&ce===Ne[++me]&&ce===Ne[++me]&&ce===Ne[++me]&&me<ke);W.match_length=T-(ke-me),W.match_length>W.lookahead&&(W.match_length=W.lookahead)}if(W.match_length>=A?(fe=l._tr_tally(W,1,W.match_length-A),W.lookahead-=W.match_length,W.strstart+=W.match_length,W.match_length=0):(fe=l._tr_tally(W,0,W.window[W.strstart]),W.lookahead--,W.strstart++),fe&&(M(W,!1),W.strm.avail_out===0))return S}return W.insert=0,se===h?(M(W,!0),W.strm.avail_out===0?Y:B):W.last_lit&&(M(W,!1),W.strm.avail_out===0)?S:L}(O,H):o[O.level].func(O,H);if(Q!==Y&&Q!==B||(O.status=666),Q===S||Q===Y)return j.avail_out===0&&(O.last_flush=-1),p;if(Q===L&&(H===1?l._tr_align(O):H!==5&&(l._tr_stored_block(O,0,0,!1),H===3&&(ee(O.head),O.lookahead===0&&(O.strstart=0,O.block_start=0,O.insert=0))),$(j),j.avail_out===0))return O.last_flush=-1,p}return H!==h?p:O.wrap<=0?1:(O.wrap===2?(J(O,255&j.adler),J(O,j.adler>>8&255),J(O,j.adler>>16&255),J(O,j.adler>>24&255),J(O,255&j.total_in),J(O,j.total_in>>8&255),J(O,j.total_in>>16&255),J(O,j.total_in>>24&255)):(K(O,j.adler>>>16),K(O,65535&j.adler)),$(j),0<O.wrap&&(O.wrap=-O.wrap),O.pending!==0?p:1)},s.deflateEnd=function(j){var H;return j&&j.state?(H=j.state.status)!==E&&H!==69&&H!==73&&H!==91&&H!==103&&H!==I&&H!==666?q(j,y):(j.state=null,H===I?q(j,-3):p):y},s.deflateSetDictionary=function(j,H){var G,O,R,U,V,Q,W,se,fe=H.length;if(!j||!j.state||(U=(G=j.state).wrap)===2||U===1&&G.status!==E||G.lookahead)return y;
vendor: 17,944 bytes, line 508
508for(U===1&&(j.adler=c(j.adler,H,fe,0)),G.wrap=0,fe>=G.w_size&&(U===0&&(ee(G.head),G.strstart=0,G.block_start=0,G.insert=0),se=new i.Buf8(G.w_size),i.arraySet(se,H,fe-G.w_size,G.w_size,0),H=se,fe=G.w_size),V=j.avail_in,Q=j.next_in,W=j.input,j.avail_in=fe,j.next_in=0,j.input=H,de(G);G.lookahead>=A;){for(O=G.strstart,R=G.lookahead-(A-1);G.ins_h=(G.ins_h<<G.hash_shift^G.window[O+A-1])&G.hash_mask,G.prev[O&G.w_mask]=G.head[G.ins_h],G.head[G.ins_h]=O,O++,--R;);G.strstart=O,G.lookahead=A-1,de(G)}return G.strstart+=G.lookahead,G.block_start=G.strstart,G.insert=G.lookahead,G.lookahead=0,G.match_length=G.prev_length=A-1,G.match_available=0,j.next_in=Q,j.input=W,j.avail_in=V,G.wrap=U,p},s.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,s){r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,r,s){r.exports=function(o,i){var l,c,d,u,f,h,p,y,g,x,v,b,w,_,C,N,k,P,A,T,D,E,I,S,L;l=o.state,c=o.next_in,S=o.input,d=c+(o.avail_in-5),u=o.next_out,L=o.output,f=u-(i-o.avail_out),h=u+(o.avail_out-257),p=l.dmax,y=l.wsize,g=l.whave,x=l.wnext,v=l.window,b=l.hold,w=l.bits,_=l.lencode,C=l.distcode,N=(1<<l.lenbits)-1,k=(1<<l.distbits)-1;e:do{w<15&&(b+=S[c++]<<w,w+=8,b+=S[c++]<<w,w+=8),P=_[b&N];t:for(;;){if(b>>>=A=P>>>24,w-=A,(A=P>>>16&255)===0)L[u++]=65535&P;else{if(!(16&A)){if(!(64&A)){P=_[(65535&P)+(b&(1<<A)-1)];continue t}if(32&A){l.mode=12;break e}o.msg="invalid literal/length code",l.mode=30;break e}T=65535&P,(A&=15)&&(w<A&&(b+=S[c++]<<w,w+=8),T+=b&(1<<A)-1,b>>>=A,w-=A),w<15&&(b+=S[c++]<<w,w+=8,b+=S[c++]<<w,w+=8),P=C[b&k];n:for(;;){if(b>>>=A=P>>>24,w-=A,!(16&(A=P>>>16&255))){if(!(64&A)){P=C[(65535&P)+(b&(1<<A)-1)];continue n}o.msg="invalid distance code",l.mode=30;break e}if(D=65535&P,w<(A&=15)&&(b+=S[c++]<<w,(w+=8)<A&&(b+=S[c++]<<w,w+=8)),p<(D+=b&(1<<A)-1)){o.msg="invalid distance too far back",l.mode=30;break e}if(b>>>=A,w-=A,(A=u-f)<D){if(g<(A=D-A)&&l.sane){o.msg="invalid distance too far back",l.mode=30;break e}if(I=v,(E=0)===x){if(E+=y-A,A<T){for(T-=A;L[u++]=v[E++],--A;);E=u-D,I=L}}else if(x<A){if(E+=y+x-A,(A-=x)<T){for(T-=A;L[u++]=v[E++],--A;);if(E=0,x<T){for(T-=A=x;L[u++]=v[E++],--A;);E=u-D,I=L}}}else if(E+=x-A,A<T){for(T-=A;L[u++]=v[E++],--A;);E=u-D,I=L}for(;2<T;)L[u++]=I[E++],L[u++]=I[E++],L[u++]=I[E++],T-=3;T&&(L[u++]=I[E++],1<T&&(L[u++]=I[E++]))}else{for(E=u-D;L[u++]=L[E++],L[u++]=L[E++],L[u++]=L[E++],2<(T-=3););T&&(L[u++]=L[E++],1<T&&(L[u++]=L[E++]))}break}}break}}while(c<d&&u<h);c-=T=w>>3,b&=(1<<(w-=T<<3))-1,o.next_in=c,o.next_out=u,o.avail_in=c<d?d-c+5:5-(c-d),o.avail_out=u<h?h-u+257:257-(u-h),l.hold=b,l.bits=w}},{}],49:[function(n,r,s){var o=n("../utils/common"),i=n("./adler32"),l=n("./crc32"),c=n("./inffast"),d=n("./inftrees"),u=1,f=2,h=0,p=-2,y=1,g=852,x=592;function v(E){return(E>>>24&255)+(E>>>8&65280)+((65280&E)<<8)+((255&E)<<24)}function b(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(E){var I;return E&&E.state?(I=E.state,E.total_in=E.total_out=I.total=0,E.msg="",I.wrap&&(E.adler=1&I.wrap),I.mode=y,I.last=0,I.havedict=0,I.dmax=32768,I.head=null,I.hold=0,I.bits=0,I.lencode=I.lendyn=new o.Buf32(g),I.distcode=I.distdyn=new o.Buf32(x),I.sane=1,I.back=-1,h):p}function _(E){var I;return E&&E.state?((I=E.state).wsize=0,I.whave=0,I.wnext=0,w(E)):p}function C(E,I){var S,L;return E&&E.state?(L=E.state,I<0?(S=0,I=-I):(S=1+(I>>4),I<48&&(I&=15)),I&&(I<8||15<I)?p:(L.window!==null&&L.wbits!==I&&(L.window=null),L.wrap=S,L.wbits=I,_(E))):p}function N(E,I){var S,L;return E?(L=new b,(E.state=L).window=null,(S=C(E,I))!==h&&(E.state=null),S):p}var k,P,A=!0;function T(E){if(A){var I;for(k=new o.Buf32(512),P=new o.Buf32(32),I=0;I<144;)E.lens[I++]=8;for(;I<256;)E.lens[I++]=9;for(;I<280;)E.lens[I++]=7;for(;I<288;)E.lens[I++]=8;for(d(u,E.lens,0,288,k,0,E.work,{bits:9}),I=0;I<32;)E.lens[I++]=5;d(f,E.lens,0,32,P,0,E.work,{bits:5}),A=!1}E.lencode=k,E.lenbits=9,E.distcode=P,E.distbits=5}function D(E,I,S,L){var Y,B=E.state;return B.window===null&&(B.wsize=1<<B.wbits,B.wnext=0,B.whave=0,B.window=new o.Buf8(B.wsize)),L>=B.wsize?(o.arraySet(B.window,I,S-B.wsize,B.wsize,0),B.wnext=0,B.whave=B.wsize):(L<(Y=B.wsize-B.wnext)&&(Y=L),o.arraySet(B.window,I,S-L,Y,B.wnext),(L-=Y)?(o.arraySet(B.window,I,S-L,L,0),B.wnext=L,B.whave=B.wsize):(B.wnext+=Y,B.wnext===B.wsize&&(B.wnext=0),B.whave<B.wsize&&(B.whave+=Y))),0}s.inflateReset=_,s.inflateReset2=C,s.inflateResetKeep=w,s.inflateInit=function(E){return N(E,15)},s.inflateInit2=N,s.inflate=function(E,I){var S,L,Y,B,q,F,ee,$,M,J,K,X,de,te,ae,re,le,ue,z,ie,j,H,G,O,R=0,U=new o.Buf8(4),V=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!E||!E.state||!E.output||!E.input&&E.avail_in!==0)return p;(S=E.state).mode===12&&(S.mode=13),q=E.next_out,Y=E.output,ee=E.avail_out,B=E.next_in,L=E.input,F=E.avail_in,$=S.hold,M=S.bits,J=F,K=ee,H=h;e:for(;;)switch(S.mode){case y:if(S.wrap===0){S.mode=13;break}for(;M<16;){if(F===0)break e;F--,$+=L[B++]<<M,M+=8}if(2&S.wrap&&$===35615){U[S.check=0]=255&$,U[1]=$>>>8&255,S.check=l(S.check,U,2,0),M=$=0,S.mode=2;break}if(S.flags=0,S.head&&(S.head.done=!1),!(1&S.wrap)||(((255&$)<<8)+($>>8))%31){E.msg="incorrect header check",S.mode=30;break}if((15&$)!=8){E.msg="unknown compression method",S.mode=30;break}if(M-=4,j=8+(15&($>>>=4)),S.wbits===0)S.wbits=j;else if(j>S.wbits){E.msg="invalid window size",S.mode=30;break}S.dmax=1<<j,E.adler=S.check=1,S.mode=512&$?10:12,M=$=0;break;case 2:for(;M<16;){if(F===0)break e;F--,$+=L[B++]<<M,M+=8}if(S.flags=$,(255&S.flags)!=8){E.msg="unknown compression method",S.mode=30;break}if(57344&S.flags){E.msg="unknown header flags set",S.mode=30;break}S.head&&(S.head.text=$>>8&1),512&S.flags&&(U[0]=255&$,U[1]=$>>>8&255,S.check=l(S.check,U,2,0)),M=$=0,S.mode=3;case 3:for(;M<32;){if(F===0)break e;F--,$+=L[B++]<<M,M+=8}S.head&&(S.head.time=$),512&S.flags&&(U[0]=255&$,U[1]=$>>>8&255,U[2]=$>>>16&255,U[3]=$>>>24&255,S.check=l(S.check,U,4,0)),M=$=0,S.mode=4;case 4:for(;M<16;){if(F===0)break e;F--,$+=L[B++]<<M,M+=8}S.head&&(S.head.xflags=255&$,S.head.os=$>>8),512&S.flags&&(U[0]=255&$,U[1]=$>>>8&255,S.check=l(S.check,U,2,0)),M=$=0,S.mode=5;case 5:if(1024&S.flags){for(;M<16;){if(F===0)break e;F--,$+=L[B++]<<M,M+=8}S.length=$,S.head&&(S.head.extra_len=$),512&S.flags&&(U[0]=255&$,U[1]=$>>>8&255,S.check=l(S.check,U,2,0)),M=$=0}else S.head&&(S.head.extra=null);S.mode=6;case 6:if(1024&S.flags&&(F<(X=S.length)&&(X=F),X&&(S.head&&(j=S.head.extra_len-S.length,S.head.extra||(S.head.extra=new Array(S.head.extra_len)),o.arraySet(S.head.extra,L,B,X,j)),512&S.flags&&(S.check=l(S.check,L,X,B)),F-=X,B+=X,S.length-=X),S.length))break e;S.length=0,S.mode=7;case 7:if(2048&S.flags){if(F===0)break e;for(X=0;j=L[B+X++],S.head&&j&&S.length<65536&&(S.head.name+=String.fromCharCode(j)),j&&X<F;);if(512&S.flags&&(S.check=l(S.check,L,X,B)),F-=X,B+=X,j)break e}else S.head&&(S.head.name=null);S.length=0,S.mode=8;case 8:if(4096&S.flags){if(F===0)break e;for(X=0;j=L[B+X++],S.head&&j&&S.length<65536&&(S.head.comment+=String.fromCharCode(j)),j&&X<F;);if(512&S.flags&&(S.check=l(S.check,L,X,B)),F-=X,B+=X,j)break e}else S.head&&(S.head.comment=null);S.mode=9;case 9:if(512&S.flags){for(;M<16;){if(F===0)break e;F--,$+=L[B++]<<M,M+=8}if($!==(65535&S.check)){E.msg="header crc mismatch",S.mode=30;break}M=$=0}S.head&&(S.head.hcrc=S.flags>>9&1,S.head.done=!0),E.adler=S.check=0,S.mode=12;break;case 10:for(;M<32;){if(F===0)break e;F--,$+=L[B++]<<M,M+=8}E.adler=S.check=v($),M=$=0,S.mode=11;case 11:if(S.havedict===0)return E.next_out=q,E.avail_out=ee,E.next_in=B,E.avail_in=F,S.hold=$,S.bits=M,2;E.adler=S.check=1,S.mode=12;case 12:if(I===5||I===6)break e;case 13:if(S.last){$>>>=7&M,M-=7&M,S.mode=27;break}for(;M<3;){if(F===0)break e;F--,$+=L[B++]<<M,M+=8}switch(S.last=1&$,M-=1,3&($>>>=1)){case 0:S.mode=14;break;case 1:if(T(S),S.mode=20,I!==6)break;$>>>=2,M-=2;break e;case 2:S.mode=17;break;case 3:E.msg="invalid block type",S.mode=30}$>>>=2,M-=2;break;case 14:for($>>>=7&M,M-=7&M;M<32;){if(F===0)break e;F--,$+=L[B++]<<M,M+=8}if((65535&$)!=($>>>16^65535)){E.msg="invalid stored block lengths",S.mode=30;break}if(S.length=65535&$,M=$=0,S.mode=15,I===6)break e;case 15:S.mode=16;case 16:if(X=S.length){if(F<X&&(X=F),ee<X&&(X=ee),X===0)break e;o.arraySet(Y,L,B,X,q),F-=X,B+=X,ee-=X,q+=X,S.length-=X;break}S.mode=12;break;case 17:for(;M<14;){if(F===0)break e;F--,$+=L[B++]<<M,M+=8}if(S.nlen=257+(31&$),$>>>=5,M-=5,S.ndist=1+(31&$),$>>>=5,M-=5,S.ncode=4+(15&$),$>>>=4,M-=4,286<S.nlen||30<S.ndist){E.msg="too many length or distance symbols",S.mode=30;break}S.have=0,S.mode=18;case 18:for(;S.have<S.ncode;){for(;M<3;){if(F===0)break e;F--,$+=L[B++]<<M,M+=8}S.lens[V[S.have++]]=7&$,$>>>=3,M-=3}for(;S.have<19;)S.lens[V[S.have++]]=0;if(S.lencode=S.lendyn,S.lenbits=7,G={bits:S.lenbits},H=d(0,S.lens,0,19,S.lencode,0,S.work,G),S.lenbits=G.bits,H){E.msg="invalid code lengths set",S.mode=30;break}S.have=0,S.mode=19;case 19:for(;S.have<S.nlen+S.ndist;){for(;re=(R=S.lencode[$&(1<<S.lenbits)-1])>>>16&255,le=65535&R,!((ae=R>>>24)<=M);){if(F===0)break e;F--,$+=L[B++]<<M,M+=8}if(le<16)$>>>=ae,M-=ae,S.lens[S.have++]=le;else{if(le===16){for(O=ae+2;M<O;){if(F===0)break e;F--,$+=L[B++]<<M,M+=8}if($>>>=ae,M-=ae,S.have===0){E.msg="invalid bit length repeat",S.mode=30;break}j=S.lens[S.have-1],X=3+(3&$),$>>>=2,M-=2}else if(le===17){for(O=ae+3;M<O;){if(F===0)break e;F--,$+=L[B++]<<M,M+=8}M-=ae,j=0,X=3+(7&($>>>=ae)),$>>>=3,M-=3}else{for(O=ae+7;M<O;){if(F===0)break e;F--,$+=L[B++]<<M,M+=8}M-=ae,j=0,X=11+(127&($>>>=ae)),$>>>=7,M-=7}if(S.have+X>S.nlen+S.ndist){E.msg="invalid bit length repeat",S.mode=30;break}for(;X--;)S.lens[S.have++]=j}}if(S.mode===30)break;if(S.lens[256]===0){E.msg="invalid code -- missing end-of-block",S.mode=30;break}if(S.lenbits=9,G={bits:S.lenbits},H=d(u,S.lens,0,S.nlen,S.lencode,0,S.work,G),S.lenbits=G.bits,H){E.msg="invalid literal/lengths set",S.mode=30;break}if(S.distbits=6,S.distcode=S.distdyn,G={bits:S.distbits},H=d(f,S.lens,S.nlen,S.ndist,S.distcode,0,S.work,G),S.distbits=G.bits,H){E.msg="invalid distances set",S.mode=30;break}if(S.mode=20,I===6)break e;case 20:S.mode=21;case 21:if(6<=F&&258<=ee){E.next_out=q,E.avail_out=ee,E.next_in=B,E.avail_in=F,S.hold=$,S.bits=M,c(E,K),q=E.next_out,Y=E.output,ee=E.avail_out,B=E.next_in,L=E.input,F=E.avail_in,$=S.hold,M=S.bits,S.mode===12&&(S.back=-1);break}for(S.back=0;re=(R=S.lencode[$&(1<<S.lenbits)-1])>>>16&255,le=65535&R,!((ae=R>>>24)<=M);){if(F===0)break e;F--,$+=L[B++]<<M,M+=8}if(re&&!(240&re)){for(ue=ae,z=re,ie=le;re=(R=S.lencode[ie+(($&(1<<ue+z)-1)>>ue)])>>>16&255,le=65535&R,!(ue+(ae=R>>>24)<=M);){if(F===0)break e;F--,$+=L[B++]<<M,M+=8}$>>>=ue,M-=ue,S.back+=ue}if($>>>=ae,M-=ae,S.back+=ae,S.length=le,re===0){S.mode=26;break}if(32&re){S.back=-1,S.mode=12;break}if(64&re){E.msg="invalid literal/length code",S.mode=30;break}S.extra=15&re,S.mode=22;case 22:if(S.extra){for(O=S.extra;M<O;){if(F===0)break e;F--,$+=L[B++]<<M,M+=8}S.length+=$&(1<<S.extra)-1,$>>>=S.extra,M-=S.extra,S.back+=S.extra}S.was=S.length,S.mode=23;case 23:for(;re=(R=S.distcode[$&(1<<S.distbits)-1])>>>16&255,le=65535&R,!((ae=R>>>24)<=M);){if(F===0)break e;F--,$+=L[B++]<<M,M+=8}if(!(240&re)){for(ue=ae,z=re,ie=le;re=(R=S.distcode[ie+(($&(1<<ue+z)-1)>>ue)])>>>16&255,le=65535&R,!(ue+(ae=R>>>24)<=M);){if(F===0)break e;F--,$+=L[B++]<<M,M+=8}$>>>=ue,M-=ue,S.back+=ue}if($>>>=ae,M-=ae,S.back+=ae,64&re){E.msg="invalid distance code",S.mode=30;break}S.offset=le,S.extra=15&re,S.mode=24;case 24:if(S.extra){for(O=S.extra;M<O;){if(F===0)break e;F--,$+=L[B++]<<M,M+=8}S.offset+=$&(1<<S.extra)-1,$>>>=S.extra,M-=S.extra,S.back+=S.extra}if(S.offset>S.dmax){E.msg="invalid distance too far back",S.mode=30;break}S.mode=25;case 25:if(ee===0)break e;if(X=K-ee,S.offset>X){if((X=S.offset-X)>S.whave&&S.sane){E.msg="invalid distance too far back",S.mode=30;break}de=X>S.wnext?(X-=S.wnext,S.wsize-X):S.wnext-X,X>S.length&&(X=S.length),te=S.window}else te=Y,de=q-S.offset,X=S.length;for(ee<X&&(X=ee),ee-=X,S.length-=X;Y[q++]=te[de++],--X;);S.length===0&&(S.mode=21);break;case 26:if(ee===0)break e;Y[q++]=S.length,ee--,S.mode=21;break;case 27:if(S.wrap){for(;M<32;){if(F===0)break e;F--,$|=L[B++]<<M,M+=8}if(K-=ee,E.total_out+=K,S.total+=K,K&&(E.adler=S.check=S.flags?l(S.check,Y,K,q-K):i(S.check,Y,K,q-K)),K=ee,(S.flags?$:v($))!==S.check){E.msg="incorrect data check",S.mode=30;break}M=$=0}S.mode=28;case 28:if(S.wrap&&S.flags){for(;M<32;){if(F===0)break e;F--,$+=L[B++]<<M,M+=8}if($!==(4294967295&S.total)){E.msg="incorrect length check",S.mode=30;break}M=$=0}S.mode=29;case 29:H=1;break e;case 30:H=-3;break e;case 31:return-4;case 32:default:return p}return E.next_out=q,E.avail_out=ee,E.next_in=B,E.avail_in=F,S.hold=$,S.bits=M,(S.wsize||K!==E.avail_out&&S.mode<30&&(S.mode<27||I!==4))&&D(E,E.output,E.next_out,K-E.avail_out)?(S.mode=31,-4):(J-=E.avail_in,K-=E.avail_out,E.total_in+=J,E.total_out+=K,S.total+=K,S.wrap&&K&&(E.adler=S.check=S.flags?l(S.check,Y,K,E.next_out-K):i(S.check,Y,K,E.next_out-K)),E.data_type=S.bits+(S.last?64:0)+(S.mode===12?128:0)+(S.mode===20||S.mode===15?256:0),(J==0&&K===0||I===4)&&H===h&&(H=-5),H)},s.inflateEnd=function(E){if(!E||!E.state)return p;var I=E.state;return I.window&&(I.window=null),E.state=null,h},s.inflateGetHeader=function(E,I){var S;return E&&E.state&&2&(S=E.state).wrap?((S.head=I).done=!1,h):p},s.inflateSetDictionary=function(E,I){var S,L=I.length;return E&&E.state?(S=E.state).wrap!==0&&S.mode!==11?p:S.mode===11&&i(1,I,L,0)!==S.check?-3:D(E,I,L,L)?(S.mode=31,-4):(S.havedict=1,h):p},s.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,s){var o=n("../utils/common"),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],l=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],c=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],d=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(u,f,h,p,y,g,x,v){var b,w,_,C,N,k,P,A,T,D=v.bits,E=0,I=0,S=0,L=0,Y=0,B=0,q=0,F=0,ee=0,$=0,M=null,J=0,K=new o.Buf16(16),X=new o.Buf16(16),de=null,te=0;for(E=0;E<=15;E++)K[E]=0;for(I=0;I<p;I++)K[f[h+I]]++;for(Y=D,L=15;1<=L&&K[L]===0;L--);if(L<Y&&(Y=L),L===0)return y[g++]=20971520,y[g++]=20971520,v.bits=1,0;for(S=1;S<L&&K[S]===0;S++);for(Y<S&&(Y=S),E=F=1;E<=15;E++)if(F<<=1,(F-=K[E])<0)return-1;if(0<F&&(u===0||L!==1))return-1;for(X[1]=0,E=1;E<15;E++)X[E+1]=X[E]+K[E];for(I=0;I<p;I++)f[h+I]!==0&&(x[X[f[h+I]]++]=I);if(k=u===0?(M=de=x,19):u===1?(M=i,J-=257,de=l,te-=257,256):(M=c,de=d,-1),E=S,N=g,q=I=$=0,_=-1,C=(ee=1<<(B=Y))-1,u===1&&852<ee||u===2&&592<ee)return 1;for(;;){for(P=E-q,T=x[I]<k?(A=0,x[I]):x[I]>k?(A=de[te+x[I]],M[J+x[I]]):(A=96,0),b=1<<E-q,S=w=1<<B;y[N+($>>q)+(w-=b)]=P<<24|A<<16|T|0,w!==0;);for(b=1<<E-1;$&b;)b>>=1;if(b!==0?($&=b-1,$+=b):$=0,I++,--K[E]==0){if(E===L)break;E=f[h+x[I]]}if(Y<E&&($&C)!==_){for(q===0&&(q=Y),N+=S,F=1<<(B=E-q);B+q<L&&!((F-=K[B+q])<=0);)B++,F<<=1;if(ee+=1<<B,u===1&&852<ee||u===2&&592<ee)return 1;y[_=$&C]=Y<<24|B<<16|N-g|0}}return $!==0&&(y[N+$]=E-q<<24|64<<16|0),v.bits=Y,0}},{"../utils/common":41}],51:[function(n,r,s){r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,r,s){var o=n("../utils/common"),i=0,l=1;function c(R){for(var U=R.length;0<=--U;)R[U]=0}var d=0,u=29,f=256,h=f+1+u,p=30,y=19,g=2*h+1,x=15,v=16,b=7,w=256,_=16,C=17,N=18,k=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],P=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],A=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],T=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],D=new Array(2*(h+2));c(D);var E=new Array(2*p);c(E);var I=new Array(512);c(I);var S=new Array(256);c(S);var L=new Array(u);c(L);var Y,B,q,F=new Array(p);function ee(R,U,V,Q,W){this.static_tree=R,this.extra_bits=U,this.extra_base=V,this.elems=Q,this.max_length=W,this.has_stree=R&&R.length}function $(R,U){this.dyn_tree=R,this.max_code=0,this.stat_desc=U}function M(R){return R<256?I[R]:I[256+(R>>>7)]}function J(R,U){R.pending_buf[R.pending++]=255&U,R.pending_buf[R.pending++]=U>>>8&255}function K(R,U,V){R.bi_valid>v-V?(R.bi_buf|=U<<R.bi_valid&65535,J(R,R.bi_buf),R.bi_buf=U>>v-R.bi_valid,R.bi_valid+=V-v):(R.bi_buf|=U<<R.bi_valid&65535,R.bi_valid+=V)}function X(R,U,V){K(R,V[2*U],V[2*U+1])}function de(R,U){for(var V=0;V|=1&R,R>>>=1,V<<=1,0<--U;);return V>>>1}function te(R,U,V){var Q,W,se=new Array(x+1),fe=0;for(Q=1;Q<=x;Q++)se[Q]=fe=fe+V[Q-1]<<1;for(W=0;W<=U;W++){var ce=R[2*W+1];ce!==0&&(R[2*W]=de(se[ce]++,ce))}}function ae(R){var U;for(U=0;U<h;U++)R.dyn_ltree[2*U]=0;for(U=0;U<p;U++)R.dyn_dtree[2*U]=0;for(U=0;U<y;U++)R.bl_tree[2*U]=0;R.dyn_ltree[2*w]=1,R.opt_len=R.static_len=0,R.last_lit=R.matches=0}function re(R){8<R.bi_valid?J(R,R.bi_buf):0<R.bi_valid&&(R.pending_buf[R.pending++]=R.bi_buf),R.bi_buf=0,R.bi_valid=0}function le(R,U,V,Q){var W=2*U,se=2*V;return R[W]<R[se]||R[W]===R[se]&&Q[U]<=Q[V]}function ue(R,U,V){for(var Q=R.heap[V],W=V<<1;W<=R.heap_len&&(W<R.heap_len&&le(U,R.heap[W+1],R.heap[W],R.depth)&&W++,!le(U,Q,R.heap[W],R.depth));)R.heap[V]=R.heap[W],V=W,W<<=1;R.heap[V]=Q}function z(R,U,V){var Q,W,se,fe,ce=0;if(R.last_lit!==0)for(;
vendor: 3,757 bytes, line 508
508Q=R.pending_buf[R.d_buf+2*ce]<<8|R.pending_buf[R.d_buf+2*ce+1],W=R.pending_buf[R.l_buf+ce],ce++,Q===0?X(R,W,U):(X(R,(se=S[W])+f+1,U),(fe=k[se])!==0&&K(R,W-=L[se],fe),X(R,se=M(--Q),V),(fe=P[se])!==0&&K(R,Q-=F[se],fe)),ce<R.last_lit;);X(R,w,U)}function ie(R,U){var V,Q,W,se=U.dyn_tree,fe=U.stat_desc.static_tree,ce=U.stat_desc.has_stree,me=U.stat_desc.elems,ke=-1;for(R.heap_len=0,R.heap_max=g,V=0;V<me;V++)se[2*V]!==0?(R.heap[++R.heap_len]=ke=V,R.depth[V]=0):se[2*V+1]=0;for(;R.heap_len<2;)se[2*(W=R.heap[++R.heap_len]=ke<2?++ke:0)]=1,R.depth[W]=0,R.opt_len--,ce&&(R.static_len-=fe[2*W+1]);for(U.max_code=ke,V=R.heap_len>>1;1<=V;V--)ue(R,se,V);for(W=me;V=R.heap[1],R.heap[1]=R.heap[R.heap_len--],ue(R,se,1),Q=R.heap[1],R.heap[--R.heap_max]=V,R.heap[--R.heap_max]=Q,se[2*W]=se[2*V]+se[2*Q],R.depth[W]=(R.depth[V]>=R.depth[Q]?R.depth[V]:R.depth[Q])+1,se[2*V+1]=se[2*Q+1]=W,R.heap[1]=W++,ue(R,se,1),2<=R.heap_len;);R.heap[--R.heap_max]=R.heap[1],function(Ne,Je){var ct,ye,Re,Ce,De,Ue,Ve=Je.dyn_tree,pt=Je.max_code,At=Je.stat_desc.static_tree,jt=Je.stat_desc.has_stree,Bt=Je.stat_desc.extra_bits,hn=Je.stat_desc.extra_base,Vt=Je.stat_desc.max_length,St=0;for(Ce=0;Ce<=x;Ce++)Ne.bl_count[Ce]=0;for(Ve[2*Ne.heap[Ne.heap_max]+1]=0,ct=Ne.heap_max+1;ct<g;ct++)Vt<(Ce=Ve[2*Ve[2*(ye=Ne.heap[ct])+1]+1]+1)&&(Ce=Vt,St++),Ve[2*ye+1]=Ce,pt<ye||(Ne.bl_count[Ce]++,De=0,hn<=ye&&(De=Bt[ye-hn]),Ue=Ve[2*ye],Ne.opt_len+=Ue*(Ce+De),jt&&(Ne.static_len+=Ue*(At[2*ye+1]+De)));if(St!==0){do{for(Ce=Vt-1;Ne.bl_count[Ce]===0;)Ce--;Ne.bl_count[Ce]--,Ne.bl_count[Ce+1]+=2,Ne.bl_count[Vt]--,St-=2}while(0<St);for(Ce=Vt;Ce!==0;Ce--)for(ye=Ne.bl_count[Ce];ye!==0;)pt<(Re=Ne.heap[--ct])||(Ve[2*Re+1]!==Ce&&(Ne.opt_len+=(Ce-Ve[2*Re+1])*Ve[2*Re],Ve[2*Re+1]=Ce),ye--)}}(R,U),te(se,ke,R.bl_count)}function j(R,U,V){var Q,W,se=-1,fe=U[1],ce=0,me=7,ke=4;for(fe===0&&(me=138,ke=3),U[2*(V+1)+1]=65535,Q=0;Q<=V;Q++)W=fe,fe=U[2*(Q+1)+1],++ce<me&&W===fe||(ce<ke?R.bl_tree[2*W]+=ce:W!==0?(W!==se&&R.bl_tree[2*W]++,R.bl_tree[2*_]++):ce<=10?R.bl_tree[2*C]++:R.bl_tree[2*N]++,se=W,ke=(ce=0)===fe?(me=138,3):W===fe?(me=6,3):(me=7,4))}function H(R,U,V){var Q,W,se=-1,fe=U[1],ce=0,me=7,ke=4;for(fe===0&&(me=138,ke=3),Q=0;Q<=V;Q++)if(W=fe,fe=U[2*(Q+1)+1],!(++ce<me&&W===fe)){if(ce<ke)for(;X(R,W,R.bl_tree),--ce!=0;);else W!==0?(W!==se&&(X(R,W,R.bl_tree),ce--),X(R,_,R.bl_tree),K(R,ce-3,2)):ce<=10?(X(R,C,R.bl_tree),K(R,ce-3,3)):(X(R,N,R.bl_tree),K(R,ce-11,7));se=W,ke=(ce=0)===fe?(me=138,3):W===fe?(me=6,3):(me=7,4)}}c(F);var G=!1;function O(R,U,V,Q){K(R,(d<<1)+(Q?1:0),3),function(W,se,fe,ce){re(W),J(W,fe),J(W,~fe),o.arraySet(W.pending_buf,W.window,se,fe,W.pending),W.pending+=fe}(R,U,V)}s._tr_init=function(R){G||(function(){var U,V,Q,W,se,fe=new Array(x+1);for(W=Q=0;W<u-1;W++)for(L[W]=Q,U=0;U<1<<k[W];U++)S[Q++]=W;for(S[Q-1]=W,W=se=0;W<16;W++)for(F[W]=se,U=0;U<1<<P[W];U++)I[se++]=W;for(se>>=7;W<p;W++)for(F[W]=se<<7,U=0;U<1<<P[W]-7;U++)I[256+se++]=W;for(V=0;V<=x;V++)fe[V]=0;for(U=0;U<=143;)D[2*U+1]=8,U++,fe[8]++;for(;U<=255;)D[2*U+1]=9,U++,fe[9]++;for(;U<=279;)D[2*U+1]=7,U++,fe[7]++;for(;U<=287;)D[2*U+1]=8,U++,fe[8]++;for(te(D,h+1,fe),U=0;U<p;U++)E[2*U+1]=5,E[2*U]=de(U,5);Y=new ee(D,k,f+1,h,x),B=new ee(E,P,0,p,x),q=new ee(new Array(0),A,0,y,b)}(),G=!0),R.l_desc=new $(R.dyn_ltree,Y),R.d_desc=new $(R.dyn_dtree,B),R.bl_desc=new $(R.bl_tree,q),R.bi_buf=0,R.bi_valid=0,ae(R)},s._tr_stored_block=O,s._tr_flush_block=function(R,U,V,Q){var W,se,fe=0;0<R.level?(R.strm.data_type===2&&(R.strm.data_type=function(ce){var me,ke=4093624447;for(me=0;me<=31;me++,ke>>>=1)if(1&ke&&ce.dyn_ltree[2*me]!==0)return i;if(ce.dyn_ltree[18]!==0||ce.dyn_ltree[20]!==0||ce.dyn_ltree[26]!==0)return l;for(me=32;me<f;me++)if(ce.dyn_ltree[2*me]!==0)return l;return i}(R)),ie(R,R.l_desc),ie(R,R.d_desc),fe=function(ce){var me;
508for(j(ce,ce.dyn_ltree,ce.l_desc.max_code),j(ce,ce.dyn_dtree,ce.d_desc.max_code),ie(ce,ce.bl_desc),me=y-1;3<=me&&ce.bl_tree[2*T[me]+1]===0;me--);return ce.opt_len+=3*(me+1)+5+5+4,me}(R),W=R.opt_len+3+7>>>3,(se=R.static_len+3+7>>>3)<=W&&(W=se)):W=se=V+5,V+4<=W&&U!==-1?O(R,U,V,Q):R.strategy===4||se===W?(K(R,2+(Q?1:0),3),z(R,D,E)):(K(R,4+(Q?1:0),3),function(ce,me,ke,Ne){var Je;for(K(ce,me-257,5),K(ce,ke-1,5),K(ce,Ne-4,4),Je=0;Je<Ne;Je++)K(ce,ce.bl_tree[2*T[Je]+1],3);H(ce,ce.dyn_ltree,me-1),H(ce,ce.dyn_dtree,ke-1)}(R,R.l_desc.max_code+1,R.d_desc.max_code+1,fe+1),z(R,R.dyn_ltree,R.dyn_dtree)),ae(R),Q&&re(R)},s._tr_tally=function(R,U,V){return R.pending_buf[R.d_buf+2*R.last_lit]=U>>>8&255,R.pending_buf[R.d_buf+2*R.last_lit+1]=255&U,R.pending_buf[R.l_buf+R.last_lit]=255&V,R.last_lit++,U===0?R.dyn_ltree[2*V]++:(R.matches++,U--,R.dyn_ltree[2*(S[V]+f+1)]++,R.dyn_dtree[2*M(U)]++),R.last_lit===R.lit_bufsize-1},s._tr_align=function(R){K(R,2,3),X(R,w,D),function(U){U.bi_valid===16?(J(U,U.bi_buf),U.bi_buf=0,U.bi_valid=0):8<=U.bi_valid&&(U.pending_buf[U.pending++]=255&U.bi_buf,U.bi_buf>>=8,U.bi_valid-=8)}(R)}},{"../utils/common":41}],53:[function(n,r,s){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,s){(function(o){(function(i,l){if(!i.setImmediate){var c,d,u,f,h=1,p={},y=!1,g=i.document,x=Object.getPrototypeOf&&Object.getPrototypeOf(i);x=x&&x.setTimeout?x:i,c={}.toString.call(i.process)==="[object process]"?function(_){process.nextTick(function(){b(_)})}:function(){if(i.postMessage&&!i.importScripts){var _=!0,C=i.onmessage;return i.onmessage=function(){_=!1},i.postMessage("","*"),i.onmessage=C,_}}()?(f="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",w,!1):i.attachEvent("onmessage",w),function(_){i.postMessage(f+_,"*")}):i.MessageChannel?((u=new MessageChannel).port1.onmessage=function(_){b(_.data)},function(_){u.port2.postMessage(_)}):g&&"onreadystatechange"in g.createElement("script")?(d=g.documentElement,function(_){var C=g.createElement("script");C.onreadystatechange=function(){b(_),C.onreadystatechange=null,d.removeChild(C),C=null},d.appendChild(C)}):function(_){setTimeout(b,0,_)},x.setImmediate=function(_){typeof _!="function"&&(_=new Function(""+_));for(var C=new Array(arguments.length-1),N=0;N<C.length;N++)C[N]=arguments[N+1];var k={callback:_,args:C};return p[h]=k,c(h),h++},x.clearImmediate=v}function v(_){delete p[_]}function b(_){if(y)setTimeout(b,0,_);else{var C=p[_];if(C){y=!0;try{(function(N){var k=N.callback,P=N.args;switch(P.length){case 0:k();break;case 1:k(P[0]);break;case 2:k(P[0],P[1]);break;case 3:k(P[0],P[1],P[2]);break;default:k.apply(l,P)}})(C)}finally{v(_),y=!1}}}}function w(_){_.source===i&&typeof _.data=="string"&&_.data.indexOf(f)===0&&b(+_.data.slice(f.length))}})(typeof self>"u"?o===void 0?this:o:self)}).call(this,typeof ii<"u"?ii:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(bS);var mz=bS.exports;const gz=Ev(mz),wS=new Uint8Array([137,80,78,71,13,10,26,10]),Ql=new TextEncoder,Mu=new TextDecoder,Me=e=>{throw new Error(e)},bo=(e,t)=>e[t]*256+e[t+1],Ni=(e,t)=>new DataView(e.buffer,e.byteOffset+t,4).getUint32(0),_S=(e,t)=>e.length===t.length&&e.every((n,r)=>n===t[r]),co=e=>{const t=new Uint8Array(e.reduce((r,s)=>r+s.length,0));let n=0;for(const r of e)t.set(r,n),n+=r.length;return t};function SS(e,t){(!e||!t||e>16384||t>16384||e*t>4e7)&&Me("Imagem fora do limite: até 40 megapixels e 16.384 pixels por dimensão.")}const xz=Array.from({length:256},(e,t)=>{let n=t;for(let r=0;r<8;r++)n=n&1?3988292384^n>>>1:n>>>1;return n>>>0});function CS(e){let t=4294967295;for(const n of e)t=xz[(t^n)&255]^t>>>8;return(t^4294967295)>>>0}function Rx(e,t){const n=new Uint8Array(12+t.length),r=new DataView(n.buffer);return r.setUint32(0,t.length),n.set(Ql.encode(e),4),n.set(t,8),r.setUint32(n.length-4,CS(n.subarray(4,n.length-4))),n}const vz={tEXt:"Texto PNG",zTXt:"Texto comprimido PNG",iTXt:"Texto internacional / XMP",eXIf:"EXIF (pode incluir GPS, câmera, datas e autor)",iCCP:"Perfil ICC",sRGB:"Perfil sRGB",gAMA:"Gama",cHRM:"Cromaticidade",tIME:"Data de edição",pHYs:"Resolução",bKGD:"Fundo sugerido",hIST:"Histograma",sPLT:"Paleta sugerida"};function yz(e){var y;const t=[],n=[],r=[];let s=8,o=0,i=0,l=0,c=0,d=0,u=!1,f=!1,h=!1,p=0;for(;s<e.length;){s+12>e.length&&Me("Chunk PNG truncado.");const g=Ni(e,s);(g>2147483647||g>e.length-s-12)&&Me("Comprimento PNG inválido.");const x=s+12+g,v=Mu.decode(e.subarray(s+4,s+8));/^[A-Za-z]{2}[A-Z][A-Za-z]$/.test(v)||Me("Tipo de chunk PNG inválido."),CS(e.subarray(s+4,x-4))!==Ni(e,x-4)&&Me("CRC PNG inválido.");const b=e.subarray(s+8,x-4);!t.length&&v!=="IHDR"&&Me("IHDR precisa iniciar o PNG."),(v==="acTL"||v==="fcTL"||v==="fdAT")&&Me("PNG animado (APNG) não é suportado.");const w=["IHDR","PLTE","tRNS","IDAT","IEND"].includes(v);if(!w&&v[0]===v[0].toUpperCase()&&Me("PNG contém um chunk crítico não suportado."),f&&v!=="IDAT"&&(h=!0),v==="IHDR"?((t.length||g!==13)&&Me("IHDR PNG inválido ou duplicado."),o=Ni(b,0),i=Ni(b,4),SS(o,i),l=b[8],c=b[9],(!((y={0:[1,2,4,8,16],2:[8,16],3:[1,2,4,8],4:[8,16],6:[8,16
508]}[c])!=null&&y.includes(l))||b[10]!==0||b[11]!==0||b[12]>1)&&Me("Cabeçalho PNG não suportado.")):v==="PLTE"?((d||u||f||c===0||c===4||!g||g%3||g>768)&&Me("Paleta PNG inválida."),d=g/3,c===3&&d>2**l&&Me("Paleta excede a profundidade PNG.")):v==="tRNS"?((u||f)&&Me("Transparência PNG fora de ordem."),(c===0&&(g!==2||bo(b,0)>=2**l)||c===2&&(g!==6||[0,2,4].some(_=>bo(b,_)>=2**l))||c===3&&(!d||!g||g>d)||![0,2,3].includes(c))&&Me("Transparência PNG inválida."),u=!0):v==="IDAT"?((h||c===3&&!d)&&Me("Dados PNG fora de ordem."),f=!0,p+=g):v==="IEND"?(g||!f||!p)&&Me("Final PNG inválido."):(n.push(vz[v]??`Chunk adicional ${v}`),["iCCP","sRGB","gAMA","cHRM","cICP","mDCV","cLLI"].includes(v)&&r.push("Remover informações de cor pode mudar a aparência em visualizadores; os dados dos pixels serão preservados."),v==="eXIf"&&r.push("A remoção de EXIF também remove a orientação de exibição.")),t.push({start:s,end:x,kind:v,metadata:!w,payload:b}),s=x,v==="IEND")return s<e.length&&n.push("Dados após o fim do arquivo"),{format:"png",width:o,height:i,metadata:[...new Set(n)],warnings:[...new Set(r)],parts:t,end:s}}return Me("PNG sem IEND.")}function bz(e){const t=[],n=[],r=[];let s=2,o=0,i=0,l=0,c=[],d,u=!1,f=!1;for(;s<e.length;){const h=s;for(e[s++]!==255&&Me("Marcador JPEG desalinhado.");e[s]===255;)s++;s>=e.length&&Me("Marcador JPEG truncado.");const p=e[s++];if(p===217)return(!l||!o||!u||!f)&&Me("JPEG sem dados de imagem completos."),d!==void 0&&(d!==1||c.length!==3||c.some((w,_)=>w!==_+1))&&Me("JPEG Adobe RGB/CMYK não suportado para limpeza sem alterar as cores. Exporte como JPG sRGB ou PNG."),t.push({start:h,end:s,kind:"EOI",metadata:!1,payload:e.subarray(s,s)}),s<e.length&&n.push("Dados após o fim do arquivo"),{format:"jpeg",width:o,height:i,metadata:[...new Set(n)],warnings:[...new Set(r)],parts:t,end:s};([0,216,1].includes(p)||p>=208&&p<=215)&&Me("Marcador JPEG inesperado."),s+2>e.length&&Me("Segmento JPEG truncado.");const y=bo(e,s),g=s+y;(y<2||g>e.length)&&Me("Comprimento de segmento JPEG inválido.");const x=e.subarray(s+2,g),v=p>=224&&p<=239||p===254;let b=p.toString(16);if(v){b=p===254?"COM":`APP${p-224}`;const w=p===254?"Comentário JPEG":p===225&&Mu.decode(x.subarray(0,6))==="Exif\0\0"?"EXIF (pode incluir GPS, câmera, datas e autor)":p===225?"XMP / APP1":p===226?"Perfil ICC / APP2":p===237?"IPTC / Photoshop":b;n.push(w),p===225&&w.startsWith("EXIF")&&r.push("A remoção de EXIF também remove a orientação de exibição."),p===226&&r.push("Remover o perfil ICC pode mudar a aparência em visualizadores; os dados comprimidos serão preservados."),p===238&&((x.length!==12||Mu.decode(x.subarray(0,5))!=="Adobe"||d!==void 0)&&Me("Segmento Adobe JPEG não suportado."),d=x[11])}else if([192,193,194].includes(p)){(o||x.length<6||x[0]!==8)&&Me("Quadro JPEG não suportado."),i=bo(x,1),o=bo(x,3),SS(o,i);const w=x[5];(![1,3].includes(w)||x.length!==6+w*3)&&Me("JPEG RGB/CMYK ou quadro não suportado."),c=Array.from({length:w},(_,C)=>x[6+C*3]),(new Set(c).size!==w||w===3&&c.some((_,C)=>_!==C+1))&&Me("Espaço de cor JPEG não suportado; use JPG sRGB ou PNG.");for(let _=7;_<x.length;_+=3)(!(x[_]>>4)||x[_]>>4>4||!(x[_]&15)||(x[_]&15)>4||x[_+1]>3)&&Me("Amostragem JPEG inválida.")}else if(p===219){let w=0;for(;w<x.length;){const _=x[w++];(_>>4>1||(_&15)>3)&&Me("Tabela de quantização JPEG inválida."),w+=_>>4?128:64}(!w||w!==x.length)&&Me("Tabela de quantização JPEG truncada."),u=!0}else if(p===196){let w=0;for(;w<x.length;){const _=x[w++];(_>>4>1||(_&15)>3||w+16>x.length)&&Me("Tabela Huffman JPEG inválida.");let C=0;for(let N=0;N<16;N++)C+=x[w++];(!C||C>256)&&Me("Tabela Huffman JPEG inválida."),w+=C}(!w||w!==x.length)&&Me("Tabela Huffman JPEG truncada."),f=!0}else p===221?x.length!==2&&Me("Intervalo JPEG inválido."):p!==218&&Me("Codificação JPEG não suportada. Use JPEG convencional ou progressivo.");if(t.push({start:h,end:g,kind:b,metadata:v,payload:x}),s=g,p===218){const w=x[0];(!o||!u||!f||!w||w>c.length||x.length!==1+w*2+3)&&Me("Scan JPEG inválido.");const _=new Set;for(let N=1;N<=w*2;N+=2)(!c.includes(x[N])||_.has(x[N])||x[N+1]>>4>3||(x[N+1]&15)>3)&&Me("Componente de scan JPEG inválido."),_.add(x[N]);l++;const C=s;for(;s<e.length;){if(e[s]!==255){s++;continue}const N=s;for(;e[s]===255;)s++;s>=e.length&&Me("Scan JPEG truncado.");const k=e[s];if(k===0||k>=208&&k<=215){s++;continue}s=N;break}
508s===C&&Me("Scan JPEG vazio."),t.push({start:C,end:s,kind:"scan",metadata:!1,payload:e.subarray(C,s)})}}return Me("JPEG sem marcador de fim (EOI).")}function $h(e){return e.length>25*1024*1024&&Me("Arquivo maior que 25 MiB."),e.length>=8&&_S(e.subarray(0,8),wS)?yz(e):e[0]===255&&e[1]===216?bz(e):Me("Formato não suportado. Use imagens JPG ou PNG estáticas.")}function Ru(e){return/^[A-Za-z0-9-]{1,100}$/.test(e)||Me("Código de rastreio inválido."),Ql.encode(e)}function wz(e){const{format:t,width:n,height:r,metadata:s,warnings:o}=$h(e);return{format:t,width:n,height:r,metadata:s,warnings:o}}function _z(e,t){const n=$h(e),r=Ru(t);let s;if(n.format==="png"){const o=n.parts.filter(l=>!l.metadata&&l.kind!=="IEND"),i=Rx("tEXt",co([Ql.encode("ImageDescription\0"),r]));s=co([wS,...o.map(l=>e.subarray(l.start,l.end)),i,Rx("IEND",new Uint8Array)])}else{const o=co([new Uint8Array([255,254,r.length+2>>8,r.length+2&255]),r]);s=co([new Uint8Array([255,216]),o,...n.parts.filter(i=>!i.metadata).map(i=>e.subarray(i.start,i.end))])}return jS(s,t),s}function jS(e,t){const n=$h(e),r=n.parts.filter(o=>o.metadata),s=n.format==="png"?co([Ql.encode("ImageDescription\0"),Ru(t)]):Ru(t);(n.end!==e.length||r.length!==1||r[0].kind!==(n.format==="png"?"tEXt":"COM")||!_S(r[0].payload,s))&&Me("Falha na verificação: esperado exatamente um código de rastreio e nenhum outro metadado.")}async function Du(e){const t=await crypto.subtle.digest("SHA-256",new Uint8Array(e).buffer);return Array.from(new Uint8Array(t),n=>n.toString(16).padStart(2,"0")).join("")}function Sz(e,t=new Date){(!Number.isSafeInteger(e)||e<1||!Number.isFinite(t.getTime()))&&Me("Índice ou data do código inválido.");const n=s=>String(s).padStart(2,"0"),r=Array.from(crypto.getRandomValues(new Uint8Array(6)),s=>s.toString(16).padStart(2,"0")).join("").toUpperCase();return`P${n(t.getMonth()+1)}${n(t.getDate())}-${n(t.getHours())}${n(t.getMinutes())}-c${String(e).padStart(3,"0")}-${r}`}const kS=new TextEncoder,On=e=>{throw new Error(e)},ES=(e,t)=>new DataView(e.buffer,e.byteOffset+t,4).getUint32(0),Uh=(e,t,n)=>String.fromCharCode(...e.subarray(t,t+n)),vl=e=>{const t=new Uint8Array(e.reduce((r,s)=>r+s.length,0));let n=0;for(const r of e)t.set(r,n),n+=r.length;return t},Cz=/^[A-Za-z0-9-]{1,100}$/,jz=40*1024*1024;function kz(e){return Cz.test(e)||On("Código de rastreio inválido."),kS.encode(e)}function Wh(e){return e.length>=8&&e[4]===102&&e[5]===116&&e[6]===121&&e[7]===112}function Jl(e){return e.length>=4&&e[0]===26&&e[1]===69&&e[2]===223&&e[3]===163}function Ez(e){return Wh(e)||Jl(e)}function Nz(e){return e.length>=12?Uh(e,8,4):""}function Dx(e,t){let n=0;for(;n+8<=e.length;){let r=ES(e,n);const s=Uh(e,n+4,4);if(r===1){if(n+16>e.length)break;const o=new DataView(e.buffer,e.byteOffset+n+8,8);r=Number(o.getBigUint64(0))}else r===0&&(r=e.length-n);if(r<8||n+r>e.length)break;t(s,n,r),n+=r}}function NS(e){if(e.length>jz&&On("O vídeo excede 40 MB."),e.length<12&&On("Arquivo de vídeo incompleto."),Jl(e))return{format:"webm",width:0,height:0,metadata:["Contêiner WebM"],warnings:["A limpeza altera o hash sem recodificar o vídeo."]};Wh(e)||On("Formato de vídeo não suportado. Use MP4, MOV ou WEBM.");const t=Nz(e),n=t==="qt  "?"mov":"mp4",r=[`Marca ${t.trim()||"ftyp"}`];let s=!1;return Dx(e,(o,i,l)=>{o==="moov"&&Dx(e.subarray(i+8,i+l),c=>{c==="mvhd"&&(s=!0,r.push("Átomo mvhd (data de criação)")),c==="udta"&&r.push("Átomo udta (metadados do usuário)")}),o==="uuid"&&r.push("Átomo uuid"),(o==="free"||o==="skip")&&r.push("Espaço livre")}),s||r.push("Sem átomo mvhd visível"),{format:n,width:0,height:0,metadata:[...new Set(r)],warnings:["A limpeza altera o hash sem recodificar o vídeo. Players leem o arquivo normalmente."]}}function Pz(e){const t=8+e.length,n=new Uint8Array(t);return n[0]=t>>>24&255,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=t&255,n[4]=102,n[5]=114,n[6]=101,n[7]=101,n.set(e,8),n}function Az(e){return e.length>126&&On("Código de rastreio longo demais para WebM."),vl([new Uint8Array([236,128|e.length]),e])}function Tz(e){const t=crypto.getRandomValues(new Uint8Array(8));return vl([kz(e),new Uint8Array([0]),t])}function Iz(e){const t=new Uint8Array(e);for(let n=0;n<t.length-12;
508n++)if(t[n]===109&&t[n+1]===118&&t[n+2]===104&&t[n+3]===100){const s=t[n+4]===1?12:8;n+4+s+3<t.length&&(t[n+4+s+3]=Math.floor(Math.random()*256));break}return t}function Mz(e,t){NS(e);const n=Tz(t);let r;return Jl(e)?r=vl([e,Az(n)]):r=vl([Iz(e),Pz(n)]),PS(r,t),r}function PS(e,t){const n=kS.encode(t);if(Jl(e)){const i=2+n.length+1+8;e.length<i&&On("Falha na verificação: vídeo sem código de rastreio.");const l=e.subarray(e.length-i);(l[0]!==236||(l[1]&127)!==n.length+9)&&On("Falha na verificação: esperado um elemento Void com o código.");for(let c=0;c<n.length;c++)l[2+c]!==n[c]&&On("Falha na verificação: código de rastreio não confere.");return}(!Wh(e)||e.length<16)&&On("Falha na verificação: contêiner de vídeo inválido.");const r=8+n.length+1+8,s=e.length-r;(s<0||ES(e,s)!==r||Uh(e,s+4,4)!=="free")&&On("Falha na verificação: esperado um átomo free com o código.");const o=e.subarray(s+8);for(let i=0;i<n.length;i++)o[i]!==n[i]&&On("Falha na verificação: código de rastreio não confere.")}const Rz={mp4:"video/mp4",mov:"video/quicktime",webm:"video/webm"},AS=20,Ox=25*1024*1024,Lx=40*1024*1024,TS=75*1024*1024,Fx=200*1024*1024,zx=400*1024*1024,IS=[5,10,15,20];function Bx(e){return e.type.startsWith("video/")||/\.(mp4|m4v|mov|webm)$/i.test(e.name)}async function Dz(e){if(!Bx(e)&&e.size>Ox)throw new Error("O arquivo excede 25 MB.");if(Bx(e)&&e.size>Lx)throw new Error("O vídeo excede 40 MB.");const t=new Uint8Array(await e.arrayBuffer());if(Ez(t)){if(t.byteLength>Lx)throw new Error("O vídeo excede 40 MB.");const r=NS(t);return{id:crypto.randomUUID(),file:e,data:t,inspection:r,hash:await Du(t),kind:"video"}}if(t.byteLength>Ox)throw new Error("O arquivo excede 25 MB.");const n=wz(t);if(typeof createImageBitmap!="function")throw new Error("Use um navegador atualizado com suporte a imagens bitmap.");try{(await createImageBitmap(e)).close()}catch{throw new Error("A imagem não pôde ser decodificada. Exporte novamente como JPG ou PNG.")}return{id:crypto.randomUUID(),file:e,data:t,inspection:n,hash:await Du(t),kind:"image"}}async function Oz(e,t,n,r,s,o){if(!e.length||e.length>AS)throw new Error("Selecione de 1 a 20 arquivos.");const i=t==="clean-video"?1:n;if(t!=="clean-video"&&!IS.includes(n))throw new Error("Multiplicador inválido.");if(t==="clean-video"){if(e.some(x=>x.kind!=="video"))throw new Error("O Limpa Hash de Vídeo aceita apenas MP4, MOV ou WEBM.")}else if(e.some(x=>x.kind==="video"))throw new Error("O duplicador de imagens aceita apenas JPG ou PNG. Use o Limpa Hash de Vídeo.");const l=e.reduce((x,v)=>x+v.data.byteLength,0);if(l>TS)throw new Error("O lote excede 75 MB.");const c=t==="clean-video",d=c?zx:Fx;if((t==="duplicate"||t==="clean-video")&&l*i>d)throw new Error(c?"O lote de vídeo excederia 400 MB. Reduza os arquivos.":"O projeto excederia 200 MB. Reduza o lote ou o multiplicador.");const u=new Date,h={name:`Projeto_${u.toISOString().replace(/[-:]/g,"").replace("T","_").replace("Z","").replace(".","_")}_${crypto.randomUUID().slice(0,8)}`,createdAt:u.toISOString(),mode:t,requested:e.length*i,sources:e.map(x=>({name:x.file.name,hash:x.hash,inspection:x.inspection,kind:x.kind})),outputs:[],errors:[],cancelled:!1};let p=0,y=0;const g=new Set;for(let x=0;x<e.length;x++){const v=e[x];for(let b=0;b<i;b++){if(s.aborted)return h.cancelled=!0,h;try{let w=v.data,_=v.kind==="video"?"Limpeza de hash de vídeo sem recodificação; metadados de criação alterados.":"Duplicação sem recodificação; dados de pixels preservados; limpeza de metadados.",C=v.inspection.format,N=v.kind==="video"?Rz[v.inspection.format]:C==="jpeg"?"image/jpeg":"image/png";if(t==="creative"){const S=await fz(v.file,b,r);if(s.aborted)return h.cancelled=!0,h;w=new Uint8Array(await S.blob.arrayBuffer()),_=`${S.recipe}; modelo IA: ${r.llmId||"criar-imagem::nano-banana-pro"}`,C="png",N="image/png"}let k;do k=Sz(x*i+b+1,u);while(g.has(k));g.add(k);const P=v.kind==="video"?Mz(w,k):_z(w,k);v.kind==="video"?PS(P,k):jS(P,k);const A=c?zx:Fx;if(y+P.byteLength>A)return h.errors.push(c?"Limite de 400 MB atingido. As cópias restantes não foram geradas.":"Limite de 200 MB atingido. As cópias restantes não foram geradas."),h;const T=await Du(P);if(s.aborted)return h.cancelled=!0,h;const D=v.kind==="video"?C==="mov"?"mov":C==="webm"?"webm":"mp4":C==="jpeg"?"jpg":"png",E=v.file.name.replace(/\.[^.]+$/,"").replace(/[^\p{L}\p{N}_-]/gu,"_").slice(0,60)||(v.kind==="video"?"video":"imagem"),I={name:v.kind==="video"?`${E}_limpo.${D}`:`${String(x+1).padStart(3,"0")}_${E}_${k}.${D}`,source:v.file.name,code:k,hash:T,recipe:_,blob:new Blob([new Uint8Array(P)],{type:N})};h.outputs.push(I),y+=P.byteLength,o(++p,h.requested,I)}catch(w){h.errors.push(`${v.file.name}${t==="clean-video"?"":` — cópia ${b+1}`}: ${w instanceof Error?w.message:"Falha ao processar arquivo."}`),o(++p,h.requested)}await new Promise(w=>setTimeout(w,0))}}return h}const Pi=e=>e.replace(/[\r\n\t]/g," ");function MS(e){const t=[e.name,`Criado em (UTC): ${e.createdAt}`,`Modo: ${e.mode}`,`Solicitadas: ${e.requested}; geradas e verificadas: ${e.outputs.length}`,`Estado: ${e.cancelled?"cancelado — resultado parcial":e.errors.length?"concluído com falhas — resultado parcial":"concluído"}`,"Verificação: exatamente um campo de rastreio; sem outros metadados descritivos nem dados após EOI/IEND.","Dados estruturais necessários à decodificação (incluindo transparência) são preservados.","Duplicação preserva dados de pixels codificados. Remover ICC/EXIF pode alterar cores/orientação exibidas.","Originais não são alterados. SHA-256 calculado sobre todos os bytes de cada arquivo.","","ORIGINAIS"];for(const n of e.sources)t.push(`Arquivo: ${Pi(n.name)}`,`SHA-256: ${n.hash}`,`Metadados encontrados: ${n.inspection.metadata.join(", ")||"nenhum"}`,...n.inspection.warnings,"");t.push("CÓPIAS");for(const n of e.outputs)t.push(`Arquivo: ${n.name}`,`Original: ${Pi(n.source)}`,`Código: ${n.code}`,`Receita: ${Pi(n.recipe)}`,`SHA-256: ${n.hash}`,"Verificação: OK (1 campo de rastreio)","");return e.errors.length&&t.push("FALHAS",...e.errors.map(Pi)),t.join(`
509`)}async function Lz(e,t){const n=new gz,r=n.folder(e.name);for(const s of e.outputs)r.file(s.name,await s.blob.arrayBuffer());return r.file("relatorio.txt",MS(e)),n.generateAsync({type:"blob",compression:"STORE"},s=>t==null?void 0:t(s.percent))}function sd(e,t){const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),3e4)}function Vx({blob:e,alt:t,video:n=!1}
509){const[r,s]=m.useState("");return m.useEffect(()=>{const o=URL.createObjectURL(e);return s(o),()=>URL.revokeObjectURL(o)},[e]),r?n||e.type.startsWith("video/")?a.jsx("video",{src:r,"aria-label":t,className:"h-full w-full object-contain",muted:!0,playsInline:!0,preload:"metadata"}):a.jsx("img",{src:r,alt:t,className:"h-full w-full object-contain",loading:"lazy"}):null}const Fz=["original","1:1","4:5","9:16"],zz=["warm","cool","vibrant","faded","mono","cinema"],Bz=["clean","grain","vignette","frame","polaroid","note","headline"];function Vz({initialMode:e="duplicate"}){const{t}=Qe(["imageWorkshop","creativeCanvas"]),[n,r]=m.useState(e==="clean-video"||e==="creative"?e:"duplicate"),[s,o]=m.useState([]),[i,l]=m.useState(5),[c,d]=m.useState(()=>({...az,formats:[],grades:[],styles:[],llmId:xS})),[u,f]=m.useState(!1),[h,p]=m.useState(!1),[y,g]=m.useState(!1),[x,v]=m.useState(0),[b,w]=m.useState(0),[_,C]=m.useState(null),[N,k]=m.useState([]),[P,A]=m.useState([]),[T,D]=m.useState(!1),E=m.useRef(null),I=m.useRef(null),S=m.useRef(null),L=m.useRef(null),Y=m.useRef(!1),B=m.useRef(!0);m.useEffect(()=>(B.current=!0,()=>{var z;B.current=!1,(z=L.current)==null||z.abort()}),[]);const q=u||h||y,F=n==="clean-video",ee=n==="creative",$=s.filter(z=>F?z.kind==="video":z.kind==="image"),M=ee&&(!c.formats.length||!c.grades.length||!c.styles.length),J=pz(`${c.title}
510${c.subtitle}`);function K(z){z===n||q||(r(z),C(null),k([]),A([]),v(0))}async function X(z){if(Y.current||!z.length)return;Y.current=!0,p(!0);const ie=[...s],j=O=>F?O.kind==="video":O.kind==="image",H=[];let G=ie.filter(j).reduce((O,R)=>O+R.file.size,0);try{for(const O of z){if(!B.current)return;if(ie.filter(j).length>=AS){H.push(t(F?"videoFileLimit":"fileLimit"));break}if(G+O.size>TS){H.push(`${O.name}: ${t("inputLimit")}`);continue}try{const R=await Dz(O);if(F&&R.kind!=="video"){H.push(`${O.name}: ${t("imageNotInVideo")}`);continue}if(!F&&R.kind==="video"){H.push(`${O.name}: ${t(ee?"videoNotInFactory":"videoNotInImages")}`);continue}if(ie.some(U=>U.hash===R.hash))continue;ie.push(R),G+=O.size}catch(R){H.push(`${O.name}: ${R instanceof Error?R.message:t("failed")}`)}}B.current&&(o(ie),A(H))}finally{Y.current=!1,B.current&&p(!1)}}async function de(){if(Y.current||!$.length||M)return;Y.current=!0;const z=new AbortController;L.current=z,f(!0),C(null),k([]),v(0),A([]);try{const ie=await Oz($,n,F?1:i,c,z.signal,(j,H,G)=>{B.current&&(v(Math.round(j/H*100)),G&&k(O=>O.length<8?[...O,G]:O))});B.current&&(C(ie),k([]))}catch(ie){B.current&&A([ie instanceof Error?ie.message:t("failed")])}finally{Y.current=!1,L.current=null,B.current&&f(!1)}}async function te(){if(!(!_||Y.current)){Y.current=!0,g(!0),w(0);try{const z=await Lz(_,ie=>{B.current&&w(Math.round(ie))});B.current&&sd(z,`${_.name}.zip`)}catch(z){B.current&&A([z instanceof Error?z.message:t("failed")])}finally{Y.current=!1,B.current&&g(!1)}}}function ae(z,ie){d(j=>{const H=j[z];return{...j,[z]:H.includes(ie)?H.filter(G=>G!==ie):[...H,ie]}})}const re=(_==null?void 0:_.outputs.slice(0,8))??N,le=F?$.length:$.length*i,ue=[{id:"duplicate",label:t("duplicateTab")},{id:"clean-video",label:t("videoTab")},{id:"creative",label:t("creativeTitle")}];return a.jsxs("div",{className:"mx-auto max-w-6xl space-y-6 px-4 py-6 sm:px-8",children:[a.jsxs("header",{children:[a.jsx("h1",{className:"text-2xl font-bold",children:t(ee?"creativeTitle":F?"videoTitle":"duplicateTitle")}),a.jsx("p",{className:"mt-1 max-w-2xl text-sm text-muted-foreground",children:t(ee?"creativeDescription":F?"videoDescription":"duplicateDescription")})]}),a.jsx("div",{className:"inline-flex max-w-full flex-wrap gap-1 rounded-lg bg-muted/60 p-1",role:"group","aria-label":t("mode"),children:ue.map(z=>a.jsx("button",{type:"button","aria-pressed":n===z.id,disabled:q,onClick:()=>K(z.id),className:"whitespace-nowrap rounded-md px-3 py-1.5 text-sm font-medium text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50 aria-[pressed=true]:bg-background aria-[pressed=true]:text-foreground aria-[pressed=true]:shadow-sm",children:z.label},z.id))}),a.jsxs("div",{className:"grid items-start gap-6 lg:grid-cols-[1fr_360px]",children:[a.jsxs("div",{className:"min-w-0 space-y-4",children:[a.jsxs(hr,{children:[a.jsxs(io,{className:"flex-row items-center justify-between gap-2 space-y-0",children:[a.jsxs(lo,{className:"text-lg",children:[t(F?"videoSources":"sources")," ",a.jsxs("span",{className:"text-muted-foreground",children:["(",$.length,"/20)"]})]}),a.jsxs(pe,{size:"sm",variant:"ghost",disabled:q||!$.length,onClick:()=>{o(z=>z.filter(ie=>F?ie.kind!=="video":ie.kind!=="image")),C(null),k([]),A([])},children:[a.jsx(_o,{className:"mr-2 h-4 w-4"}),t("clear")]})]}),a.jsxs(us,{className:"space-y-4",children:[a.jsxs("div",{className:xe("rounded-lg border border-dashed p-8 text-center transition-colors",T?"border-foreground
510/40 bg-muted/40":"border-border"),onDragOver:z=>{z.preventDefault(),q||D(!0)},onDragLeave:()=>D(!1),onDrop:z=>{z.preventDefault(),D(!1),q||X(Array.from(z.dataTransfer.files))},children:[a.jsx("p",{className:"text-sm font-medium",children:t(F?"dropVideo":"drop")}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t(F?"limitsVideo":"limits")}),a.jsxs("div",{className:"mt-5 flex flex-wrap justify-center gap-2",children:[F?a.jsxs(pe,{variant:"outline",size:"sm",disabled:q,onClick:()=>{var z;return(z=I.current)==null?void 0:z.click()},children:[h?a.jsx(st,{className:"mr-2 h-4 w-4 animate-spin","aria-hidden":"true"}):a.jsx(vp,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),t("addVideos")]}):a.jsxs(pe,{variant:"outline",size:"sm",disabled:q,onClick:()=>{var z;return(z=E.current)==null?void 0:z.click()},children:[h?a.jsx(st,{className:"mr-2 h-4 w-4 animate-spin","aria-hidden":"true"}):a.jsx(vp,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),t("addImages")]}),a.jsxs(pe,{variant:"outline",size:"sm",disabled:q,onClick:()=>{var z;return(z=S.current)==null?void 0:z.click()},children:[a.jsx(GC,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),t("addFolder")]})]}),a.jsx("input",{ref:E,className:"hidden",type:"file",multiple:!0,accept:"image/jpeg,image/png,.jpg,.jpeg,.png","aria-label":t("addImages"),disabled:q,onCh
510ange:z=>{X(Array.from(z.target.files??[])),z.target.value=""}}),a.jsx("input",{ref:I,className:"hidden",type:"file",multiple:!0,accept:"video/mp4,video/webm,video/quicktime,.mp4,.m4v,.mov,.webm","aria-label":t("addVideos"),disabled:q,onChange:z=>{X(Array.from(z.target.files??[])),z.target.value=""}}),a.jsx("input",{ref:z=>{S.current=z,z==null||z.setAttribute("webkitdirectory","")},className:"hidden",type:"file",multiple:!0,"aria-label":t("addFolder"),disabled:q,onChange:z=>{X(Array.from(z.target.files??[])),z.target.value=""}})]}),a.jsx("div",{className:"max-h-[520px] space-y-3 overflow-y-auto",children:$.map(z=>a.jsxs("div",{className:"rounded-lg border p-3",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"h-14 w-14 shrink-0 overflow-hidden rounded-lg bg-muted",children:a.jsx(Vx,{blob:z.file,alt:z.file.name,video:z.kind==="video"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"break-all text-sm font-medium",children:z.file.name}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[z.kind==="video"?t("videoLabel"):`${z.inspection.width} × ${z.inspection.height}`," · ",(z.file.size/1024/1024).toFixed(2)," MB · ",z.inspection.format.toUpperCase()]})]}),a.jsx(pe,{size:"icon",variant:"ghost",disabled:q,"aria-label":t("remove",{name:z.file.name}),onClick:()=>o(ie=>ie.filter(j=>j.id!==z.id)),children:a.jsx(sr,{className:"h-4 w-4"})})]}),a.jsxs("details",{className:"mt-2 text-xs",children:[a.jsxs("summary",{className:"cursor-pointer text-muted-foreground",children:[t("metadataBefore")," (",z.inspection.metadata.length,")"]}),a.jsx("p",{className:"mt-2 break-words",children:z.inspection.metadata.join(" · ")||t("noMetadata")}),a.jsxs("p",{className:"mt-2 break-all font-mono",children:["SHA-256: ",z.hash]}),z.inspection.warnings.map((ie,j)=>a.jsx("p",{className:"mt-2 text-amber-600 dark:text-amber-400",children:ie},j))]})]},z.id))}),!$.length&&a.jsx("p",{className:"py-3 text-center text-sm text-muted-foreground",children:t(F?"emptyVideo":"empty")})]})]}),ee&&a.jsxs(hr,{children:[a.jsx(io,{children:a.jsx(lo,{className:"text-lg",children:t("precheck")})}),a.jsxs(us,{className:"space-y-3",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:t("precheckHelp")}),J.length?J.map((z,ie)=>a.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 p-3 text-sm",children:[a.jsxs("p",{className:"font-medium",children:[z.category,": “",z.excerpt,"”"]}),a.jsx("p",{className:"mt-1 text-muted-foreground",children:z.suggestion})]},ie)):a.jsx("p",{className:"text-sm",children:t(c.title||c.subtitle?"noFindings":"precheckEmpty")})]})]})]}),a.jsxs("div",{className:"min-w-0 space-y-4",children:[a.jsxs(hr,{children:[a.jsx(io,{children:a.jsx(lo,{className:"text-lg",children:t("settings")})}),a.jsxs(us,{className:"space-y-5",children:[ee&&a.jsxs("div",{children:[a.jsx("label",{htmlFor:"creative-llm",className:"mb-2 block text-sm font-medium",children:t("llmLabel")}),a.jsx("select",{id:"creative-llm","aria-label":t("llmLabel"),disabled:q,value:c.llmId,onChange:z=>d(ie=>({...ie,llmId:z.target.value})),className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
510ing-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",children:gS.map(z=>a.jsx("optgroup",{label:t(z.label,{ns:"creativeCanvas"}),children:z.llms.map(ie=>a.jsx("option",{value:`${z.id}::${ie.id}`,children:ie.label},`${z.id}::${ie.id}`))},z.id))}),a.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:t("llmHelp")})]}),!F&&a.jsxs("fieldset",{disabled:q,children:[a.jsx("legend",{className:"mb-2 text-sm font-medium",children:t("copies")}),a.jsx("div",{className:"grid grid-cols-4 gap-2",children:IS.map(z=>a.jsxs(pe,{type:"button",variant:i===z?"default":"outline","aria-pressed":i===z,onClick:()=>l(z),children:[z,"×"]},z))})]}),ee&&a.jsxs(a.Fragment,{children:[a.jsxs("fieldset",{disabled:q,children:[a.jsx("legend",{className:"mb-2 text-sm font-medium",children:t("formats")}),a.jsx("div",{className:"flex flex-wrap gap-2",children:Fz.map(z=>a.jsx(pe,{size:"sm",variant:c.formats.includes(z)?"default":"outline","aria-pressed":c.formats.includes(z),onClick:()=>ae("formats",z),children:z==="original"?t("original"):z},z))}),a.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:t("formatHelp")})]}),a.jsxs("fieldset",{disabled:q,children:[a.jsx("legend",{className:"mb-2 text-sm font-medium",children:t("grades")}),a.jsx("div",{className:"flex flex-wrap gap-2",children:zz.map(z=>a.jsx(pe,{size:"sm",variant:c.grades.includes(z)?"default":"outline","aria-pressed":c.grades.includes(z),onClick:()=>ae("grades",z),children:t(`grade.${z}`)},z))})]}),a.jsxs("fieldset",{disabled:q,children:[a.jsx("legend",{className:"mb-2 text-sm font-medium",children:t("styles")}),a.jsx("div",{className:"flex flex-wrap gap-2",children:Bz.map(z=>a.jsx(pe,{size:"sm",variant:c.styles.includes(z)?"default":"outline","aria-pressed":c.styles.includes(z),onClick:()=>ae("styles",z),children:t(`style.${z}`)},z))})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"creative-title",className:"mb-2 block text-sm font-medium",children:t("title")}),a.jsx(et,{id:"creative-title",disabled:q,maxLength:100,value:c.title,onChange:z=>d(ie=>({...ie,title:z.target.value})),placeholder:t("titlePlaceholder")})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"creative-subtitle",className:"mb-2 block text-sm font-medium",children:t("subtitle")}),a.jsx(et,{id:"creative-subtitle",disabled:q,maxLength:180,value:c.subtitle,onChange:z=>d(ie=>({...ie,subtitle:z.target.value})),placeholder:t("subtitlePlaceholder")})]})]}),a.jsxs("div",{className:"rounded-lg bg-muted/50 p-3 text-sm",children:[a.jsx("strong",{children:le===0?t("totalEmpty"):t(F?"videoTotal":"total",{n:le})}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t(F?"videoProjectHelp":"projectHelp")})]}),M&&a.jsx("p",{className:"text-xs text-muted-foreground",children:t("selectOptions")}),a.jsxs(pe,{className:"w-full",disabled:q||!$.length||M,onClick:()=>void de(),children:[u?a.jsx(st,{className:"mr-2 h-4 w-4 animate-spin","aria-hidden":"true"}):null,t(F?"cleanHash":"generate")]}),u&&a.jsxs("div",{className:"space-y-2",role:"status",children:[a.jsx(mS,{value:x,"aria-label":t(F?"processingVideo":"processing")}),a.jsxs("div",{className:"flex items-center justify-between text-xs",children:[a.jsxs("span",{children:[t(F?"processingVideo":"processing")," ",x,"%"]}),a.jsx(pe,{size:"sm",variant:"ghost",onClick:()=>{var z;return(z=L.current)==null?void 0:z.abort()},children:t("cancel")})]})]})]})]}),a.jsxs("div",{className:"space-y-2 text-xs text-muted-foreground",children:[a.jsx("p",{children:t(F?"videoPrivacy":"privacy")}),a.jsx("p",{children:t(F?"videoNotice":"pixelNotice")})]})]})]}),P.length>0&&a.jsx("div",{role:"alert",className:"space-y-1 rounded-lg border border-destructive/40 bg-destructive/5 p-4 text-sm",children:P.map((z,ie)=>a.jsx("p",{children:z},ie))}),(_||re.length>0)&&a.jsxs(hr,{children:[a.jsx(io,{children:a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx(lo,{className:"text-lg",children:t("results")}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:_?t("resultCount",{count:_.outputs.length,total:_.requested}):t("processing")})]}),_&&a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsx(pe,{variant:"outline",disabled:q,onClick:()=>sd(new Blob([MS(_)],{type:"text/plain;charset=utf-8"}),`${_.name}_relatorio.txt`),children:t("report")}),a.jsxs(pe,{disabled:q||!_.outputs.length,onClick:()=>void te(),children:[a.jsx(mp,{className:"mr-2 h-4 w-4"}),y?`${t("packing")} ${b}%`:t("downloadZip")]})]})]})}),a.jsxs(us,{className:"space-y-4",children:[_&&a.jsxs("p",{className:"break-all text-xs text-muted-foreground",children:[_.name," · ",t(_.mode==="clean-video"?"videoTab":_.mode==="duplicate"?"duplicateTab":"creativeTitle")]}),(_==null?void 0:_.cancelled)&&a.jsx("p",{role:"status",className:"text-sm text-amber-600 dar
510k:text-amber-400",children:t("cancelled")}),!!(_!=null&&_.errors.length)&&a.jsxs("div",{role:"alert",className:"rounded-lg bg-destructive/5 p-3 text-sm",children:[a.jsx("p",{className:"font-medium",children:t("partial")}),_.errors.map((z,ie)=>a.jsx("p",{className:"mt-1",children:z},ie))]}),a.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:re.map(z=>a.jsxs("div",{className:"min-w-0 overflow-hidden rounded-lg border",children:[a.jsx("div",{className:"h-52 bg-muted/30",children:a.jsx(Vx,{blob:z.blob,alt:z.name,video:z.blob.type.startsWith("video/")})}),a.jsxs("div",{className:"space-y-2 p-3",children:[a.jsx("p",{className:"break-all font-mono text-xs",children:z.code}),a.jsx("p",{className:"text-xs text-muted-foreground",children:z.recipe}),a.jsxs("details",{className:"text-xs",children:[a.jsxs("summary",{className:"cursor-pointer",children:["SHA-256 · ",t("verified")]}),a.jsx("p",{className:"mt-1 break-all font-mono",children:z.hash})]}),a.jsxs(pe,{size:"sm",variant:"outline",className:"w-full",onClick:()=>sd(z.blob,z.name),children:[a.jsx(mp,{className:"mr-2 h-3 w-3"}),t(z.blob.type.startsWith("video/")?"downloadVideo":"download")]})]})]},z.code))}),((_==null?void 0:_.outputs.length)??0)>8&&a.jsx("p",{className:"text-xs text-muted-foreground",children:t("previewLimit")})]})]})]})}function $z(){return a.jsx(U_,{children:a.jsx(Vz,{})})}function RS(){const{t:e}=Qe(["dashboard","common"]),[t]=Nv(),n=t.get("token")??"",[r,s]=m.useState("loading");m.useEffect(()=>{if(!n){s("invalid");return}(async()=>{try{const i=`https://jevbzxxgwsbbxzwwszag.supabase.co/functions/v1/handle-email-unsubscribe?token=${encodeURIComponent(n)}`,c=await(await fetch(i,{headers:{apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImpldmJ6eHhnd3NiYnh6d3dzemFnIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODM2OTYwMzQsImV4cCI6MjA5OTI3MjAzNH0.hOFQSgGE04I7fhEbiIIF4E2AtOOciicNOL37bCfBJtc"}})).json();c.valid?s("valid"):c.reason==="already_unsubscribed"?s("already"):s("invalid")}catch{s("invalid")}})()},[n]);const o=async()=>{s("submitting");const{data:i,error:l}=await Ln.functions.invoke("handle-email-unsubscribe",{body:{token:n}});l||!(i!=null&&i.success)?s("error"):s("success")};return a.jsx("main",{className:"min-h-screen flex items-center justify-center bg-background p-6",children:a.jsxs(hr,{className:"max-w-md w-full p-8 text-center space-y-4",children:[a.jsx("h1",{className:"text-2xl font-semibold",children:e("unsubscribe.title")}),r==="loading"&&a.jsx("p",{className:"text-muted-foreground",children:e("unsubscribe.checking")}),r==="valid"&&a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-muted-foreground",children:e("unsubscribe.confirmMessage")}),a.jsx(pe,{onClick:o,className:"w-full",children:e("unsubscribe.confirmButton")})]}),r==="submitting"&&a.jsx("p",{className:"text-muted-foreground",children:e("unsubscribe.submitting")}),r==="success"&&a.jsx("p",{className:"text-green-600",children:e("unsubscribe.success")}),r==="already"&&a.jsx("p",{className:"text-muted-foreground",children:e("unsubscribe.alreadyUnsubscribed")}),r==="invalid"&&a.jsx("p",{className:"text-destructive",children:e("unsubscribe.invali
510dLink")}),r==="error"&&a.jsx("p",{className:"text-destructive",children:e("unsubscribe.error")})]})})}function DS(){const{t:e}=Qe(["dashboard","common"]),t=Rt(),[n,r]=m.useState("checking"),[s,o]=m.useState(""),[i,l]=m.useState(""),[c,d]=m.useState(!1);m.useEffect(()=>{const{data:f}=he.auth.onAuthStateChange((x,v)=>{(x==="PASSWORD_RECOVERY"||x==="SIGNED_IN"&&v)&&r("ready")}),h=new URLSearchParams(window.location.search),p=h.get("token_hash"),y=h.get("type");if(p&&y==="recovery")return he.auth.verifyOtp({token_hash:p,type:"recovery"}).then(({data:x,error:v})=>{r(b=>b==="checking"?v||!x.session?"invalid":"ready":b)}),()=>{f.subscription.unsubscribe()};he.auth.getSession().then(({data:x})=>{r(v=>v==="checking"?x.session?"ready":"invalid":v)});const g=setTimeout(()=>r(x=>x==="checking"?"invalid":x),5e3);return()=>{f.subscription.unsubscribe(),clearTimeout(g)}},[]);const u=async()=>{var h,p;if(s.length<6){Ye.error(e("resetPassword.shortPasswordTitle"),e("resetPassword.shortPasswordDesc"));return}if(s!==i){Ye.error(e("resetPassword.mismatchTitle"),e("resetPassword.mismatchDesc"));return}r("saving");const{error:f}=await he.auth.updateUser({password:s});if(f){const y=((h=f.message)==null?void 0:h.includes("leaked"))||((p=f.message)==null?void 0:p.includes("compromised"));Ye.error(e("resetPassword.errorTitle"),y?e("resetPassword.leakedPassword"):f.message||e("resetPassword.genericError")),r("ready");return}r("done"),Ye.success(e("resetPassword.successTitle"),e("resetPassword.successDesc")),await he.auth.signOut(),setTimeout(()=>t("/auth"),1600)};return a.jsx("main",{className:"min-h-screen flex items-center justify-center bg-background p-6",children:a.jsxs(hr,{className:"max-w-md w-full p-8 space-y-5",children:[a.jsxs("div",{className:"text-center space-y-2",children:[a.jsx("div",{className:"mx-auto w-12 h-12 rounded-xl bg-primary/10 flex items-center justify-center",children:a.jsx(fo,{className:"h-6 w-6 text-primary"})}),a.jsx("h1",{className:"text-2xl font-semibold",children:e("resetPassword.title")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:e("resetPassword.subtitle")})]}),n==="checking"&&a.jsx("div",{className:"flex justify-center py-6",children:a.jsx(st,{className:"h-6 w-6 animate-spin text-muted-foreground"})}),n==="invalid"&&a.jsxs("div",{className:"text-center space-y-3",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:e("resetPassword.invalidLink")}),a.jsx(pe,{className:"w-full",onClick:()=>t("/auth"),children:e("resetPassword.backToLogin")})]}),(n==="ready"||n==="saving")&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(Be,{htmlFor:"np",children:e("resetPassword.newPasswordLabel")}),a.jsxs("div",{className:"relative",children:[a.jsx(et,{id:"np",type:c?"text":"password",value:s,onChange:f=>o(f.target.value),placeholder:e("resetPassword.newPasswordPlaceholder"),autoComplete:"new-password"}),a.jsx("button",{type:"button",onClick:()=>d(!c),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground","aria-label":e(c?"resetPassword.hidePassword":"resetPassword.showPassword"),children:c?a.jsx(md,{className:"h-4 w-4"}):a.jsx(gd,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Be,{htmlFor:"cp",children:e("resetPassword.confirmPasswordLabel")}),a.jsx(et,{id:"cp",type:c?"text":"password",value:i,onChange:f=>l(f.target.value),placeholder:e("resetPassword.confirmPasswordPlaceholder"),autoComplete:"new-password",onKeyDown:f=>f.key==="Enter"&&u()})]}),a.jsxs(pe,{className:"w-full",onClick:u,disabled:n==="saving",children:[n==="saving"?a.jsx(st,{className:"h-4 w-4 animate-spin mr-2"}):null,e("resetPassword.submitButton")]})]}),n==="done"&&a.jsx("p",{className:"text-center text-sm text-emerald-500",children:e("resetPassword.doneMessage")})]})})}const OS=()=>{const{t:e}=Qe(["dashboard","common"]),{slug:t}=Pv(),[n,r]=m.useState(null),[s,o]=m.useState(!0),[i,l]=m.useState(!1);return m.useEffect(()=>{(async()=>{if(!t){l(!0),o(!1);return}const{data:d,error:u}=await Ln.from("published_sites").select("html_content").eq("slug",t).maybeSingle();u||!d?l(!0):r(d.html_content),o(!1)})()},[t]),s?a.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100vh",background:"#000",color:"#fff"},children:a.jsx("p",{children:e("publishedSite.loading")})}):i||!n?a.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100vh",background:"#111",color:"#fff",fontFamily:"system-ui"},children:[a.jsx("h1",{style:{fontSize:"2rem",marginBottom:"0.5rem"},children:"404"}),a.jsx("p",{style:{color:"#888"},children:e("publishedSite.notFoundTitle")})]}):a.jsx("iframe",{srcDoc:n,title:e("publishedSite.iframeTitle"),style:{width:"100vw",height:"100vh",border:"none"},sandbox:"allow-scripts allow-same-origin allow-popups allow-forms",allow:"clipboard-write"})},Uz=new Set(["start","text","message","image","video","audio","document","media","sticker","delay","randomizer","aitext"]);function Wz(e,t=Math.random()){if(e.delayMs!=null)return Number(e.delayMs);if(e.delaySeconds!=null)return Number(e.delaySeconds)*1e3;const n={seconds:1e3,minutes:6e4,hours:36e5,days:864e5};if(!n[e.unit??"seconds"])return NaN;let r=Number(e.delay??e.seconds??5);if(e.delayType==="variable"){const s=Number(e.minDelay??5),o=Number(e.maxDelay??15);if(s<0||o<s)return NaN;r=s+t*(o-s)}return Math.round(r*n[e.unit??"seconds"])}function LS(e,t){var r,s,o;if(!Array.isArray(e)||!e.length)return"O fluxo precisa de um nó inicial.";if(e.length>500)return"O fluxo excede 500 nós.";if(t!==void 0&&!Array.isArray(t))return"Conexões de fluxo inválidas.";const n=new Set(e.map(i=>i==null?void 0:i.id));if(n.size!==e.length||e.some(i=>!(i!=null&&i.id)))return"IDs de nós inválidos ou duplicados.";for(const i of e){const l=String(i.type).toLowerCase(),c=i.data??{};if(c.buttons!==void 0&&!Array.isArray(c.buttons))return`Botões inválidos no nó ${i.id}.`;if(!Uz.has(l))return`O nó ${i.type}
510 não é compatível com publicação em grupos/canais Telegram.`;if(c.mentionAll||c.message_thread_id||c.threadId||c.waitForReply||(r=c.cards)!=null&&r.length||c.presence&&c.presence!=="none")return`Remova menção a todos, tópicos, cartões, presença ou espera por resposta do nó ${i.id}.`;if((s=c.choices)!=null&&s.length&&!((o=c.buttons)!=null&&o.length))return`Converta os botões legados do nó ${i.id} para botões de URL.`;if(c.replyMarkup||c.reply_markup||(c.buttons??[]).some(u=>u.action!=="url"||!/^https?:\/\//i.test(u.url??"")))return`O nó ${i.id} aceita somente botões de URL neste fluxo editorial.`;if(String(c.text??c.message??c.content??"").length>(["text","message","aitext"].includes(l)?4096:1024)&&!["delay","randomizer","start"].includes(l))return`Texto ou legenda excede o limite no nó ${i.id}.`;if(l==="delay"){const u=Wz(c,1);if(!Number.isFinite(u)||u<0||u>30*864e5)return"Espera inválida (máximo 30 dias)."}}return t!=null&&t.some(i=>!n.has(i.source)||!n.has(i.target))?"O fluxo contém conexão com nó inexistente.":null}function Hz(e){if(!e.length||e.length>10)return"Use de 1 a 10 cartões.";for(const[t,n]of e.entries()){if(!n||typeof n!="object")return"Cartao invalido.";const r=String(n.title||n.subtitle||n.text||"").trim();if(!r||r.length>80)return`Cartão ${t+1}: título obrigatório, com até 80 caracteres.`;const s=Array.isArray(n.buttons)?n.buttons:[];if(s.length>3)return`Cartão ${t+1}: máximo de 3 botões.`;for(const o of s){if(!o||typeof o!="object")return"Botao invalido.";const i=String(o.title??o.text??"").trim(),l=String(o.action??o.type??"reply").toLowerCase();if(!i||i.length>20)return`Cartão ${t+1}: rótulo do botão obrigatório, com até 20 caracteres.`;if(!["reply","url"].includes(l))return`Cartão ${t+1}: use botão de resposta ou URL; ${l} não é suportado neste cartão.`;if(l==="url"&&!String(o.url??"").trim())return`Cartão ${t+1}: preencha a URL do botão.`}}return null}function Hh(e,t){var n,r,s;if(!["instagram","messenger"].includes(t))return null;for(const o of e){const i=(n=o.data)==null?void 0:n.cards;if(o.type==="carousel"||["card","cards","carousel"].includes(String((r=o.data)==null?void 0:r.interactionType))){const c=Hz(Array.isArray(i)?i:[]);if(c)return`Bloco ${o.id}: ${c} Alterações não salvas.`}if(((s=o.data)==null?void 0:s.interactionType)==="imageButton"&&(Array.isArray(o.data.buttons)&&o.data.buttons.length?o.data.buttons:Array.isArray(o.data.choices)?o.data.choices:[]).length>3)return`Bloco ${o.id}: imagem com botões aceita até 3 botões. Alterações não salvas.`}return null}function fs(e){const t=Math.max(0,Math.round(e)),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),s=Math.floor(t%3600/60),o=[];return n&&o.push(`${n} ${n===1?"dia":"dias"}`),r&&o.push(`${r}h`),s&&!n&&o.push(`${s}min`),o.length||o.push(t?`${t}s`:"0min"),o.join(" ")}const $x={seconds:1,minutes:60,hours:3600,days:86400},qz=new Set(["timeout","no_response","followup"]);function Gz(e,t){var u;const n=f=>!!f&&String(f.action??f.type??"reply").toLowerCase()==="reply",r=Array.isArray(e.buttons)?e.buttons:[],s=Array.isArray(e.cards)?e.cards:[],o=[...r,...s.flatMap(f=>Array.isArray(f.buttons)?f.buttons:[])];if(t.startsWith("btn-"))return o.some(f=>`btn-${f.id}`===t&&n(f));const i=/^card-(\d+)-btn-(\d+)$/.exec(t);if(i){const f=(u=s[Number(i[1])])==null?void 0:u.buttons;
510return Array.isArray(f)&&n(f[Number(i[2])])}const l=/^choice-(\d+)$/.exec(t);if(!l)return!1;const c=Number(l[1]);if(r.length)return n(r[c]);const d=Array.isArray(e.choices)?e.choices[c]:void 0;return typeof d!="string"||!d.trim()||/^\[.*\]$/.test(d.trim())?!1:!/^(https?:\/\/|url:|copy:|tel:|webapp:)/.test((d.split("|")[1]??"").trim())}function wo(e,t,n,r,s){const o=e[t]??n,i=String(e[r]??s);if(typeof o!="number"||!Number.isFinite(o)||o<=0||!$x[i])throw new Error(`Tempo inválido: ${t}/${r}.`);const l=o*$x[i];if(!Number.isFinite(l))throw new Error(`Tempo inválido: ${t}.`);return l}function Ux(e){if(e.type!=="delay")return 0;const t=e.data??{};if(t.delayType!=null&&t.delayType!=="fixed"&&t.delayType!=="variable")throw new Error("Tipo de delay inválido.");if(t.delayType==="variable"){const n=wo(t,"minDelay",5,"unit","seconds"),r=wo(t,"maxDelay",15,"unit","seconds");if(n>r)throw new Error("O delay mínimo deve ser menor ou igual ao máximo.");return r}return wo(t,"delay",5,"unit","seconds")}function Wx(e,t){const n=e.data??{},r=t.sourceHandle||"default",s=e.type==="waitInput"||e.type==="waitInputAI",o=e.type==="interactiveBlock"||e.type==="carousel";if(qz.has(r)&&(s||o))return s&&n.timeoutEnabled!==!0?null:{cost:wo(n,"timeout",s?24:6,"timeoutUnit",o&&n.timeout!=null?"minutes":"hours"),reset:!1};if(e.type==="aiResponder"&&r==="expiration")return n.enableExpiration!==!0?null:{cost:wo({expirationMinutes:n.expirationMinutes},"expirationMinutes",30,"__minutes","minutes"),reset:!1};if(e.type==="interactiveBlock"&&r==="fallback")return n.fallbackEnabled===!1?null:{cost:0,reset:!0};const i=s&&(r==="default"||e.type==="waitInputAI"&&r==="max_attempts"),l=o&&Gz(n,r);return{cost:0,reset:i||l}}function FS(e,t,n){if(!["instagram","messenger"].includes(n)||!e.length)return[];if(e.some(h=>!h.id)||new Set(e.map(h=>h.id)).size!==e.length)return[{code:"INVALID_GRAPH",nodeId:"",pathNodeIds:[],totalSeconds:0,contributions:[],message:"IDs de blocos ausentes ou duplicados. Alterações não salvas."}];const r=new Map(e.map(h=>[h.id,h])),s=t.filter(h=>r.has(h.source)&&r.has(h.target)),o=new Map;for(const h of s){const p=o.get(h.source)??[];p.push(h),o.set(h.source,p)}const i=new Set(s.map(h=>h.target)),l=e.filter(h=>h.type==="start"),c=l.length?l:e.filter(h=>!i.has(h.id));c.length||c.push(e[0]);const d=new Map(c.map(h=>[h.id,0])),u=new Map,f=(h,p,y,g)=>{const x=[p],v=new Set(x);let b=u.get(p);for(;b&&(x.unshift(b),!v.has(b));)v.add(b),b=u.get(b);const w=[];for(let N=0;N<x.length;N++){const k=r.get(x[N]);if(!k)continue;try{const T=Ux(k);T>0&&w.push({nodeId:k.id,seconds:T,via:"delay"})}catch{}const P=x[N+1];if(!P)continue;let A=null;for(const T of o.get(k.id)??[]){if(T.target!==P)continue;let D=null;try{D=Wx(k,T)}catch{continue}!D||D.cost<=0||(!A||D.cost>A.cost)&&(A={cost:D.cost,via:(T.sourceHandle||"")==="expiration"?"expiration":"timeout"})}A&&w.push({nodeId:k.id,seconds:A.cost,via:A.via})}const _=n==="instagram"?"Instagram":"Messenger",C=w.length?` Quem soma tempo: ${w.map(N=>`${N.nodeId} (${fs(N.seconds)})`).join(", ")}.`:"";return[{code:h,nodeId:p,pathNodeIds:x,totalSeconds:y,contributions:w,message:`${g}. A janela do ${_} é de 24 horas e este caminho acumula ${fs(y)} em ${x.length} blocos.${C} Alterações não salvas.`}]};for(let h=0;h<=e.length;h++){let p=!1;for(const y of e){const g=d.get(y.id);if(g===void 0)continue;let x;try{x=g+Ux(y)}catch(v){return f("INVALID_WAIT",y.id,g,v.message)}if(x>=86400)return f("MESSAGING_WINDOW_EXCEEDED",y.id,x,`O atraso acumulado (${fs(x)}) atinge ou excede 24 horas`);for(const v of o.get(y.id)??[]){let b;try{b=Wx(y,v)}catch(_){return f("INVALID_WAIT",y.id,x,_.message)}if(!b)continue;const w=b.reset?0:x+b.cost;if(w>=86400)return f("MESSAGING_WINDOW_EXCEEDED",y.id,w,`O atraso acumulado (${fs(w)}) atinge ou excede 24 horas`);if(w>(d.get(v.target)??-1)&&(d.set(v.target,w),b.reset?u.delete(v.target):u.set(v.target,y.id),p=!0,h===e.length))return f("MESSAGING_WINDOW_CYCLE",v.target,w,"Ciclo com atraso positivo sem nova resposta do contato")}}if(!p)return[]}return[]}const ca=m.forwardRef(({className:e,...t},n)=>a.jsx("textarea",{className:xe("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
510ing-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));ca.displayName="Textarea";const Hx=["sale","pix_detected"],Kz="sale-flow-conflicts";function Yz(e,t={}){const{effectiveUserId:n}=ti(),r=t.enabled??!0,{data:s=[],isLoading:o}=bf({queryKey:[Kz,n],enabled:r&&!!n,staleTime:60*1e3,queryFn:async()=>{if(!n)return[];const{data:d,error:u}=await he.from("inbox_flows").select("id, name, assigned_instances, trigger_type").eq("user_id",n).is("deleted_at",null).in("trigger_type",Hx);return u?(console.error("[useSaleFlowInstanceConflicts] error",u),[]):d||[]}}),i=m.useMemo(()=>s.filter(d=>d.id!==e),[s,e]),l=(d,u)=>{for(const f of i)if((f.assigned_instances||[]).includes(d))return f;return null};return{isLoading:o,otherSaleFlows:i,getConflictForInstance:l,getSelectionConflicts:(d,u,f)=>{if(u&&!Hx.includes(u))return[];if(i.length===0)return[];const h=f?new Set(f):null,p=h?d.filter(x=>h.has(x)):d,y=new Set,g=[];for(const x of p){const v=l(x);v&&!y.has(v.id)&&(y.add(v.id),g.push(v))}return g}}}function zS(e){const t=(e==null?void 0:e.message)||"";return typeof t=="string"&&t.includes("sale_flow_conflict")}function qx(e){const t=e.trim();if(!t.includes("/"))return t;try{const n=new URL(/^https?:\/\//i.test(t)?t:`https://${t}`),r=n.hostname.toLowerCase().replace(/^(www|m)\./,"");return r!=="instagram.com"&&r!=="facebook.com"&&r!=="fb.com"?"":(n.searchParams.get("story_fbid")??n.searchParams.get("fbid")??n.searchParams.get("v"))||n.pathname.split("/").filter(Boolean).pop()||""}catch{return""}}function ad(e,t){const n=(e??[]).map(o=>String(o).trim()).filter(Boolean);if(!n.length)return!0;const r=String(t.platformPostId??"").trim(),s=t.permalink?qx(t.permalink):"";return n.some(o=>{const i=qx(o);return i?r&&i===r||r&&/^\d+_\d+$/.test(r)&&i===r.split("_")[1]||r&&/^\d+_\d+$/.test(i)&&r===i.split("_")[1]?!0:!!s&&i===s:!1})}function Xz({instanceIds:e,value:t,onChange:n}){const{t:r}=Qe("flowBuilder"),[s,o]=m.useState(!1),[i,l]=m.useState(e[0]??""),[c,d]=m.useState([]),[u,f]=m.useState(null),[h,p]=m.useState(!1),[y,g]=m.useState(!1),[x,v]=m.useState(""),b=m.useRef(0),w=t.split(/[\n,]/).map(P=>P.trim()).filter(Boolean),_=e.includes(i)?i:e[0]??"";async function C(P){const A=++b.current;p(!0),g(!1);try{const{data:T,error:D}=await he.functions.invoke("zernio-comment-posts",{body:{instanceId:_,cursor:P}});if(A!==b.current)return;if(D||T!=null&&T.error)throw D??new Error(T.error);d(E=>[...new Map([...P?E:[],...T.posts??[]].map(I=>[I.id,I])).values()]),f(T.cursor??null)}catch{A===b.current&&g(!0)}finally{A===b.current&&p(!1)}}m.useEffect(()=>{if(!(!s||!_))return d([]),f(null),C(),()=>{b.current++}},[s,_]);function N(P,A){const T=w.filter(D=>!ad([D],{platformPostId:P.id,permalink:P.permalink}));n((A?[...T,P.id]:T).join(`
511`))}const k=c.filter(P=>`${P.content} ${P.permalink} ${P.id}`.toLowerCase().includes(x.trim().toLowerCase()));return a.jsxs(a.Fragment,{children:[a.jsx(pe,{type:"button",variant:"outline",size:"sm",disabled:!e.length,onClick:()=>o(!0),children:r("triggerEvents.postPicker.open")}),!e.length&&a.jsx("p",{className:"text-xs text-muted-foreground",children:r("triggerEvents.postPicker.connect")}),a.jsx(cn,{open:s,onOpenChange:o,children:a.jsxs(Qt,{className:"max-w-xl",children:[a.jsx(qt,{children:a.jsx(Gt,{children:r("triggerEvents.postPicker.title")})}),e.length>1&&a.jsx("select",{"aria-label":r("triggerEvents.postPicker.account"),value:_,onChange:P=>l(P.target.value),className:"rounded border bg-background p-2",children:e.map((P,A)=>a.jsxs("option",{value:P,children:[r("triggerEvents.postPicker.account")," ",A+1]},P))}),a.jsx(et,{"aria-label":r("triggerEvents.postPicker.search"),placeholder:r("triggerEvents.postPicker.search"),value:x,onChange:P=>v(P.target.value)}),a.jsx("p",{className:"text-xs text-muted-foreground",children:r("triggerEvents.postPicker.hint")}),a.jsxs("div",{className:"max-h-80 overflow-y-auto space-y-2",children:[k.map(P=>{const A=w.length>0&&ad(w,{platformPostId:P.id,permalink:P.permalink});return a.jsxs("label",{className:"flex cursor-pointer items-center gap-3 rounded border p-2",children:[a.jsx(qr,{checked:A,onCheckedChange:T=>N(P,T===!0)}),/^https:\/\//.test(P.picture)&&a.jsx("img",{src:P.picture,alt:"",loading:"lazy",className:"h-16 w-16 rounded object-cover"}),a.jsxs("span",{className:"min-w-0 text-sm",children:[a.jsx("span",{className:"line-clamp-2",children:P.content||r("triggerEvents.postPicker.noCaption")}),a.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:P.permalink||P.id})]})]},P.id)}),!h&&!y&&!k.length&&a.jsx("p",{className:"text-sm",children:r("triggerEvents.postPicker.empty")})]}),y&&a.jsx("p",{role:"alert",className:"text-sm text-destructive",children:r("triggerEvents.postPicker.error")}),a.jsxs("div",{className:"flex justify-between gap-2",children:[a.jsx(pe,{type:"button",variant:"outline",disabled:h,onClick:()=>void C(u??void 0),children:r(h?"triggerEvents.postPicker.loading":u?"triggerEvents.postPicker.more":"triggerEvents.postPicker.refresh")}),a.jsx(pe,{type:"button",onClick:()=>{const P=w.map(A=>{var T;return((T=c.find(D=>ad([A],{platformPostId:D.id,permalink:D.permalink})))==null?void 0:T.id)??A});n([...new Set(P)].join(`
512`)),o(!1)},children:r("triggerEvents.postPicker.done")})]})]})})]})}const Zz={unofficial:["dm"],official:["dm"],telegram:["dm"],instagram:["dm","comment","story_reply","story_mention","ad_referral","reaction"],messenger:["dm","comment","ad_referral","reaction"]},Wi=["dm"];function Qz(e){return e.split(/[\n,]/).map(t=>
512t.trim()).filter(Boolean)}function Jz({channel:e,value:t,onChange:n,postIds:r,onPostIdsChange:s,commentReply:o,onCommentReplyChange:i,instanceIds:l=[]}){const{t:c}=Qe("flowBuilder"),d=Zz[e]??Wi;if(d.length<=1)return null;const u=(f,h)=>{const p=new Set(t);h?p.add(f):p.delete(f),n(d.filter(y=>p.has(y)))};return a.jsxs("div",{className:"space-y-2 rounded-md border p-3",children:[a.jsx(Be,{children:c("triggerEvents.title")}),a.jsx("p",{className:"text-xs text-muted-foreground",children:c("triggerEvents.hint")}),a.jsx("div",{className:"space-y-2",children:d.map(f=>a.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[a.jsx(qr,{checked:t.includes(f),onCheckedChange:h=>u(f,h===!0)}),c(`triggerEvents.events.${f}`)]},f))}),t.length===0&&a.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400",children:c("triggerEvents.none")}),t.includes("comment")&&a.jsxs("div",{className:"space-y-1 pt-1",children:[a.jsx(Be,{className:"text-xs",children:c("triggerEvents.postIdsLabel")}),a.jsx(Xz,{instanceIds:l,value:r,onChange:s}),a.jsx(ca,{"aria-label":c("triggerEvents.postIdsLabel"),value:r,onChange:f=>s(f.target.value),placeholder:c("triggerEvents.postIdsPlaceholder"),rows:2}),a.jsx("p",{className:"text-xs text-muted-foreground",children:c("triggerEvents.commentHint")}),e==="instagram"&&a.jsxs("div",{className:"space-y-2 pt-2",children:[a.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[a.jsx(qr,{checked:o!==null,onCheckedChange:f=>i(f===!0?"":null)}),c("triggerEvents.publicReplyLabel")]}),o!==null&&a.jsxs(a.Fragment,{children:[a.jsx(ca,{"aria-label":c("triggerEvents.publicReplyLabel"),value:o,onChange:f=>i(f.target.value),maxLength:1e3,rows:3,placeholder:c("triggerEvents.publicReplyPlaceholder")}),a.jsx("p",{className:"text-xs text-muted-foreground",children:c("triggerEvents.publicReplyHint")})]})]})]})]})}const e8=["openai","gemini","anthropic","deepseek","openrouter"];function t8(e){const[t,n]=m.useState(null),[r,s]=m.useState(0),o=m.useRef(void 0),i=m.useCallback(()=>s(l=>l+1),[]);return m.useEffect(()=>{let l=!1;if(e!==o.current&&n(null),o.current=e,!!e)return(async()=>{const{data:c,error:d}=await he.rpc("list_platform_ai_keys",{p_owner_user_id:e});if(l)return;if(d){console.error("[usePlatformAIIntegrationKeys] lookup error:",d.message),n([]);return}const u=Array.isArray(c)?c:[];n(u.filter(f=>e8.includes(f==null?void 0:f.provider)).map(f=>({id:f.id,provider:f.provider,label:f.label||"",isDefault:!!f.is_default,connectedAt:f.connected_at})))})().catch(()=>{l||n([])}),()=>{l=!0}},[e,r]),t===null?null:{keys:t,defaultKey:t.find(l=>l.isDefault)??t[0]??null,refetch:i}}const Gx={openai:"OpenAI",gemini:"Gemini",anthropic:"Anthropic (Claude)",deepseek:"DeepSeek",openrouter:"OpenRouter"};function n8({keys:e,mode:t,onModeChange:n,selectedKeyId:r,onSelectedKeyIdChange:s,apiKey:o,onApiKeyChange:i,apiKeyPlaceholder:l="sk-xxxxxxxxxxxxx",requiredHelpText:c,disconnectedHelpText:d,compact:u=!1}){const{t:f}=Qe(["flowBuilder","common"]),h=c??f("platformAIKeySourceField.defaultRequiredHelp"),p=d??f("platformAIKeySourceField.defaultDisconnectedHelp"),y=u?"text-[11px]":"text-xs",g=e?e.keys.find(x=>x.id===r)??e.defaultKey:null;return a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"inline-flex rounded-md border border-border p-0.5 gap-0.5",children:[a.jsx("button",{type:"button",onClick:()=>n("own"),className:`rounded px-2 py-1 ${y} font-medium transition-colors ${t==="own"?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"}`,children:f("platformAIKeySourceField.myKey")}),a.jsx("button",{type:"button",onClick:()=>n("integration"),className:`rounded px-2 py-1 ${y} font-medium transition-colors ${t==="integration"?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"}`,children:f("platformAIKeySourceField.integrationKey")})]}),t==="own"?a.jsxs(a.Fragment,{children:[a.jsx(et,{type:"password",autoComplete:"off",className:u?"h-8 text-xs":void 0,placeholder:l,value:o,onChange:x=>i(x.target.value)}),!o.trim()&&a.jsx("p",{className:"text-xs text-rose-400",children:h})]}):e===null?a.jsx("p",{className:"text-xs text-muted-foreground",children:f("platformAIKeySourceField.loadingIntegrationStatus")}):g?a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"p-2 rounded bg-emerald-500/10 border border-emerald-500/30 text-xs text-emerald-400 flex items-center justify-between gap-2 flex-wrap",children:[a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(Vo,{className:"h-3.5 w-3.5 shrink-0"}),f("platformAIKeySourceField.usingKey",{keyName:g.label?`"${g.label}"`:f("platformAIKeySourceField.yourKey"),provider:Gx[g.provider]})]}),a.jsxs(_a,{to:"/integrations?tab=platform-ai",className:"underline underline-offset-2 shrink-0 hover:text-emerald-300",children:[f("platformAIKeySourceField.manage")," →"]})]}),e.keys.length>1&&a.jsxs(cs,{value:g.id,onValueChange:x=>{var v;return s(x===((v=e.defaultKey)==null?void 0:v.id)?void 0:x)},children:[a.jsx(Fr,{className:u?"h-8 text-xs":void 0,children:a.jsx(ds,{})}),a.jsx(zr,{children:e.keys.map(x=>a.jsxs(Ut,{value:x.id,children:[x.label||f("platformAIKeySourceField.noNickname")," — ",Gx[x.provider],x.isDefault?` ${f("platformAIKeySourceField.defaultSuffix")}`:""]},x.id))})]})]}):a.jsxs("div",{className:"p-2 rounded bg-amber-500/10 border border-amber-500/30 text-xs text-amber-400 space-y-1",children:[a.jsxs("p",{className:"flex items-start gap-2",children:[a.jsx(Jn,{className:"h-3.5 w-3.5 shrink-0 mt-0.5"}),a.jsx("span",{children:p})]}),a.jsxs(_a,{to:"/integrations?tab=platform-ai",className:"font-medium underline underline-offset-2 hover:text-amber-300",children:[f("platformAIKeySourceField.connectNow")," →"]})]})]})}const r8=[{provider:"openai",id:"gpt-5.4-nano",label:"GPT-5.4 Nano",tier:"economico",inputPricePerM:.2,outputPricePerM:1.25,supportsVision:!0,supportsPdf:!1,supportsAudio:!1,recommendedFor:"classificação simples, respostas curtas, alto volume"},{provider:"openai",id:"gpt-5.4-mini",label:"GPT-5.4 Mini",tier:"equilibrado",inputPricePerM:.75,outputPricePerM:4.5,supportsVision:!0,supportsPdf:!1,supportsAudio:!1,recommendedFor:"atendimento geral, custo-benefício"},{provider:"openai",id:"gpt-5.4",label:"GPT-5.4",tier:"equilibrado",inputPricePerM:2.5,outputPricePerM:15,supportsVision:!0,supportsPdf:!1,supportsAudio:!1,recommendedFor:"tarefas complexas, raciocínio"},{provider:"openai",id:"gpt-5.6-luna",label:"GPT-5.6 Luna",tier:"economico",inputPricePerM:1,outputPricePerM:6,supportsVision:!0,supportsPdf:!1,supportsAudio:!1,recommendedFor:"flagship barato, bom equilíbrio"},{provider:"openai",id:"gpt-5.6-terra",label:"GPT-5.6 Terra",tier:"equilibrado",inputPricePerM:2.5,outputPricePerM:15,supportsVision:!0,supportsPdf:!1,supportsAudio:!1},{provider:"openai",id:"gpt-5.6-sol",label:"GPT-5.6 Sol",tier:"poderoso",inputPricePerM:5,outputPricePerM:30,supportsVision:!0,supportsPdf:!1,supportsAudio:!1,recommendedFor:"máxima qualidade"},{provider:"openai",id:"gpt-4o",label:"GPT-4o (legado)",tier:"equilibrado",inputPricePerM:2.5,outputPricePerM:10,supportsVision:!0,supportsPdf:!1,supportsAudio:!1,legacy:!0},{provider:"openai",id:"gpt-4o-mini",label:"GPT-4o Mini (legado)",tier:"economico",inputPricePerM:.15,outputPricePerM:.6,supportsVision:!0,supportsPdf:!1,supportsAudio:!1,legacy:!0}],s8=[{provider:"gemini",id:"gemini-2.5-flash-lite",label:"Gemini 2.5 Flash-Lite (legado)",tier:"economico",inputPricePerM:.1,outputPricePerM:.4,supportsVision:!0,supportsPdf:!0,supportsAudio:!0,legacy:!0,recommendedFor:"mais barato, alto volume, classificação"},{provider:"gemini",id:"gemini-2.5-flash",label:"Gemini 2.5 Flash",tier:"equilibrado",inputPricePerM:.3,outputPricePerM:2.5,supportsVision:!0,supportsPdf:!0,supportsAudio:!0,recommendedFor:"uso geral, recomendado"},{provider:"gemini",id:"gemini-2.5-pro",label:"Gemini 2.5 Pro",tier:"poderoso",inputPricePerM:1.25,outputPricePerM:10,supportsVision:!0,supportsPdf:!0,supportsAudio:!0},{provider:"gemini",id:"gemini-3.1-flash-lite",label:"Gemini 3.1 Flash-Lite",tier:"economico",inputPricePerM:.25,outputPricePerM:1.5,supportsVision:!0,supportsPdf:!0,supportsAudio:!0},{provider:"gemini",id:"gemini-3.5-flash",label:"Gemini 3.5 Flash",tier:"equilibrado",inputPricePerM:1.5,outputPricePerM:9,supportsVision:!0,supportsPdf:!0,supportsAudio:!0,recommendedFor:"novo default recomendado"},{provider:"gemini",id:"gemini-3.1-pro-preview",label:"Gemini 3.1 Pro (preview)",tier:"poderoso",inputPricePerM:2,outputPricePerM:12,supp
512ortsVision:!0,supportsPdf:!0,supportsAudio:!0}],a8=[{provider:"anthropic",id:"claude-haiku-4-5",label:"Claude Haiku 4.5",tier:"economico",inputPricePerM:1,outputPricePerM:5,supportsVision:!0,supportsPdf:!0,supportsAudio:!1,recommendedFor:"mais rápido e barato da Anthropic"},{provider:"anthropic",id:"claude-sonnet-5",label:"Claude Sonnet 5",tier:"equilibrado",inputPricePerM:3,outputPricePerM:15,supportsVision:!0,supportsPdf:!0,supportsAudio:!1,recommendedFor:"recomendado, melhor custo-benefício"},{provider:"anthropic",id:"claude-opus-4-8",label:"Claude Opus 4.8",tier:"poderoso",inputPricePerM:5,outputPricePerM:25,supportsVision:!0,supportsPdf:!0,supportsAudio:!1,recommendedFor:"mais capaz, tarefas complexas"}],o8=[{provider:"deepseek",id:"deepseek-v4-flash",label:"DeepSeek V4 Flash",tier:"economico",inputPricePerM:.14,outputPricePerM:.28,supportsVision:!1,supportsPdf:!1,supportsAudio:!1,recommendedFor:"extremamente barato, alto volume"},{provider:"deepseek",id:"deepseek-v4-pro",label:"DeepSeek V4 Pro",tier:"equilibrado",inputPricePerM:.435,outputPricePerM:.87,supportsVision:!1,supportsPdf:!1,supportsAudio:!1}],qh=[...r8,...s8,...a8,...o8];function i8(e){return qh.filter(t=>t.provider===e)}function l8(e,t){return qh.find(n=>n.provider===e&&n.id===t)}function c8(e){return qh.filter(t=>!(e.vision!==void 0&&t.supportsVision!==e.vision||e.pdf!==void 0&&t.supportsPdf!==e.pdf||e.audio!==void 0&&t.supportsAudio!==e.audio))}function d8(e){const t=n=>Number.isInteger(n)?n.toFixed(2):n.toString();return`$${t(e.inputPricePerM)} / $${t(e.outputPricePerM)} por 1M tokens`}const u8="https://openrouter.ai/api/v1/models";function f8(e){var r;const t=e==null?void 0:e.data;if(!Array.isArray(t))return[];const n=[];for(const s of t){const o=String((s==null?void 0:s.id)??"").trim();if(!o)continue;const i=((r=s==null?void 0:s.architecture)==null?void 0:r.input_modalities)??[];n.push({provider:"openrouter",id:o,label:String((s==null?void 0:s.name)??"").trim()||o,tier:"equilibrado",inputPricePerM:0,outputPricePerM:0,supportsVision:i.includes("image"),supportsPdf:i.includes("file"),supportsAudio:i.includes("audio")})}return n.sort((s,o)=>s.label.localeCompare(o.label))}function h8(e=!0){const{data:t,isLoading:n,isError:r}=bf({queryKey:["openrouter-models"],queryFn:async()=>{const s=await Ww(u8);if(!s.ok)throw new Error(`OpenRouter ${s.status}`);return f8(await s.json())},enabled:e,staleTime:36e5,retry:1});return{models:t??[],isLoading:n,isError:r}}function p8(e){const t=h8(e==="openrouter"),n=m.useMemo(()=>e==="openrouter"?[]:i8(e),[e]);return e==="openrouter"?{models:t.models,isLoading:t.isLoading,isError:t.isError}:{models:n,isLoading:!1,isError:!1}}const m8={economico:{icon:"💰",label:"Econômico",classes:"border-emerald-500/50 bg-emerald-500/10 text-emerald-500 hover:bg-emerald-500/15"},equilibrado:{icon:"⚖️",label:"Equilibrado",classes:"border-blue-500/50 bg-blue-500/10 text-blue-500 hover:bg-blue-500/15"},poderoso:{icon:"🧠",label:"Mais capaz",classes:"border-violet-500/50 bg-violet-500/10 text-violet-500 hover:bg-violet-500/15"}};function g8({provider:e,modelId:t,model:n,className:r}){const s=n??(e&&t?l8(e,t):void 0);if(!s||s.provider==="openrouter")return null;const o=m8[s.tier];return a.jsx(pf,{children:a.jsxs(Fy,{children:[a.jsx(zy,{asChild:!0,children:a.jsxs(Yn,{variant:"outline",className:xe("gap-1 cursor-default text-xs font-medium",o.classes,r),children:[a.jsx("span",{"aria-hidden":"true",children:o.icon}),o.label]})}),a.jsxs(mf,{side:"top",className:"max-w-[240px]",children:[a.jsxs("p",{className:"text-xs",children:[d8(s)," (entrada/saída)"]}),s.recommendedFor&&a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Melhor para: ",s.recommendedFor]})]})]})})}var Kx=1,x8=.9,v8=.8,y8=.17,od=.1,id=.999,b8=.9999,w8=.99,_8=/[\\\/_+.#"@\[\(\{&]/,S8=/[\\\/_+.#"@\[\(\{&]/g,C8=/[\s-]/,BS=/[\s-]/g;function Ou(e,t,n,r,s,o,i){if(o===t.length)return s===e.length?Kx:w8;var l=`${s},${o}`;if(i[l]!==void 0)return i[l];for(var c=r.charAt(o),d=n.indexOf(c,s),u=0,f,h,p,y;d>=0;)f=Ou(e,t,n,r,d+1,o+1,i),f>u&&(d===s?f*=Kx:_8.test(e.charAt(d-1))?(f*=v8,p=e.slice(s,d-1).match(S8),p&&s>0&&(f*=Math.pow(id,p.length))):C8.test(e.charAt(d-1))?(f*=x8,y=e.slice(s,d-1).match(BS),y&&s>0&&(f*=Math.pow(id,y.length))):(f*=y8,s>0&&(f*=Math.pow(id,d-s))),e.charAt(d)!==t.charAt(o)&&(f*=b8)),(f<od&&n.charAt(d-1)===r.charAt(o+1)||r.charAt(o+1)===r.charAt(o)&&n.charAt(d-1)!==r.charAt(o))&&(h=Ou(e,t,n,r,d+1,o+2,i),h*od>f&&(f=h*od)),f>u&&(u=f),d=n.indexOf(c,d+1);return i[l]=u,u}function Yx(e){return e.toLowerCase().replace(BS," ")}function j8(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Ou(e,t,Yx(e),Yx(t),0,0,{})}var eo='[cmdk-group=""]',ld='[cmdk-group-items=""]',k8='[cmdk-group-heading=""]',VS='[cmdk-item=""]',Xx=`${VS}
512:not([aria-disabled="true"])`,Lu="cmdk-item-select",Hs="data-value",E8=(e,t,n)=>j8(e,t,n),$S=m.createContext(void 0),ni=()=>m.useContext($S),US=m.createContext(void 0),Gh=()=>m.useContext(US),WS=m.createContext(void 0),HS=m.forwardRef((e,t)=>{let n=qs(()=>{var M,J;return{search:"",value:(J=(M=e.value)!=null?M:e.defaultValue)!=null?J:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=qs(()=>new Set),s=qs(()=>new Map),o=qs(()=>new Map),i=qs(()=>new Set),l=qS(e),{label:c,children:d,value:u,onValueChange:f,filter:h,shouldFilter:p,loop:y,disablePointerSelection:g=!1,vimBindings:x=!0,...v}=e,b=ln(),w=ln(),_=ln(),C=m.useRef(null),N=F8();Fs(()=>{if(u!==void 0){let M=u.trim();n.current.value=M,k.emit()}},[u]),Fs(()=>{N(6,I)},[]);let k=m.useMemo(()=>({subscribe:M=>(i.current.add(M),()=>i.current.delete(M)),snapshot:()=>n.current,setState:(M,J,K)=>{var X,de,te,ae;if(!Object.is(n.current[M],J)){if(n.current[M]=J,M==="search")E(),T(),N(1,D);else if(M==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let re=document.getElementById(_);re?re.focus():(X=document.getElementById(b))==null||X.focus()}if(N(7,()=>{var re;n.current.selectedItemId=(re=S())==null?void 0:re.id,k.emit()}),K||N(5,I),((de=l.current)==null?void 0:de.value)!==void 0){let re=J??"";(ae=(te=l.current).onValueChange)==null||ae.call(te,re);return}}k.emit()}},emit:()=>{i.current.forEach(M=>M())}}),[]),P=m.useMemo(()=>({value:(M,J,K)=>{var X;J!==((X=o.current.get(M))==null?void 0:X.value)&&(o.current.set(M,{value:J,keywords:K}),n.current.filtered.items.set(M,A(J,K)),N(2,()=>{T(),k.emit()}))},item:(M,J)=>(r.current.add(M),J&&(s.current.has(J)?s.current.get(J).add(M):s.current.set(J,new Set([M]))),N(3,()=>{E(),T(),n.current.value||D(),k.emit()}),()=>{o.current.delete(M),r.current.delete(M),n.current.filtered.items.delete(M);let K=S();N(4,()=>{E(),(K==null?void 0:K.getAttribute("id"))===M&&D(),k.emit()})}),group:M=>(s.current.has(M)||s.current.set(M,new Set),()=>{o.current.delete(M),s.current.delete(M)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:b,inputId:_,labelId:w,listInnerRef:C}),[]);function A(M,J){var K,X;let de=(X=(K=l.current)==null?void 0:K.filter)!=null?X:E8;return M?de(M,n.current.search,J):0}function T(){if(!n.current.search||l.current.shouldFilter===!1)return;let M=n.current.filtered.items,J=[];n.current.filtered.groups.forEach(X=>{let de=s.current.get(X),te=0;de.forEach(ae=>{let re=M.get(ae);te=Math.max(re,te)}),J.push([X,te])});let K=C.current;L().sort((X,de)=>{var te,ae;let re=X.getAttribute("id"),le=de.getAttribute("id");return((te=M.get(le))!=null?te:0)-((ae=M.get(re))!=null?ae:0)}).forEach(X=>{let de=X.closest(ld);de?de.appendChild(X.parentElement===de?X:X.closest(`${ld} > *`)):K.appendChild(X.parentElement===K?X:X.closest(`${ld} > *`))}),J.sort((X,de)=>de[1]-X[1]).forEach(X=>{var de;let te=(de=C.current)==null?void 0:de.querySelector(`${eo}[${Hs}="${encodeURIComponent(X[0])}"]`);te==null||te.parentElement.appendChild(te)})}function D(){let M=L().find(K=>K.getAttribute("aria-disabled")!=="true"),J=M==null?void 0:M.getAttribute(Hs);k.setState("value",J||void 0)}function E(){var M,J,K,X;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let de=0;for(let te of r.current){let ae=(J=(M=o.current.get(te))==null?void 0:M.value)!=null?J:"",re=(X=(K=o.current.get(te))==null?void 0:K.keywords)!=null?X:[],le=A(ae,re);n.current.filtered.items.set(te,le),le>0&&de++}for(let[te,ae]of s.current)for(let re of ae)if(n.current.filtered.items.get(re)>0){n.current.filtered.groups.add(te);break}n.current.filtered.count=de}function I(){var M,J,K;let X=S();X&&(((M=X.parentElement)==null?void 0:M.firstChild)===X&&((K=(J=X.closest(eo))==null?void 0:J.querySelector(k8))==null||K.scrollIntoView({block:"nearest"})),X.scrollIntoView({block:"nearest"}))}function S(){var M;return(M=C.current)==null?void 0:M.querySelector(`${VS}[aria-selected="true"]`)}function L(){var M;return Array.from(((M=C.current)==null?void 0:M.querySelectorAll(Xx))||[])}function Y(M){let J=L()[M];J&&k.setState("value",J.getAttribute(Hs))}function B(M){var J;let K=S(),X=L(),de=X.findIndex(ae=>ae===K),te=X[de+M];(J=l.current)!=null&&J.loop&&(te=de+M<0?X[X.length-1]:de+M===X.length?X[0]:X[de+M]),te&&k.setState("value",te.getAttribute(Hs))}function q(M){let J=S(),K=J==null?void 0:J.closest(eo),X;for(;K&&!X;)K=M>0?O8(K,eo):L8(K,eo),X=K==null?void 0:K.querySelector(Xx);X?k.setState("value",X.getAttribute(Hs)):B(M)}let F=()=>Y(L().length-1),ee=M=>{M.preventDefault(),M.metaKey?F():M.altKey?q(1):B(1)},$=M=>{M.preventDefault(),M.metaKey?Y(0):M.altKey?q(-1):B(-1)};return m.createElement(Ie.div,{ref:t,tabIndex:-1,...v,"cmdk-root":"",onKeyDown:M=>{var J;(J=v.onKeyDown)==null||J.call(v,M);let K=M.nativeEvent.isComposing||M.keyCode===229;if(!(M.defaultPrevented||K))switch(M.key){case"n":case"j":{x&&M.ctrlKey&&ee(M);break}case"ArrowDown":{ee(M);break}case"p":case"k":{x&&M.ctrlKey&&$(M);break}case"ArrowUp":{$(M);break}case"Home":{M.preventDefault(),Y(0);break}case"End":{M.preventDefault(),F();break}case"Enter":{M.preventDefault();let X=S();if(X){let de=new Event(Lu);X.dispatchEvent(de)}}}}},m.createElement("label",{"cmdk-label":"",htmlFor:P.inputId,id:P.labelId,style:B8},c),ec(e,M=>m.createElement(US.Provider,{value:k},m.createElement($S.Provider,{value:P},M))))}),N8=m.forwardRef((e,t)=>
vendor: 9,563 bytes, line 512
512{var n,r;let s=ln(),o=m.useRef(null),i=m.useContext(WS),l=ni(),c=qS(e),d=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:i==null?void 0:i.forceMount;Fs(()=>{if(!d)return l.item(s,i==null?void 0:i.id)},[d]);let u=GS(s,o,[e.value,e.children,o],e.keywords),f=Gh(),h=Gr(N=>N.value&&N.value===u.current),p=Gr(N=>d||l.filter()===!1?!0:N.search?N.filtered.items.get(s)>0:!0);m.useEffect(()=>{let N=o.current;if(!(!N||e.disabled))return N.addEventListener(Lu,y),()=>N.removeEventListener(Lu,y)},[p,e.onSelect,e.disabled]);function y(){var N,k;g(),(k=(N=c.current).onSelect)==null||k.call(N,u.current)}function g(){f.setState("value",u.current,!0)}if(!p)return null;let{disabled:x,value:v,onSelect:b,forceMount:w,keywords:_,...C}=e;return m.createElement(Ie.div,{ref:Es(o,t),...C,id:s,"cmdk-item":"",role:"option","aria-disabled":!!x,"aria-selected":!!h,"data-disabled":!!x,"data-selected":!!h,onPointerMove:x||l.getDisablePointerSelection()?void 0:g,onClick:x?void 0:y},e.children)}),P8=m.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:s,...o}=e,i=ln(),l=m.useRef(null),c=m.useRef(null),d=ln(),u=ni(),f=Gr(p=>s||u.filter()===!1?!0:p.search?p.filtered.groups.has(i):!0);Fs(()=>u.group(i),[]),GS(i,l,[e.value,e.heading,c]);let h=m.useMemo(()=>({id:i,forceMount:s}),[s]);return m.createElement(Ie.div,{ref:Es(l,t),...o,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},n&&m.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:d},n),ec(e,p=>m.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?d:void 0},m.createElement(WS.Provider,{value:h},p))))}),A8=m.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,s=m.useRef(null),o=Gr(i=>!i.search);return!n&&!o?null:m.createElement(Ie.div,{ref:Es(s,t),...r,"cmdk-separator":"",role:"separator"})}),T8=m.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,s=e.value!=null,o=Gh(),i=Gr(d=>d.search),l=Gr(d=>d.selectedItemId),c=ni();return m.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),m.createElement(Ie.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":l,id:c.inputId,type:"text",value:s?e.value:i,onChange:d=>{s||o.setState("search",d.target.value),n==null||n(d.target.value)}})}),I8=m.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...s}=e,o=m.useRef(null),i=m.useRef(null),l=Gr(d=>d.selectedItemId),c=ni();return m.useEffect(()=>{if(i.current&&o.current){let d=i.current,u=o.current,f,h=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let p=d.offsetHeight;u.style.setProperty("--cmdk-list-height",p.toFixed(1)+"px")})});return h.observe(d),()=>{cancelAnimationFrame(f),h.unobserve(d)}}},[]),m.createElement(Ie.div,{ref:Es(o,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:c.listId},ec(e,d=>m.createElement("div",{ref:Es(i,c.listInnerRef),"cmdk-list-sizer":""},d)))}),M8=m.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:o,container:i,...l}=e;return m.createElement(Lf,{open:n,onOpenChange:r},m.createElement(Ff,{container:i},m.createElement(Dl,{"cmdk-overlay":"",className:s}),m.createElement(Ol,{"aria-label":e.label,"cmdk-dialog":"",className:o},m.createElement(HS,{ref:t,...l}))))}),R8=m.forwardRef((e,t)=>Gr(n=>n.filtered.count===0)?m.createElement(Ie.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),D8=m.forwardRef((e,t)=>{let{progress:n,children:r,label:s="Loading...",...o}=e;return m.createElement(Ie.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},ec(e,i=>m.createElement("div",{"aria-hidden":!0},i)))}),fn=Object.assign(HS,{List:I8,Item:N8,Input:T8,Group:P8,Separator:A8,Dialog:M8,Empty:R8,Loading:D8});function O8(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function L8(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function qS(e){let t=m.useRef(e);return Fs(()=>{t.current=e}),t}var Fs=typeof window>"u"?m.useEffect:m.useLayoutEffect;function qs(e){let t=m.useRef();return t.current===void 0&&(t.current=e()),t}function Gr(e){let t=Gh(),n=()=>e(t.snapshot());return m.useSyncExternalStore(t.subscribe,n,n)}function GS(e,t,n,r=[]){let s=m.useRef(),o=ni();return Fs(()=>{var i;let l=(()=>{var d;for(let u of n){if(typeof u=="string")return u.trim();if(typeof u=="object"&&"current"in u)return u.current?(d=u.current.textContent)==null?void 0:d.trim():s.current}})(),c=r.map(d=>d.trim());o.value(e,l,c),(i=t.current)==null||i.setAttribute(Hs,l),s.current=l}),s}var F8=()=>{let[e,t]=m.useState(),n=qs(()=>new Map);return Fs(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,s)=>{n.current.set(r,s),t({})}};function z8(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function ec({asChild:e,children:t},n){return e&&m.isValidElement(t)?m.cloneElement(z8(t),{ref:t.ref},n(t.props.children)):n(t)}var B8={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const KS=m.forwardRef(({className:e,...t},n)=>a.jsx(fn,{ref:n,className:xe("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));KS.displayName=fn.displayName;const YS=m.forwardRef(({className:e,...t},n)=>a.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[a.jsx(aj,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),a.jsx(fn.Input,{ref:n,className:xe("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));YS.displayName=fn.Input.displayName;const XS=m.forwardRef(({className:e,...t},n)=>a.jsx(fn.List,{ref:n,className:xe("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));XS.displayName=fn.List.displayName;const ZS=m.forwardRef((e,t)=>a.jsx(fn.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));ZS.displayName=fn.Empty.displayName;const QS=m.forwardRef(({className:e,...t},n)=>a.jsx(fn.Group,{ref:n,className:xe("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));QS.displayName=fn.Group.displayName;const V8=m.forwardRef(({className:e,...t},n)=>a.jsx(fn.Separator,{ref:n,className:xe("-mx-1 h-px bg-border",e),...t}));V8.displayName=fn.Separator.displayName;const JS=m.forwardRef(({className:e,...t},n)=>a.jsx(fn.Item,{ref:n,className:xe("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",e),...t}));JS.displayName=fn.Item.displayName;var tc="Popover",[e2,mU]=Vn(tc,[Ma]),ri=Ma(),[$8,es]=e2(tc),t2=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:s,onOpenChange:o,modal:i=!1}=e,l=ri(t),c=m.useRef(null),[d,u]=m.useState(!1),[f,h]=As({prop:r,defaultProp:s??!1,onChange:o,caller:tc});return a.jsx(cf,{...l,children:a.jsx($8,{scope:t,contentId:ln(),triggerRef:c,open:f,onOpenChange:h,onOpenToggle:m.useCallback(()=>h(p=>!p),[h]),hasCustomAnchor:d,onCustomAnchorAdd:m.useCallback(()=>u(!0),[]),onCustomAnchorRemove:m.useCallback(()=>u(!1),[]),modal:i,children:n})})};t2.displayName=tc;var n2="PopoverAnchor",U8=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=es(n2,n),o=ri(n),{onCustomAnchorAdd:i,onCustomAnchorRemove:l}=s;return m.useEffect(()=>(i(),()=>l()),[i,l]),a.jsx(jl,{...o,...r,ref:t})});U8.displayName=n2;var r2="PopoverTrigger",s2=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=es(r2,n),o=ri(n),i=Ze(t,s.triggerRef),l=a.jsx(Ie.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":c2(s.open),...r,ref:i,onClick:ze(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:a.jsx(jl,{asChild:!0,...o,children:l})});s2.displayName=r2;var Kh="PopoverPortal",[W8,H8]=e2(Kh,{forceMount:void 0}),a2=e=>{const{__scopePopover:t,forceMount:n,children:r,container:s}=e,o=es(Kh,t);return a.jsx(W8,{scope:t,forceMount:n,children:a.jsx(Kr,{present:n||o.open,children:a.jsx(kl,{asChild:!0,container:s,children:r})})})};a2.displayName=Kh;var Pa="PopoverContent",o2=m.forwardRef((e,t)=>{const n=H8(Pa,e.__scopePopover),{forceMount:r=n.forceMount,...s}=e,o=es(Pa,e.__scopePopover);return a.jsx(Kr,{present:r||o.open,children:o.modal?a.jsx(G8,{...s,ref:t}):a.jsx(K8,{...s,ref:t})})});o2.displayName=Pa;var q8=Ns("PopoverContent.RemoveScroll"),G8=m.forwardRef((e,t)=>{const n=es(Pa,e.__scopePopover),r=m.useRef(null),s=Ze(t,r),o=m.useRef(!1);return m.useEffect(()=>{const i=r.current;if(i)return Mf(i)},[]),a.jsx(Ml,{as:q8,allowPinchZoom:!0,children:a.jsx(i2,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ze(e.onCloseAutoFocus,i=>{var l;i.preventDefault(),o.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:ze(e.onPointerDownOutside,i=>{const l=i.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;o.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:ze(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),K8=m.forwardRef((e,t)=>
512{const n=es(Pa,e.__scopePopover),r=m.useRef(!1),s=m.useRef(!1);return a.jsx(i2,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,o),o.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),o.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:o=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=o.target;((d=n.triggerRef.current)==null?void 0:d.contains(i))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),i2=m.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:i,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:u,...f}=e,h=es(Pa,n),p=ri(n);return If(),a.jsx(Tl,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:o,children:a.jsx(Uo,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:u,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>h.onOpenChange(!1),children:a.jsx(df,{"data-state":c2(h.open),role:"dialog",id:h.contentId,...p,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),l2="PopoverClose",Y8=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=es(l2,n);return a.jsx(Ie.button,{type:"button",...r,ref:t,onClick:ze(e.onClick,()=>s.onOpenChange(!1))})});Y8.displayName=l2;var X8="PopoverArrow",Z8=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=ri(n);return a.jsx(uf,{...s,...r,ref:t})});Z8.displayName=X8;function c2(e){return e?"open":"closed"}var Q8=t2,J8=s2,eB=a2,d2=o2;const tB=Q8,nB=J8,u2=m.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},s)=>a.jsx(eB,{children:a.jsx(d2,{ref:s,align:t,sideOffset:n,className:xe("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));u2.displayName=d2.displayName;function rB({models:e,value:t,onChange:n,isLoading:r,isError:s,disabled:o}){const{t:i}=Qe(["flowBuilder","common"]),[l,c]=m.useState(!1),d=e.find(u=>u.id===t);return a.jsxs("div",{className:"space-y-1",children:[a.jsxs(tB,{open:l,onOpenChange:c,children:[a.jsx(nB,{asChild:!0,children:a.jsxs(pe,{type:"button",variant:"outline",role:"combobox","aria-expanded":l,disabled:o,className:"w-full justify-between font-normal",children:[a.jsx("span",{className:"truncate text-left",children:t?(d==null?void 0:d.label)??t:i("openRouterModelPicker.selectPlaceholder")}),a.jsx(LC,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),a.jsx(u2,{className:"w-[--radix-popover-trigger-width] p-0",align:"start",children:a.jsxs(KS,{children:[a.jsx(YS,{placeholder:i("openRouterModelPicker.searchPlaceholder")}),a.jsxs(XS,{children:[a.jsx(ZS,{children:i(r?"openRouterModelPicker.loading":"openRouterModelPicker.noResults")}),a.jsx(QS,{children:e.map(u=>a.jsxs(JS,{value:`${u.label} ${u.id}`,onSelect:()=>{n(u.id),c(!1)},children:[a.jsx(Lr,{className:xe("mr-2 h-4 w-4 shrink-0",u.id===t?"opacity-100":"opacity-0")}),a.jsxs("span",{className:"flex min-w-0 flex-col",children:[a.jsx("span",{className:"truncate",children:u.label}),a.jsx("span",{className:"truncate text-xs text-muted-foreground",children:u.id})]})]},u.id))})]})]})})]}),r&&a.jsx("p",{className:"text-xs text-muted-foreground",children:i("openRouterModelPicker.loading")}),s&&a.jsx("p",{className:"text-xs text-muted-foreground",children:i("openRouterModelPicker.error")})]})}const sB={keyword:"triggerLabels.keyword",all:"triggerLabels.all",sale:"triggerLabels.sale",tag:"triggerLabels.tag",webhook:"triggerLabels.webhook"},aB=sB.sale;function Hi(e,t){const n=new Map;if(!e||e.length===0)return n;const r=new Map;for(const c of t||[])!(c!=null&&c.source)||!(c!=null&&c.target)||(r.has(c.source)||r.set(c.source,[]),r.get(c.source).push(c.target));const s=e.filter(c=>c.type==="start").map(c=>c.id);s.length===0&&e.length>0&&s.push(e[0].id);let o=1;const i=[...s],l=new Set;for(;i.length>0;){const c=i.shift();if(l.has(c))continue;l.add(c),n.set(c,o++);const d=r.get(c)||[];for(const u of d)l.has(u)||i.push(u)}for(const c of e)l.has(c.id)||n.set(c.id,o++);return n}function gU(e,t){return m.useMemo(()=>Hi(e,t),[e,t])}const Fu={pix:"BR",spei:"MX",cop_breb:"CO",cop_breb_llave:"CO",cop_pse:"CO",cop_nequi:"CO",mx_oxxo:"MX",mx_codi:"MX",pe_yape:"PE",pe_plin:"PE",pe_cash:"PE",pe_bank_transfer:"PE",ars_transfer:"AR",in_upi:"IN",ph_gcash:"PH",ph_maya:"PH"},Yh={BR:["pix"],MX:["spei","mx_oxxo","mx_codi"],CO:["cop_pse","cop_breb_llave","cop_breb","cop_nequi"],PE:["pe_yape","pe_plin","pe_cash","pe_bank_transfer"],AR:["ars_transfer"],IN:["in_upi"],PH:["ph_gcash","ph_maya"]},oB=Yh.PE,iB=Yh.PH;function Zx(e){return oB.includes(e)}function Qx(e){return iB.includes(e)}const lB={skalepay:500,pushinpay:50,sigilopay:99};function cB(e,t){return Math.max(lB[e]??0,dB[t])}const dB={pix:1,spei:2e3,cop_breb:1e6,cop_breb_llave:1e6,cop_pse:1e6,cop_nequi:1e6,mx_oxxo:2e3,mx_codi:2e3,pe_yape:1,pe_plin:1,pe_cash:1,pe_bank_transfer:1,ars_transfer:1,in_upi:2e4,ph_gcash:3e4,ph_maya:3e4},Jx={pix:"R$",spei:"MX$",cop_breb:"COP$",cop_breb_llave:"COP$",cop_pse:"COP$",cop_nequi:"COP$",mx_oxxo:"MX$",mx_codi:"MX$",pe_yape:"S/",pe_plin:"S/",pe_cash:"S/",pe_bank_transfer:"S/",ars_transfer:"AR$",in_upi:"₹",ph_gcash:"₱",ph_maya:"₱"},xU={pix:"🇧🇷 PIX",spei:"🇲🇽 SPEI",mx_oxxo:"🇲🇽 OXXO",mx_codi:"🇲🇽 CoDi",cop_pse:"🇨🇴 PSE",cop_breb:"🇨🇴 Bre-B",cop_breb_llave:"🇨🇴 Bre-B (link)",cop_nequi:"🇨🇴 Nequi",pe_yape:"🇵🇪 Yape",pe_plin:"🇵🇪 Plin",pe_cash:"🇵🇪 Efectivo",pe_bank_transfer:"🇵🇪 Transferencia",ars_transfer:"🇦🇷 CBU",in_upi:"🇮🇳 UPI",ph_gcash:"🇵🇭 GCash",ph_maya:"🇵🇭 Maya"},uB={pix:["none","qr","custom"],spei:["none","custom"],mx_oxxo:["none","voucher","custom"],mx_codi:["qr"],cop_breb:["none","qr","custom"],cop_pse:["none","custom"],cop_nequi:["none","custom"],cop_breb_llave:["none","custom"],pe_yape:["none","custom"],pe_plin:["none","custom"],pe_cash:["none","custom"],pe_bank_transfer:["none","custom"],ars_transfer:["none","custom"],in_upi:["none","custom"],ph_gcash:["none","custom"],ph_maya:["none","custom"]}
512,fB={pix:!0,spei:!0,cop_breb:!0,cop_breb_llave:!0,cop_pse:!0,cop_nequi:!0,mx_oxxo:!1,mx_codi:!0,pe_yape:!0,pe_plin:!0,pe_cash:!0,pe_bank_transfer:!0,ars_transfer:!0,in_upi:!0,ph_gcash:!0,ph_maya:!0};function nc(e,t){const n=String((e==null?void 0:e.method)??"").trim();if(Object.prototype.hasOwnProperty.call(Fu,n))return n;if(String((e==null?void 0:e.country)??"").trim().toUpperCase()==="MX"||t==="speiApi")return"spei";const r=Yh[String((e==null?void 0:e.country)??"").trim().toUpperCase()];return r&&r.length===1?r[0]:"pix"}function hB(e){const t=String(e??"").toUpperCase().replace(/[^0-9A-ZÑ&]/g,"");return t.length>=10&&t.length<=18}function f2(e){return String((e==null?void 0:e.caption)??"").trim()||String((e==null?void 0:e.text)??"").trim()}function zu(e){const t=String((e==null?void 0:e.copyButtonText)??"").trim();if(t)return t;const n=Array.isArray(e==null?void 0:e.choices)?e==null?void 0:e.choices:[];for(const r of n){const s=String(r??""),o=s.indexOf("|");if(o<0||!s.slice(o+1).startsWith("copy:"))continue;const i=s.slice(0,o).trim();if(i)return i}return""}function ev(e){return(e==null?void 0:e.sendCopyButton)!==!1}const Bu={pix:"Copiar código PIX",spei:"Copiar CLABE",cop_breb:"Copiar código QR",cop_breb_llave:"Pagar",cop_pse:"Pagar",cop_nequi:"Pagar con Nequi",mx_oxxo:"Copiar referencia",mx_codi:"Copiar código CoDi",pe_yape:"Pagar",pe_plin:"Pagar",pe_cash:"Pagar",pe_bank_transfer:"Copiar cuenta",ars_transfer:"Copiar CBU",in_upi:"Pagar",ph_gcash:"Pagar",ph_maya:"Pagar"},pB=["Copiar código UPI"];function vU(e,t){const n=Bu[e],r=String(t??"").trim();return r?r===n?r:new Set([...Object.values(Bu),...pB]).has(r)?n:r:n}const mB=["none","qr","custom","voucher"];function Vu(e,t){const n=uB[nc(e,t)],r=n.includes("qr")?"qr":n.includes("voucher")?"voucher":"none",s=l=>n.includes(l)?l:n.length===1?n[0]:r,o=String((e==null?void 0:e.imageMode)??"").trim();if(mB.includes(o))return s(o);const i=String((e==null?void 0:e.messageType)??"");return s(i==="imageText"||i==="imageTextButton"?String((e==null?void 0:e.mediaUrl)??"").trim()?"custom":"none":(e==null?void 0:e.sendQrImage)===!1?"none":"qr")}function gB(e,t){return h2(e)||e==="beehive"||e==="zenith"&&t==="pix"}const xB=["kairos","sigilopay"];function h2(e){return xB.includes(e)}function tv(e,t){const n=String((e==null?void 0:e.provider)??"").trim();if(gB(n,nc(e,t)))return!1;const r=o=>String((e==null?void 0:e[o])??"").trim(),s=["payerName","payerNameFallback","payerDocument","payerDocumentFallback","payerEmail","payerEmailFallback"].some(o=>r(o)!=="");return(e==null?void 0:e.autoPayerData)===!0||(e==null?void 0:e.autoPayerData)===void 0&&!s}function vB(e,t){return String((e==null?void 0:e.provider)??"").trim()!=="xpag"||nc(e,t)!=="spei"?!1:(e==null?void 0:e.openValue)===!0}function yU(e){return String((e==null?void 0:e.credentialId)??"").trim()===""}function yB(e){const t=e.replace(/[^\d.,-]/g,"").trim();if(!t)return NaN;const n=t.startsWith("-"),r=t.replace(/-/g,""),s=r.lastIndexOf(","),o=r.lastIndexOf(".");let i;if(s>=0&&o>=0){const c=s>o?",":".",d=c===","?".":",";i=r.split(d).join("").replace(c,".")}else if(s>=0)i=r.replace(/,/g,".");else if(o>=0){const c=r.split("."),d=c[c.length-1];i=c.length>1&&d.length===3&&c.slice(0,-1).every(f=>f.length>0&&f.length<=3)&&!(c.length===2&&c[0]==="0")?c.join(""):r}else i=r;const l=Number(i);return n?-l:l}const bU=[{label:"Copiar cuenta",action:"copy",valueTemplate:"{{accountNumber}}"},{label:"Copiar referencia",action:"copy",valueTemplate:"{{reference}}"}],nv="_zenithPeAvailableMethods",bB="_zenithPeCapabilitiesKnown",wU="_zenithPeCapabilityCredentialId",rv="_zenithPhAvailableMethods",_U="_zenithPhCapabilitiesKnown",SU="_zenithPhCapabilityCredentialId";function wB(e){return Array.isArray(e==null?void 0:e.paymentButtons)?e.paymentButtons.map(t=>{const n=t&&typeof t=="object"?t:{};return{label:String(n.label??""),action:n.action==="url"?"url":n.action==="copy"?"copy":n.action,valueTemplate:String(n.valueTemplate??"")}}):[]}const _B=["kiwify","zuckpay","kairos","xpag","zenith","nexuspag","skalepay","sigilopay","pushinpay","beehive"],CU=["zuckpay","xpag","zenith"],SB={zuckpay:["pix","spei"],k
512airos:["pix"],kiwify:["pix"],nexuspag:["pix"],sigilopay:["pix"],pushinpay:["pix"],beehive:["pix"],skalepay:["pix"],xpag:["pix","spei","mx_oxxo","cop_breb","cop_nequi","ars_transfer"],zenith:["spei","mx_oxxo","mx_codi","pix","cop_pse","cop_breb_llave","cop_nequi","pe_yape","pe_plin","pe_cash","pe_bank_transfer","in_upi","ph_gcash","ph_maya","ars_transfer"]};function CB(e,t){return(SB[e]??["pix"]).includes(t)}const jB={pix:!1,spei:!1,cop_breb:!1,cop_breb_llave:!1,cop_pse:!1,cop_nequi:!1,mx_oxxo:!1,mx_codi:!1,pe_yape:!1,pe_plin:!1,pe_cash:!1,pe_bank_transfer:!1,ars_transfer:!1,in_upi:!1,ph_gcash:!1,ph_maya:!1},kB=[];function p2(e,t){return jB[e]===!0&&kB.includes(t)}function sv(e,t){return fB[e]===!0&&!p2(e,t)}function EB(e){return e==="unofficial"||e==="telegram"}function av(e){return e==="instagram"||e==="messenger"}const NB={pix:!1,spei:!1,cop_breb:!1,cop_breb_llave:!0,cop_pse:!0,cop_nequi:!0,mx_oxxo:!1,mx_codi:!1,pe_yape:!0,pe_plin:!0,pe_cash:!0,pe_bank_transfer:!0,ars_transfer:!1,in_upi:!0,ph_gcash:!0,ph_maya:!0};function jU(e,t){return NB[e]===!0&&!p2(e,t)}const PB="{{telefone}}";function AB(e){const t=e==null?void 0:e.nequiPhone;return t==null?PB:String(t)}function TB(e){return String(e??"").replace(/\D/g,"").length===11}function IB(e){const t=String(e??"").replace(/\D/g,"");return t.length>=5&&t.length<=15}function MB(e){const t=String(e??"").replace(/\D/g,""),n=t.length===12&&t.startsWith("57")?t.slice(2):t;return n.length===10&&n.startsWith("3")}const RB="{{telefone}}";function DB(e){const t=e==null?void 0:e.phPhone;return t==null?RB:String(t)}function OB(e){const t=String(e??"").replace(/\D/g,""),n=t.length===12&&t.startsWith("63")?t.slice(2):t.length===11&&t.startsWith("0")?t.slice(1):t;return/^9\d{9}$/.test(n)}const LB=["zuckpay","kairos","sigilopay","zenith","skalepay"],FB=["zenith","nexuspag","pushinpay"];function zB(e,t){return t==="ars_transfer"?!1:e==="zenith"?t==="pix":!FB.includes(e)}function m2(e){const t=String(e??"").replace(/\D/g,"");if(t.length!==11||/^(\d)\1{10}$/.test(t))return!1;const n=(r,s)=>{let o=0;for(let l=0;l<r.length;l++)o+=Number(r[l])*(s-l);const i=o*10%11;return i===10?0:i};return n(t.slice(0,9),10)===Number(t[9])&&n(t.slice(0,10),11)===Number(t[10])}function BB(e){const t=String(e??"").replace(/\D/g,"");if(t.length!==14||/^(\d)\1{13}$/.test(t))return!1;const n=r=>{let s=r.length-7,o=0;for(let l=0;l<r.length;l++)o+=Number(r[l])*s,s=s-1<2?9:s-1;const i=o%11;return i<2?0:11-i};return n(t.slice(0,12))===Number(t[12])&&n(t.slice(0,13))===Number(t[13])}function VB(e){return m2(e)||BB(e)}const ov=6e4;function $B(e,t,n){const r=e??{},s=String(n??r.__flowChannel??"").trim(),o=v=>String(r[v]??"").trim(),i=[],l=o("provider"),c=nc(r,t),d=c==="spei",u=Fu[c]==="CO",f=Fu[c]==="AR",h=Zx(c),p=Qx(c);if(_B.includes(l)?CB(l,c)||i.push({field:"provider",message:f?Fe.t("flowBuilder:pixApiValidation.gatewayNoArgentina"):u?Fe.t("flowBuilder:pixApiValidation.gatewayNoColombia"):h?Fe.t("flowBuilder:pixApiValidation.gatewayNoPeru"):p?Fe.t("flowBuilder:pixApiValidation.gatewayNoPhilippines"):Fe.t("flowBuilder:pixApiValidation.gatewayNoMexico")}):i.push({field:"provider",message:Fe.t("flowBuilder:pixApiValidation.chooseGateway")}),h){const v=r[bB]===!0,b=Array.isArray(r[nv])?r[nv].filter(Zx):[];v?b.includes(c)||i.push({field:"method",message:Fe.t("flowBuilder:pixApiValidation.methodUnavailableForCredential")}):i.push({field:"credentialCapabilities",message:Fe.t("flowBuilder:pixApiValidation.revalidateZenithCredential")})}if(p){const v=Array.isArray(r[rv])?r[rv].filter(Qx):[];v.length>0&&!v.includes(c)&&i.push({field:"method",message:Fe.t("flowBuilder:pixApiValidation.methodUnavailableForCredentialPh")})}if(!vB(r,t)){const v=o("amount");if(!v)i.push({field:"amount",message:Fe.t("flowBuilder:pixApiValidation.enterAmount")});else if(!v.includes("{{")){const b=yB(v);if(!b||Number.isNaN(b)||b<=0)i.push({field:"amount",message:Fe.t("flowBuilder:pixApiValidation.invalidAmount",{amount:v})});else{const w=Math.round(b*100),_=cB(l,c);if(w<_){const C=(_/100).toFixed(2).replace(".",",");i.push({field:"amount",message:Fe.t("flowBuilder:pixApiValidation.belowMinimum",{symbol:Jx[c],min:C})})}else if(l==="skalepay"&&w>ov){const C=(ov/100).toFixed(2).replace(".",",");
512i.push({field:"amount",message:Fe.t("flowBuilder:pixApiValidation.aboveMaximum",{symbol:Jx[c],max:C})})}}}}if(!av(s)&&!f2(r)&&i.push({field:"caption",message:Fe.t("flowBuilder:pixApiValidation.writeMessage")}),av(s)&&Vu(r,t)==="none"&&sv(c,l)&&!ev(r)&&i.push({field:"sendCopyButton",message:Fe.t("flowBuilder:pixApiValidation.codeOrImageRequired")}),c!=="pe_bank_transfer"&&(!s||EB(s))&&sv(c,l)&&ev(r)&&!zu(r)&&i.push({field:"copyButtonText",message:Fe.t("flowBuilder:pixApiValidation.enterButtonText")}),c==="pe_bank_transfer"){const v=r.paymentButtons,b=wB(r);!Array.isArray(v)||b.length<1||b.length>3?i.push({field:"paymentButtons",message:Fe.t("flowBuilder:pixApiValidation.bankButtonsCount")}):b.forEach((w,_)=>{const C=w.label.trim(),N=w.valueTemplate.trim();(C.length<1||C.length>20)&&i.push({field:"paymentButtons",message:Fe.t("flowBuilder:pixApiValidation.bankButtonLabel",{number:_+1})}),w.action!=="copy"&&w.action!=="url"&&i.push({field:"paymentButtons",message:Fe.t("flowBuilder:pixApiValidation.bankButtonAction",{number:_+1})}),N?w.action==="url"&&!N.includes("{{")&&!/^https?:\/\//i.test(N)&&i.push({field:"paymentButtons",message:Fe.t("flowBuilder:pixApiValidation.bankButtonUrl",{number:_+1})}):i.push({field:"paymentButtons",message:Fe.t("flowBuilder:pixApiValidation.bankButtonValue",{number:_+1})})})}Vu(r,t)==="custom"&&!o("mediaUrl")&&i.push({field:"mediaUrl",message:Fe.t("flowBuilder:pixApiValidation.chooseCustomImage")});const y=(v,b)=>o(v)!==""||o(b)!=="",g=l==="zenith"&&c==="pix",x=l==="skalepay";if(h2(l)||l==="beehive"||g){if(y("payerName","payerNameFallback")||i.push({field:"payerName",message:Fe.t("flowBuilder:pixApiValidation.enterPayerName")}),!y("payerDocument","payerDocumentFallback"))i.push({field:"payerDocument",message:Fe.t("flowBuilder:pixApiValidation.enterPayerCpf")});else if(g){const v=o("payerDocument")||o("payerDocumentFallback");v&&!v.includes("{{")&&!m2(v)&&i.push({field:"payerDocument",message:Fe.t("flowBuilder:pixApiValidation.invalidPayerCpf")}
512)}!g&&!y("payerEmail","payerEmailFallback")&&i.push({field:"payerEmail",message:Fe.t("flowBuilder:pixApiValidation.enterPayerEmail")})}else if(x){const v=o("payerDocument")||o("payerDocumentFallback");v?!v.includes("{{")&&!VB(v)&&i.push({field:"payerDocument",message:Fe.t("flowBuilder:pixApiValidation.invalidPayerCpf")}):i.push({field:"payerDocument",message:Fe.t("flowBuilder:pixApiValidation.enterPayerCpf")}),!tv(r,t)&&!y("payerEmail","payerEmailFallback")&&i.push({field:"payerEmail",message:Fe.t("flowBuilder:pixApiValidation.enterPayerEmail")})}else if(!tv(r,t)){const v=o("payerDocument")||o("payerDocumentFallback"),b=zB(l,c);!v&&b?i.push({field:"payerDocument",message:d?Fe.t("flowBuilder:pixApiValidation.enterPayerRfcCurp"):Fe.t("flowBuilder:pixApiValidation.enterPayerCpf")}):v&&d&&b&&!v.includes("{{")&&!hB(v)?i.push({field:"payerDocument",message:Fe.t("flowBuilder:pixApiValidation.invalidRfcCurp")}):f&&v&&!v.includes("{{")&&!TB(v)?i.push({field:"payerDocument",message:Fe.t("flowBuilder:pixApiValidation.invalidArDocument")}):u&&!v.includes("{{")&&!IB(v)&&i.push({field:"payerDocument",message:Fe.t("flowBuilder:pixApiValidation.invalidCoDocument")}),(u||LB.includes(l))&&!y("payerEmail","payerEmailFallback")&&i.push({field:"payerEmail",message:Fe.t("flowBuilder:pixApiValidation.enterPayerEmail")})}if(c==="cop_nequi"){const v=AB(r).trim();v?!v.includes("{{")&&!MB(v)&&i.push({field:"nequiPhone",message:Fe.t("flowBuilder:pixApiValidation.invalidNequiPhone")}):i.push({field:"nequiPhone",message:Fe.t("flowBuilder:pixApiValidation.enterNequiPhone")})}if(p){const v=DB(r).trim();v?!v.includes("{{")&&!OB(v)&&i.push({field:"phPhone",message:Fe.t("flowBuilder:pixApiValidation.invalidPhPhone")}):i.push({field:"phPhone",message:Fe.t("flowBuilder:pixApiValidation.enterPhPhone")})}return i}const UB=[["Para completar tu pago, abre la app de tu banco y transfiere a esta llave Bre-B:","","{{cop_llave}}","","Monto a enviar: COP$ {{cop_valor}}","","Escribe tú mismo el monto — la llave no lo lleva guardado."].join(`
513`),["Ya enviamos el cobro a tu app Nequi. Ábrela y confirma el pago de COP$ {{cop_valor}}.","","Si no te llegó la notificación, entra a Nequi de todos modos: el cobro queda pendiente ahí."].join(`
514`),["Ya enviamos el cobro a tu app Nequi. Ábrela y confirma el pago de COP$ {{cop_valor}}.","","Si no te llegó la notificación, toca el botón de abajo."].join(`
515`)];function Xh(e,t){return t==="zenith"&&(e==="cop_breb_llave"||e==="cop_nequi")}function WB(e){return[e==="cop_nequi"?"Para completar tu pago con Nequi, abre el enlace:":"Para completar tu pago con Bre-B, abre el enlace:","{{cop_link}}","","Monto: COP$ {{cop_valor}}"].join(`
516`)}function HB(e,t,n){return Xh(t,n)?!e.trim()||UB.includes(e.trim())?WB(t):e.replace(/\{\{\s*cop_llave\s*\}\}/g,"{{cop_link}}"):e}function qB(e,t,n){return Xh(t,n)&&(!e.trim()||e.trim()==="Copiar llave")?t==="cop_nequi"?"Pagar con Nequi":"Pagar":e}const kU=["Para concluir, faça uma transferência SPEI:","","CLABE: {{spei_clabe}}","Valor: MX$ {{spei_valor}}","","Transfira o valor EXATO — valores diferentes não são confirmados automaticamente."].join(`
517`),GB=["Para completar tu pago, haz una transferencia SPEI:","","CLABE: {{spei_clabe}}","Monto: MX$ {{spei_valor}}","","Transfiere el monto EXACTO — otros valores no se confirman automáticamente."].join(`
518`);function KB(e){var n,r;if((e==null?void 0:e.type)==="pixApi"&&Xh(String((n=e.data)==null?void 0:n.method),String((r=e.data)==null?void 0:r.provider))){const s=e.data??{},o=String(s.method),i=String(s.provider),l=HB(String(s.caption||s.text||""),o,i),c=qB(zu(s),o,i);return s.caption===l&&s.copyButtonText===c?e:{...e,data:{...s,caption:l,copyButtonText:c}}}if((e==null?void 0:e.type)!=="speiApi")return e;const t=e.data??{};return{...e,data:{...t,country:"MX",method:"spei",caption:f2(t)||GB,copyButtonText:zu(t)||Bu.spei,imageMode:Vu(t,e.type),sendQrImage:!1}}}function YB(e){if(!Array.isArray(e))return e;const t=e.map(KB);return t.some((n,r)=>n!==e[r])?t:e}const ge={status:"ok"};function Se(e){return{status:"refuse",reason:e}}function uo(e,t){return{status:"degrade",reason:e,strategy:t}}const XB="canal reativo: cold_outreach / open_conversation / broadcast não são suportados (PLATFORM_NOT_SUPPORTED)",bn=Se(XB),ZB={unofficial:{text:ge,media:ge,quick_replies:Se("pastilha de resposta rápida é da Meta (Instagram/Messenger); no WhatsApp a opção fica fixa na conversa (buttons)"),buttons:ge,list:ge,cta_url:ge,carousel:ge,reaction_send:ge,official_template:Se("template aprovado é da API Oficial da Meta; no WhatsApp não oficial não existe"),edit_message:Se("editar mensagem enviada não existe no UAZAPI"),poll:ge,sticker:ge,pix:ge,call:ge,contact:ge,whatsapp_label:ge,broadcast:ge,cold_outreach:ge,open_conversation:ge,card:ge,button_url:ge,button_phone:Se("botão de ligação não existe no WhatsApp não-oficial"),button_copy:ge,button_webapp:Se("o WhatsApp não tem Mini App; o botão abriria no navegador, que já é o botão de link"),view_once:ge,video_format:ge,forwarded:ge,voice_note:ge},official:{text:ge,media:ge,quick_replies:Se("pastilha de resposta rápida é da Meta (Instagram/Messenger); no WhatsApp a opção fica fixa na conversa (buttons)"),buttons:ge,list:ge,cta_url:ge,carousel:ge,reaction_send:ge,official_template:ge,edit_message:Se("Cloud API WhatsApp não expõe edição de mensagem enviada"),poll:Se("enquete é recurso do WhatsApp pessoal, não existe na Cloud API"),sticker:Se("figurinha não existe no envio da API oficial (só no recebimento)"),pix:Se("botão de PIX nativo é recurso do aplicativo WhatsApp, não da Cloud API"),call:Se("ligação exige WhatsApp Business Calling habilitado no número"),contact:ge,whatsapp_label:Se("etiqueta nativa é do WhatsApp Business app, não da Cloud API"),broadcast:ge,cold_outreach:ge,open_conversation:ge,card:ge,button_url:ge,button_phone:Se("a Cloud API ignora botão de telefone (só o Messenger tem)"),button_copy:Se("copy-code existe na Cloud API só dentro de template aprovado, não em mensagem de sessão"),button_webapp:Se("o WhatsApp não tem Mini App; o botão abriria no navegador, que já é o botão de link"),view_once:Se("visualização única não existe na API oficial"),video_format:Se("vídeo redondo (ptv) e autoplay não existem na API oficial"),forwarded:Se("marcar como encaminhado não existe na API oficial"),voice_note:ge},instagram:{text:ge,media:ge,quick_replies:ge,buttons:ge,list:uo("lista nativa não existe no Instagram DM","flatten_to_quick_replies_or_text"),cta_url:ge,carousel:ge,reaction_send:ge,official_template:Se("template aprovado não existe no Instagram; fora da janela o caminho é a etiqueta de mensagem"),edit_message:Se("Instagram DM não permite editar mensagem enviada"),poll:Se("enquete não existe no Instagram DM"),sticker:Se("figurinha WhatsApp não existe no Instagram DM"),pix:Se("PIX nativo é exclusivo do WhatsApp app"),call:Se("ligação WhatsApp não existe no Instagram DM"),contact:Se("vCard WhatsApp não existe no Instagram DM"),whatsapp_label:Se("etiqueta WhatsApp não existe no Instagram DM"),broadcast:bn,cold_outreach:bn,open_conversation:bn,card:ge,button_url:ge,button_phone:Se("botão de telefone é exclusivo do Messenger"),button_copy:Se("botão de copiar não existe no Instagram"),button_webapp:Se("Mini App é recurso do Telegram; no Instagram use o botão de link"),view_once:Se("visualização única não existe no Instagram"),video_format:Se("vídeo redondo e autoplay não existem no Instagram"),forwarded:Se("marcar como encaminhado não existe no Instagram"),voice_note:Se("nota de voz não existe; o Instagram recusa MP3 e OGG")},messenger:{text:ge,media:ge,quick_replies:ge,buttons:ge,list:uo("lista nativa não existe no Messenger","flatten_to_quick_replies_or_text"),cta_url:ge,carousel:ge,reaction_send:ge,official_template:Se("template aprovado não existe no Messenger; fora da janela o caminho é a etiqueta de mensagem"),edit_message:Se("Messenger não permite editar mensagem enviada"),poll:Se("enquete não existe no Messenger"),sticker:Se("figurinha WhatsApp não existe no Messenger"),pix:Se("PIX nativo é exclusivo do WhatsApp app"),call:Se("ligação WhatsApp não existe no Messenger"),contact:Se("vCard WhatsApp não existe no Messenger"),whatsapp_label:Se("etiqueta WhatsApp não existe no Messenger"),broadcast:bn,cold_outreach:bn,open_conversation:bn,card:ge,button_url:ge,button_phone:ge,button_copy:Se("botão de copiar não existe no Messenger"),button_webapp:Se("Mini App é recurso do Telegram; no Messenger use o botão de link"),view_once:Se("visualização única não existe no Messenger"),video_format:Se("vídeo redondo e autoplay não existem no Messenger"),forwarded:Se("marcar como encaminhado não existe no Messenger"),voice_note:Se("nota de voz não existe no Messenger")},telegram:{text:ge,media:ge,quick_replies:Se("o Telegram usa teclado inline (buttons), não quick replies"),buttons:ge,list:uo("lista nativa estilo WhatsApp não existe no Telegram","flatten_to_inline_keyboard_or_text"),cta_url:ge,carousel:ge,reaction_send:ge,official_template:Se("template aprovado é da Meta; o Telegram não tem equivalente"),edit_message:ge,poll:uo("enquete Telegram não mapeia 1:1 ao bloco poll do editor","refuse_or_text"),sticker:ge,pix:Se("PIX nativo é exclusivo do WhatsApp app"),call:Se("ligação WhatsApp não existe no Telegram"),contact:Se("vCard WhatsApp não é mapeado para Telegram neste Run"),whatsapp_label:Se("etiqueta WhatsApp não existe no Telegram"),broadcast:bn,cold_outreach:bn,open_conversation:bn,card:ge,button_url:ge,button_phone:Se("a Bot API não tem botão de ligação"),button_copy:ge,button_webapp:ge,view_once:Se("visualização única não existe na Bot API"),video_format:Se("vídeo redondo e autoplay não existem na Bot API"),forwarded:Se("marcar como encaminhado não existe no envio da Bot API"),voice_note:ge}},QB={text:ge,media:ge,quick_replies:Se("o Telegram usa teclado inline (buttons), não quick replies"),buttons:ge,list:uo("lista nativa não existe na Bot API","flatten_to_inline_keyboard"),
518cta_url:ge,carousel:ge,reaction_send:ge,official_template:Se("template aprovado é da Meta; o Telegram não tem equivalente"),edit_message:Se("edição ainda não está implementada no Telegram direto"),poll:Se("enquete ainda não está implementada no Telegram direto"),sticker:ge,pix:Se("bloco PIX pode gerar mídia e não é compatível com o Telegram direto S1"),call:Se("ligação WhatsApp não existe no Telegram"),contact:Se("contato/vCard ainda não está implementado no Telegram direto"),whatsapp_label:Se("etiqueta WhatsApp não existe no Telegram"),broadcast:bn,cold_outreach:bn,open_conversation:bn,card:ge,button_url:ge,button_phone:Se("a Bot API não tem botão de ligação"),button_copy:ge,button_webapp:ge,view_once:Se("visualização única não existe na Bot API"),video_format:Se("vídeo redondo e autoplay não existem na Bot API"),forwarded:Se("marcar como encaminhado não existe no envio da Bot API"),voice_note:ge},JB=new Set(["instagram","messenger","telegram"]);function eV(e){return JB.has(e)}function jn(e,t,n){var i;const r=((i=ZB[e])==null?void 0:i[t])??ge,s=g2(n);if(e!=="telegram"||!s.includes("telegram_direct"))return r;const o=QB[t]??r;return o.status==="refuse"||r.status==="refuse"?o.status==="refuse"?o:r:o.status==="degrade"||r.status==="degrade"?o.status==="degrade"?o:r:ge}function EU(e,t,n){return jn(e,t,n).status!=="refuse"}function g2(e){const t=Array.isArray(e)?e:[e];return[...new Set(t.filter(n=>typeof n=="string"&&n.trim().length>0).map(n=>n.trim().toLowerCase()))]}const x2={text:"text",aiText:"text",image:"media",video:"media",audio:"media",audioAI:"media",document:"media",iaGenerator:"media",pixApi:"media",pixApi__xpag:"media",pixApi__zenith:"media",speiApi:"media",interactiveBlock:"buttons",carousel:"carousel",sticker:"sticker",sendPixKey:"pix",sendCharge:"pix",call:"call",contact:"contact",whatsappLabel:"whatsapp_label",menu:"buttons",officialTemplate:"official_template"};function Zh(e,t,n){var o,i,l;const r=String(t.type??"");if(r==="waitInput"&&((o=t.data)==null?void 0:o.captureImage)===!0&&e==="telegram"&&g2(n).includes("telegram_direct"))return Se("Telegram direto S1 ainda não captura a mídia recebida no bloco Aguardar resposta");const s=x2[r];return s?jn(e,s,n):r==="aiResponder"&&((i=t.data)==null?void 0:i.enableAudioResponse)===!0?jn(e,"media",n):r==="notifyAdmin"&&typeof((l=t.data)==null?void 0:l.notificationType)=="string"&&t.data.notificationType!==""&&t.data.notificationType!=="push"&&t.data.notificationType!=="telegram"?e==="unofficial"?ge:Se("notificação administrativa por WhatsApp usa o sender UAZAPI; neste canal use Push"):ge}function tV(e,t){const n=new Set;for(const[r,s]of Object.entries(x2))s&&jn(e,s,t).status==="refuse"&&n.add(r);return e!=="unofficial"&&(n.add("menu"),n.add("speiApi")),n}function nV(e,t,n){const r=[],s=(o,i)=>{o.forEach((l,c)=>{var y,g,x,v;const d=String(l.type??"unknown"),u=Zh(t,l,n),f=Hh([l],t);f&&r.push({id:String(l.id??`${i}-${c}`),type:d,reason:f,path:i}),u.status==="refuse"&&r.push({id:String(l.id??`${i}-${c}`),type:d,reason:u.reason,path:i});const h=(y=l.data)==null?void 0:y.knowledgeBaseFlows;Array.isArray(h)&&h.forEach((b,w)=>{if(!b||typeof b!="object")return;const _=b;if(_.isActive===!1||!Array.isArray(_.nodes))return;const C=typeof _.name=="string"&&_.name.trim()?_.name.trim():`mini-fluxo ${w+1}`;s(_.nodes,`${i} > ${C}`)});const p=(g=l.data)==null?void 0:g.followUpMiniFlow;if(((x=l.data)==null?void 0:x.followUpEnabled)===!0&&((v=l.data)==null?void 0:v.followUpMode)==="miniFlow"&&p&&typeof p=="object"){const b=p;Array.isArray(b.nodes)&&s(b.nodes,`${i} > follow-up`)}})};return s(e,"fluxo principal"),r}function rV(e,t,n){return jn(e,t==="list"?"list":t==="quickReply"?"quick_replies":"buttons",n).status==="refuse"?0:e==="unofficial"?t==="list"?10:t==="button"||t==="imageButton"?5:3:e==="official"?t==="list"?10:3:t==="list"||t==="button"||t==="imageButton"||t==="quickReply"?13:3}function sV(e){return e==="unofficial"||e==="official"||e==="instagram"||e==="messenger"||e==="telegram"}function NU(e){return sV(e)?e:"unofficial"}const aV=20,oV=64;function iV(e){return e==="telegram"?oV:aV}
518const PU=80,AU=3,TU=10,lV="btn-";function IU(e){return`${lV}${e.id}`}function rc(e){const t=String(e??"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return t?t.slice(0,32):`b${Math.random().toString(36).slice(2,10)}`}function cV(e,t){const n=String(e??"").trim();if(n.startsWith("[")&&n.endsWith("]"))return{kind:"section",title:n.slice(1,-1).trim()};const r=n.split("|"),s=(r[0]??"").trim(),o=(r[1]??"").trim(),i=(r[2]??"").trim(),l=rc(o||s||`choice-${t}`);return o.startsWith("http://")||o.startsWith("https://")?{id:l,title:s,action:"url",url:o,description:i||void 0}:o.startsWith("url:")?{id:l,title:s,action:"url",url:o.slice(4).trim(),description:i||void 0}:o.startsWith("webapp:")?{id:l,title:s,action:"webapp",url:o.slice(7).trim(),description:i||void 0}:o.startsWith("copy:")?{id:l,title:s,action:"copy",copyValue:o.slice(5).trim(),description:i||void 0}:o.startsWith("tel:")?{id:l,title:s,action:"phone",phone:o.slice(4).trim(),description:i||void 0}:{id:l,title:s,action:"reply",description:i||void 0}}function v2(e){return e.kind==="section"}function MU(e,t){const n=String((e==null?void 0:e.text)??"").trim(),r=String((e==null?void 0:e.type)??"REPLY").toUpperCase(),s=rc((e==null?void 0:e.id)||n||`btn-${t}`);return r==="URL"?{id:s,title:n,action:"url",url:String((e==null?void 0:e.url)??"").trim()}:{id:s,title:n,action:"reply"}}function dV(e){const t=e==null?void 0:e.buttons;if(Array.isArray(t)&&t.length>0&&uV(t))return t;const n=e==null?void 0:e.choices;return Array.isArray(n)?n.map((r,s)=>cV(String(r??""),s)):[]}function uV(e){return e.every(t=>!t||typeof t!="object"?!1:t.kind==="section"?!0:typeof t.action=="string")}function fV(e){if(v2(e))return`[${e.title}]`;const t=e.title.trim();return e.action==="url"?`${t}|${(e.url??"").trim()}`:e.action==="webapp"?`${t}|webapp:${(e.url??"").trim()}`:e.action==="copy"?`${t}|copy:${(e.copyValue??"").trim()}`:e.action==="phone"?`${t}|tel:${(e.phone??"").trim()}`:e.description?`${t}|${e.id}|${e.description}`:t}function RU(e){const t=String(e??"").trim();return t.startsWith("[")&&t.endsWith("]")}function y2(e){const t=new Set;return e.map((n,r)=>{let s=n.id||rc(n.title||`b${r}`);return t.has(s)&&(s=`${s}-${r}`),t.add(s),s===n.id?n:{...n,id:s}})}function hV(e){const t=dV(e).map((n,r)=>v2(n)?{id:rc(`secao-${r}-${n.title}`),title:`[${n.title}]`,action:"reply"}:n);return y2(t)}function pV(e){const t=y2(e);return{buttons:t,choices:t.map(fV)}}const iv="fluxo principal",mV=new Set(["default","a","source",""]);function gV(e){return e==null||mV.has(String(e))}function $u(e){const t=e.data??{};for(const n of["label","title","name"]){const r=t[n];if(typeof r=="string"&&r.trim())return r.trim()}return e.type}const xV=new Set(["schedule","sale","pix_detected"]);function b2(e){return`${e.source}|${e.sourceHandle??""}|${e.target}`}function vV(e,t){let n=e.map(s=>({...s}));for(const s of t){const o=n.filter(d=>d.target===s),i=n.filter(d=>d.source===s&&gV(d.sourceHandle)),l=n.filter(d=>d.source!==s&&d.target!==s),c=[];for(const d of o)for(const u of i)d.source!==u.target&&c.push({...d,id:`e-${d.source}-${d.sourceHandle??"d"}-${u.target}`,target:u.target});n=[...l,...c]}const r=new Set;return n.filter(s=>{const o=b2(s);return r.has(o)?!1:(r.add(o),!0)})}function Wt(e,t,n,r){e.changes.push({kind:n,nodeId:t.id,nodeType:t.type,label:$u(t),reason:r,path:e.path})}function to(e,t){return`${e}::btn-${t}`}function yV(e,t,n){const r=hV(e.data);if(r.length===0)return null;const s=jn(t.to,"button_url",t.providers).status==="ok",o=jn(t.to,"button_phone",t.providers).status==="ok",i=jn(t.to,"button_copy",t.providers).status==="ok",l=jn(t.to,"button_webapp",t.providers).status==="ok",c=iV(t.to),d=[];for(const f of r){let h=f;if(h.action==="webapp"&&!l)if(s&&String(h.url??"").trim())h={...h,action:"url"},Wt(t,e,"adapted",`botão "${h.title}": Mini App vira botão de link (o site abre no navegador, não dentro do app)`);else{t.handlesMortos.add(to(e.id,h.id)),Wt(t,e,"removed",`botão "${h.title}": Mini App só existe no Telegram e este canal não tem botão de link`);continue}if(h.action==="url"&&!s){t.handlesMortos.add(to(e.id,h.id)),Wt(t,e,"removed",`botão "${h.title}": botão de link não existe neste canal (o endereço era ${h.url??"—"})`);continue}if(h.action==="phone"&&!o){t.handlesMortos.add(to(e.id,h.id)),Wt(t,e,"removed",`botão "${h.title}": botão de ligação não existe neste canal (o número era ${h.phone??"—"})`);continue}if(h.action==="copy"&&!i){t.handlesMortos.add(to(e.id,h.id)),Wt(t,e,"removed",`botão "${h.title}": botão de copiar não existe neste canal (o valor era ${h.copyValue??"—"})`);continue}h.title.length>c&&Wt(t,e,"warning",`botão "${h.title}": o rótulo passa de ${c} caracteres e o canal corta no envio`),h.iconUrl&&!["instagram","messenger"].includes(t.to)&&(h={...h,iconUrl:void 0}),d.push(h)}const u=rV(t.to,n,t.providers);if(u>0&&d.length>u){for(const f of d.slice(u))t.handlesMortos.add(to(e.id,f.id)),Wt(t,e,"removed",`botão "${f.title}": o canal aceita no máximo ${u} opções neste bloco`);d.length=u}return r.forEach((f,h)=>{t.handlesRenomeados.set(`${e.id}::choice-${h}`,`btn-${f.id}`),d.some(p=>p.id===f.id)||t.handlesMortos.add(`${e.id}::choice-${h}`)}),d}function bV(e,t){var o;const n=(o=e.data)==null?void 0:o.cards;if(!Array.isArray(n)||n.length===0||!["instagram","messenger"].includes(t.to))return null;let r=n.map(i=>i&&typeof i=="object"?{...i}:i);const s=i=>{const l=i==null?void 0:i.buttons;return Array.isArray(l)?l:[]};return r.length>
51810&&(r.slice(10).forEach((i,l)=>{s(i).forEach((c,d)=>{t.handlesMortos.add(`${e.id}::card-${10+l}-btn-${d}`)})}),Wt(t,e,"removed",`galeria: ${r.length} cartões viram 10 (teto da Meta)`),r=r.slice(0,10)),r.forEach((i,l)=>{if(!i||typeof i!="object")return;const c=i,d=String(c.title||c.subtitle||c.text||"").trim();d&&d.length>80?(c.title=d.slice(0,80),Wt(t,e,"adapted",`cartão ${l+1}: título cortado em 80 caracteres`)):d&&!c.title&&(c.title=d);const u=[];s(c).forEach((f,h)=>{const p=`${e.id}::card-${l}-btn-${h}`,y=String((f==null?void 0:f.action)??(f==null?void 0:f.type)??"reply").toLowerCase(),g=String((f==null?void 0:f.title)??(f==null?void 0:f.text)??"");if(y!=="reply"&&y!=="url"){t.handlesMortos.add(p),Wt(t,e,"removed",`cartão ${l+1}: botão "${g}" usa uma ação que o cartão da Meta não aceita`);return}if(u.length>=3){t.handlesMortos.add(p),Wt(t,e,"removed",`cartão ${l+1}: botão "${g}" não cabe — o cartão da Meta aceita 3`);return}t.handlesRenomeados.set(p,`card-${l}-btn-${u.length}`),u.push(f)}),c.buttons=u}),r}const wV=[{campo:"voiceNote",capability:"voice_note",motivo:"nota de voz não existe neste canal; o áudio vai como arquivo",ligado:e=>e===!0,desligado:void 0},{campo:"viewOnce",capability:"view_once",motivo:"visualização única não existe neste canal; a mídia fica na conversa",ligado:e=>e===!0,desligado:void 0},{campo:"sendAsForwarded",capability:"forwarded",motivo:"marcar como encaminhado não existe neste canal",ligado:e=>e===!0,desligado:void 0},{campo:"videoFormat",capability:"video_format",motivo:"vídeo redondo e autoplay não existem neste canal; o vídeo vai no formato comum",ligado:e=>e==="ptv"||e==="videoplay",desligado:void 0}];function _V(e,t){const n={...e.data??{}};let r=!1;for(const c of wV)c.ligado(n[c.campo])&&jn(t.to,c.capability,t.providers).status!=="ok"&&(n[c.campo]=c.desligado,Wt(t,e,"adapted",c.motivo),r=!0);const s=typeof n.interactionType=="string"?n.interactionType:"";let o=s||"button";s==="quickReply"&&jn(t.to,"quick_replies",t.providers).status!=="ok"&&(o="button",n.interactionType="button",Wt(t,e,"adapted","resposta rápida vira botão fixo (a pastilha só existe no Instagram e no Messenger)"),r=!0),s==="list"&&jn(t.to,"list",t.providers).status!=="ok"&&(o="button",n.interactionType="button",Wt(t,e,"adapted","lista vira botões (lista nativa só existe no WhatsApp)"),r=!0),e.type==="notifyAdmin"&&typeof n.notificationType=="string"&&n.notificationType!==""&&n.notificationType!=="push"&&n.notificationType!=="telegram"&&t.to!=="unofficial"&&(n.notificationType="push",Wt(t,e,"adapted","aviso por WhatsApp vira notificação push (o envio para outro destinatário é do UAZAPI)"),r=!0),e.type==="waitInput"&&n.captureImage===!0&&Zh(t.to,{id:e.id,type:e.type,data:n},t.providers).status==="refuse"&&(n.captureImage=!1,Wt(t,e,"adapted","a captura de imagem sai do bloco: este canal ainda não baixa a mídia recebida"),r=!0);const i=yV(e,t,o);if(i){const c=JSON.stringify(n.buttons??null);Object.assign(n,pV(i)),JSON.stringify(n.buttons??null)!==c&&(r=!0)}const l=bV(e,t);return l&&(n.cards=l,r=!0),r?n:e.data??{}}function lv(e,t){return{...e,path:t,handlesMortos:new Set,handlesRenomeados:new Map}}function SV(e,t,n){let r=e;const s=e.knowledgeBaseFlows;if(Array.isArray(s)){const i=s.map((l,c)=>{if(!l||typeof l!="object")return l;const d=l;if(!Array.isArray(d.nodes))return l;const u=typeof d.name=="string"&&d.name.trim()?d.name.trim():`mini-fluxo ${c+1}`,f=Uu(d.nodes,Array.isArray(d.edges)?d.edges:[],lv(t,`${n} > ${u}`));return{...d,nodes:f.nodes,edges:f.edges}});r={...r,knowledgeBaseFlows:i}}const o=e.followUpMiniFlow;if(o&&typeof o=="object"&&Array.isArray(o.nodes)){const i=o,l=Uu(i.nodes,Array.isArray(i.edges)?i.edges:[],lv(t,`${n} > follow-up`));r={...r,followUpMiniFlow:{...i,nodes:l.nodes,edges:l.edges}}}return r}function Uu(e,t,n){const r=tV(n.to,n.providers),s=new Set,o=[];for(const u of e){const f=Zh(n.to,{id:u.id,type:u.type,data:u.data},n.providers),h=u.type==="waitInput"||u.type==="notifyAdmin";if(f.status==="refuse"&&!h||r.has(u.type)){s.add(u.id);const y=f.status==="refuse"?f.reason:`o bloco ${u.type} não existe neste canal`;n.changes.push({kind:"removed",nodeId:u.id,nodeType:u.type,label:$u(u),reason:y,path:n.path});continue}let p=_V(u,n);p=SV(p,n,$u(u)),o.push({...u,data:p})}const l=vV(t,s).filter(u=>!n.handlesMortos.has(`${u.source}::${u.sourceHandle??""}`)).map(u=>{const f=n.handlesRenomeados.get(`${u.source}::${u.sourceHandle??""}`);return f&&f!==u.sourceHandle?{...u,sourceHandle:f}:u}),c=new Set,d=l.filter(u=>{const f=b2(u);return c.has(f)?!1:(c.add(f),!0)});return{nodes:o,edges:d}}function CV(e){const{nodes:t,edges:n,from:r,to:s,providers:o,triggerType:i}=e;if(r===s)return{nodes:[...t],edges:[...n],changes:[],blockers:["O fluxo já está neste canal."]};const l=[],d=Uu(t,n,{to:s,providers:o,path:iv,changes:l,handlesMortos:new Set,handlesRenomeados:new Map});i&&xV.has(i)&&eV(s)&&l.push({kind:"warning",nodeId:"",nodeType:"trigger",label:`gatilho "${i}"`,reason:"este canal só responde a quem falou primeiro; um gatilho que abre a conversa não dispara aqui. Troque o gatilho depois de converter.",path:iv});const u=[],f=Hh(d.nodes,s);f&&u.push(f);const h=FS(d.nodes,d.edges,s)[0];return h&&u.push(h.message),{nodes:d.nodes,edges:d.edges,changes:l,blockers:u}}function jV(e){return e.reduce((t,n)=>({...t,[n.kind]:t[n.kind]+1}),{removed:0,adapted:0,warning:0})}const Ws={unofficial:"WhatsApp",official:"WhatsApp Oficial",instagram:"Instagram",messenger:"Messenger",telegram:"Telegram"},kV={removed:{icone:_o,cls:"text-destructive"}
518,adapted:{icone:xj,cls:"text-amber-600 dark:text-amber-400"},warning:{icone:Hu,cls:"text-muted-foreground"}};function EV({open:e,onOpenChange:t,flow:n,fromChannel:r,nodes:s,edges:o,instances:i,providers:l,ownerUserId:c,onConverted:d}){const{t:u}=Qe(["flowBuilder","common"]),[f,h]=m.useState(""),[p,y]=m.useState(!1),g=m.useMemo(()=>_O.filter(_=>_!==r).map(_=>({canal:_,conexoes:ea(i,_).length,disponivel:_==="unofficial"||ea(i,_).length>0})),[i,r]),x=m.useMemo(()=>f?CV({nodes:s,edges:o,from:r,to:f,providers:l,triggerType:n.trigger_type}):null,[f,s,o,r,l,n.trigger_type]),v=x?jV(x.changes):null,b=!x||x.blockers.length>0,w=async()=>{if(!(!x||!f||b)){if(n.flow_kind==="group"&&f==="telegram"){const _=LS(x.nodes,x.edges);if(_){rt.error(_);return}}y(!0);try{const _=ea(i,f).map(k=>k.id),{data:C,error:N}=await he.from("inbox_flows").insert({user_id:c,flow_kind:n.flow_kind??"contact",name:u("channelConversion.copyName",{name:n.name,channel:Ws[f]}),description:n.description??"",nodes:x.nodes,edges:x.edges,trigger_type:n.trigger_type??"keyword",trigger_keywords:n.trigger_keywords??[],is_active:!1,assigned_instances:_,...f!=="unofficial"?{flow_channel:f}:{}}).select("id").single();if(N)throw N;rt.success(u("channelConversion.toasts.done",{channel:Ws[f]})),t(!1),h(""),d(C.id)}catch(_){const C=zS(_)?u("channelConversion.toasts.saleConflict"):(_==null?void 0:_.message)??String(_);rt.error(u("channelConversion.toasts.failed",{error:C}))}finally{y(!1)}}};return a.jsx(cn,{open:e,onOpenChange:t,children:a.jsxs(Qt,{className:"max-w-2xl max-h-[85vh] flex flex-col",children:[a.jsxs(qt,{children:[a.jsxs(Gt,{className:"flex items-center gap-2",children:[Ws[r],a.jsx(Ca,{className:"h-4 w-4 text-muted-foreground"}),f?Ws[f]:u("channelConversion.pickTarget")]}),a.jsx(En,{children:u("channelConversion.subtitle")})]}),a.jsxs("div",{className:"space-y-4 overflow-y-auto pr-1",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(Be,{children:u("channelConversion.targetLabel")}),a.jsxs(cs,{value:f,onValueChange:_=>h(_),children:[a.jsx(Fr,{children:a.jsx(ds,{placeholder:u("channelConversion.pickTarget")})}),a.jsx(zr,{children:g.map(({canal:_,conexoes:C,disponivel:N})=>a.jsxs(Ut,{value:_,disabled:!N,children:[Ws[_],_!=="unofficial"&&a.jsx("span",{className:"text-muted-foreground text-xs ml-2",children:N?u("channelConversion.connectionCount",{count:C}):u("channelConversion.noConnection")})]},_))})]})]}),x&&x.blockers.length>0&&a.jsxs("div",{className:"rounded-lg border border-destructive/40 bg-destructive/10 p-3 space-y-2",children:[a.jsxs("p",{className:"text-sm font-medium text-destructive flex items-center gap-2",children:[a.jsx(Jn,{className:"h-4 w-4"}),u("channelConversion.blocked")]}),x.blockers.map(_=>a.jsx("p",{className:"text-xs text-destructive/90",children:_},_))]}),x&&x.blockers.length===0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"rounded-lg border border-border bg-muted/40 p-3 text-sm",children:x.changes.length===0?u("channelConversion.nothingChanges"):u("channelConversion.summary",{removed:v.removed,adapted:v.adapted,warnings:v.warning})}),x.changes.length>0&&a.jsx("ul",{className:"space-y-2",children:x.changes.map((_,C)=>{const N=kV[_.kind],k=N.icone;return a.jsxs("li",{className:"flex gap-2 rounded-md border border-border p-2 text-xs",children:[a.jsx(k,{className:xe("h-4 w-4 shrink-0 mt-0.5",N.cls)}),a.jsxs("div",{className:"min-w-0",children:[a.jsxs("p",{className:"font-medium truncate",children:[_.label,a.jsxs("span",{className:"text-muted-foreground font-normal ml-1",children:["(",_.nodeType,")"]})]}),a.jsx("p",{className:"text-muted-foreground",children:_.reason}),_.path!=="fluxo principal"&&a.jsx("p",{className:"text-muted-foreground/70 mt-0.5",children:_.path})]})]},`${_.nodeId}-${C}`)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:u("channelConversion.safetyNote",{channel:f?Ws[f]:"",count:f?ea(i,f).length:0})})]})]}),a.jsxs(zb,{children:[a.jsx(pe,{variant:"outline",onClick:()=>t(!1),disabled:p,children:u("common:actions.cancel")}),a.jsxs(pe,{onClick:w,disabled:b||p,children:[p&&a.jsx(st,{className:"h-4 w-4 mr-2 animate-spin"}),u("channelConversion.confirm")]})]})]})})}const NV=86400,PV={delay:"espera",timeout:"tempo limite",expiration:"expiração"};function AV(e,t,n,r){const s=t==="instagram"?"Instagram":"Messenger",o=(e.contributions??[]).map(c=>{const d=n(c.nodeId),u=r(c.nodeId)??c.nodeId;return{rotulo:d!==void 0?`#${d}`:u,tipo:u,tempo:fs(c.seconds),segundos:c.seconds,via:c.via,nodeId:c.nodeId}}).sort((c,d)=>d.segundos-c.segundos),i=Math.max(0,e.totalSeconds-NV),l=e.code==="MESSAGING_WINDOW_CYCLE"?`Há um laço que soma tempo sem uma nova resposta do contato — ele nunca cabe nas 24 horas do ${s}.`:`Este caminho acumula ${fs(e.totalSeconds)} em ${e.pathNodeIds.length} blocos — ${fs(i)} além das 24 horas do ${s}.`;return{titulo:`A janela de 24 horas do ${s} não comporta este fluxo`,resumo:l,passos:o,blocosNoCaminho:e.pathNodeIds.length}}function w2(e){return`${e.rotulo} ${PV[e.via]}: ${e.tempo}`}function TV(e){const t=e.passos.slice(0,3).map(w2),n=e.passos.length-t.length,r=t.length?` Encurte: ${t.join(", ")}${n>0?` e mais ${n}`:""}.`:"";return`${e.resumo}${r} Alterações não salvas.`}const cd="__auto__",dd=1500,cv={gemini:"Google Gemini",openai:"OpenAI (GPT)",anthropic:"Anthropic (Claude)",deepseek:"DeepSeek",openrouter:"OpenRouter"},Ai=Array.from(new Set([...c8({vision:!0}).map(e=>e.provider),"openrouter"])),IV={gemini:"AIza...",openai:"sk-...",anthropic:"sk-ant-...",deepseek:"sk-...",openrouter:"sk-or-..."};function MV(e,t){return e.map(n=>{if(n.type!=="start")return n;const r={...n.data||{}};return delete r.onUpdateFlowSettings,delete r.undefinedVariables,{...n,data:{...r,triggerType:t.triggerType,triggerKeywords:t.triggerKeywords,triggerTags:t.triggerTags,keywordMatchType:t.keywordMatchType}}})}const _2=()=>be(()=>import("./FlowCanvas-BlIOyG27.js"),__vite__mapDeps([165,1,166,2,3,4,7,109,114,15,106,51,107,108,47,60,62,63,41,77,79,61,64,65,90,28,45,27,91,25,110,26,37,66,111,
518112,113,38,167,85,81,140,157,89,168,169,73,19,69,76,59,20,22,23,105,8,9,67,74,18,103,92,115,116,117,34,75,46,86,118,170,42,43,44,53,160,78,70])),RV=m.lazy(()=>_2().then(e=>({default:e.FlowCanvas}))),DV=m.lazy(()=>be(()=>import("./PassageMetricsDialog-Dd1vHeZb.js"),__vite__mapDeps([171,1,170,2,3,4,15,50,51,52])).then(e=>({default:e.PassageMetricsDialog}))),qi=()=>{const{t:e}=Qe(["flowBuilder","common"]),{id:t}=Pv(),n=Rt(),r=or(),{user:s}=at(),{effectiveUserId:o}=ti(),i=o||(s==null?void 0:s.id),[l,c]=m.useState(null),[d,u]=m.useState(!0),[f,h]=m.useState(!1),[p,y]=m.useState(null),[g,x]=m.useState(null),[v,b]=m.useState(""),[w,_]=m.useState(""),[C,N]=m.useState("keyword"),[k,P]=m.useState(""),[A,T]=m.useState(""),[D,E]=m.useState("contains"),[I,S]=m.useState(Wi),[L,Y]=m.useState(""),[B,q]=m.useState(null),[F,ee]=m.useState(!1),[$,M]=m.useState(!1),[J,K]=m.useState("00:00"),[X,de]=m.useState("06:00"),[te,ae]=m.useState([]),[re,le]=m.useState([]),[ue,z]=m.useState(!1),[ie,j]=m.useState("own"),[H,G]=m.useState("gemini"),[O,R]=m.useState(""),[U,V]=m.useState(void 0),Q=t8(i),W=Q?Q.keys.find(ne=>ne.id===U)??Q.defaultKey:null,se=ie==="integration"&&W?W.provider:H,fe=p8(se),[ce,me]=m.useState(""),[ke,Ne]=m.useState(!1),[Je,ct]=m.useState(null),[ye,Re]=m.useState(null),[Ce,De]=m.useState(!1),[Ue,Ve]=m.useState(!1),[pt,At]=m.useState(""),[jt,Bt]=m.useState(!1),[hn,Vt]=m.useState(!1),[St,zs]=m.useState(!1),[Pe,He]=m.useState(!1),nt=m.useRef(!0),Dt=m.useRef(null),Jt=m.useRef(null),Tt=m.useRef(null),Nn=m.useRef(()=>{}),[en,Pn]=m.useState(!1),[A2,Qh]=m.useState(!1),[T2,Jh]=m.useState(!1),[tn,ep]=m.useState([]),[Wn,tp]=m.useState([]),[sc,ac]=m.useState(""),oc="https://webhook.zapdata.co/functions/v1",dt=C==="sale"||C==="pix_detected",{getSelectionConflicts:np,isLoading:I2}=Yz(t,{enabled:dt}),si=te.map(ne=>ne.id),vt=b_(l==null?void 0:l.flow_channel),rp=ea(te,vt),ic=m.useMemo(()=>{if(vt==="telegram"&&re.length===0)return["zernio","telegram_direct"];const ne=new Map(te.map(_e=>[_e.id,_e])),Ee=re.length>0?re.map(_e=>ne.get(_e)).filter(_e=>!!_e):ea(te,vt),qe=[...new Set(Ee.map(_e=>{var Ot;return(Ot=_e.api_provider)==null?void 0:Ot.trim().toLowerCase()}).filter(_e=>!!_e))];return qe.length>0?qe:vt==="telegram"?["zernio","telegram_direct"]:[]},[re,vt,te]),M2=m.useCallback((ne,Ee)=>{ep(ne),tp(Ee)},[]);m.useEffect(()=>{if(C!=="webhook"||sc||!t||!i)return;(async()=>{try{const{data:Ee}=await he.from("global_webhooks").select("id, webhook_token").eq("user_id",i).eq("flow_id",t).limit(1).maybeSingle();if(Ee!=null&&Ee.webhook_token){ac(`${oc}/webhook-global?token=${Ee.webhook_token}`);return}const{data:qe}=await he.from("global_webhooks").insert({user_id:i,name:`Webhook - ${v||e("editor.flowFallbackName")}`,flow_id:t,is_active:!0}).select("webhook_token").single();qe!=null&&qe.webhook_token&&ac(`${oc}/webhook-global?token=${qe.webhook_token}`)}catch(Ee){console.error("Error generating webhook URL:",Ee)}})()},[C,sc,t,i,v]);const R2=r.pathname.startsWith("/inbox");m.useEffect(()=>{_2()},[]),m.useEffect(()=>{(async()=>{if(!i)return;const{data:Ee}=await he.from("maturador_instances").select("id, instance_name, label, phone_number, status, api_provider").eq("user_id",i).is("deletion_requested_at",null);if(Ee){const{data:qe}=await he.from("zernio_connections").select("instance_id, platform").eq("user_id",i),_e=new Map((qe||[]).map(Ot=>[Ot.instance_id,Ot.platform]));ae(Ee.map(Ot=>({...Ot,platform:_e.get(Ot.id)||null})))}})()},[i]);const lc=()=>r.pathname.startsWith("/inbox")?"/inbox/flows":"/disparador";m.useEffect(()=>{(async()=>{var Ee,qe;if(i){if(!t||t==="novo")try{const{data:_e,error:Ot}=await he.from("inbox_flows").insert({user_id:i,name:e("editor.defaultFlowName"),description:"",nodes:[],edges:[],trigger_type:"keyword",trigger_keywords:[],assigned_instances:[],is_active:!1}).select().single();if(Ot)throw Ot;const Hn=r.pathname.startsWith("/inbox")?"/inbox/flows":"/disparazap/fluxos";n(`${Hn}/${_e.id}`,{replace:!0});return}catch(_e){console.error("Error creating flow:",_e),rt.error(e("editor.toasts.createFlowError")),n(lc());return}try{const{data:_e,error:Ot}=await he.from("inbox_flows").select("*").eq("id",t).eq("user_id",i).single();if(Ot)throw Ot;const Hn={..._e,nodes:YB(_e.nodes||[]),edges:_e.edges||[],trigger_type:_e.trigger_type,trigger_keywords:_e.trigger_keywords||[],assigned_instances:_e.assigned_instances||[],reply_mode:_e.reply_mode||"all",reply_interval:_e.reply_interval||3,pause_other_flows:_e.pause_other_flows||!1};c(Hn),b(_e.name),_(_e.description||""),N(_e.trigger_type),P(((Ee=_e.trigger_keywords)==null?void 0:Ee.join(`
519`))||""),T(((qe=_e.trigger_tags)==null?void 0:qe.join(", "))||""),E(_e.keyword_match_type||"contains"),S(_e.trigger_events??Wi),Y((_e.trigger_post_ids??[]).join(`
520`)),q(_e.trigger_comment_reply??null),ee(_e.is_active),M(_e.pause_schedule_enabled||!1),K(_e.pause_schedule_start||"00:00"),de(_e.pause_schedule_end||"06:00"),le(_e.assigned_instances||[]),z(_e.pause_other_flows||!1),j(_e.pix_ai_mode==="integration"?"integration":"own");
520{const kt=_e.pix_ai_provider;G(Ai.includes(kt)?kt:"gemini")}R(_e.pix_ai_api_key||""),V(_e.pix_ai_key_id||void 0),me(_e.pix_ai_model||""),Ne(_e.pix_value_filter_enabled||!1),ct(_e.pix_min_value!=null?Number(_e.pix_min_value):null),Re(_e.pix_max_value!=null?Number(_e.pix_max_value):null),De(_e.pix_fake_branch_enabled||!1),Ve(_e.pix_duplicate_branch_enabled||!1),At(_e.pix_custom_prompt||""),Bt(_e.pix_accept_non_pix||!1),Vt(_e.pix_gateway_auto_trigger||!1),_e.trigger_type==="webhook"&&(async()=>{const{data:kt}=await he.from("global_webhooks").select("webhook_token").eq("user_id",i).eq("flow_id",t).limit(1).maybeSingle();kt!=null&&kt.webhook_token&&ac(`${oc}/webhook-global?token=${kt.webhook_token}`)})()}catch(_e){console.error("Error fetching flow:",_e),rt.error(e("editor.toasts.loadFlowError")),n(lc())}finally{u(!1)}}})()},[t,i,n,r.pathname]);const Ba=async(ne,Ee,qe=!1)=>{if(!t||!i)return!1;ep(ne),tp(Ee);const _e=(l==null?void 0:l.flow_kind)==="group"&&vt==="telegram"?LS(ne,Ee):null;if(_e)return qe||rt.error(_e),!1;const Ot=Hh(ne,vt),Hn=FS(ne,Ee,vt)[0];if(Hn||Ot){let Oe=(Hn==null?void 0:Hn.message)??Ot,mt=null;if(Hn){const We=Hi(ne,Ee),ot=new Map(ne.map(It=>[It.id,String(It.type??"")]));mt=AV(Hn,vt,It=>We.get(It),It=>ot.get(It)),Oe=TV(mt)}if(!F&&(l!=null&&l.is_active)&&!qe){const{error:We}=await he.from("inbox_flows").update({is_active:!1}).eq("id",t).eq("user_id",i);We||(c(ot=>ot&&{...ot,is_active:!1}),Oe=`Fluxo desativado. ${Oe}`),We&&rt.error(We.message)}return y(Oe),x(mt),qe||rt.error(Oe,{duration:12e3}),!1}y(null),x(null);const kt=(l==null?void 0:l.flow_kind)==="group",D2=new Set(si),Va=te.length>0?re.filter(Oe=>D2.has(Oe)):re,O2=new Set(Va),ap=[...new Set(te.filter(Oe=>O2.has(Oe.id)).map(Oe=>{var mt;return(mt=Oe.api_provider)==null?void 0:mt.trim().toLowerCase()}).filter(Oe=>!!Oe))],L2=ap.length>0?ap:ic;if(F){const Oe=nV(ne,vt,L2);if(Oe.length>0){const mt=Oe[0],We=Oe.length>1?` (+${Oe.length-1})`:"";return qe||rt.error(`Bloco incompatível com ${vt}: ${mt.type}${We}`,{description:`${mt.path}: ${mt.reason}. Desative o fluxo ou remova/adapte o bloco antes de salvar.`,duration:12e3}),!1}}if(!qe&&F){const Oe=Hi(ne,Ee),mt=ne.filter(We=>We.type==="pixApi"||We.type==="speiApi").map(We=>({id:We.id,problemas:$B(We.data,We.type,vt)})).filter(We=>We.problemas.length>0).sort((We,ot)=>(Oe.get(We.id)??0)-(Oe.get(ot.id)??0));if(mt.length>0){const We=mt[0],ot=Oe.get(We.id),It=mt.length-1,nn=It>0?e("editor.toasts.moreBlocksSameSituation",{count:It}):"";return rt.error(e("editor.toasts.incompleteBlockTitle",{numPrefix:ot?`#${ot} `:"",issues:We.problemas.map(ts=>ts.message).join("; ")}),{description:e("editor.toasts.incompleteBlockDescription",{extra:nn}),duration:12e3}),!1}}if(!qe&&F){const Oe=(We,ot,It)=>{if(ot==="integration"&&Q){const nn=Q.keys.find(ts=>ts.id===It)??Q.defaultKey;if(nn)return nn.provider}return We},mt=ne.find(We=>{const ot=We.data||{};return We.type==="aiResponder"||We.type==="waitInputAI"?Oe(ot.provider,ot.apiKeySource,ot.integrationKeyId)==="openrouter"&&!String(ot.model??"").trim():We.type==="condition"?(Array.isArray(ot.conditions)?ot.conditions:[]).some(nn=>nn.type!=="ia"?!1:Oe(nn.iaProvider,nn.apiKeySource,nn.integrationKeyId)==="openrouter"&&!String(nn.iaModel??"").trim()):!1});if(mt){const ot=Hi(ne,Ee).get(mt.id);return rt.error(e("editor.toasts.openRouterModelMissingTitle",{numPrefix:ot?`#${ot} `:""}),{description:e("editor.toasts.openRouterModelMissingDescription"),duration:12e3}),!1}}if(!kt&&F&&Va.length===0)return rt.error(e("editor.toasts.selectAtLeastOneInstance")),!1;if(!kt&&dt){if(I2)return rt.message(e("editor.toasts.verifyingPixConflicts")),!1;const Oe=np(Va,C,si);if(Oe.length>0)return rt.error(e("editor.toasts.pixConflictWithFlow",{name:Oe[0].name||e("editor.toasts.unnamedFlow")})),!1}const cc=kO(Va,te,vt);if(cc)return rt.error(e("channelInstanceMismatch.toast",{flowChannel:e(`channelInstanceMismatch.${vt}`),instanceChannel:e(`channelInstanceMismatch.${vt==="official"?"unofficial":"official"}`),instanceName:cc.label||cc.instance_name})),!1;h(!0);try{const Oe=new Set(ne.map(pn=>pn.id)),mt=Ee.filter(pn=>{const wr=Oe.has(pn.source),ai=Oe.has(pn.target);return wr&&ai}),We=kt?[]:k.split(`
521`).map(pn=>
521pn.trim()).filter(Boolean),ot=kt?[]:A.split(",").map(pn=>pn.trim()).filter(Boolean),It=kt?"contains":D,nn=MV(ne,{triggerType:kt?"manual":C,triggerKeywords:We,triggerTags:ot,keywordMatchType:It}),{error:ts}=await he.from("inbox_flows").update({name:v,description:w,nodes:JSON.parse(JSON.stringify(nn)),edges:JSON.parse(JSON.stringify(mt)),trigger_type:kt?"manual":C,trigger_keywords:We,trigger_tags:ot,keyword_match_type:It,trigger_events:kt?Wi:I,trigger_post_ids:kt?[]:Qz(L),trigger_comment_reply:!kt&&vt==="instagram"&&I.includes("comment")&&(B==null?void 0:B.trim())||null,assigned_instances:Va,is_active:F,pause_on_media:!1,pause_schedule_enabled:$,pause_schedule_start:$?J:null,pause_schedule_end:$?X:null,pause_other_flows:kt?!1:dt||C==="tag"?ue:!1,pix_ai_mode:dt?ie:"native",pix_ai_provider:dt?H:null,pix_ai_api_key:dt?O.trim():null,pix_ai_key_id:dt&&ie==="integration"?U??null:null,pix_ai_model:dt&&ce.trim()||null,pix_value_filter_enabled:dt?ke:!1,pix_min_value:dt&&ke?Je:null,pix_max_value:dt&&ke?ye:null,pix_fake_branch_enabled:dt?Ce:!1,pix_duplicate_branch_enabled:dt?Ue:!1,pix_custom_prompt:dt&&pt.trim()||null,pix_accept_non_pix:dt?jt:!1,pix_gateway_auto_trigger:dt?hn:!1,updated_at:new Date().toISOString()}).eq("id",t).eq("user_id",i);if(ts)throw ts;const op=ne.filter(pn=>{var wr,ai;return pn.type==="tag"&&((ai=(wr=pn.data)==null?void 0:wr.tagName)==null?void 0:ai.trim())});if(op.length>0){const pn=[...new Set(op.map(wr=>wr.data.tagName.trim()))];for(const wr of pn)await he.from("inbox_tags").upsert({user_id:i,name:wr},{onConflict:"user_id,name",ignoreDuplicates:!0})}return qe||rt.success(e("editor.toasts.flowSavedSuccess"),{className:"bg-black border border-orange-500 text-white [&_[data-icon]]:text-green-500",style:{background:"#000000",border:"1px solid hsl(24 95% 53%)",color:"#ffffff","--success-text-color":"#22c55e","--success-bg":"#000000","--success-border":"hsl(24 95% 53%)"}}),!0}catch(Oe){console.error("Error saving flow:",Oe);const mt=String((Oe==null?void 0:Oe.message)??"");if(/MESSAGING_WINDOW|INVALID_WAIT|INVALID_GRAPH/.test(mt))return y(mt),rt.error(mt),!1;const We=zS(Oe),ot=EO(Oe),It=We?e("editor.toasts.pixConflictTitle"):ot?Oe==null?void 0:Oe.message:e("editor.toasts.saveFlowErrorTitle"),nn=We?e("editor.toasts.pixConflictDescription"):void 0;return rt.error(It,{description:nn,duration:We?1e4:4e3,className:"bg-black border border-orange-500 text-white",style:{background:"#000000",border:"1px solid hsl(24 95% 53%)",color:"#ffffff"}}),!1}finally{h(!1)}};m.useEffect(()=>{if(!d){if(nt.current){nt.current=!1;return}return zs(!0),He(!1),Dt.current&&clearTimeout(Dt.current),Dt.current=setTimeout(async()=>{const ne=tn.length>0?tn:(l==null?void 0:l.nodes)||[],Ee=Wn.length>0?Wn:(l==null?void 0:l.edges)||[];await Ba(ne,Ee,!0)?(zs(!1),He(!1)):He(!0)},1500),()=>{Dt.current&&clearTimeout(Dt.current)}}},[d,ie,H,O,ce,ke,Je,ye,Ce,Ue,pt,jt,hn]),Nn.current=()=>{if(!t||!i)return;const ne=tn.length>0?tn:(l==null?void 0:l.nodes)||[],Ee=Wn.length>0?Wn:(l==null?void 0:l.edges)||[];Ba(ne,Ee,!0)},m.useEffect(()=>{if(!(d||!t)){if(Jt.current!==t){Jt.current=t;return}if(!(C!=="keyword"&&vt!=="instagram"&&vt!=="messenger"))return Tt.current&&clearTimeout(Tt.current),Tt.current=setTimeout(()=>{Tt.current=null,Nn.current()},800),()=>{Tt.current&&clearTimeout(Tt.current)}}},[d,t,vt,C,k,A,D,I,L,B]),m.useEffect(()=>()=>{Tt.current&&(clearTimeout(Tt.current),Tt.current=null,Nn.current())},[]),m.useEffect(()=>{if(!St)return;const ne=Ee=>{Ee.preventDefault(),Ee.returnValue=""};return window.addEventListener("beforeunload",ne),()=>window.removeEventListener("beforeunload",ne)},[St]);const sp=ne=>{le(Ee=>Ee.includes(ne)?Ee.filter(qe=>qe!==ne):[...Ee,ne])};return d?a.jsxs("div",{className:"min-h-screen bg-background",children:[a.jsx(Au,{}),a.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-4rem)]",children:a.jsx("div",{className:"animate-pulse text-muted-foreground",children:e("common:states.loading")})})]}):a.jsxs("div",{className:"h-[calc(100vh-var(--app-banner-offset,0px))] bg-background flex flex-col overflow-hidden",children:[a.jsx(Au,{useBannerOffsetVar:!0}),a.jsx("div",{className:"shrink-0",style:{height:"calc(var(--app-banner-offset, 0px) + 3.5rem)"}})," ",p&&(g?a.jsxs("div",{role:"alert",className:"shrink-0 border-b border-destructive/40 bg-destructive/10 px-4 py-2 text-sm",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"font-medium text-destructive",children:g.titulo}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[g.resumo," Alterações não salvas."]})]}),a.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground shrink-0",onClick:()=>{y(null),x(null)},children:"fechar"})]}),g.passos.length>0&&a.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:[a.jsx("span",{className:"text-xs text-muted-foreground self-center",children:"Encurte:"}),g.passos.map(ne=>a.jsx("span",{title:`${ne.tipo} · ${ne.nodeId}`,className:"rounded border border-destructive/40 bg-background px-1.5 py-0.5 text-xs font-mono",children:w2(ne)},ne.nodeId))]})]}):a.jsx("div",{role:"alert",className:"shrink-0 border border-destructive bg-destructive/10 p-3 text-sm",children:p})),a.jsxs("div",{className:"border-b border-border px-4 py-2 flex items-center justify-between bg-card shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>n(lc()),title:e(R2?"editor.backToAutomatiZap":"editor.backToDisparaZap"),children:a.jsx(ks,{className:"h-5 w-5"})}
521),a.jsx(et,{value:v,onChange:ne=>b(ne.target.value),className:"w-64 font-medium"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-2 mr-4",children:[a.jsx(yn,{checked:F,onCheckedChange:ee,id:"flow-active",className:F?"data-[state=checked]:bg-green-500":"data-[state=unchecked]:bg-red-500"}),a.jsx(Be,{htmlFor:"flow-active",className:"text-sm",children:e(F?"editor.active":"editor.inactive")})]}),a.jsxs(pe,{variant:"outline",size:"sm",onClick:()=>Jh(!0),title:e("channelConversion.buttonTitle"),children:[a.jsx(Vv,{className:"h-4 w-4 mr-1"}),e("channelConversion.button")]}),a.jsxs(cn,{children:[a.jsx(ET,{asChild:!0,children:a.jsxs(pe,{variant:"outline",size:"sm",children:[a.jsx(Ku,{className:"h-4 w-4 mr-1"}),e("editor.settingsButton")]})}),a.jsxs(Qt,{className:"max-w-lg max-h-[85vh] flex flex-col p-0 gap-0",children:[a.jsx(qt,{className:"px-6 pt-6 pb-2 flex-shrink-0",children:a.jsx(Gt,{children:e("editor.settingsDialogTitle")})}),a.jsx("div",{className:"flex-1 overflow-y-auto scrollbar-none px-6",children:a.jsxs("div",{className:"space-y-4 pb-20",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(Be,{children:e("editor.flowNameLabel")}),a.jsx(et,{value:v,onChange:ne=>b(ne.target.value)})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Be,{children:e("common:fields.description")}),a.jsx(ca,{value:w,onChange:ne=>_(ne.target.value),rows:3})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Be,{children:e("editor.triggerTypeLabel")}),a.jsxs(cs,{value:C,onValueChange:ne=>N(ne),children:[a.jsx(Fr,{children:a.jsx(ds,{})}),a.jsxs(zr,{children:[a.jsx(Ut,{value:"keyword",children:e("editor.triggerTypes.keyword")}),a.jsx(Ut,{value:"all",children:e("editor.triggerTypes.all")}),a.jsx(Ut,{value:"schedule",children:e("editor.triggerTypes.schedule")}),a.jsx(Ut,{value:"sale",children:e(aB)}),a.jsx(Ut,{value:"webhook",children:e("editor.triggerTypes.webhook")})]})]})]}),dt&&(()=>{const ne=re.filter(qe=>si.includes(qe)),Ee=np(ne,C,si);return Ee.length===0?null:a.jsxs("div",{className:"rounded-md border border-red-500/40 bg-red-500/10 p-3 text-xs text-red-600 dark:text-red-400 space-y-1",children:[a.jsx("p",{className:"font-semibold",children:e("editor.pixConflictWarning.title")}),a.jsx("p",{children:e("editor.pixConflictWarning.alreadyInUse")}),a.jsx("ul",{className:"list-disc list-inside",children:Ee.slice(0,5).map(qe=>a.jsx("li",{children:qe.name||e("editor.pixConflictWarning.unnamedFlow")},qe.id))}),a.jsx("p",{children:e("editor.pixConflictWarning.chooseDifferent")})]})})(),dt&&a.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-md bg-amber-500/10 border-amber-500/30",children:[a.jsxs("div",{children:[a.jsxs(Be,{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-amber-500",children:"⚡"}),e("editor.pauseOtherFlows.label")]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:e("editor.pauseOtherFlows.description")})]}),a.jsx(yn,{checked:ue,onCheckedChange:z,className:ue?"data-[state=checked]:bg-green-500":"data-[state=unchecked]:bg-red-500"})]}),dt&&a.jsxs("div",{className:"space-y-2 p-3 border rounded-md",children:[a.jsx(Be,{children:e("editor.pixAi.sectionLabel")}),a.jsxs("div",{className:"space-y-2",children:[ie==="own"&&a.jsxs(a.Fragment,{children:[a.jsxs(cs,{value:H,onValueChange:ne=>{G(ne),me("")},children:[a.jsx(Fr,{children:a.jsx(ds,{})}),a.jsx(zr,{children:Ai.map(ne=>a.jsx(Ut,{value:ne,children:cv[ne]},ne))})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:e("editor.pixAi.visionOnlyHint")})]}),a.jsx(n8,{keys:Q,mode:ie,onModeChange:ne=>{j(ne),ne==="integration"&&W&&Ai.includes(W.provider)&&G(W.provider)},selectedKeyId:U,onSelectedKeyIdChange:V,apiKey:O,onApiKeyChange:R,apiKeyPlaceholder:IV[H]||"AIza...",requiredHelpText:e("editor.pixAi.requiredHelpText")}),ie==="integration"&&W&&!Ai.includes(W.provider)&&a.jsx("p",{className:"text-xs text-amber-400",children:e("editor.pixAi.wrongProviderWarning",{provider:cv[W.provider]})}),ie==="own"&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:[e("editor.pixAi.storedInFlowOnly")," ",e(H==="openai"?"editor.pixAi.getKeyOpenAI":H==="anthropic"?"editor.pixAi.getKeyAnthropic":H==="openrouter"?"editor.pixAi.getKeyOpenRouter":"editor.pixAi.getKeyGoogle"),"."]}),(()=>{const ne=se,Ee=fe.models.filter(_e=>
521_e.supportsVision);if(Ee.length===0)return fe.isLoading?a.jsx("p",{className:"text-xs text-muted-foreground",children:e("editor.pixAi.modelsLoading")}):fe.isError?a.jsx("p",{className:"text-xs text-muted-foreground",children:e("editor.pixAi.modelsLoadError")}):null;const qe=Ee.some(_e=>_e.id===ce);return a.jsxs("div",{className:"space-y-1 pt-1",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx(Be,{className:"text-xs",children:e("editor.pixAi.modelLabel")}),ce&&qe&&a.jsx(g8,{provider:ne,modelId:ce})]}),ne==="openrouter"?a.jsx(rB,{models:Ee,value:ce,onChange:me,isLoading:fe.isLoading,isError:fe.isError}):a.jsxs(a.Fragment,{children:[a.jsxs(cs,{value:ce||cd,onValueChange:_e=>me(_e===cd?"":_e),children:[a.jsx(Fr,{children:a.jsx(ds,{})}),a.jsxs(zr,{children:[a.jsx(Ut,{value:cd,children:e("editor.pixAi.modelAuto")}),!qe&&ce&&a.jsx(Ut,{value:ce,children:e("editor.pixAi.modelSavedNotInCatalog",{model:ce})}),Ee.map(_e=>a.jsxs(Ut,{value:_e.id,children:[_e.label,_e.legacy?e("editor.pixAi.modelLegacySuffix"):""]},_e.id))]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:e("editor.pixAi.modelAutoHint")})]})]})})()]})]}),dt&&a.jsxs("div",{className:"space-y-2 p-3 border rounded-md",children:[a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx(yn,{checked:jt,onCheckedChange:Bt}),a.jsx("span",{className:"text-xs font-medium flex-1",children:e("editor.acceptNonPix.label")})]}),jt&&a.jsx("p",{className:"text-xs text-muted-foreground",children:e("editor.acceptNonPix.description")}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(Be,{className:"text-xs",children:e("editor.customPrompt.label",{count:pt.length,max:dd})}),a.jsx(ca,{value:pt,onChange:ne=>At(ne.target.value.slice(0,dd)),placeholder:e("editor.customPrompt.placeholder"),rows:3,maxLength:dd}),a.jsx("p",{className:"text-xs text-muted-foreground",children:e("editor.customPrompt.hint")})]})]}),dt&&a.jsxs("div",{className:"space-y-2 p-3 border rounded-md",children:[a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx(yn,{checked:hn,onCheckedChange:Vt}),a.jsx("span",{className:"text-xs font-medium flex-1",children:e("editor.gatewayAutoTrigger.label")})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:e("editor.gatewayAutoTrigger.description")})]}),dt&&a.jsxs("div",{className:"space-y-2 p-3 border rounded-md",children:[a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx(yn,{checked:ke,onCheckedChange:Ne}),a.jsx("span",{className:"text-xs font-medium flex-1",children:e("editor.valueFilter.label")})]}),ke&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(Be,{className:"text-xs",children:e("editor.valueFilter.minLabel")}),a.jsx(et,{type:"number",inputMode:"decimal",step:"0.01",min:"0",placeholder:e("editor.valueFilter.minPlaceholder"),value:Je??"",onChange:ne=>ct(ne.target.value===""?null:Number(ne.target.value))})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(Be,{className:"text-xs",children:e("editor.valueFilter.maxLabel")}),a.jsx(et,{type:"number",inputMode:"decimal",step:"0.01",min:"0",placeholder:e("editor.valueFilter.maxPlaceholder"),value:ye??"",onChange:ne=>Re(ne.target.value===""?null:Number(ne.target.value))})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:e("editor.valueFilter.hint")})]})]}),dt&&a.jsxs("div",{className:"space-y-2 p-3 border rounded-md",children:[a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx(yn,{checked:Ce,onCheckedChange:De}),a.jsx("span",{className:"text-xs font-medium flex-1",children:e("editor.fakeDuplicateBranch.fakeLabel")})]}),a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx(yn,{checked:Ue,onCheckedChange:Ve}),a.jsx("span",{className:"text-xs font-medium flex-1",children:e("editor.fakeDuplicateBranch.duplicateLabel")})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:e("editor.fakeDuplicateBranch.hint")})]}),C==="keyword"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(Be,{children:e("editor.keywordMatch.label")}),a.jsxs(cs,{value:D,onValueChange:ne=>E(ne),children:[a.jsx(Fr,{children:a.jsx(ds,{})}),a.jsxs(zr,{children:[a.jsx(Ut,{value:"exact",children:e("editor.keywordMatch.exact")}),a.jsx(Ut,{value:"contains",children:e("editor.keywordMatch.contains")}),a.jsx(Ut,{value:"not_contains",children:e("editor.keywordMatch.notContains")})]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[D==="exact"&&e("editor.keywordMatch.exactHint"),D==="contains"&&e("editor.keywordMatch.containsHint"),D==="not_contains"&&e("editor.keywordMatch.notContainsHint")]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Be,{children:e("editor.keywordsLabel")}),a.jsx(ca,{value:k,onChange:ne=>P(ne.target.value),placeholder:e("editor.keywordsPlaceholder"),rows:2})]})]}),(l==null?void 0:l.flow_kind)!=="group"&&(C==="keyword"||C==="all")&&a.jsx(Jz,{channel:vt,value:I,onChange:S,instanceIds:re,postIds:L,onPostIdsChange:Y,commentReply:B,onCommentReplyChange:q}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(Be,{className:"flex items-center gap-2",children:[a.jsx(ij,{className:"h-4 w-4"}),e("editor.instancesLabel")]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:e("editor.instancesHint")}),a.jsx("div",{className:"space-y-2 mt-2 max-h-48 overflow-y-auto",children:rp.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:e("editor.noInstancesFound")}):rp.map(ne=>a.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-md hover:bg-accent cursor-pointer",onClick:()=>sp(ne.id),children:[a.jsx(qr,{checked:re.includes(ne.id),onCheckedChange:()=>sp(ne.id)}),a.jsxs("div",{className:"flex-1",children:[a.jsx("span",{className:"text-sm font-medium",children:ne.label||ne.instance_name}),ne.phone_number&&a.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:ne.ph
521one_number})]}),a.jsx(Yn,{variant:"outline",className:ne.status==="connected"||ne.status==="open"?"bg-green-500/20 text-green-500 border-green-500":"bg-red-500/20 text-red-500 border-red-500",children:ne.status==="connected"||ne.status==="open"?e("editor.instanceOnline"):e("editor.instanceOffline")})]},ne.id))}),re.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:re.map(ne=>{const Ee=te.find(qe=>qe.id===ne);return Ee?a.jsx(Yn,{variant:"secondary",className:"text-xs",children:Ee.label||Ee.instance_name},ne):null})})]}),a.jsxs("div",{className:"space-y-4 border rounded-md p-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Gu,{className:"h-4 w-4 text-muted-foreground"}),a.jsxs("div",{children:[a.jsx(Be,{children:e("editor.pauseSchedule.label")}),a.jsx("p",{className:"text-xs text-muted-foreground",children:e("editor.pauseSchedule.description")})]})]}),a.jsx(yn,{checked:$,onCheckedChange:M,className:$?"data-[state=checked]:bg-green-500":"data-[state=unchecked]:bg-red-500"})]}),$&&a.jsxs("div",{className:"space-y-3 pt-2",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(Be,{className:"text-xs",children:e("editor.pauseSchedule.startLabel")}),a.jsx(et,{type:"time",value:J,onChange:ne=>K(ne.target.value)})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Be,{className:"text-xs",children:e("editor.pauseSchedule.endLabel")}),a.jsx(et,{type:"time",value:X,onChange:ne=>de(ne.target.value)})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground bg-muted p-2 rounded",children:e("editor.pauseSchedule.timezoneHint")})]})]}),a.jsxs("div",{className:"flex items-center justify-between py-2",children:[a.jsx(Be,{children:e("editor.flowActiveLabel")}),a.jsx(yn,{checked:F,onCheckedChange:ee,className:F?"data-[state=checked]:bg-green-500":"data-[state=unchecked]:bg-red-500"})]})]})}),a.jsx("div",{className:"flex-shrink-0 border-t border-border px-6 py-4 flex justify-end",children:a.jsx(pe,{onClick:()=>{const ne=tn.length>0?tn:(l==null?void 0:l.nodes)||[],Ee=Wn.length>0?Wn:(l==null?void 0:l.edges)||[];Ba(ne,Ee)},disabled:f,className:"bg-green-600 hover:bg-green-700 text-white",children:e(f?"common:states.saving":"common:actions.save")})})]})]}),a.jsxs(pe,{variant:"outline",size:"sm",onClick:()=>{(tn.length>0?tn:(l==null?void 0:l.nodes)||[]).some(qe=>qe.type==="passageTracker")?Pn(!0):Qh(!0)},children:[a.jsx(KC,{className:"h-4 w-4 mr-1"}),e("editor.funnelMetricsButton")]}),dt&&Pe&&a.jsx("span",{className:"text-xs text-destructive",children:e("editor.triggerSettingsSaveFailed")}),dt&&St&&!Pe&&a.jsx("span",{className:"text-xs text-muted-foreground animate-pulse",children:e("editor.triggerSettingsSaving")}),a.jsxs(pe,{size:"sm",onClick:()=>{const ne=tn.length>0?tn:(l==null?void 0:l.nodes)||[],Ee=Wn.length>0?Wn:(l==null?void 0:l.edges)||[];Ba(ne,Ee)},disabled:f,className:"bg-green-600 hover:bg-green-700 text-white",children:[a.jsx(sj,{className:"h-4 w-4 mr-1"}),e(f?"common:states.saving":"common:actions.save")]})]})]}),a.jsx("div",{className:"flex-1 min-h-0",children:l&&a.jsx(m.Suspense,{fallback:a.jsx("div",{className:"h-full w-full bg-muted/20 animate-pulse"}),children:a.jsx(RV,{initialNodes:l.nodes,initialEdges:l.edges,onSave:Ba,triggerType:C,triggerKeywords:k.split(`
522`).map(ne=>ne.trim()).filter(Boolean),triggerTags:A.split(",").map(ne=>ne.trim()).filter(Boolean),keywordMatchType:D,pauseOtherFlows:ue,pixAiMode:ie,pixAiProvider:H,pixAiApiKey:O,pixAiKeyId:U,pixAiModel:ce,pixValueFilterEnabled:ke,pixMinValue:Je,pixMaxValue:ye,pixFakeBranchEnabled:Ce,pixDuplicateBranchEnabled:Ue,pixCustomPrompt:pt,pixAcceptNonPix:jt,pixGatewayAutoTrigger:hn,webhookUrl:sc,pauseScheduleEnabled:$,pauseScheduleStart:J,pauseScheduleEnd:X,triggerEvents:I,triggerPostIds:L,triggerCommentReply:B,onUpdateFlowSettings:ne=>{ne.triggerType&&N(ne.triggerType),ne.triggerEvents&&S(ne.triggerEvents),ne.triggerPostIds!==void 0&&Y(ne.triggerPostIds),ne.triggerCommentReply!==void 0&&q(ne.triggerCommentReply),ne.triggerKeywords&&P(ne.triggerKeywords.join(`
523`)),ne.triggerTags&&T(ne.triggerTags.join(", ")),ne.keywordMatchType&&E(ne.keywordMatchType),ne.pauseOtherFlows!==void 0&&z(ne.pauseOtherFlows),ne.pixAiMode!==void 0&&j(ne.pixAiMode==="integration"?"integration":"own"),ne.pixAiProvider!==void 0&&G(ne.pixAiProvider),ne.pixAiApiKey!==void 0&&R(ne.pixAiApiKey),ne.pixAiKeyId!==void 0&&V(ne.pixAiKeyId),ne.pixAiModel!==void 0&&me(ne.pixAiModel),ne.pixValueFilterEnabled!==void 0&&Ne(!!ne.pixValueFilterEnabled),ne.pixMinValue!==void 0&&ct(ne.pixMinValue),ne.pixMaxValue!==void 0&&Re(ne.pixMaxValue),ne.pixFakeBranchEnabled!==void 0&&De(!!ne.pixFakeBranchEnabled),ne.pixDuplicateBranchEnabled!==void 0&&Ve(!!ne.pixDuplicateBranchEnabled),ne.pixCustomPrompt!==void 0&&At(ne.pixCustomPrompt),ne.pixAcceptNonPix!==void 0&&Bt(!!ne.pixAcceptNonPix),ne.pixGatewayAutoTrigger!==void 0&&Vt(!!ne.pixGatewayAutoTrigger),ne.pauseScheduleEnabled!==void 0&&M(ne.pauseScheduleEnabled),ne.pauseScheduleStart!==void 0&&K(ne.pauseScheduleStart),ne.pauseScheduleEnd!==void 0&&de(ne.pauseScheduleEnd)},flowId:t,flowActive:F,flowKind:(l==null?void 0:l.flow_kind)==="group"?"group":"contact",flowChannel:vt,capabilityProvi
523ders:ic,assignedInstances:re,onStateChange:M2})})}),en&&t&&l&&a.jsx(m.Suspense,{fallback:null,children:a.jsx(DV,{open:en,onClose:()=>Pn(!1),flowId:t,nodes:tn.length>0?tn:l.nodes})}),l&&i&&a.jsx(EV,{open:T2,onOpenChange:Jh,flow:{name:v,description:w,trigger_type:C,trigger_keywords:k.split(`
524`).map(ne=>ne.trim()).filter(Boolean)},fromChannel:vt,nodes:tn.length>0?tn:l.nodes??[],edges:Wn.length>0?Wn:l.edges??[],instances:te,providers:ic,ownerUserId:i,onConverted:ne=>n(r.pathname.startsWith("/inbox")?`/inbox/flows/${ne}`:`/disparazap/fluxos/${ne}`)}),a.jsx(d_,{open:A2,onOpenChange:Qh,children:a.jsxs(Nh,{children:[a.jsxs(Ph,{children:[a.jsx(Th,{children:e("editor.noLeadCountDialog.title")}),a.jsx(Ih,{children:e("editor.noLeadCountDialog.description")})]}),a.jsx(Ah,{children:a.jsx(Mh,{children:e("editor.noLeadCountDialog.gotIt")})})]})})]})},OV=Object.freeze(Object.defineProperty({__proto__:null,default:qi},Symbol.toStringTag,{value:"Module"}));function LV({children:e}){const{init:t,config:n}=Ch();return m.useEffect(()=>{n!=null&&n.enabled&&t()},[n==null?void 0:n.enabled,t]),a.jsx(a.Fragment,{children:e})}const FV=[{to:"/inbox",label:"Automatizap",icon:Hv,match:e=>e==="/inbox"||e.startsWith("/inbox/")},{to:"/ads",label:"Ads",icon:uj,match:e=>e==="/ads"||e.startsWith("/ads/")},{to:"/settings",label:"Configurações",icon:Ku,match:e=>e==="/settings"||e.startsWith("/settings/")}],zV=["/inbox/chat","/auth","/login","/lp","/flow-preview","/s","/tutorial","/privacidade","/termos"],BV=()=>{const{pathname:e}=or(),[t]=Nv();return zV.some(n=>e===n||e.startsWith(n+"/"))||e==="/inbox"&&t.get("contact")||e.startsWith("/inbox/flows/")&&e!=="/inbox/flows"?null:a.jsx("nav",{className:"md:hidden fixed bottom-0 left-0 right-0 z-40 bg-card/95 backdrop-blur border-t border-border",style:{paddingBottom:"env(safe-area-inset-bottom)"},children:a.jsx("ul",{className:"grid grid-cols-3",children:FV.map(({to:n,label:r,icon:s,match:o})=>{const i=o(e);return a.jsx("li",{children:a.jsxs(B2,{to:n,className:xe("flex flex-col items-center justify-center gap-1 py-2.5 text-[11px] font-medium transition-colors",i?"text-accent":"text-muted-foreground hover:text-foreground"),children:[a.jsx(s,{className:xe("w-5 h-5",i&&"text-accent")}),a.jsx("span",{className:"truncate",children:r})]})},n)})})})},VV=m.lazy(()=>be(()=>import("./Index-DhF0PcXn.js"),__vite__mapDeps([138,1,18,19,139,2,3,4,10,11,12,13,14,15,49,140,88,35,128,27,38,50,51,141,52]))),$V=m.lazy(()=>be(()=>import("./LandingPage-C16mDOVc.js"),__vite__mapDeps([172,1,17,15,127,9,2,3,4,36,43,31,151]))),UV=m.lazy(()=>be(()=>import("./ProductMetrics-CjNHAtw9.js"),__vite__mapDeps([173,1,139,2,3,4,50,51,161,128,38,15,174,27]))),WV=m.lazy(()=>be(()=>import("./ZapdataConverter-CZhuiF-F.js"),__vite__mapDeps([158,1,28,15,3,2,4]))),HV=m.lazy(()=>be(()=>import("./GeradorPalavrasChaves-Dh9Q9_bk.js"),__vite__mapDeps([175,1,2,3,4,176,177,33,34,18,19,15,32,178,168]))),qV=m.lazy(()=>be(()=>import("./ProductAnalysis-Dmjfgsj2.js"),__vite__mapDeps([179,1,2,3,4,139,180,15,28]))),GV=m.lazy(()=>be(()=>import("./NumberOrganizer-BO418ZSv.js"),__vite__mapDeps([181,1,128,2,3,4,15,56,28,27,38,168,169,174,12]))),KV=m.lazy(()=>be(()=>import("./TrackOfertas-CJ2yeVRn.js"),__vite__mapDeps([159,1,2,3,4,27,15,100,160,28,50,51,161,113,12,13]))),YV=m.lazy(()=>be(()=>import("./AudioGenerator-CakVOZlF.js"),__vite__mapDeps([154,1,2,3,4,79,15,80,63,27,124,41,77]))),XV=m.lazy(()=>be(()=>import("./AudioTranscriber-Bv6wgYdK.js"),__vite__mapDeps([155,1,2,3,4,15]))),ZV=m.lazy(()=>be(()=>import("./ExtensaoAdsWhatsApp-1J8QGz5e.js"),__vite__mapDeps([163,1,18,19,127,9,48,15,122,124,2,3,4]))),QV=m.lazy(()=>be(()=>import("./VideoDownloader-CJ_4NRjr.js"),__vite__mapDeps([156,1,2,3,4,112,64,15,157]))),JV=m.lazy(()=>be(()=>import("./SMSBot-BdUAQ-Cc.js"),__vite__mapDeps([182,1,132,2,3,4,15,20,34,28,56]))),e$=m.lazy(()=>be(()=>import("./SMMPanel-CXivRfFz.js"),__vite__mapDeps([183,1,132,2,3,4,15,20,133,56,35,28]))),t$=m.lazy(()=>be(()=>import("./AdminPanelNew-Be37mx-A.js"),__vite__mapDeps([184,1,2,3,4,15,39,56,134,70,168,169,27,128,40,113,10,11,12,13,14,73,19,69,49,149,28,91,116,50,51,141,17,18,97,178,81,47,74,77,137,122,135,86,62,20,64,72]))),n$=m.lazy(()=>be(()=>import("./InboxPage-DpBKhAcl.js"),__vite__mapDeps([57,1,2,3,4,58,15,59,20,22,23,45,27,60,
52461,47,62,63,64,65,66,26,67,21,46,68,19,69,16,17,18,24,25,28,42,43,44,70,71,48,14,72,12,56,73,11,74,13,75,34,76,41,77,78,36,53,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,49,94,95,96,38,97,98,99,100,101]))),dv=m.lazy(()=>be(()=>import("./FlowListPage-nmjHVJ28.js"),__vite__mapDeps([102,1,2,3,4,5,6,73,19,69,15,103,21,104,105,106,51,107,108,47,60,62,63,41,77,79,61,64,65,90,28,45,27,91,109,25,110,26,37,66,111,112,113,38,114,59,20,22,23,8,9,67,74,18,92,115,116,117,34,75,46,86,118,119,42,43,44,58,84,70,88,95,96,48,120,121,101,122]))),r$=m.lazy(()=>be(()=>import("./GroupFlowsPage-CjYDfQit.js"),__vite__mapDeps([164,1,96,2,3,4,27,15]))),uv=m.lazy(()=>be(()=>import("./InboxDashboard-g6UgcGCE.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56]))),fv=m.lazy(()=>be(()=>import("./MessageBlaster-CoIIHH6n.js"),__vite__mapDeps([142,1,18,19,2,3,4,22,42,43,15,44,143,67,10,11,12,13,14,96,99,144,98,75,46,27,47,48,124,56,145,77,90,28,41]))),s$=m.lazy(()=>be(()=>import("./DisparaZapOficial-CKdd-qXb.js"),__vite__mapDeps([185,1,2,3,4,180,18,19,128,27,15,28,124,47,37,150,41,77,65]))),a$=m.lazy(()=>be(()=>import("./SiteCloner-CuPdFX52.js"),__vite__mapDeps([186,1,18,19,2,3,4,176,177,33,34,15,37,135,62,65,89,94]))),o$=m.lazy(()=>be(()=>import("./AdsLayout-DgBfBFkA.js"),__vite__mapDeps([148,1,2,3,4,19,10,11,12,13,14,15,149,93,27,38,128,47,144,98,49,50,51,52,141,103,118,77,41,88,53,55,56,28,150,8,9,151]))),hv=m.lazy(()=>be(()=>import("./ZernioCallback-DsvkdsN0.js"),__vite__mapDeps([187,1,15]))),S2=m.lazy(()=>be(()=>import("./PaymentThankYou-Bj43uTCm.js"),__vite__mapDeps([188,1,3,15,2,4]))),C2=m.lazy(()=>be(()=>import("./PaymentCancelled-CMLhKge6.js"),__vite__mapDeps([189,1,3,15,2,4]))),i$=m.lazy(()=>be(()=>import("./ZernioBroadcast-BQiupzYx.js"),__vite__mapDeps([190,1,2,3,4,18,19,128,34,22,25,15,65,28,56]))),l$=m.lazy(()=>be(()=>import("./NotifyAdminPage-zQqybgve.js"),__vite__mapDeps([191,1,2,3,4,24,25,15,28,27,53,116,38,145,39,129]))),c$=m.lazy(()=>be(()=>import("./NotifyAdminAddNumber-Uqy33bdU.js"),__vite__mapDeps([192,1,2,3,4,24,25,29,15,30,31,32,33,34,18,19,6,28,35,36,37,38,39,40,41,27]))),d$=m.lazy(()=>be(()=>import("./QuickRepliesPage-Cy3r10GL.js"),__vite__mapDeps([125,1,2,3,4,82,15,87,83,27,47,95]))),u$=m.lazy(()=>be(()=>import("./GlobalSettingsPage-ChYvfpFc.js"),__vite__mapDeps([193,1,2,3,4,87,47,15,124,27,95]))),f$=m.lazy(()=>be(()=>import("./InboxKanbanPage-BGnfpkkS.js"),__vite__mapDeps([123,1,2,3,4,20,73,19,69,15,24,25,22,23,67,71,42,43,44,103,49,28,27,53,118,70,26,32,47,124,119]))),h$=m.lazy(()=>be(()=>import("./ContactsPage-qCSGZszF.js"),__vite__mapDeps([194,1,2,3,4,73,19,69,15,143,22,46,18,27,26,71,42,43,44,67,24,25,47,12,137,28,48,101]))),j2=m.lazy(()=>be(()=>import("./Settings-q4f9W6Qt.js"),__vite__mapDeps([126,1,2,3,4,20,40,127,9,15,27,8,70,83,54,38,128,34,28,129,119,110,14]))),p$=m.lazy(()=>be(()=>import("./Marketplace-D78o23VJ.js"),__vite__mapDeps([131,1,132,2,3,4,15,18,19,34,133,8,9,37,28,38,39,134,65,135,129,27,116,113]))),m$=m.lazy(()=>be(()=>import("./SaleNotificationSettings-BQfTaI0m.js"),__vite__mapDeps([195,1,2,3,4,40,15,14,66,70,27,118,196]))),g$=m.lazy(()=>be(()=>import("./LogzzNotificationSettings-CyOUxiFB.js"),__vite__mapDeps([197,1,2,3,4,40,15,14,119,27,118,196]))),x$=m.lazy(()=>be(()=>import("./AffiliateDashboard-CL-8D5-L.js"),__vite__mapDeps([136,1,2,3,4,15,128,10,11,12,13,14,50,51,137,116,88,86,49,81,72,52]))),v$=m.lazy(()=>be(()=>import("./SubscriptionPage-Dwu2ifi4.js"),__vite__mapDeps([130,1,6,2,3,4,104,33,34,18,19,15,12,49]))),pv=m.lazy(()=>be(()=>import("./IntegrationsPage-C52-DIiN.js"),__vite__mapDeps([198,1,7,17,115,92,2,3,4,15,27,95,40,119,56,28,94,61,70,111,38,199,44,117,122,78]))),y$=m.lazy(()=>be(()=>import("./FlowPreviewPage-CBe2ZXsM.js"),__vite__mapDeps([200,1,2,3,4,106,51,107,104,108,47,15,60,62,63,41,77,79,61,64,65,90,28,45,27,91,109,25,110,26,37,66,111,112,113,38,167,85,81,140,157]))),b$=m.lazy(()=>be(()=>import("./CreativeCanvas-D9a1W7xN.js"),__vite__mapDeps([201,1,106,51,107,2,3,4,62,15,64,157,70,160,27,176,33,34,18,19,124]))),w$=m.lazy(()=>be(()=>import("./CreativeCanvasProjects-DRQyhhCQ.js"),__vite__mapDeps([146,1,2,3,4,18,19,15,62,64,12,73,69,147,122,120,27,84,101,38]))),_$=m.lazy(()=>be(()=>import("./CreativeShareImport-YS7eJt-X.js"),__vite__mapDeps([202,1,147,2,3,4,15]))),S$=m.lazy(()=>be(()=>import("./Tutoriais-DUxKfNh3.js"),__vite__mapDeps([152,1,153,122,15,3,2,4]))),k2=m.lazy(()=>be(()=>import("./TutorialPublic-BWEJthCV.js"),__vite__mapDeps([203,1,153,3,15,2,4]))),C$=m.lazy(()=>be(()=>import("./AdminProviders-C9kARjI8.js"),__vite__mapDeps([204,1,2,3,4,68,19,69,15,134,56,28,178,70]))),E2=m.lazy(()=>be(()=>import("./PrivacyPolicy-c-mnT2cg.js"),__vite__mapDeps([205,1,3,15,2,4]))),j$=m.lazy(()=>be(()=>
524import("./McpMediaReview-0FMsVNm5.js"),__vite__mapDeps([206,1,2,3,4,166,7,109,114,15]))),k$=m.lazy(()=>be(()=>import("./McpAuthorize-CfAsW7Rb.js"),__vite__mapDeps([207,1,2,3,4,199,7,15,111,124]))),E$=m.lazy(()=>be(()=>import("./ZenithOAuthConnect-DcmL_JKR.js"),__vite__mapDeps([208,1,2,3,4,15]))),N$=m.lazy(()=>be(()=>import("./ZenithOAuthCallback-Bd5BEx6G.js"),__vite__mapDeps([209,1,2,3,4,15]))),N2=m.lazy(()=>be(()=>import("./TermsOfService-BcxxGOBu.js"),__vite__mapDeps([210,1,65,15,3,2,4]))),P2=m.lazy(()=>be(()=>import("./DataDeletion-HD7Ss6LO.js"),__vite__mapDeps([211,1,78,15,3,2,4]))),P$=m.lazy(()=>be(()=>import("./Ferramentas-bo1TIR8c.js"),__vite__mapDeps([212,1,122,15,116,53,63,65,100,32,88,30,3,2,4]))),A$=m.lazy(()=>be(()=>import("./Redirects-TYESJMlX.js"),__vite__mapDeps([162,1,2,3,4,115,92,42,43,15,44,10,11,12,13,14,50,51,52,49,122,28,84,27,116,121,38]))),T$=new MN({defaultOptions:{queries:{staleTime:6e4,gcTime:10*6e4,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!0,retry:1}}}),I$=()=>{const{isImpersonating:e,impersonatedEmail:t,stopImpersonation:n}=qo();return!e||!t?null:a.jsx(e6,{userEmail:t,onExit:n})},M$=()=>{const[e]=m.useState(()=>{var t;return _f(window.location)&&(((t=new URLSearchParams(window.location.search).get("state"))==null?void 0:t.startsWith("fb_"))??!1)});return S6(),m.useEffect(()=>{e||kj()},[e]),e?a.jsx(Fd,{}):a.jsxs(a.Fragment,{children:[a.jsx(Fd,{}),a.jsx(XF,{children:a.jsx(JF,{})}),a.jsx(I$,{}),a.jsx(t6,{}),a.jsx(s6,{}),a.jsx(r6,{}),a.jsx(n6,{}),a.jsx(BV,{}),a.jsx(m.Suspense,{fallback:a.jsx(wl,{}),children:a.jsxs(Wu,{children:[a.jsx(ve,{path:"/lp",element:a.jsx(LV,{children:a.jsx($V,{})})}),a.jsx(ve,{path:"/auth",element:a.jsx(cS,{})}),a.jsx(ve,{path:"/flow-preview",element:a.jsx(y$,{})}),a.jsx(ve,{path:"/s/:slug",element:a.jsx(OS,{})}),a.jsx(ve,{path:"/tutorial",element:a.jsx(k2,{})}),a.jsx(ve,{path:"/authorize",element:a.jsx(k$,{})}),a.jsx(ve,{path:"/mcp/media/:requestId",element:a.jsx(j$,{})}),a.jsx(ve,{path:"/integrations/zenith/connect",element:a.jsx(E$,{})}),a.jsx(ve,{path:"/integrations/zenith/callback",element:a.jsx(N$,{})}),a.jsx(ve,{path:"/privacidade",element:a.jsx(E2,{})}),a.jsx(ve,{path:"/termos",element:a.jsx(N2,{})}),a.jsx(ve,{path:"/exclusao-de-dados",element:a.jsx(P2,{})}),a.jsx(ve,{path:"/data-deletion",element:a.jsx(ta,{to:"/exclusao-de-dados",replace:!0})}),a.jsx(ve,{path:"/unsubscribe",element:a.jsx(RS,{})}),a.jsx(ve,{path:"/zernio/callback",element:a.jsx(hv,{})}),a.jsx(ve,{path:"/meta/callback",element:a.jsx(hv,{})}),a.jsx(ve,{path:"/pagamento/obrigado",element:a.jsx(S2,{})}),a.jsx(ve,{path:"/pagamento/cancelado",element:a.jsx(C2,{})}),a.jsx(ve,{path:"/reset-password",element:a.jsx(DS,{})}),a.jsx(ve,{path:"/",element:a.jsx(it,{children:a.jsx(ta,{to:"/inbox",replace:!0})})}),a.jsx(ve,{path:"/marketplace",element:a.jsx(it,{children:a.jsx(p$,{onModeChange:()=>{},currentMode:"marketplace"})})}),a.jsx(ve,{path:"/zap-converter",element:a.jsx(it,{children:a.jsx(WV,{})})}),a.jsx(ve,{path:"/gerador-palavras-chaves",element:a.jsx(it,{children:a.jsx(HV,{})})}),a.jsx(ve,{path:"/metricas",element:a.jsx(it,{children:a.jsx(VV,{})})}),a.jsx(ve,{path:"/organizador-numeros",element:a.jsx(it,{children:a.jsx(GV,{})})}),a.jsx(ve,{path:"/track-ofertas",element:a.jsx(it,{children:a.jsx(KV,{})})}),a.jsx(ve,{path:"/sms-bot",element:a.jsx(it,{children:a.jsx(JV,{})})}),a.jsx(ve,{path:"/smm-panel",element:a.jsx(it,{children:a.jsx(e$,{})})}),a.jsx(ve,{path:"/produto/:productId",element:a.jsx(it,{children:a.jsx(UV,{})})}),a.jsx(ve,{path:"/produto/:productId/analise",element:a.jsx(it,{children:a.jsx(qV,{})})}),a.jsx(ve,{path:"/gerador-audio",element:a.jsx(yt,{featureName:"Gerador de Áudio",children:a.jsx(YV,{})})}),a.jsx(ve,{path:"/transcricao-audio",element:a.jsx(yt,{featureName:"Transcrição de Áudio",children:a.jsx(XV,{})})}),a.jsx(ve,{path:"/extensao-ads",element:a.jsx(it,{children:a.jsx(ZV,{})})}),a.jsx(ve,{path:"/video-downloader",element:a.jsx(it,{children:a.jsx(QV,{})})}),a.jsx(ve,{path:"/limpa-hash",element:a.jsx(it,{children:a.jsx($z,{})})}),a.jsx(ve,{path:"/fabrica-criativos",element:a.jsx(ta,{to:"/limpa-hash",replace:!0})}),a.jsx(ve,{path:"/inbox",element:a.jsx(yt,{featureName:"Automati-Zap",children:a.jsx(uv,{})})}),a.jsx(ve,{path:"/inbox/conexoes",element:a.jsx(yt,{featureName:"Automati-Zap",children:a.jsx(uv,{})})}),a.jsx(ve,{path:"/inbox/chat",element:a.jsx(yt,{featureName:"Automati-Zap",children:a.jsx(n$,{})})}),a.jsx(ve,{path:"/inbox/flows",element:a.jsx(yt,{featureName:"Automati-Zap",children:a.jsx(dv,{})})}),a.jsx(ve,{path:"/inbox/flows/groups",element:a.jsx(yt,{featureName:"Automati-Zap",children:a.jsx(r$,{})})}),a.jsx(ve,{path:"/inbox/flows/:id",element:a.jsx(yt,{featureName:"Automati-Zap",children:a.jsx(qi,{})})}),a.jsx(ve,{path:"/inbox/notify-admin",element:a.jsx(yt,{featureName:"Automati-Zap",children:a.jsx(l$,{})})}),a.jsx(ve,{path:"/inbox/notify-admin/add-number",element:a.jsx(yt,{featureName:"Automati-Zap",children:a.jsx(c$,{})})}),a.jsx(ve,{path:"/inbox/quick-replies",element:a.jsx(yt,{featureName:"Automati-Zap",children:a.jsx(d$,{})})}),a.jsx(ve,{path:"/inbox/global-settings",element:a.jsx(yt,{featureName:"Automati-Zap",children:a.jsx(u$,{})})}),a.jsx(ve,{path:"/inbox/kanban",element:a.jsx(yt,{featureName:"Automati-Zap",children:a.jsx(f$,{})})}),a.jsx(ve,{path:"/inbox/contacts",element:a.jsx(yt,{featureName:"Automati-Zap",children:a.jsx(h$,{})})}),a.jsx(ve,{path:"/ferramentas",element:a.jsx(it,{children:a.jsx(P$,{})})}),a.jsx(ve,{path:"/redirects",element:a.jsx(it,{children:a.jsx(A$,{})})}),a.jsx(ve,{path:"/disparador",element:a.jsx(yt,{featureName:"DisparaZap",children:a.jsx(fv,{})})}),a.jsx(ve,{path:"/disparador/agendador-grupos",element:a.jsx(yt,{featureName:"DisparaZap",children:a.jsx(fv,{})})}),a.jsx(ve,{path:"/disparazap-oficial",element:a.jsx(qF,{children:a.jsx(s$,{})})}),a.jsx(ve,{path:"/disparo-oficial",element:a.jsx(nd,{children:a.jsx(i$,{})})}),a.jsx(ve,{path:"/disparazap/fluxos",element:a.jsx(yt,{featureName:"DisparaZap",children:a.jsx(dv,{})})}),a.jsx(ve,{path:"/disparazap/fluxos/novo",element:a.jsx(yt,{featureName:"DisparaZap",children:a.jsx(qi,{})})}),a.jsx(ve,{path:"/disparazap/fluxos/:id",element:a.jsx(yt,{featureName:"DisparaZap",children:a.jsx(qi,{})})}),a.jsx(ve,{path:"/clonador",element:a.jsx(yt,{featureName:"Clonador de Entregável",children:a.jsx(a$,{})})}),a.jsx(ve,{path:"/criativos",element:a.jsx(yt,{featureName:"Canvas de Criativos",children:a.jsx(w$,{})})}),a.jsx(ve,{path:"/criativos/importar/:code",element:a.jsx(it,{children:a.jsx(_$,{})})}),a.jsx(ve,{path:"/criativos/:flowId",element:a.jsx(yt,{featureName:"Canvas de Criativos",children:a.jsx(b$,{})})}),a.jsx(ve,{path:"/settings",element:a.jsx(it,{children:a.jsx(Xa,{children:a.jsx(j2,{})})})}),a.jsx(ve,{path:"/settings/sale-notifications",element:a.jsx(it,{children:a.jsx(Xa,{children:a.jsx(m$,{})})})}),a.jsx(ve,{path:"/settings/logzz-notifications",element:a.jsx(it,{children:a.jsx(Xa,{children:a.jsx(g$,{})})})}),a.jsx(ve,{path:"/integrations",element:a.jsx(it,{children:a.jsx(Xa,{children:a.jsx(pv,{})})})}),a.jsx(ve,{path:"/integrations/:tab",element:a.jsx(it,{children:a.jsx(Xa,{children:a.jsx(pv,{})})})}),a.jsx(ve,{path:"/affiliate",element:a.jsx(it,{children:a.jsx(x$,{})})}),a.jsx(ve,{path:"/subscription",element:a.jsx(it,{children:a.jsx(v$,{})})}),a.jsx(ve,{path:"/tutoriais",element:a.jsx(it,{children:a.jsx(S$,{})})}),a.jsx(ve,{path:"/ads/*",element:a.jsx(it,{children:a.jsx(o$,{})})}),a.jsx(ve,{path:"/admin-panel",element:a.jsx(nd,{children:a.jsx(t$,{})})}),a.jsx(ve,{path:"/admin/providers",element:a.jsx(nd,{children:a.jsx(C$,{})})}),a.jsx(ve,{path:"*",element:a.jsx(Z6,{})})]})})]})},R$=()=>a.jsx(XP,{children:a.jsx(wA,{children:a.jsx(_A,{children:a.jsx(nA,{children:a.jsx(CA,{children:a.jsx($P,{children:a.jsx(GP,{children:a.jsx(M$,{})})})})})})})}),D$=()=>a.jsx(m.Suspense,{fallback:a.jsx(wl,{}),children:a.jsxs(Wu,{children:[a.jsx(ve,{path:"/auth",element:a.jsx(cS,{})}),a.jsx(ve,{path:"/reset-password",element:a.jsx(DS,{})}),a.jsx(ve,{path:"/tutorial",element:a.jsx(k2,{})}),a.jsx(ve,{path:"/privacidade",element:a.jsx(E2,{})}),a.jsx(ve,{path:"/termos",element:a.jsx(N2,{})}),a.jsx(ve,{path:"/exclusao-de-dados",element:a.jsx(P2,{})}),a.jsx(ve,{path:"/data-deletion",element:a.jsx(ta,{to:"/exclusao-de-dados",replace:!0})}),a.jsx(ve,{path:"/unsubscribe",element:a.jsx(RS,{})}),a.jsx(ve,{path:"/pagamento/obrigado",element:a.jsx(S2,{})}),a.jsx(ve,{path:"/pagamento/cancelado",element:a.jsx(C2,{})})]})}),O$=()=>{const{pathname:e}=or();return e.startsWith("/flow-preview")?null:a.jsx(x6,{})},L$=()=>{const e=m.useRef(null);return m.useEffect(()=>(e.current&&Hp(e.current),()=>{Hp(null)}),[]),a.jsx(LN,{client:T$,children:a.jsx(bj,{children:a.jsxs(pf,{children:[a.jsx(Q_,{ref:e,defaultPosition:"bottom-right"}),a.jsx(pP,{}),a.jsx(u6,{}),a.jsx(y6,{}),a.jsxs(V2,{children:[a.jsx(v6,{}),a.jsx(O$,{}),a.jsxs(Wu,{children:[a.jsx(ve,{path:"/s/:slug",element:a.jsx(OS,{})}),a.jsx(ve,{path:"*",element:a.jsx(XN,{children:a.jsx(nP,{children:a.jsx(hP,{publicContent:a.jsx(D$,{}),management:a.jsx(m.Suspense,{fallback:a.jsx(wl,{}),children:a.jsx(j2,{companiesOnly:!0})}),children:a.jsx(R$,{})})})})})]})]})]})})})},DU=Object.freeze(Object.defineProperty({__proto__:null,default:L$},Symbol.toStringTag,{value:"Module"}));
524export{PT as $,PC as A,pe as B,hr as C,mp as D,U_ as E,zF as F,Ca as G,Lr as H,et as I,Hu as J,Yu as K,Be as L,gp as M,lj as N,dj as O,tB as P,Ki as Q,rj as R,bl as S,hj as T,Uv as U,YC as V,Ov as W,sr as X,Xr as Y,Hv as Z,MT as _,Qe as a,t8 as a$,_s as a0,ro as a1,Bb as a2,Jp as a3,rs as a4,Hb as a5,qb as a6,Oi as a7,Yn as a8,Q3 as a9,ks as aA,Ww as aB,aj as aC,Fv as aD,Au as aE,PF as aF,$C as aG,ij as aH,BL as aI,Ye as aJ,ET as aK,HC as aL,sj as aM,rP as aN,Iy as aO,Tf as aP,vp as aQ,eU as aR,X3 as aS,d_ as aT,Nh as aU,Ph as aV,Th as aW,Ih as aX,Ah as aY,f_ as aZ,Mh as a_,ur as aa,Gb as ab,Kb as ac,fo as ad,fA as ae,li as af,ca as ag,oj as ah,Xe as ai,Ln as aj,Ch as ak,qr as al,xp as am,at as an,pr as ao,nx as ap,LC as aq,KS as ar,YS as as,ZS as at,QS as au,JS as av,$l as aw,ht as ax,OC as ay,Lv as az,cs as b,rB as b$,i8 as b0,JC as b1,yp as b2,mS as b3,zC as b4,gd as b5,yn as b6,rL as b7,bf as b8,nj as b9,F_ as bA,z_ as bB,B_ as bC,FC as bD,FL as bE,V_ as bF,kF as bG,gj as bH,$n as bI,Hi as bJ,vj as bK,nU as bL,V8 as bM,qu as bN,tj as bO,mj as bP,Go as bQ,aU as bR,c8 as bS,Wi as bT,p8 as bU,b_ as bV,ea as bW,Yz as bX,aB as bY,g8 as bZ,n8 as b_,pj as ba,XS as bb,xc as bc,Xy as bd,Yi as be,Aa as bf,pf as bg,Fy as bh,zy as bi,mf as bj,__ as bk,DC as bl,QC as bm,QF as bn,IC as bo,qo as bp,Ku as bq,QO as br,la as bs,Xn as bt,k_ as bu,Zn as bv,Da as bw,TC as bx,Oh as by,sU as bz,xe as c,T4 as c$,Jz as c0,Gu as c1,kO as c2,Qz as c3,zS as c4,EO as c5,XC as c6,_O as c7,GC as c8,Kz as c9,ln as cA,Kr as cB,lt as cC,$r as cD,YO as cE,gx as cF,oU as cG,ZO as cH,JO as cI,nl as cJ,iU as cK,Dl as cL,Ol as cM,Ll as cN,zf as cO,Bf as cP,Lf as cQ,Lb as cR,Ff as cS,Pt as cT,a4 as cU,o4 as cV,Vw as cW,A4 as cX,k4 as cY,Xu as cZ,Xg as c_,Yv as ca,y3 as cb,Vn as cc,As as cd,ze as ce,Ze as cf,w3 as cg,Ie as ch,af as ci,kh as cj,ix as ck,tV as cl,zt as cm,IF as cn,FS as co,Hh as cp,NU as cq,nV as cr,Al as cs,Vf as ct,ZC as cu,gz as cv,sA as cw,Ko as cx,jh as cy,o1 as cz,Fr as d,SB as d$,I4 as d0,Wg as d1,ib as d2,Nf as d3,iA as d4,ob as d5,Ti as d6,js as d7,uC as d8,hC as d9,nv as dA,rv as dB,bB as dC,_U as dD,wU as dE,SU as dF,nc as dG,vU as dH,kU as dI,GB as dJ,TU as dK,PU as dL,AU as dM,jn as dN,hV as dO,rV as dP,pV as dQ,Yh as dR,CB as dS,tv as dT,Fu as dU,sv as dV,jU as dW,vB as dX,wB as dY,$B as dZ,Vu as d_,pC as da,Z_ as db,g6 as dc,cU as dd,lU as de,Ma as df,jl as dg,Mf as dh,If as di,Tl as dj,Uo as dk,df as dl,uf as dm,Es as dn,Ml as dp,Dj as dq,cf as dr,kl as ds,Ns as dt,KC as du,EU as dv,xj as dw,h8 as dx,Zx as dy,Qx as dz,ds as e,an as e$,h2 as e0,p2 as e1,cB as e2,iV as e3,Bu as e4,PB as e5,AB as e6,RB as e7,DB as e8,CU as e9,G$ as eA,Xo as eB,Fg as eC,Ht as eD,hu as eE,zv as eF,H$ as eG,tm as eH,X$ as eI,NC as eJ,IO as eK,MO as eL,fr as eM,RO as eN,d8 as eO,H6 as eP,FF as eQ,gS as eR,pU as eS,hU as eT,Wv as eU,yo as eV,Ho as eW,jd as eX,ko as eY,AN as eZ,Ft as e_,EB as ea,av as eb,uB as ec,Jx as ed,bU as ee,UB as ef,WB as eg,Dv as eh,sB as ei,yB as ej,xU as ek,yU as el,rc as em,y2 as en,MU as eo,RU as ep,IU as eq,Bv as er,Yr as es,qC as et,q$ as eu,ej as ev,Uw as ew,BC as ex,GD as ey,xt as ez,zr as f,bN as f0,Uz as f1,gU as f2,gB as f3,zB as f4,m2 as f5,DU as f6,Ut as g,nB as h,u2 as i,nL as j,fj as k,uj as l,cn as m,Qt as n,qt as o,gF as p,Gt as q,En as r,zb as s,rt as t,ti as u,$_ as v,io as w,lo as x,us as y,_o as z};

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.