PageSourceSearch

https://www.infomoney.com.br/wp-content/themes/infomoney/v2/build/4638.d08104f84927f5e905b4.js

js infomoney.com.br collected 2026-09-24 08:26:53 UTC 11,208 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunkv2||=[]).push([[4638],{68015(t,e,o){o.d(e,{l:()=>r});class r{static KEY_PREFIX="im_cache";static _localStorageAvailable=null;isLocalStorageAvailable(){if(null!==r._localStorageAvailable)return r._localStorageAvailable;try{const t="__im_cache_test__";localStorage.setItem(t,t),localStorage.removeItem(t),r._localStorageAvailable=!0}catch{r._localStorageAvailable=!1}return r._localStorageAvailable}buildStorageKey(t){return`${r.KEY_PREFIX}:${t.getGroup()}:${t.getKey()}`}get(t){if(!t.isValid()||!this.isLocalStorageAvailable())return null;try{const e=localStorage.getItem(this.buildStorageKey(t));if(!e)return null;const o=JSON.parse(e);return Date.now()>o.expiresAt?(this.delete(t),null):o.data}catch{return null}}set(t,e){if(!e.isValid()||!this.isLocalStorageAvailable())return!1;try{const o={data:t,expiresAt:Date.now()+1e3*e.getExpire()};return localStorage.setItem(this.buildStorageKey(e),JSON.stringify(o)),!0}catch{return!1}}delete(t){if(!t.isValid()||!this.isLocalStorageAvailable())return!1;try{return localStorage.removeItem(this.buildStorageKey(t)),!0}catch{return!1}}has(t){return null!==this.get(t)}flushGroup(t){if(!t||!this.isLocalStorageAvailable())return!1;try{const e=`${r.KEY_PREFIX}:${t}:`,o=[];for(let t=0;t<localStorage.length;t++){const r=localStorage.key(t);r?.startsWith(e)&&o.push(r)}return o.forEach(t=>localStorage.removeItem(t)),!0}catch{return!1}}}},96718(t,e,o){o.d(e,{s:()=>i});class r{key="";constructor(t=180,e="infomoney"){this.expire=Math.max(0,t),this.group=e}getKey(){return this.key}getExpire(){return this.expire}getGroup(){return this.group}isValid(){return this.key.length>0&&this.expire>=0&&this.group.length>0}sanitizeKey(t){return t.toLowerCase().replace(/[^a-z0-9_\-]/g,"_").replace(/_{2,}/g,"_").replace(/^_+|_+$/g,"")}}class i extends r{constructor(t,e=180,o="infomoney"){if(super(e,o),!t)throw new Error("StringCacheOptions: a chave (key) não pode ser vazia");const r=this.sanitizeKey(t);if(!r)throw new Error("StringCacheOptions: a chave (key) resultou vazia após sanitização");this.key=r}}},211876(t,e,o){function r(t){if(!t)return"";let e=5381;for(let o=0;o<t.length;o++)e=(e<<5)+e+t.charCodeAt(o)>>>0;return e.toString(36)}o.d(e,{Y:()=>r})},585939(t,e,o){o.d(e,{h:()=>h});var r=o(68015),i=o(211876),a=o(96718),s=o(915631);const n="favorite_authors_ids",c=("undefined"!=typeof window?window.InfoMoneyPage?.cache_ttl_favorites_authors:void 0)??604800;class h{static cache=new r.l;static buildOptions(t){return new a.s(`user_${(0,i.Y)(t)}`,c,n)}static getauthId(){return s.A.getCookie("auth-id")??null}static get(){const t=this.getauthId();if(!t)return null;const e=this.buildOptions(t),o=this.cache.get(e);return o?o.ownerHash!==(0,i.Y)(t)?(this.cache.delete(e),null):o.authorIds:null}static set(t){const e=this.getauthId();if(!e)return;const o=this.buildOptions(e),r={ownerHash:(0,i.Y)(e),authorIds:t};this.cache.set(r,o)}static addId(t){const e=this.getauthId();if(!e)return;const o=this.buildOptions(e),r=this.cache.get(o);if(!r)return;if(r.ownerHash!==(0,i.Y)(e))return void this.cache.delete(o);if(r.authorIds.includes(t))return;const a={ownerHash:r.ownerHash,authorIds:[t,...r.authorIds]};this.cache.set(a,o)}static removeId(t){const e=this.getauthId();if(!e)return;const o=this.buildOptions(e),r=this.cache.get(o);if(!r)return;if(r.ownerHash!==(0,i.Y)(e))return void this.cache.delete(o);const a=r.authorIds.filter(e=>e!==t);if(a.length===r.authorIds.length)return;const s={ownerHash:r.ownerHash,authorIds:a};this.cache.set(s,o)}static invalidate(){const t=this.getauthId();if(!t)return;const e=this.buildOptions(t);this.cache.delete(e)}static invalidateAll(){return this.cache.flushGroup(n)}}},967802(t,e,o){o.d(e,{M:()=>h});var r=o(68015),i=o(211876),a=o(96718),s=o(915631);const n="posts_by_coauthor_ids",c=("undefined"!=typeof window?window.InfoMoneyPage?.cache_ttl_authors_posts:void 0)??300;class h{static cache=new r.l;static buildOptions(t){return new a.s(`user_${(0,i.Y)(t)}`,c,n)}static buildCoauthorIdsKey(t){return[...t].sort((t,e)=>t-e).join(",")}static getAuthId(){return s.A.getCookie("auth-id")??null}static get(t){const e=this.getAuthId();if(!e)return null;const o=this.buildOptions(e),r=this.cache.get(o);if(!r)return null;if(r.ownerHash!==(0,i.Y)(e))return this.cache.delete(o),null;const a=this.buildCoauthorIdsKey(t);return r.coauthorIdsKey!==a?(this.cache.delete(o),null):r}static set(t,e,o,r,a,s){const n=this.getAuthId();if(!n)return;const c=this.buildOptions(n),h={ownerHash:(0,i.Y)(n),coauthorIdsKey:this.buildCoauthorIdsKey(t),cards:e,buffer:o,nextPage:r,sourcesHasMore:a,hasMore:s};this.cache.set(h,c)}
1static invalidate(){const t=this.getAuthId();t&&this.cache.delete(this.buildOptions(t))}static invalidateAll(){return this.cache.flushGroup(n)}}},671599(t,e,o){if(o.d(e,{c:()=>s}),/^(3(216|38|884)|6(701|725|989)|(41|79)97|170|1834|7043|8159)$/.test(o.j))var r=o(915631);if(/^(3(216|38|884)|6(701|725|989)|(41|79)97|170|1834|7043|8159)$/.test(o.j))var i=o(225434);const a="flowAutomatic";class s{constructor(){this.cookieService=r.A,this.flowManager=new i.A}getFlowCookie(t){return this.cookieService.getCookie(t)||null}clearFlowCookie(t){this.cookieService.deleteCookie(t)}parseCookie(t){let e;try{e=JSON.parse(t)}catch{return console.error("[FlowAutomatic] Cookie com JSON inválido, removendo.",t),this.clearFlowCookie(a),null}return void 0!==e.config&&null!==e.config&&"object"==typeof e.config||(e.config={}),"string"!=typeof e.flowKey||""===e.flowKey.trim()?(console.error("[FlowAutomatic] flowKey inválido (não é string ou está vazio).",e),this.clearFlowCookie(a),null):"string"!=typeof e.path||""===e.path.trim()?(console.error("[FlowAutomatic] path inválido (não é string ou está vazio).",e),this.clearFlowCookie(a),null):"object"!=typeof e.config||null===e.config||Array.isArray(e.config)?(console.error("[FlowAutomatic] config inválido (não é objeto válido).",e),this.clearFlowCookie(a),null):e}isPathMatch(t){return t===window.location.pathname}async runFlow(t){try{const e={...t.config??{},flowKey:t.flowKey};await this.flowManager.executeFlow(t.flowKey,e)}catch(t){console.error("[FlowAutomatic] Erro ao executar fluxo:",t)}}async execute(){const t=this.getFlowCookie(a);if(!t)return;const e=this.parseCookie(t);e&&this.isPathMatch(e.path)&&(await this.runFlow(e),this.clearFlowCookie(a))}}o.d(e,["s",0,a])},984638(t,e,o){o.r(e);var r=o(173367),i=o(225434),a=o(948258),s=o(861513),n=o(967802),c=o(915631),h=o(671599);const l="followedAuthorAddUpdated";class u extends r.A{constructor(t={}){super(t),this.userService=new a.A,this.favoriteAuthorsService=new s.A,this.authorId=t.authorId}validateConfig(){if(!this.authorId)throw new Error("[FlowFollowedAuthorsAdd] authorId é obrigatório na configuração")}setCookieFlow(t,e){c.A.setCookie(h.s,JSON.stringify({flowKey:e,config:t,path:window.location.pathname}),1)}async execute(){const t=this.config;try{this.validateConfig()}catch(t){return void this.dispatchFollowedAuthorAddEvent({authorId:this.authorId||0,loading:!1,error:!0,isAuthenticated:!1})}if(!this.userService.checkAuthStatus().isLoggedIn)return this.setCookieFlow(t,"FOLLOWED_AUTHOR_ADD"),void await(new i.A).executeFlow("LOGIN",{source:"follow-author"});this.dispatchFollowedAuthorAddEvent({authorId:this.authorId,loading:!0,error:!1,isAuthenticated:!0});try{const t=await this.favoriteAuthorsService.saveAuthor(this.authorId.toString()),e=t.Result?.map(t=>Number(t.AuthorId))??[];this.favoriteAuthorsService.cacheAuthorIds(e),n.M.invalidate(),this.dispatchFollowedAuthorAddEvent({authorId:this.authorId,loading:!1,error:!1,isAuthenticated:!0,updatedIds:e})}catch(t){const e=t.statusCode,o=t.message;if(409===e)return void this.dispatchFollowedAuthorAddEvent({authorId:this.authorId,loading:!1,error:!1,isAuthenticated:!0,alreadyFollowed:!0});if(400===e&&"Limite de favoritos atingido."===o)return void this.dispatchFollowedAuthorAddEvent({authorId:this.authorId,loading:!1,error:!1,isAuthenticated:!0,limitReached:!0});this.dispatchFollowedAuthorAddEvent({authorId:this.authorId,loading:!1,error:!0,isAuthenticated:!0})}}dispatchFollowedAuthorAddEvent(t){window.dispatchEvent(new CustomEvent(l,{detail:t}))}}const d=u;o.d(e,["FOLLOWED_AUTHOR_ADD_EVENT",0,l,"default",0,d])},944742(t,e,o){var r=o(915631);o.d(e,["A",0,class{static getConfig(){return{url:window.InfoMoneyPage?.base_api_user_manager||"",subscriptionKey:window.InfoMoneyPage?.base_api_user_manager_ocp_apim_subscription_key||""}}static getCookie(t){return r.A.getCookie(t)||""}static getParams(t){return new URLSearchParams(Object.entries(t).filter(([t,e])=>void 0!==e).reduce((t,[e,o])=>(Array.isArray(o)?t[e]=o.join(","):t[e]=String(o),t),{})).toString()}}])},861513(t,e,o){o.d(e,{A:()=>a});var r=o(944742),i=o(585939);class a extends r.A{static _pendingFetch=null;async getAllFavoriteAuthors(){return a._pendingFetch||(a._pendingFetch=this._fetchAllPages().finally(()=>{a._pendingFetch=null})),a._pendingFetch}async _fetchAllPages(){const t=a.getConfig(),e=a.getCookie("access-token"),o=[];let r=1,i=!0;try{for(;i;){const a=`${t.url}authors/favorites?page=${r}`,s=await fetch(a,{method:"GET",headers:{Accept:"application/json","Ocp-Apim-Subscription-Key":t.subscriptionKey,Authorization:`Bearer ${e}`}});if(!s.ok){const t=await s.json();throw new Error(t.message||`Erro ao buscar autores favoritos na página ${r}`)}const n=await s.json();if(!n.Result||0===n.Result.length)break;o.push(...n.Result),i=n.PageInfo?.HasNextPage??!1,r++}return{Result:o,PageInfo:{HasNextPage:!1}}}catch(t){throw console.error("UserFavoriteAuthorsService._fetchAllPages: Erro ao buscar autores favoritos:",t),t}}async saveAuthor(t){const e=a.getConfig(),o=`${e.url}authors/favorites`,r=a.getCookie("access-token");try{const i=Number(t);if(!Number.isFinite(i))throw new Error("authorId inválido");const a=await fetch(o,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","Ocp-Apim-Subscription-Key":e.subscriptionKey,Authorization:`Bearer ${r}`},body:JSON.stringify({authorId:i})});if(!a.ok){const t=await a.json(),e=t.errorMessages?.[0]??t.ErrorMessages?.[0]??t.errors?.[0]??t.message??"Erro ao salvar autor favorito";throw Object.assign(new Error(e),{statusCode:a.status})}const s=await a.json();return this._clearAuthorsCache(),s}catch(e){throw console.error(`UserFavoriteAuthorsService.saveAuthor: Erro ao salvar autor favorito ${t}:`,e),e}}async removeAuthorFavorite(t){const e=a.getConfig(),o=`${e.url}authors/favorites/${t}`,r=a.getCookie("access-token");try{const t=await fetch(o,{method:"DELETE",headers:{Accept:"application/json","Ocp-Apim-Subscription-Key":e.subscriptionKey,Authorization:`Bearer ${r}`}});if(!t.ok){const e=await t.json();throw Object.assign(new Error(e.message||"Erro ao remover autor favorito"),{statusCode:t.status})}const i=await t.json();return this._clearAuthorsCache(),i}catch(e){throw console.error(`UserFavoriteAuthorsService.removeAuthorFavorite: Erro ao remover autor favorito ${t}:`,e),e}}_clearAuthorsCache(){}getAuthId(){return i.h.getauthId()}getCachedAuthorIds(){return i.h.get()}cacheAuthorIds(t){i.h.set(t)}removeCachedAuthorId(t){i.h.removeId(t)}
1static invalidateAllCachedAuthorIds(){return i.h.invalidateAll()}}}}]);

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.